made update checking more variable

This commit is contained in:
Václav Šmejkal 2022-04-07 17:26:41 +02:00
parent 95b3e9d02c
commit b970de23a5
2 changed files with 7 additions and 5 deletions

View File

@ -8,5 +8,7 @@
#define INVALID_KEY 1
#define VERSION "v1.1"
#define VERSIONS_URL "https://raw.githubusercontent.com/ENDev-WHY2/WHY2-Encryption-System/c/versions.json"
#define VERSIONS_NAME "versions.json"
#endif
#endif

View File

@ -19,10 +19,10 @@ encryptText(char *text, char *keyNew)
//CURL VARIABLES
CURL *curl = curl_easy_init();
FILE *fileBuffer = fopen("versions.json", "w");
FILE *fileBuffer = fopen(VERSIONS_NAME, "w");
//GET versions.json
curl_easy_setopt(curl, CURLOPT_URL, "https://raw.githubusercontent.com/ENDev-WHY2/WHY2-Encryption-System/c/versions.json");
curl_easy_setopt(curl, CURLOPT_URL, VERSIONS_URL);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, fileBuffer);
//DOWNLOAD versions.json
@ -33,7 +33,7 @@ encryptText(char *text, char *keyNew)
fclose(fileBuffer);
//JSON VARIABLES
FILE *jsonFile = fopen("versions.json", "r");
FILE *jsonFile = fopen(VERSIONS_NAME, "r");
char buffer[256];
char lineBuffer[64];
struct json_object *parsedJson;
@ -169,4 +169,4 @@ encryptText(char *text, char *keyNew)
free(key);
return returningText;
}
}