forked from markus/S_New4
82 lines
2.5 KiB
C++
82 lines
2.5 KiB
C++
#ifndef MANAGEPAGE_H
|
|
#define MANAGEPAGE_H
|
|
|
|
|
|
#include "accountManager.h"
|
|
#include "parameterManager.h" // for isNumber
|
|
|
|
#ifdef _WIN32
|
|
#include "./../include/curl/curl.h"
|
|
#include <windows.h>
|
|
|
|
//----------------------?????????????????
|
|
#define noSLLCheck
|
|
|
|
#else
|
|
#include "curl/curl.h"
|
|
#endif
|
|
|
|
#include <sstream>
|
|
#include <unistd.h> // sleep
|
|
#include <algorithm>
|
|
#include <ctime> // std::time, localtime ...
|
|
|
|
|
|
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;
|
|
};
|
|
|
|
struct checkNameRply {
|
|
std::string name;
|
|
PAGE pageInUse;
|
|
enum STATUS { SUCCESS, FAILED, NOTHING_FOUND, MULTIPLE_OPTIONS, NO_WORKING_PAGE } status;
|
|
|
|
checkNameRply(const std::string &name, const PAGE &p, const checkNameRply::STATUS &s )
|
|
: name(name), pageInUse(p), status(s) {}
|
|
};
|
|
|
|
|
|
class PageManager
|
|
{
|
|
public:
|
|
PageManager(std::string sock5ProxyOnlyAddress = "127.0.0.1:9150");
|
|
~PageManager();
|
|
|
|
void setProxy(std::string ip, int port);
|
|
void setDebugMode(bool status);
|
|
|
|
void get_terminal_size(int& width);
|
|
|
|
Reply getServerRequest(std::string protocol, std::string Url, bool useCookies = false, std::string data = "", bool generateCookieFile = false, bool UrlAfterRedirectOnlyNeeded = false, std::string cookieFilePath = "");
|
|
int downLoadToFile(std::string filePath, std::string url);
|
|
|
|
int login(PAGE page, Account account, std::string cookieFilePath);
|
|
Reply getUrlAfterRedirect(std::string p, std::string Url, std::string cookieFilePath);
|
|
checkNameRply checkName(std::vector<PAGE> &pages, std::string Name, bool useFirstPage);
|
|
std::string getLinks(std::string HTML);
|
|
std::string chooseHosterLink(std::string HosterList, std::string Hoster_with_Highst_Priority_at_First, std::string languages_with_highst_priority_at_first, bool withWarnMsg);
|
|
std::string getLinkAfterHosterBasedOperation(std::string url);
|
|
|
|
int counterContains(std::string text, std::string substring_with_prozent_i_for_number, int starte_mit_dieser_Zahl = 1);
|
|
std::string grep(std::string text, std::string substring, bool IgnoreCaseSensetifity = false);
|
|
static std::string upper_string(const std::string& str);
|
|
size_t getDate();
|
|
std::string getExePath();
|
|
|
|
int compareVersions(std::string Version1, std::string Version2);
|
|
|
|
int writeToFile(std::vector<std::string> paths, std::string text);
|
|
|
|
static std::string getCurlVersion();
|
|
|
|
std::string sock5Proxy;
|
|
private:
|
|
bool debugMode = false;
|
|
};
|
|
|
|
#endif // MANAGEPAGE_H
|