more optimizations
This commit is contained in:
@@ -214,7 +214,7 @@ if (files.length > 0) {
|
||||
for (let i = start; i < Math.min(files.length, start + 6); i++) {
|
||||
url = "wtv-tricks:/view-scrapbook-image?id=" + files[i];
|
||||
if (request_headers.query.addMediaURL) {
|
||||
url = unescape(request_headers.query.addMediaURL) + "&scrapbookID=" + files[i];
|
||||
url = decodeURIComponent(request_headers.query.addMediaURL) + "&scrapbookID=" + files[i];
|
||||
}
|
||||
data += `
|
||||
<td align=center valign=middle>
|
||||
|
||||
@@ -118,13 +118,13 @@ vspace=0
|
||||
<tr>
|
||||
<td>
|
||||
<table cellspacing=0 cellpadding=0
|
||||
href="wtv-author:/styles?tmplClass=11&docName=${docName}&styleName=${escape(styleName)}&pageNum=${(page > 0) ? (page - 1) : (pages.length - 1)}#minus" id=minus><tr><td><img src="wtv-author:/ROMCache/minus_button.gif">
|
||||
href="wtv-author:/styles?tmplClass=11&docName=${docName}&styleName=${encodeURIComponent(styleName)}&pageNum=${(page > 0) ? (page - 1) : (pages.length - 1)}#minus" id=minus><tr><td><img src="wtv-author:/ROMCache/minus_button.gif">
|
||||
</table>
|
||||
</td>
|
||||
<td align=center><font color=D1D1D1><B>${page + 1} of ${pages.length}</B></font></td>
|
||||
<td>
|
||||
<table cellspacing=0 cellpadding=0
|
||||
href="wtv-author:/styles?tmplClass=11&docName=${docName}&styleName=${escape(styleName)}&pageNum=${(page+1 < pages.length) ? (page + 1) : 0}#plus" id=plus><tr><td><img src="wtv-author:/ROMCache/plus_button.gif">
|
||||
href="wtv-author:/styles?tmplClass=11&docName=${docName}&styleName=${encodeURIComponent(styleName)}&pageNum=${(page+1 < pages.length) ? (page + 1) : 0}#plus" id=plus><tr><td><img src="wtv-author:/ROMCache/plus_button.gif">
|
||||
</table>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -85,7 +85,7 @@ if (request_headers['wtv-request-type'] == 'download') {
|
||||
case "GET":
|
||||
var 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=" + escape(update_list[k].type) + "&";
|
||||
if (update_list[k].type) get_url += "content_type=" + encodeURIComponent(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;
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ async function processLC2DownloadPage(flashrom_info, headers, numparts = null) {
|
||||
|
||||
if (!flashrom_info.is_last_part) {
|
||||
flashrom_info.next_rompath = request_headers.request_url.replace(
|
||||
escape(request_headers.query.path),
|
||||
escape(flashrom_info.next_rompath.replace(service_name + ":/", ""))
|
||||
encodeURIComponent(request_headers.query.path),
|
||||
encodeURIComponent(flashrom_info.next_rompath.replace(service_name + ":/", ""))
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -4,8 +4,8 @@ if (request_headers.query.path) {
|
||||
var url = service_name + ":/get-lc2-page?path=" + request_headers.query.path;
|
||||
var romtype = session_data.get("wtv-client-rom-type");
|
||||
if (romtype == "bf0app") {
|
||||
url = "client:updateflash?ipaddr=" + minisrv_config.services[service_name].host + "&port=" + minisrv_config.services[service_name].port + "&path=" + escape(service_name + ":/" + request_headers.query.path);
|
||||
if (request_headers.query.numparts) url += escape("?numparts=" + request_headers.query.numparts);
|
||||
url = "client:updateflash?ipaddr=" + minisrv_config.services[service_name].host + "&port=" + minisrv_config.services[service_name].port + "&path=" + encodeURIComponent(service_name + ":/" + request_headers.query.path);
|
||||
if (request_headers.query.numparts) url += encodeURIComponent("?numparts=" + request_headers.query.numparts);
|
||||
} else {
|
||||
if (request_headers.query.numparts) url += "&numparts=" + request_headers.query.numparts;
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ if (request_headers.query.vflash) delete request_headers.query.vflash;
|
||||
if (request_headers.query.pflash) delete request_headers.query.pflash;
|
||||
|
||||
for (const [key, value] of Object.entries(request_headers.query)) {
|
||||
proxy_query += "&" + key + "=" + escape(value);
|
||||
proxy_query += "&" + key + "=" + encodeURIComponent(value);
|
||||
}
|
||||
|
||||
if (!minisrv_config.services[service_name].use_zefie_server) {
|
||||
@@ -20,7 +20,7 @@ if (!minisrv_config.services[service_name].use_zefie_server) {
|
||||
|
||||
var options = {
|
||||
host: "roms.minisrv.dev",
|
||||
path: "/?minisrv=true&service_name="+escape(service_name)+"&pflash=" + session_data.get("wtv-client-rom-type") + proxy_query,
|
||||
path: "/?minisrv=true&service_name="+encodeURIComponent(service_name)+"&pflash=" + session_data.get("wtv-client-rom-type") + proxy_query,
|
||||
timeout: 5000,
|
||||
method: 'GET'
|
||||
}
|
||||
|
||||
@@ -249,7 +249,7 @@ From:
|
||||
<td width=10>
|
||||
<td>`;
|
||||
if (message.from_name != message.from_addr) {
|
||||
data += `${wtvshared.htmlEntitize(message.from_addr)} <a href="client:showalert?sound=none&message=To%20add%20%3Cblackface%3E${escape(escape(message.from_name))}%3C%2Fblackface%3E%20to%20your%20Address%20book,%20choose%20%3Cb%3EAdd%3C%2Fb%3E.&buttonlabel2=Cancel&buttonaction2=client:donothing&buttonlabel1=Add&buttonaction1=wtv-mail:/addressbook%3Faction%3Deditfromheader%26noresponse%3Dtrue%26nickname%3D${escape(escape(message.from_name))}%26address%3D${escape(escape(message.from_addr))}%26new_address%3Dtrue">(${wtvshared.htmlEntitize(message.from_name)})</a>`;
|
||||
data += `${wtvshared.htmlEntitize(message.from_addr)} <a href="client:showalert?sound=none&message=To%20add%20%3Cblackface%3E${encodeURIComponent(encodeURIComponent(message.from_name))}%3C%2Fblackface%3E%20to%20your%20Address%20book,%20choose%20%3Cb%3EAdd%3C%2Fb%3E.&buttonlabel2=Cancel&buttonaction2=client:donothing&buttonlabel1=Add&buttonaction1=wtv-mail:/addressbook%3Faction%3Deditfromheader%26noresponse%3Dtrue%26nickname%3D${encodeURIComponent(encodeURIComponent(message.from_name))}%26address%3D${encodeURIComponent(encodeURIComponent(message.from_addr))}%26new_address%3Dtrue">(${wtvshared.htmlEntitize(message.from_name)})</a>`;
|
||||
} else {
|
||||
data += `${wtvshared.htmlEntitize(message.from_addr)}`;
|
||||
}
|
||||
|
||||
@@ -592,7 +592,7 @@ ${strftime("%a, %b %e, %Y, %I:%M%P", new Date(Date.parse(response.article.header
|
||||
From:
|
||||
<td>`;
|
||||
if (message.from_name != message.from_addr) {
|
||||
data += `<a href="client:showalert?sound=none&message=Would%20you%20like%20to%20add%20%3Cblackface%3E${wtvshared.htmlEntitize(message.from_name)}%3C%2Fblackface%3E%20to%20your%20address%20list%3F&buttonlabel2=No&buttonaction2=client:donothing&buttonlabel1=Yes&buttonaction1=wtv-mail:/addressbook%3Faction%3Deditfromheader%26noresponse%3Dtrue%26nickname%3D${escape(escape(message.from_name))}%26address%3D${escape(escape(message.from_addr))}%26new_address%3Dtrue">${wtvshared.htmlEntitize(message.from_addr)} </a>`;
|
||||
data += `<a href="client:showalert?sound=none&message=Would%20you%20like%20to%20add%20%3Cblackface%3E${wtvshared.htmlEntitize(message.from_name)}%3C%2Fblackface%3E%20to%20your%20address%20list%3F&buttonlabel2=No&buttonaction2=client:donothing&buttonlabel1=Yes&buttonaction1=wtv-mail:/addressbook%3Faction%3Deditfromheader%26noresponse%3Dtrue%26nickname%3D${encodeURIComponent(encodeURIComponent(message.from_name))}%26address%3D${encodeURIComponent(encodeURIComponent(message.from_addr))}%26new_address%3Dtrue">${wtvshared.htmlEntitize(message.from_addr)} </a>`;
|
||||
} else {
|
||||
data += `${wtvshared.htmlEntitize(response.article.headers.FROM)}`;
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ lib.get(targetUrl, (res) => {
|
||||
} else {
|
||||
var idx = data.indexOf('<BR>');
|
||||
data = data.substring(0, idx);
|
||||
var redirectUrl = `${service_name}:/proxy?err=${escape(data)}`;
|
||||
var redirectUrl = `${service_name}:/proxy?err=${encodeURIComponent(data)}`;
|
||||
sendToClient(socket, {'Status': 302, 'Location': redirectUrl}, '');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -15,8 +15,8 @@ if (!request_headers.query.registering ||
|
||||
data = errpage[1];
|
||||
} else {
|
||||
if (request_headers.query['Change']) {
|
||||
var changeUrl = "wtv-register:/ValidateAgreement?registering=" + escape(request_headers.query.registering) + "&subscriber_name=" + escape(request_headers.query.subscriber_name);
|
||||
changeUrl += "&subscriber_username=" + escape(request_headers.query.subscriber_username) + "&subscriber_contact=" + escape(request_headers.query.subscriber_contact) + "&subscriber_contact_method=" + escape(request_headers.query.subscriber_contact_method)
|
||||
var changeUrl = "wtv-register:/ValidateAgreement?registering=" + encodeURIComponent(request_headers.query.registering) + "&subscriber_name=" + encodeURIComponent(request_headers.query.subscriber_name);
|
||||
changeUrl += "&subscriber_username=" + encodeURIComponent(request_headers.query.subscriber_username) + "&subscriber_contact=" + encodeURIComponent(request_headers.query.subscriber_contact) + "&subscriber_contact_method=" + encodeURIComponent(request_headers.query.subscriber_contact_method);
|
||||
var errpage = wtvshared.doRedirect(changeUrl);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
|
||||
@@ -46,7 +46,7 @@ Content-Type: text/html`;
|
||||
data = "";
|
||||
|
||||
Object.keys(settings_obj).forEach(function (k, v) {
|
||||
data += k + "=" + escape(settings_obj[k]) + "&";
|
||||
data += k + "=" + encodeURIComponent(settings_obj[k]) + "&";
|
||||
});
|
||||
|
||||
data = data.substring(0, (data.length - 1));
|
||||
|
||||
@@ -110,7 +110,7 @@ Choose the songs that you'd like to include.
|
||||
var songTitle = musicList[k]['title'];
|
||||
if (songTitle.length > strLenLimit) songTitle = musicList[k]['title'].substr(0, strLenLimit - 3) + "...";
|
||||
if (musicList.length > 14) data += '<font size="-2">';
|
||||
data += `<a href="${musicList[k]['url']}?wtv-title=${escape(musicList[k]['title'])}" onmouseout="clearTitle()" onmouseover="showTitle('${musicList[k]['title'].replace(/\'/g, "\\'")}')">${songTitle}</a>
|
||||
data += `<a href="${musicList[k]['url']}?wtv-title=${encodeURIComponent(musicList[k]['title'])}" onmouseout="clearTitle()" onmouseover="showTitle('${musicList[k]['title'].replace(/\'/g, "\\'")}')">${songTitle}</a>
|
||||
</td></tr></tbody></table>`;
|
||||
if (musicList.length > 14) data += '</font>';
|
||||
songsListed++;
|
||||
|
||||
@@ -31,8 +31,8 @@ if (request_headers.query && session_data) {
|
||||
var qraw_split = qraw[i].split("=");
|
||||
if (qraw_split.length == 2) {
|
||||
var k = qraw_split[0];
|
||||
if (k == "enableCategory") music_obj['enableCategories'].push(unescape(qraw[i].split("=")[1].replace(/\+/g, "%20")));
|
||||
if (k == "enableSong") music_obj['enableSongs'].push(unescape(qraw[i].split("=")[1].replace(/\+/g, "%20")));
|
||||
if (k == "enableCategory") music_obj['enableCategories'].push(decodeURIComponent(qraw[i].split("=")[1].replace(/\+/g, "%20")));
|
||||
if (k == "enableSong") music_obj['enableSongs'].push(decodeURIComponent(qraw[i].split("=")[1].replace(/\+/g, "%20")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -549,10 +549,10 @@ class WTVClientSessionData {
|
||||
} else {
|
||||
if (path && expires && data) {
|
||||
var cookie_data = {};
|
||||
cookie_data['cookie'] = unescape(data);
|
||||
cookie_data['expires'] = unescape(expires);
|
||||
cookie_data['path'] = unescape(path);
|
||||
cookie_data['domain'] = unescape(domain);
|
||||
cookie_data['cookie'] = decodeURIComponent(data);
|
||||
cookie_data['expires'] = decodeURIComponent(expires);
|
||||
cookie_data['path'] = decodeURIComponent(path);
|
||||
cookie_data['domain'] = decodeURIComponent(domain);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
@@ -608,7 +608,7 @@ class WTVClientSessionData {
|
||||
/*
|
||||
var outstring = "";
|
||||
Object.keys(cookie_data).forEach(function (k) {
|
||||
outstring += k + "=" + escape(cookie_data[k]) + "&";
|
||||
outstring += k + "=" + encodeURIComponent(cookie_data[k]) + "&";
|
||||
});
|
||||
return outstring.slice(0, outstring.length - 1);
|
||||
*/
|
||||
|
||||
@@ -1548,13 +1548,13 @@ class clientShowAlert {
|
||||
*/
|
||||
getURL() {
|
||||
let url = "client:ShowAlert?";
|
||||
if (this.message) url += `message=${escape(this.message)}&`;
|
||||
if (this.buttonlabel1) url += `buttonlabel1=${escape(this.buttonlabel1)}&`;
|
||||
if (this.buttonaction1) url += `buttonaction1=${escape(this.buttonaction1)}&`;
|
||||
if (this.buttonlabel2) url += `buttonlabel2=${escape(this.buttonlabel2)}&`;
|
||||
if (this.buttonaction2) url += `buttonaction2=${escape(this.buttonaction2)}&`;
|
||||
if (this.image) url += `image=${escape(this.image)}&`;
|
||||
if (this.sound) url += `sound=${escape(this.sound)}&`;
|
||||
if (this.message) url += `message=${encodeURIComponent(this.message)}&`;
|
||||
if (this.buttonlabel1) url += `buttonlabel1=${encodeURIComponent(this.buttonlabel1)}&`;
|
||||
if (this.buttonaction1) url += `buttonaction1=${encodeURIComponent(this.buttonaction1)}&`;
|
||||
if (this.buttonlabel2) url += `buttonlabel2=${encodeURIComponent(this.buttonlabel2)}&`;
|
||||
if (this.buttonaction2) url += `buttonaction2=${encodeURIComponent(this.buttonaction2)}&`;
|
||||
if (this.image) url += `image=${encodeURIComponent(this.image)}&`;
|
||||
if (this.sound) url += `sound=${encodeURIComponent(this.sound)}&`;
|
||||
if (this.noback) url += "noback=true&";
|
||||
return url.slice(0, -1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user