[Cache] Add new cache urls

This commit is contained in:
momo5502 2017-06-04 20:51:05 +02:00
parent 2680ed2981
commit 320d51ae32
3 changed files with 26 additions and 10 deletions

View File

@ -4,12 +4,25 @@ namespace Utils
{
const char* Cache::Urls[] =
{
"https://iw4xcachep26muba.onion.to",
"https://iw4xcachep26muba.onion.link",
"https://iw4xcachep26muba.onion.rip",
/*"https://iw4xcachejnetuln.onion.to",
"https://iw4xcachedjodc4y.onion.to",
*/
"https://iw4xcachep26muba.onion.nu",
"https://iw4xcachep26muba.onion.guide",
// Cookie
"https://iw4xcachep26muba.onion.casa",
"https://iw4xcachep26muba.hiddenservice.net",
// Uses session id
//"https://iw4xcachep26muba.onion.cab",
// Dead
//"https://iw4xcachep26muba.onion.link",
//"https://iw4xcachep26muba.onion.to",
// Not registered yet
//"https://iw4xcachejnetuln.onion.to",
//"https://iw4xcachedjodc4y.onion.to",
};
std::string Cache::ValidUrl;
std::mutex Cache::CacheMutex;
@ -30,6 +43,9 @@ namespace Utils
if (Cache::ValidUrl.empty())
{
InternetSetCookieA("https://onion.casa", "disclaimer_accepted", "1");
InternetSetCookieA("https://hiddenservice.net", "disclaimer_accepted", "1");
for (int i = 0; i < ARRAYSIZE(Cache::Urls); ++i)
{
std::string result = Utils::WebIO(useragent, Cache::GetUrl(Cache::Urls[i], path)).setTimeout(timeout)->get();

View File

@ -35,7 +35,7 @@ namespace Utils
if(this->hSession) InternetCloseHandle(this->hSession);
}
void WebIO::SetCredentials(std::string _username, std::string _password)
void WebIO::setCredentials(std::string _username, std::string _password)
{
this->username.clear();
this->password.clear();
@ -558,7 +558,7 @@ namespace Utils
return false;
}
void WebIO::setProgressCallback(std::function<void(size_t, size_t)> callback)
void WebIO::setProgressCallback(Utils::Slot<void(size_t, size_t)> callback)
{
this->progressCallback = callback;
}

View File

@ -25,7 +25,7 @@ namespace Utils
~WebIO();
void setURL(std::string url);
void SetCredentials(std::string username, std::string password);
void setCredentials(std::string username, std::string password);
std::string postFile(std::string url, std::string data, std::string fieldName, std::string fileName);
std::string postFile(std::string data, std::string fieldName, std::string fileName);
@ -62,7 +62,7 @@ namespace Utils
bool uploadFileData(std::string file, std::string data);
bool downloadFileData(std::string file, std::string &data);
void setProgressCallback(std::function<void(size_t, size_t)> callback);
void setProgressCallback(Utils::Slot<void(size_t, size_t)> callback);
void cancelDownload() { this->cancel = true; }
private:
@ -96,7 +96,7 @@ namespace Utils
DWORD timeout;
std::function<void(size_t, size_t)> progressCallback;
Utils::Slot<void(size_t, size_t)> progressCallback;
std::string buildPostBody(WebIO::Params params);