forked from pantyusha/nesca
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathvercheckerthread.cpp
34 lines (32 loc) · 942 Bytes
/
vercheckerthread.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#include "vercheckerthread.h"
#include "externData.h"
#include "mainResources.h"
#include "Connector.h"
#include "Utils.h"
void VerCheckerThread::run()
{
while(true) {
const char request[] = "https://raw.githubusercontent.com/uis246/nesca/master/version";
std::string buffer;
// std::vector<std::string> headerVector{ "X-Nescav3: True" };
Connector con;
con.nConnect(request, 443, &buffer);
uint_fast32_t newVer;
{
const char *ver;
ver=strstr(buffer.c_str(), "\r\n\r\n");
if(ver)
newVer=(uint_fast32_t)atoi(ver+4);
else
newVer=0;
}
if(newVer > (uint_fast32_t)atoi(gVER))
{
stt->doEmitionFoundData("<br><font color=\"Pink\">======Update required======<br>Latest version: " + QString(to_string(newVer).c_str()) +
"<br>Your version: " + QString(gVER) + "<br>=========================</font>");
stt->doEmitionShowRedVersion();
}
vct->sleep(600000); //10 min
}
//vct->terminate();
}