prefer wtvshared.escape over encodeURIComponent

This commit is contained in:
zefie
2025-08-14 18:57:37 -04:00
parent 54b960a840
commit e7d16387da
27 changed files with 223 additions and 205 deletions

View File

@@ -45,7 +45,7 @@ if (fail_url === null) fail_url = new clientShowAlert({
let url;
if (request_headers.query.url) {
url = encodeURIComponent(request_headers.query.url);
url = wtvshared.escape(request_headers.query.url);
} else {
url = `wtv-disk:/sync`;
if (request_headers.query.diskmap) url += `%3fdiskmap%3d${request_headers.query.diskmap}`;

View File

@@ -15,7 +15,7 @@ if (request_headers.query.group) {
const query = request_headers.query;
query['url'] = 'wtv-disk:/delete-group';
const queryString = Object.keys(query)
.map(key => encodeURIComponent(key) + '=' + encodeURIComponent(query[key]))
.map(key => wtvshared.escape(key) + '=' + wtvshared.escape(query[key]))
.join('&');
headers = "302 Found\nLocation: wtv-disk:/content/DownloadScreen.tmpl" + (queryString ? ("?" + queryString) : "");
}
@@ -47,7 +47,7 @@ if (request_headers.query.group) {
state = `<a href="wtv-disk:/content/DownloadScreen.tmpl?group=${group}&diskmap=${group}&force=true">invalid</a>`;
}
const date = client_group_data[group]['last-checkup-time'] || "never";
data += `<tr><td><a href="wtv-disk:/content/DownloadScreen.tmpl?url=${encodeURIComponent('wtv-disk:/delete-group?path='+path+'&group='+group)}">${group}</a></td><td>${path}</td><td>${state}</td><td>${date}</td></tr>\n`;
data += `<tr><td><a href="wtv-disk:/content/DownloadScreen.tmpl?url=${wtvshared.escape('wtv-disk:/delete-group?path='+path+'&group='+group)}">${group}</a></td><td>${path}</td><td>${state}</td><td>${date}</td></tr>\n`;
})
}
data += `

View File

@@ -15,7 +15,7 @@ if (request_headers['wtv-request-type'] === "download") {
query['success_url'] = 'wtv-disk:/delete-group';
query['message'] = "Obtaining group data...";
const queryString = Object.keys(query)
.map(key => encodeURIComponent(key) + '=' + encodeURIComponent(query[key]))
.map(key => wtvshared.escape(key) + '=' + wtvshared.escape(query[key]))
.join('&');
headers = "302 Found\nwtv-expire-all: wtv-disk:\nLocation: wtv-disk:/content/DownloadScreen.tmpl" + (queryString ? ("?" + queryString) : "");
}

View File

@@ -85,7 +85,7 @@ if (request_headers['wtv-request-type'] === 'download') {
case "GET":
let get_url = service_name + ":/" + update_list[k].location + "?";
if (update_list[k].compress === false) get_url += "dont_compress=true&";
if (update_list[k].type) get_url += "content_type=" + encodeURIComponent(update_list[k].type) + "&";
if (update_list[k].type) get_url += "content_type=" + wtvshared.escape(update_list[k].type) + "&";
wtvdl.get(update_list[k].file.replace(diskmap_group_data.base, ""), update_list[k].file, get_url, diskmap_group_name, update_list[k].checksum, update_list[k].uncompressed_size || null, update_list[k].original_filename)
break;
}
@@ -317,7 +317,7 @@ if (request_headers['wtv-request-type'] === 'download') {
}
} else {
const queryString = Object.keys(request_headers.query)
.map(key => encodeURIComponent(key) + '=' + encodeURIComponent(request_headers.query[key]))
.map(key => wtvshared.escape(key) + '=' + wtvshared.escape(request_headers.query[key]))
.join('&');
headers = "302 Found\nLocation: wtv-disk:/content/DownloadScreen.tmpl" + (queryString ? ("?" + queryString) : "");
data = "";