allow ../ in our http urls

This commit is contained in:
mrdude2478 2023-09-06 22:50:33 +01:00
parent eb8692cbc3
commit 7f52663841
3 changed files with 29 additions and 20 deletions

View File

@ -44,7 +44,7 @@ DATA := data
INCLUDES := include include/ui include/data include/install include/nx include/nx/ipc include/util $(CURDIR)/include/Plutonium/Plutonium/include INCLUDES := include include/ui include/data include/install include/nx include/nx/ipc include/util $(CURDIR)/include/Plutonium/Plutonium/include
APP_TITLE := TinWoo Installer APP_TITLE := TinWoo Installer
APP_AUTHOR := MrDude APP_AUTHOR := MrDude
APP_VERSION := 1.0.17 APP_VERSION := 1.0.18
ROMFS := romfs ROMFS := romfs
APP_ICON := icon.jpg APP_ICON := icon.jpg

View File

@ -5,7 +5,7 @@
namespace inst::config { namespace inst::config {
static const std::string appDir = "sdmc:/switch/tinwoo"; static const std::string appDir = "sdmc:/switch/tinwoo";
static const std::string configPath = appDir + "/config.json"; static const std::string configPath = appDir + "/config.json";
static const std::string appVersion = "1.0.17"; static const std::string appVersion = "1.0.18";
extern std::string gAuthKey; extern std::string gAuthKey;
extern std::string sigPatchesUrl; extern std::string sigPatchesUrl;

View File

@ -99,6 +99,7 @@ namespace netInstStuff {
ic = c; ic = c;
// bodge code needed to prevernt encoded url changing forward slash to %2F // bodge code needed to prevernt encoded url changing forward slash to %2F
if (c == '/') new_str += '/'; if (c == '/') new_str += '/';
else if (c == '.') new_str += '.';
else if (c == ':') new_str += ':'; else if (c == ':') new_str += ':';
else if (isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~') new_str += c; else if (isalnum(c) || c == '-' || c == '_' || c == '.' || c == '~') new_str += c;
else { else {
@ -423,9 +424,7 @@ namespace netInstStuff {
index = found + 6; index = found + 6;
while (index < response.size()) { while (index < response.size()) {
if (response[index] == '"') { if (response[index] == '"') {
if (link.find("../") == std::string::npos)
if (findCaseInsensitive(link, ".nsp") != std::string::npos || findCaseInsensitive(link, ".nsz") != std::string::npos || findCaseInsensitive(link, ".xci") != std::string::npos || findCaseInsensitive(link, ".xcz") != std::string::npos) { if (findCaseInsensitive(link, ".nsp") != std::string::npos || findCaseInsensitive(link, ".nsz") != std::string::npos || findCaseInsensitive(link, ".xci") != std::string::npos || findCaseInsensitive(link, ".xcz") != std::string::npos) {
/* /*
Try to see if the href links contain http - if not add the own url Try to see if the href links contain http - if not add the own url
defined in the settings page defined in the settings page
@ -438,7 +437,7 @@ namespace netInstStuff {
tmp_array.push_back(link); tmp_array.push_back(link);
} }
} }
break; break; //don't remove this or the net install screen will crash
} }
link += response[index++]; link += response[index++];
} }
@ -454,14 +453,24 @@ namespace netInstStuff {
} }
/* /*
//debug for checking url before and after
FILE * fp; FILE * fp;
fp = fopen ("links.txt", "a+"); fp = fopen ("before.txt", "a+");
for (unsigned long int i = 0; i < urls.size(); i++) { for (unsigned long int i = 0; i < tmp_array.size(); i++) {
std::string x = urls[i]; std::string x = tmp_array[i];
const char *info = x.c_str(); const char *info = x.c_str();
fprintf(fp, "%s\n", info); fprintf(fp, "%s\n", info);
} }
fclose(fp); fclose(fp);
FILE * fp2;
fp2 = fopen ("after.txt", "a+");
for (unsigned long int i = 0; i < urls.size(); i++) {
std::string y = urls[i];
const char *info2 = y.c_str();
fprintf(fp2, "%s\n", info2);
}
fclose(fp2);
*/ */
tmp_array.clear(); //we may as well clear this now as it's done it's job.. tmp_array.clear(); //we may as well clear this now as it's done it's job..