2019-07-06 20:47:29 +02:00
|
|
|
#ifndef MANAGEPAGE_H
|
|
|
|
#define MANAGEPAGE_H
|
|
|
|
|
2021-03-01 10:42:50 +01:00
|
|
|
|
2019-08-16 20:12:25 +02:00
|
|
|
#include "accountManager.h"
|
2019-10-17 18:10:13 +02:00
|
|
|
#include "parameterManager.h" // for isNumber
|
2019-08-19 17:32:52 +02:00
|
|
|
|
2021-03-01 10:42:50 +01:00
|
|
|
#ifdef _WIN32
|
2022-03-25 21:50:29 +01:00
|
|
|
#include "./../include/curl/curl.h"
|
2021-03-01 10:42:50 +01:00
|
|
|
#include <windows.h>
|
2022-03-31 18:52:36 +02:00
|
|
|
|
|
|
|
//----------------------?????????????????
|
|
|
|
#define noSLLCheck
|
|
|
|
|
2022-03-25 21:50:29 +01:00
|
|
|
#else
|
|
|
|
#include "curl/curl.h"
|
2021-03-01 10:42:50 +01:00
|
|
|
#endif
|
|
|
|
|
2019-07-06 20:47:29 +02:00
|
|
|
#include <sstream>
|
2019-09-01 10:40:36 +02:00
|
|
|
#include <unistd.h> // sleep
|
2019-08-03 18:23:12 +02:00
|
|
|
#include <algorithm>
|
2019-10-04 20:11:01 +02:00
|
|
|
#include <ctime> // std::time, localtime ...
|
2019-08-03 18:23:12 +02:00
|
|
|
|
2019-07-06 20:47:29 +02:00
|
|
|
|
|
|
|
struct Reply {
|
|
|
|
Reply() {}
|
|
|
|
Reply(std::string value_both) : html(value_both), url(value_both) {}
|
|
|
|
Reply(std::string html, std::string url) : html(html), url(url) {}
|
|
|
|
|
|
|
|
std::string html, url;
|
|
|
|
};
|
|
|
|
|
2021-02-28 23:00:11 +01:00
|
|
|
struct checkNameRply {
|
|
|
|
std::string name;
|
|
|
|
PAGE pageInUse;
|
2022-03-31 18:52:36 +02:00
|
|
|
enum STATUS { SUCCESS, FAILED, NOTHING_FOUND, MULTIPLE_OPTIONS, NO_WORKING_PAGE } status;
|
2021-02-28 23:00:11 +01:00
|
|
|
|
|
|
|
checkNameRply(const std::string &name, const PAGE &p, const checkNameRply::STATUS &s )
|
|
|
|
: name(name), pageInUse(p), status(s) {}
|
|
|
|
};
|
|
|
|
|
2019-07-06 20:47:29 +02:00
|
|
|
|
|
|
|
class PageManager
|
|
|
|
{
|
|
|
|
public:
|
2021-03-02 14:17:20 +01:00
|
|
|
PageManager(std::string sock5ProxyOnlyAddress = "127.0.0.1:9150");
|
2019-07-06 20:47:29 +02:00
|
|
|
~PageManager();
|
|
|
|
|
2019-08-03 18:23:12 +02:00
|
|
|
void setProxy(std::string ip, int port);
|
2019-07-08 20:17:11 +02:00
|
|
|
void setDebugMode(bool status);
|
2019-07-07 18:30:37 +02:00
|
|
|
|
2020-07-22 19:40:53 +02:00
|
|
|
void get_terminal_size(int& width);
|
|
|
|
|
2022-03-26 00:23:20 +01:00
|
|
|
Reply getServerRequest(std::string protocol, std::string Url, bool useCookies = false, std::string data = "", bool generateCookieFile = false, bool UrlAfterRedirectOnlyNeeded = false, std::string cookieFilePath = "");
|
2019-10-13 12:54:58 +02:00
|
|
|
int downLoadToFile(std::string filePath, std::string url);
|
|
|
|
|
2021-03-03 17:23:48 +01:00
|
|
|
int login(PAGE page, Account account, std::string cookieFilePath);
|
2022-03-26 00:23:20 +01:00
|
|
|
Reply getUrlAfterRedirect(std::string p, std::string Url, std::string cookieFilePath);
|
2022-03-31 18:52:36 +02:00
|
|
|
checkNameRply checkName(std::vector<PAGE> &pages, std::string Name, bool useFirstPage);
|
2019-07-06 20:47:29 +02:00
|
|
|
std::string getLinks(std::string HTML);
|
2019-12-16 17:41:07 +01:00
|
|
|
std::string chooseHosterLink(std::string HosterList, std::string Hoster_with_Highst_Priority_at_First, std::string languages_with_highst_priority_at_first, bool withWarnMsg);
|
2020-04-06 14:31:34 +02:00
|
|
|
std::string getLinkAfterHosterBasedOperation(std::string url);
|
2019-07-06 20:47:29 +02:00
|
|
|
|
|
|
|
int counterContains(std::string text, std::string substring_with_prozent_i_for_number, int starte_mit_dieser_Zahl = 1);
|
2019-08-03 18:23:12 +02:00
|
|
|
std::string grep(std::string text, std::string substring, bool IgnoreCaseSensetifity = false);
|
2020-04-06 14:31:34 +02:00
|
|
|
static std::string upper_string(const std::string& str);
|
2019-10-04 20:11:01 +02:00
|
|
|
size_t getDate();
|
2019-10-14 15:34:49 +02:00
|
|
|
std::string getExePath();
|
2019-08-03 18:23:12 +02:00
|
|
|
|
2019-10-17 18:10:13 +02:00
|
|
|
int compareVersions(std::string Version1, std::string Version2);
|
|
|
|
|
2020-02-22 15:26:24 +01:00
|
|
|
int writeToFile(std::vector<std::string> paths, std::string text);
|
2019-07-06 20:47:29 +02:00
|
|
|
|
2022-03-25 21:50:29 +01:00
|
|
|
static std::string getCurlVersion();
|
|
|
|
|
2019-08-03 18:23:12 +02:00
|
|
|
std::string sock5Proxy;
|
2019-07-06 20:47:29 +02:00
|
|
|
private:
|
2019-07-08 20:17:11 +02:00
|
|
|
bool debugMode = false;
|
2019-07-06 20:47:29 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif // MANAGEPAGE_H
|