diff --git a/zefie_wtvp_minisrv/app.js b/zefie_wtvp_minisrv/app.js index 7df36f67..f102ab42 100644 --- a/zefie_wtvp_minisrv/app.js +++ b/zefie_wtvp_minisrv/app.js @@ -29,7 +29,7 @@ const WTVFlashrom = require(classPath + "/WTVFlashrom.js"); const WTVIRC = require(classPath + "/WTVIRC.js"); const WTVFTP = require(classPath + "/WTVFTP.js"); const vm = require('vm'); -const debug = require('debug')('minisrv_main'); +const debug = require('debug')('app'); const express = require('express'); let wtvirc = null; @@ -1831,7 +1831,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq if (!wtvshared.checkSSID(socket.ssid)) { if (!socket.ssid.startsWith("1SEGA") && !socket.ssid.startsWith("MSTVSIMU")) { // reject invalid SSIDs, but let Dreamcast and MSTV Sim through for now until we figure out their checksumming method. - const errpage = wtvshared.doErrorPage(400, "minisrv ran into a technical problem. Reason: Your SSID is not valid."); + const errpage = wtvshared.doErrorPage(400, `${minisrv_config.config.service_name} ran into a technical problem. Reason: Your SSID is not valid.`); socket.close_me = true; sendToClient(socket, errpage[0], errpage[1]); return; @@ -2091,7 +2091,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq if (socket_sessions[socket.id].expecting_post_data) delete socket_sessions[socket.id].expecting_post_data; socket.setTimeout(minisrv_config.config.socket_timeout * 1000); if (headers.length == 0) { - const errpage = wtvshared.doErrorPage(400, `${minisrv_config.config.service_name} ran into a technical problem, please try again.`); + const errpage = wtvshared.doErrorPage(400); sendToClient(socket, errpage[0], errpage[1]); return; } diff --git a/zefie_wtvp_minisrv/client_emu.js b/zefie_wtvp_minisrv/client_sim.js similarity index 100% rename from zefie_wtvp_minisrv/client_emu.js rename to zefie_wtvp_minisrv/client_sim.js diff --git a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Billing/Index.js b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Billing/Index.js index bcc5dfd0..23f05cab 100644 --- a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Billing/Index.js +++ b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Billing/Index.js @@ -218,7 +218,7 @@ for(var loop = 0; loop < vCount; loop++) { appUrl = document.formInfo.tryItUrl.value; if (appUrl != "" ) { - if ( appUrl.substring(0,10) == "wtv-tricks" ) { + if ( appUrl.slice(0,10) == "wtv-tricks" ) { if ( document.formInfo.tryItLabel.value.length == 4 ) { document.write(""); } else { diff --git a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Mail/Main.js b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Mail/Main.js index 57840031..d01764ac 100644 --- a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Mail/Main.js +++ b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Mail/Main.js @@ -224,11 +224,11 @@ document.indexForm.indexSubcat.value = "0"; drawAll(); } function goToPage(a,b) { str = subCatUrl[a][b]; -if (str.substring(0,4) == "faq:") { goToStr = str.substring(4,str.length); +if (str.slice(0,4) == "faq:") { goToStr = str.slice(4,str.length); goToHelpCenter(goToStr); -} else if (str.substring(0,9) == "non-help:") { goToStr = str.substring(9,str.length); +} else if (str.slice(0,9) == "non-help:") { goToStr = str.slice(9,str.length); goToUrl(goToStr); -} else if (str.substring(0,7) == "newFAQ:") { goToStr = str.substring(7,str.length); +} else if (str.slice(0,7) == "newFAQ:") { goToStr = str.slice(7,str.length); goToFAQURL(goToStr); } else { goToStr = ('wtv-guide:/help?' + str); goToUrl(goToStr); @@ -279,13 +279,13 @@ go back to it. If not, just go to it. If wholeString is specified, it looks for perfect matches of the whole string. */ ind = gvnStr.indexOf("wtv-token"); -if (ind > -1) { gvnStr = gvnStr.substring(0,ind); +if (ind > -1) { gvnStr = gvnStr.slice(0,ind); } window.message("gvnStr=" + gvnStr); foundInBackList = false; for (i=history.length; i--; i>0 ) { if ( wholeString != null ) { testStr = history[i]; } else { str = history[i]; -testStr = str.substring(0, gvnStr.length); +testStr = str.slice(0, gvnStr.length); } if ( testStr == gvnStr ) { i++; foundInBackList = true; diff --git a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=Find.htm b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/Find.html similarity index 100% rename from zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=Find.htm rename to zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/Find.html diff --git a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=Goto.htm b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/Goto.html similarity index 100% rename from zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=Goto.htm rename to zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/Goto.html diff --git a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=HangUp.htm b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/HangUp.html similarity index 100% rename from zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=HangUp.htm rename to zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/HangUp.html diff --git a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options.htm b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/Index.html similarity index 100% rename from zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options.htm rename to zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/Index.html diff --git a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=Info.htm b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/Info.html similarity index 100% rename from zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=Info.htm rename to zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/Info.html diff --git a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=Messenger.htm b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/Messenger.html similarity index 100% rename from zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=Messenger.htm rename to zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/Messenger.html diff --git a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=Print.htm b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/Print.html similarity index 100% rename from zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=Print.htm rename to zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/Print.html diff --git a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=Reload.htm b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/Reload.html similarity index 100% rename from zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=Reload.htm rename to zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/Reload.html diff --git a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=Save.htm b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/Save.html similarity index 100% rename from zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=Save.htm rename to zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/Save.html diff --git a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=TVvsWeb.htm b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/TVvsWeb.htm similarity index 100% rename from zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=TVvsWeb.htm rename to zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/TVvsWeb.htm diff --git a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=TvWindow.htm b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/TvWindow.htm similarity index 100% rename from zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=TvWindow.htm rename to zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/TvWindow.htm diff --git a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=logo.htm b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/logo.html similarity index 100% rename from zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/topic=Tips&subtopic=Options&page=logo.htm rename to zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/prerendered/Tips/Options/logo.html diff --git a/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/viewergen/index.js b/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/viewergen/index.js index 680e2cef..eb7b132b 100644 --- a/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/viewergen/index.js +++ b/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/viewergen/index.js @@ -106,7 +106,7 @@ function getPatchDataType(type, invert = false) { function getResData(file) { var res_data = null; - if (file.substr(-2, 2).toLowerCase() == "gz") { + if (file.slice(-2, 2).toLowerCase() == "gz") { var res_gz_data = wtvshared.getServiceDep("/viewergen/" + file); res_data = zlib.gunzipSync(res_gz_data); } else { @@ -228,34 +228,34 @@ function getPatchData(fname, client_data_obj, start_url = "client:GoToConn", def if (typeof val === 'string') { // start url override if (start_url != patch_defaults.start_url && start_url.length <= patch_limits.start_url) { - if (val.substr(0, patch_defaults.start_url.length) == patch_defaults.start_url) + if (val.slice(0, patch_defaults.start_url.length) == patch_defaults.start_url) customized_patch_data[idx] = start_url + "\x00"; } // default service ip override if (default_ip != patch_defaults.default_ip && default_ip.length <= patch_limits.default_ip) { - if (val.substr(0, patch_defaults.default_ip.length) == patch_defaults.default_ip) + if (val.slice(0, patch_defaults.default_ip.length) == patch_defaults.default_ip) customized_patch_data[idx] = default_ip + "\x00"; } } else { if (!val.byteLength) { // not a buffer object var block_length = val['length']; - var patch_data = getPatchDataType(val['type'], (fname.substr(12, 3) != "1.1")); + var patch_data = getPatchDataType(val['type'], (fname.slice(12, 3) != "1.1")); if (patch_data) { var patch_data_array = patch_data.split("\r\n"); var patch_data_string = ""; Object.keys(patch_data_array).forEach(function (didx) { var header_end = patch_data_array[didx].indexOf(":"); if (header_end) { - var patch_data_header = patch_data_array[didx].substr(0, header_end); + var patch_data_header = patch_data_array[didx].slice(0, header_end); var client_value = client_data_obj[patch_data_header]; if (client_value) patch_data_string += patch_data_array[didx].replace("%s", client_value) + "\r\n"; } }); } - if (fname.substr(12, 3) != "2.5") { + if (fname.slice(12, 3) != "2.5") { var length_difference = block_length - patch_data_string.length; if (length_difference > 0) patch_data_string += "\x00".repeat(length_difference - (val['type'].length + 1)); @@ -493,8 +493,8 @@ if (request_headers.query.viewer && var patched_file = patchBinary(patchDataObject); var enabled_feature_bits = []; Object.keys(request_headers.query).forEach((k) => { - if (k.substring(0, 12) === "feature_bit_") { - enabled_feature_bits.push(parseInt(k.substring(12))); + if (k.slice(0, 12) === "feature_bit_") { + enabled_feature_bits.push(parseInt(k.slice(12))); } }); Object.keys(enabled_feature_bits).forEach((k) => { @@ -553,8 +553,8 @@ Content-Disposition: attachment; filename="${viewer_file.replace(".exe", ".zip") var embed_modpacks = []; Object.keys(request_headers.query).forEach((k) => { - if (k.substring(0, 8) === "modpack_") { - embed_modpacks.push(parseInt(k.substring(8))); + if (k.slice(0, 8) === "modpack_") { + embed_modpacks.push(parseInt(k.slice(8))); } }); @@ -601,9 +601,9 @@ window.onload = function() { function getSSIDCRC(ssid) { let crc = 0; - var ssid = ssid.substr(0, 14); + var ssid = ssid.slice(0, 14); for (let i = 0; i < ssid.length; i += 2) { - let inbyte = parseInt(ssid.substring(i, i+2), 16); + let inbyte = parseInt(ssid.slice(i, i+2), 16); for (let ii = 8; ii > 0; ii--) { let mix = (crc ^ inbyte) & 0x01; crc >>= 1; @@ -667,9 +667,9 @@ function validateSSID(ssid) { alert("Please choose a valid SSID and try again."); return false; } - if ((ssid.substr(0,1) != "0" && ssid.substr(0,1) != "8" && ssid.substr(0,1) != "9") || - (ssid.substr(6,1) != "0") || - (ssid.substr(9,5) != "0b002")) { + if ((ssid.slice(0,1) != "0" && ssid.slice(0,1) != "8" && ssid.slice(0,1) != "9") || + (ssid.slice(6,1) != "0") || + (ssid.slice(9,5) != "0b002")) { alert("Your SSID is not proper, but I'll allow it.") } return true; diff --git a/zefie_wtvp_minisrv/includes/ServiceVault/mailto/catchall.js b/zefie_wtvp_minisrv/includes/ServiceVault/mailto/catchall.js index 89adadaa..6a3445d1 100644 --- a/zefie_wtvp_minisrv/includes/ServiceVault/mailto/catchall.js +++ b/zefie_wtvp_minisrv/includes/ServiceVault/mailto/catchall.js @@ -1,7 +1,7 @@ var minisrv_service_file = true; var mailto = request_headers.request_url; -mailto = mailto.substring(mailto.indexOf(":") + 1); +mailto = mailto.slice(mailto.indexOf(":") + 1); mailto = mailto.split("?")[0]; var subject = request_headers.query.subject || ""; var body = request_headers.query.body || ""; diff --git a/zefie_wtvp_minisrv/includes/ServiceVault/wtv-1800/preregister.js b/zefie_wtvp_minisrv/includes/ServiceVault/wtv-1800/preregister.js index 00d4c98c..940c674b 100644 --- a/zefie_wtvp_minisrv/includes/ServiceVault/wtv-1800/preregister.js +++ b/zefie_wtvp_minisrv/includes/ServiceVault/wtv-1800/preregister.js @@ -143,7 +143,7 @@ if (session_data.data_store.wtvsec_login) { break; } - if (socket.ssid.substr(0, 8) == "MSTVSIMU") { + if (socket.ssid.slice(0, 8) == "MSTVSIMU") { prereg_contype = "text/dialscript"; var file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/UTV/utv_hsd.tok", true); } diff --git a/zefie_wtvp_minisrv/includes/classes/WTVAuthor.js b/zefie_wtvp_minisrv/includes/classes/WTVAuthor.js index 5608217a..0ccf164d 100644 --- a/zefie_wtvp_minisrv/includes/classes/WTVAuthor.js +++ b/zefie_wtvp_minisrv/includes/classes/WTVAuthor.js @@ -91,7 +91,7 @@ class WTVAuthor { this.debug("createPage","pages",pages) var pagenums = []; for(let i = 0; i < pagelen; i++) { - var toarr = pages[i].substr(0, pages[i].indexOf('.')); + var toarr = pages[i].slice(0, pages[i].indexOf('.')); pagenums.push(parseInt(toarr)); } pagenums = pagenums.sort() @@ -469,7 +469,7 @@ this.fs.writeFile(destDir + this.wtvclient.session_store.subscriber_username + ' break; case "clipart": - this.fs.mkdirSync(destDir + this.wtvclient.session_store.subscriber_username + '/' + pagedata.publishname + "/" + atob(thisblock.photo).substr(0, atob(thisblock.photo).lastIndexOf("/")), { recursive: true }) + this.fs.mkdirSync(destDir + this.wtvclient.session_store.subscriber_username + '/' + pagedata.publishname + "/" + atob(thisblock.photo).slice(0, atob(thisblock.photo).lastIndexOf("/")), { recursive: true }) this.fs.copyFile('includes/ServiceVault/wtv-author/' + atob(thisblock.photo), destDir + this.wtvclient.session_store.subscriber_username + '/' + pagedata.publishname + "/" + atob(thisblock.photo), (err) => { if (err) throw err; }); @@ -840,7 +840,7 @@ html += `">next page var publishname = null; if (pagedata.published != true) { - publishname = pagedata.title.substring(0, 50).replaceAll(" ", "").replace(/[^A-Za-z0-9]/g, "-"); + publishname = pagedata.title.slice(0, 50).replaceAll(" ", "").replace(/[^A-Za-z0-9]/g, "-"); pagedata.publishname = publishname; this.editPage(pagedata, pagenum); if (this.fs.existsSync(destDir + this.wtvclient.session_store.subscriber_username + '/' + publishname)) { @@ -867,7 +867,7 @@ html += `">next page }); } for (let i = 0; i < this.stylemedia.length; i++) { - this.fs.mkdirSync(destDir + this.wtvclient.session_store.subscriber_username + '/' + publishname + this.stylemedia[i].substr(0, this.stylemedia[i].lastIndexOf("/")), { recursive: true }) + this.fs.mkdirSync(destDir + this.wtvclient.session_store.subscriber_username + '/' + publishname + this.stylemedia[i].slice(0, this.stylemedia[i].lastIndexOf("/")), { recursive: true }) this.fs.copyFile('includes/ServiceVault/wtv-author' + this.stylemedia[i], destDir + this.wtvclient.session_store.subscriber_username + '/' + publishname + this.stylemedia[i], (err) => { if (err) throw err; }); diff --git a/zefie_wtvp_minisrv/includes/classes/WTVBGMusic.js b/zefie_wtvp_minisrv/includes/classes/WTVBGMusic.js index e5dad029..5159db66 100644 --- a/zefie_wtvp_minisrv/includes/classes/WTVBGMusic.js +++ b/zefie_wtvp_minisrv/includes/classes/WTVBGMusic.js @@ -1331,10 +1331,10 @@ class WTVBGMusic { getSongCategory(songid) { if (String(songid).length === 3) { // 3 digit song id - return parseInt(String(songid).substr(0, 1)); + return parseInt(String(songid).slice(0, 1)); } else if (String(songid).length === 4) { // 4 digit song id - return parseInt(String(songid).substr(0, 2)); + return parseInt(String(songid).slice(0, 2)); } return null; } @@ -1353,10 +1353,10 @@ class WTVBGMusic { musiclist[k].id = k; if (String(category).length === 1) { // 3 digit song id - if (parseInt(k.substr(0, 1)) == parseInt(category) && String(k).length === 3) songList.push(musiclist[k]); + if (parseInt(k.slice(0, 1)) == parseInt(category) && String(k).length === 3) songList.push(musiclist[k]); } else if (String(category).length === 2) { // 4 digit song id - if (parseInt(k.substr(0, 2)) == parseInt(category) && String(k).length === 4) songList.push(musiclist[k]); + if (parseInt(k.slice(0, 2)) == parseInt(category) && String(k).length === 4) songList.push(musiclist[k]); } }); return songList.filter(value => Object.keys(value).length !== 0); diff --git a/zefie_wtvp_minisrv/includes/classes/WTVClientCapabilities.js b/zefie_wtvp_minisrv/includes/classes/WTVClientCapabilities.js index 1dd78964..9bbccca7 100644 --- a/zefie_wtvp_minisrv/includes/classes/WTVClientCapabilities.js +++ b/zefie_wtvp_minisrv/includes/classes/WTVClientCapabilities.js @@ -99,7 +99,7 @@ class WTVClientCapabilities { //In case remaining hex length (or initial) is not multiple of 8 var blockSize = remainingSize < 8 ? remainingSize : 8; - binary += parseInt(hex.substr(p * 8, blockSize), 16).toString(2); + binary += parseInt(hex.slice(p * 8, blockSize), 16).toString(2); remainingSize -= blockSize; } diff --git a/zefie_wtvp_minisrv/includes/classes/WTVClientSessionData.js b/zefie_wtvp_minisrv/includes/classes/WTVClientSessionData.js index e40675ad..7d8b21f1 100644 --- a/zefie_wtvp_minisrv/includes/classes/WTVClientSessionData.js +++ b/zefie_wtvp_minisrv/includes/classes/WTVClientSessionData.js @@ -610,7 +610,7 @@ class WTVClientSessionData { Object.keys(cookie_data).forEach(function (k) { outstring += k + "=" + escape(cookie_data[k]) + "&"; }); - return outstring.substring(0, outstring.length - 1); + return outstring.slice(0, outstring.length - 1); */ return cookie_data.cookie; } diff --git a/zefie_wtvp_minisrv/includes/classes/WTVDisk.js b/zefie_wtvp_minisrv/includes/classes/WTVDisk.js index 04286738..2c08e0e1 100644 --- a/zefie_wtvp_minisrv/includes/classes/WTVDisk.js +++ b/zefie_wtvp_minisrv/includes/classes/WTVDisk.js @@ -160,7 +160,7 @@ class WTVDownloadList { this.download_list += `file-permission: ${file_permission}\n`; if (checksum != null) this.download_list += `wtv-checksum: ${checksum}\n`; if (uncompressed_size != null) this.download_list += `wtv-uncompressed-filesize: ${uncompressed_size}\n`; - this.download_list += `service-source-location: /webtv/content/${source.substring(source.indexOf('-') + 1, source.indexOf(':/'))}d/${source.substring(source.indexOf(':/') + 2)}\n`; + this.download_list += `service-source-location: /webtv/content/${source.slice(source.indexOf('-') + 1, source.indexOf(':/'))}d/${source.slice(source.indexOf(':/') + 2)}\n`; this.download_list += `client-dest-location: ${path}\n\n`; } @@ -182,7 +182,7 @@ class WTVDownloadList { if (typeof post_data == 'string') post_data = post_data.split("\n\n"); const group_data = []; post_data.forEach(function (v) { - if (v.substring(0, 4) == "file") { + if (v.slice(0, 4) == "file") { const block_split = v.split("\n"); const group_data_entry = {}; group_data_entry.path = block_split[0]; diff --git a/zefie_wtvp_minisrv/includes/classes/WTVFlashrom.js b/zefie_wtvp_minisrv/includes/classes/WTVFlashrom.js index 52af4afe..d7251657 100644 --- a/zefie_wtvp_minisrv/includes/classes/WTVFlashrom.js +++ b/zefie_wtvp_minisrv/includes/classes/WTVFlashrom.js @@ -103,7 +103,7 @@ class WTVFlashrom { if (this.minisrv_config.config.debug_flags.debug && this.minisrv_config.config.debug_flags.quiet) console.log(" # Sending", (flashrom_info.is_last_part) ? "Last Flashrom" : "Flashrom", "Part", flashrom_info.part_number, "- Bytes Sent:", flashrom_info.byte_progress + flashrom_info.part_total_size, "of", flashrom_info.total_parts_size, "(" + flashrom_info.percent_complete + " % complete)"); // read current part display message from part header - flashrom_info.message = new Buffer.from(part_header.toString('hex').substring(36 * 2, 68 * 2), 'hex').toString('ascii').replace(/[^0-9a-z\ \.\-]/gi, ""); + flashrom_info.message = new Buffer.from(part_header.toString('hex').slice(36 * 2, 68 * 2), 'hex').toString('ascii').replace(/[^0-9a-z\ \.\-]/gi, ""); flashrom_info.rompath = `wtv-flashrom:/${path}`; if (flashrom_info.is_last_part && this.bf0app_update) { diff --git a/zefie_wtvp_minisrv/includes/classes/WTVGuide.js b/zefie_wtvp_minisrv/includes/classes/WTVGuide.js index cf0e685f..c63ab246 100644 --- a/zefie_wtvp_minisrv/includes/classes/WTVGuide.js +++ b/zefie_wtvp_minisrv/includes/classes/WTVGuide.js @@ -70,28 +70,28 @@ class WTVGuide { var start = start + search.length; original_start = start; // handle - if (definition.substr(start, 1) != ">") { + if (definition.slice(start, 1) != ">") { start++; // +1 to skip = end = definition.indexOf(">", start); - link_word_override = definition.substring(start, end); + link_word_override = definition.slice(start, end); // strip any quotes - if (link_word_override.substr(0, 1).match(/[\"\']/)) link_word_override = link_word_override.substring(1); - if (link_word_override.substr(link_word_override.length - 1, 1).match(/[\"\']/)) link_word_override = link_word_override.substr(0, link_word_override.length - 1); + if (link_word_override.slice(0, 1).match(/[\"\']/)) link_word_override = link_word_override.slice(1); + if (link_word_override.slice(link_word_override.length - 1, 1).match(/[\"\']/)) link_word_override = link_word_override.slice(0, link_word_override.length - 1); link_word_for_link = link_word_override.replace(/ /g, '').replace(/\'/g, '').replace(/\"/g, '').toLowerCase(); - link_word_start_letter = link_word_for_link.substr(0, 1).toUpperCase(); + link_word_start_letter = link_word_for_link.slice(0, 1).toUpperCase(); start = end + 1; // update start pos for rest of processing } else { start++; } end = definition.indexOf("", start); - var link_word = definition.substring(start, end); + var link_word = definition.slice(start, end); if (!link_word_for_link) link_word_for_link = link_word.replace(/ /g, '').replace(/\'/g,'').replace(/\"/g,'').toLowerCase(); - if (!link_word_start_letter) link_word_start_letter = link_word.substr(0, 1).toUpperCase(); + if (!link_word_start_letter) link_word_start_letter = link_word.slice(0, 1).toUpperCase(); if (!link_word_override) link_word_override = link_word; var link_url = `wtv-guide:/help?topic=Glossary&subtopic=${link_word_start_letter}&page=${link_word_for_link}&word=${encodeURIComponent(link_word_override)}` - var new_definition = definition.substring(0, original_start - search.length) + `${link_word}` + definition.substring(end + 7); + var new_definition = definition.slice(0, original_start - search.length) + `${link_word}` + definition.slice(end + 7); definition = new_definition; } // replaces with the friendly name of the type of unit the user has diff --git a/zefie_wtvp_minisrv/includes/classes/WTVMail.js b/zefie_wtvp_minisrv/includes/classes/WTVMail.js index 425e5f07..88d07982 100644 --- a/zefie_wtvp_minisrv/includes/classes/WTVMail.js +++ b/zefie_wtvp_minisrv/includes/classes/WTVMail.js @@ -328,7 +328,7 @@ class WTVMail { else return a.time - b.time; }) .map(function (v) { - if (v.name.substring((v.name.length - self.msgFileExt.length)) === self.msgFileExt) return v.name.substring(0, (v.name.length - 5)); + if (v.name.slice((v.name.length - self.msgFileExt.length)) === self.msgFileExt) return v.name.slice(0, (v.name.length - 5)); }); if (files.length == 0) return false; // no messages @@ -398,7 +398,7 @@ class WTVMail { var path_after_replace = search_dir.replace(accounts_dir, ''); // Remove leading path separator if present if (path_after_replace.startsWith(self.path.sep)) { - path_after_replace = path_after_replace.substring(1); + path_after_replace = path_after_replace.slice(1); } var path_split = path_after_replace.split(self.path.sep); // The path should be like "ssid/user0", so extract ssid and user_id diff --git a/zefie_wtvp_minisrv/includes/classes/WTVMinifyingProxy.js b/zefie_wtvp_minisrv/includes/classes/WTVMinifyingProxy.js index 0697d16d..4b159a8f 100644 --- a/zefie_wtvp_minisrv/includes/classes/WTVMinifyingProxy.js +++ b/zefie_wtvp_minisrv/includes/classes/WTVMinifyingProxy.js @@ -292,7 +292,7 @@ class WTVMinifyingProxy { for (const [selector, styles] of cssRules) { if (selector.startsWith('.')) { // Handle class selectors (e.g., .lst) - const className = selector.substring(1); + const className = selector.slice(1); const regex = new RegExp(`<(input[^>]*class\\s*=\\s*["'][^"']*\\b${className}\\b[^"']*["'][^>]*)>`, 'gi'); html = html.replace(regex, (match, tagContent) => { // Convert CSS styles to attributes for this element (input tag) @@ -545,7 +545,7 @@ class WTVMinifyingProxy { // No body tag found, extract everything after head or use all content const headEndMatch = html.match(/<\/head>/i); if (headEndMatch) { - bodyContent = html.substring(html.indexOf(headEndMatch[0]) + headEndMatch[0].length); + bodyContent = html.slice(html.indexOf(headEndMatch[0]) + headEndMatch[0].length); } else { bodyContent = html; } @@ -711,19 +711,19 @@ ${bodyContent} intelligentTruncate(content, maxLength) { if (content.length <= maxLength) return content; - let truncated = content.substring(0, maxLength); + let truncated = content.slice(0, maxLength); // Try to cut at a tag boundary const lastCloseTag = truncated.lastIndexOf('>'); const lastOpenTag = truncated.lastIndexOf('<'); if (lastCloseTag > lastOpenTag) { - truncated = truncated.substring(0, lastCloseTag + 1); + truncated = truncated.slice(0, lastCloseTag + 1); } else { // Cut at word boundary const lastSpace = truncated.lastIndexOf(' '); if (lastSpace > maxLength * 0.8) { // Only if we don't lose too much - truncated = truncated.substring(0, lastSpace); + truncated = truncated.slice(0, lastSpace); } } @@ -769,7 +769,7 @@ ${bodyContent} // No body tag found, extract content after head or use transformed content const headEndMatch = transformed.match(/<\/head>/i); if (headEndMatch) { - bodyContent = transformed.substring(transformed.indexOf(headEndMatch[0]) + headEndMatch[0].length); + bodyContent = transformed.slice(transformed.indexOf(headEndMatch[0]) + headEndMatch[0].length); } else { bodyContent = transformed; } diff --git a/zefie_wtvp_minisrv/includes/classes/WTVNewsServer.js b/zefie_wtvp_minisrv/includes/classes/WTVNewsServer.js index 3e8f5ccf..8ad19332 100644 --- a/zefie_wtvp_minisrv/includes/classes/WTVNewsServer.js +++ b/zefie_wtvp_minisrv/includes/classes/WTVNewsServer.js @@ -94,7 +94,7 @@ class WTVNewsServer { Object.keys(message.headers).forEach((k) => { if (k.length > 0) out += `${k}: ${message.headers[k]}\r\n`; }); - out = out.substr(0, out.length - 2); + out = out.slice(0, out.length - 2); return out; }, diff --git a/zefie_wtvp_minisrv/includes/classes/WTVTellyScript.js b/zefie_wtvp_minisrv/includes/classes/WTVTellyScript.js index 2d535ddf..bb61f43f 100644 --- a/zefie_wtvp_minisrv/includes/classes/WTVTellyScript.js +++ b/zefie_wtvp_minisrv/includes/classes/WTVTellyScript.js @@ -229,7 +229,7 @@ class WTVTellyScriptTokenizer { // Process as a constant. let hexString = ""; if (checkSequence.startsWith("0x") || checkSequence.startsWith("0X")) { - hexString = checkSequence.substring(2); + hexString = checkSequence.slice(2); } else { hexString = parseInt(checkSequence, 10).toString(16).toUpperCase(); }