fix clean methode && cookie file in multi thread -> for each one ,one

This commit is contained in:
Markus 2022-03-26 13:42:15 +01:00
parent 9fbc4f28e5
commit 8dc9b101b1
3 changed files with 10 additions and 10 deletions

View File

@ -1220,18 +1220,18 @@ void unterOption_clean(Settings * settings, int argc, char **argv)
}
}
//UM sachen nach multipage update zu löschen
for ( const auto &p : settings->pagesInUse ) {
if(fileExists(settings->cookieFilePath + "_" + p.name_id)) {
if(remove((settings->cookieFilePath + "_" + p.name_id).c_str()) != 0) {
perror(( " => Error: Das löschen von " + settings->cookieFilePath + "_" + p.name_id + " ist fehlgeschlagen: ").c_str());
for ( const auto &p : settings->pagesALL ) {
if(fileExists(settings->cookieFilePath + "_" + p.url)) {
if(remove((settings->cookieFilePath + "_" + p.url).c_str()) != 0) {
perror(( " => Error: Das löschen von " + settings->cookieFilePath + "_" + p.url + " ist fehlgeschlagen: ").c_str());
return;
} else
++count;
}

for (unsigned i = 0; i < UINT_MAX && fileExists(settings->cookieFilePath + "_" + p.name_id + std::to_string(i)); ++i) {
if(remove( (settings->cookieFilePath + "_" + p.name_id + std::to_string(i)).c_str() ) != 0) {
perror((" => Error: Das löschen von " + settings->cookieFilePath + "_" + p.name_id + std::to_string(i) + " ist fehlgeschlagen: ").c_str());
for (unsigned i = 0; i < UINT_MAX && fileExists(settings->cookieFilePath + "_" + p.url + std::to_string(i)); ++i) {
if(remove( (settings->cookieFilePath + "_" + p.url + std::to_string(i)).c_str() ) != 0) {
perror((" => Error: Das löschen von " + settings->cookieFilePath + "_" + p.url + std::to_string(i) + " ist fehlgeschlagen: ").c_str());
return;
} else {
++count;

View File

@ -28,7 +28,7 @@

#define UpdaterCloudUrlWithPath "https://cloud.obermui.de/s/tXz7SWdaPJ7TacZ/download?path=%2F&files="
#define SecondUpdaterCloudUrlWithPath "https://snew4.obermui.de/download?path=%2F&files="
#define VERSION "5.2.0"
#define VERSION "5.2.1"
#define DEFAULT_FILE_VERSION "2.3"

//default, anime, normal,

View File

@ -117,7 +117,7 @@ void * threadFunction(void * data) {
}

for (int i = 1; i <= 3; ++i) {
auto REPLy = myThreadData->pageManager->getUrlAfterRedirect( myThreadData->page.protocol, myThreadData->page.url + Link, myThreadData->settings->cookieFilePath + "_" + myThreadData->page.url);
auto REPLy = myThreadData->pageManager->getUrlAfterRedirect( myThreadData->page.protocol, myThreadData->page.url + Link, myThreadData->settings->cookieFilePath + "_" + myThreadData->page.url + std::to_string(myThreadData->id));
std::string newUrl = REPLy.url;
if (newUrl == "-1") {
if(myThreadData->settings->debugMode)
@ -133,7 +133,7 @@ void * threadFunction(void * data) {
} else if(newUrl.find("/redirect/") != std::string::npos ) {
if(myThreadData->settings->debugMode)
std::cout << " > Thread " << myThreadData->id << "Warnung: Redirect Link nach umwandlung (Capcha?) --> Neuer Account" << std::endl;
if(myThreadData->pageManager->login(myThreadData->page, myThreadData->accountManager->getNextAccount(), myThreadData->settings->cookieFilePath + "_" + myThreadData->page.url) != 0) {
if(myThreadData->pageManager->login(myThreadData->page, myThreadData->accountManager->getNextAccount(), myThreadData->settings->cookieFilePath + "_" + myThreadData->page.url + std::to_string(myThreadData->id)) != 0) {
if(myThreadData->settings->debugMode)
std::cerr << " => Debug: In Thread: "<< myThreadData->id << ": login Function failed." << std::endl;
return myThreadData->setState(17);