more optimizations, remove WTVIRC for now, upgrade test.js
This commit is contained in:
6
zefie_wtvp_minisrv/.eslintignore
Normal file
6
zefie_wtvp_minisrv/.eslintignore
Normal file
@@ -0,0 +1,6 @@
|
||||
node_modules/
|
||||
SessionStore/
|
||||
ServiceLogPost/
|
||||
PageBuilderVault/
|
||||
*.min.js
|
||||
*.log
|
||||
235
zefie_wtvp_minisrv/.temp-eslint-config.json
Normal file
235
zefie_wtvp_minisrv/.temp-eslint-config.json
Normal file
@@ -0,0 +1,235 @@
|
||||
{
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2022,
|
||||
"sourceType": "script"
|
||||
},
|
||||
"env": {
|
||||
"node": true,
|
||||
"es2022": true
|
||||
},
|
||||
"rules": {
|
||||
"eqeqeq": [
|
||||
"warn",
|
||||
"always"
|
||||
],
|
||||
"no-eq-null": "warn",
|
||||
"no-redeclare": 2,
|
||||
"no-undef": 2,
|
||||
"no-use-before-define": [
|
||||
"error",
|
||||
{
|
||||
"variables": false,
|
||||
"functions": false,
|
||||
"classes": false
|
||||
}
|
||||
],
|
||||
"block-scoped-var": 2,
|
||||
"no-const-assign": 2,
|
||||
"prefer-const": 1,
|
||||
"no-var": 1,
|
||||
"no-restricted-globals": [
|
||||
"warn",
|
||||
{
|
||||
"name": "escape",
|
||||
"message": "escape() is deprecated. Use encodeURIComponent() instead."
|
||||
},
|
||||
{
|
||||
"name": "unescape",
|
||||
"message": "unescape() is deprecated. Use decodeURIComponent() instead."
|
||||
}
|
||||
],
|
||||
"no-restricted-syntax": [
|
||||
"warn",
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.property.name='substr']",
|
||||
"message": "String.prototype.substr() is deprecated. Use String.prototype.slice() instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.name='substr']",
|
||||
"message": "substr() is deprecated. Use slice() instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.property.name='substring']",
|
||||
"message": "substring() found, for continuity, please use String.prototype.slice() instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.name='substring']",
|
||||
"message": "substring() found, for continuity, please use slice() instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='Buffer'][callee.property.name='slice']",
|
||||
"message": "Found .slice() call. If this is on a Buffer, use Buffer.subarray() instead for better performance."
|
||||
},
|
||||
{
|
||||
"selector": "NewExpression[callee.name='Buffer']",
|
||||
"message": "new Buffer() is deprecated. Use Buffer.from(), Buffer.alloc(), or Buffer.allocUnsafe() instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='fs'][callee.property.name='exists']",
|
||||
"message": "fs.exists() is deprecated. Use fs.existsSync() or fs.access() instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='isArray']",
|
||||
"message": "util.isArray() is deprecated. Use Array.isArray() instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='isBoolean']",
|
||||
"message": "util.isBoolean() is deprecated. Use typeof x === 'boolean' instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='isBuffer']",
|
||||
"message": "util.isBuffer() is deprecated. Use Buffer.isBuffer() instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='isDate']",
|
||||
"message": "util.isDate() is deprecated. Use x instanceof Date instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='isError']",
|
||||
"message": "util.isError() is deprecated. Use x instanceof Error instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='isFunction']",
|
||||
"message": "util.isFunction() is deprecated. Use typeof x === 'function' instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='isNull']",
|
||||
"message": "util.isNull() is deprecated. Use x === null instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='isNullOrUndefined']",
|
||||
"message": "util.isNullOrUndefined() is deprecated. Use x == null instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='isNumber']",
|
||||
"message": "util.isNumber() is deprecated. Use typeof x === 'number' instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='isObject']",
|
||||
"message": "util.isObject() is deprecated. Use typeof x === 'object' && x !== null instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='isPrimitive']",
|
||||
"message": "util.isPrimitive() is deprecated. Use manual type checking instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='isRegExp']",
|
||||
"message": "util.isRegExp() is deprecated. Use x instanceof RegExp instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='isString']",
|
||||
"message": "util.isString() is deprecated. Use typeof x === 'string' instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='isSymbol']",
|
||||
"message": "util.isSymbol() is deprecated. Use typeof x === 'symbol' instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='isUndefined']",
|
||||
"message": "util.isUndefined() is deprecated. Use x === undefined instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='debug']",
|
||||
"message": "util.debug() is deprecated. Use console.error() instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='error']",
|
||||
"message": "util.error() is deprecated. Use console.error() instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='print']",
|
||||
"message": "util.print() is deprecated. Use console.log() instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='puts']",
|
||||
"message": "util.puts() is deprecated. Use console.log() instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='util'][callee.property.name='pump']",
|
||||
"message": "util.pump() is deprecated. Use stream.pipeline() instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.name='require'][arguments.0.value='domain']",
|
||||
"message": "The 'domain' module is deprecated. Use AsyncLocalStorage or async_hooks instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='crypto'][callee.property.name='createCredentials']",
|
||||
"message": "crypto.createCredentials() is deprecated. Use tls.createSecureContext() instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='crypto'][callee.property.name='Credentials']",
|
||||
"message": "crypto.Credentials is deprecated. Use tls.SecureContext instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.name='session_data'][callee.property.name='hasCap']",
|
||||
"message": "session_data.hasCap() is deprecated. Use session_data.capabilities.get() instead."
|
||||
},
|
||||
{
|
||||
"selector": "CallExpression[callee.type='MemberExpression'][callee.object.type='MemberExpression'][callee.object.property.name='session_data'][callee.property.name='hasCap']",
|
||||
"message": "session_data.hasCap() is deprecated. Use session_data.capabilities.get() instead."
|
||||
},
|
||||
{
|
||||
"selector": "BinaryExpression[operator='==='][left.type='Literal'][left.value=/^\\d+$/][left.typeof='number'][right.type='Identifier']",
|
||||
"message": "Comparing string literal that looks like a number with a variable using strict equality. Consider parseInt() or ensure both operands are the same type."
|
||||
},
|
||||
{
|
||||
"selector": "BinaryExpression[operator='==='][left.type='Identifier'][right.type='Literal'][right.value=/^\\d+$/][right.typeof='number']",
|
||||
"message": "Comparing variable with string literal that looks like a number using strict equality. Consider parseInt() or ensure both operands are the same type."
|
||||
},
|
||||
{
|
||||
"selector": "BinaryExpression[operator='==='][left.type='Literal'][left.typeof='string'][right.type='Literal'][right.typeof='number']",
|
||||
"message": "Comparing string literal with number literal using strict equality. This will always be false."
|
||||
},
|
||||
{
|
||||
"selector": "BinaryExpression[operator='==='][left.type='Literal'][left.typeof='number'][right.type='Literal'][right.typeof='string']",
|
||||
"message": "Comparing number literal with string literal using strict equality. This will always be false."
|
||||
},
|
||||
{
|
||||
"selector": "BinaryExpression[operator='!=='][left.type='Literal'][left.typeof='string'][right.type='Literal'][right.typeof='number']",
|
||||
"message": "Comparing string literal with number literal using strict inequality. This will always be true."
|
||||
},
|
||||
{
|
||||
"selector": "BinaryExpression[operator='!=='][left.type='Literal'][left.typeof='number'][right.type='Literal'][right.typeof='string']",
|
||||
"message": "Comparing number literal with string literal using strict inequality. This will always be true."
|
||||
}
|
||||
]
|
||||
},
|
||||
"globals": {
|
||||
"wtvmime": "readonly",
|
||||
"http": "readonly",
|
||||
"https": "readonly",
|
||||
"sharp": "readonly",
|
||||
"util": "readonly",
|
||||
"nunjucks": "readonly",
|
||||
"URL": "readonly",
|
||||
"URLSearchParams": "readonly",
|
||||
"wtvshared": "readonly",
|
||||
"zlib": "readonly",
|
||||
"clientShowAlert": "readonly",
|
||||
"WTVClientSessionData": "readonly",
|
||||
"WTVClientCapabilities": "readonly",
|
||||
"strftime": "readonly",
|
||||
"CryptoJS": "readonly",
|
||||
"crypto": "readonly",
|
||||
"fs": "readonly",
|
||||
"path": "readonly",
|
||||
"debug": "readonly",
|
||||
"minisrv_config": "readonly",
|
||||
"socket": "readonly",
|
||||
"headers": "readonly",
|
||||
"data": "readonly",
|
||||
"request_is_async": "readonly",
|
||||
"minisrv_version_string": "readonly",
|
||||
"getServiceString": "readonly",
|
||||
"sendToClient": "readonly",
|
||||
"service_vaults": "readonly",
|
||||
"service_deps": "readonly",
|
||||
"ssid_sessions": "readonly",
|
||||
"moveArrayKey": "readonly",
|
||||
"cwd": "readonly",
|
||||
"request_headers": "readonly",
|
||||
"session_data": "readonly",
|
||||
"service_name": "readonly",
|
||||
"WTVAuthor": "readonly"
|
||||
}
|
||||
}
|
||||
@@ -27,13 +27,11 @@ const WTVClientCapabilities = require(classPath + "/WTVClientCapabilities.js");
|
||||
const WTVClientSessionData = require(classPath + "/WTVClientSessionData.js");
|
||||
const WTVMime = require(classPath + "/WTVMime.js");
|
||||
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')('app');
|
||||
const express = require('express');
|
||||
|
||||
let wtvirc = null;
|
||||
let wtvnewsserver = null;
|
||||
|
||||
const minisrv_config = wtvshared.getMiniSrvConfig(); // snatches minisrv_config
|
||||
@@ -66,7 +64,7 @@ function getServiceByPort(port) {
|
||||
Object.keys(minisrv_config.services).forEach((k) => {
|
||||
if (service_name) return;
|
||||
if (minisrv_config.services[k].port) {
|
||||
if (port == parseInt(minisrv_config.services[k].port) && getServiceEnabled(k))
|
||||
if (port === parseInt(minisrv_config.services[k].port) && getServiceEnabled(k))
|
||||
service_name = k;
|
||||
}
|
||||
})
|
||||
@@ -78,7 +76,7 @@ function getServiceByVHost(vhost) {
|
||||
Object.keys(minisrv_config.services).forEach((k) => {
|
||||
if (service_name) return;
|
||||
if (minisrv_config.services[k].vhost) {
|
||||
if (vhost.toLowerCase() == minisrv_config.services[k].vhost.toLowerCase())
|
||||
if (vhost.toLowerCase() === minisrv_config.services[k].vhost.toLowerCase())
|
||||
service_name = k;
|
||||
}
|
||||
})
|
||||
@@ -130,8 +128,8 @@ function verifyServicePort(service_name, socket) {
|
||||
function getServiceByVaultDir(vault_dir) {
|
||||
let res = vault_dir;
|
||||
Object.keys(minisrv_config.services).forEach((k) => {
|
||||
if (res != vault_dir) return;
|
||||
if (minisrv_config.services[k].servicevault_dir) {
|
||||
if (res !== vault_dir) return;
|
||||
if (minisrv_config.services[k].servicevault_dir) {
|
||||
if (minisrv_config.services[k].servicevault_dir === vault_dir) {
|
||||
res = k;
|
||||
return false;
|
||||
@@ -161,20 +159,20 @@ function configureService(service_name, service_obj, initial = false) {
|
||||
// minisrv_config service toString
|
||||
service_obj.toString = function (overrides) {
|
||||
const self = Object.assign({}, this);
|
||||
if (overrides != null) {
|
||||
if (typeof (overrides) == 'object') {
|
||||
if (overrides !== null) {
|
||||
if (typeof (overrides) === 'object') {
|
||||
Object.keys(overrides).forEach(function (k) {
|
||||
if (k != "exceptions") self[k] = overrides[k];
|
||||
if (k !== "exceptions") self[k] = overrides[k];
|
||||
});
|
||||
}
|
||||
}
|
||||
let outstr = '';
|
||||
if ((service_name == "wtv-star" && self.no_star_word != true) || service_name != "wtv-star") {
|
||||
if ((service_name === "wtv-star" && self.no_star_word !== true) || service_name !== "wtv-star") {
|
||||
outstr = `wtv-service: name=${self.service_name} host=${self.host} port=${self.port}`;
|
||||
if (self.flags) outstr += ` flags=${self.flags}`;
|
||||
if (self.connections) outstr += ` connections=${self.connections}`;
|
||||
}
|
||||
if (service_name == "wtv-star") {
|
||||
if (service_name === "wtv-star") {
|
||||
outstr += `\nwtv-service: name=wtv-* host=${self.host} port=${self.port}`;
|
||||
if (self.flags) outstr += ` flags=${self.flags}`;
|
||||
if (self.connections) outstr += ` connections=${self.connections}`;
|
||||
@@ -357,7 +355,6 @@ const runScriptInVM = function (script_data, user_contextObj = {}, privileged =
|
||||
console.error(" *!* Could not load module", module_file, "requested by service", contextObj.service_name, e)
|
||||
}
|
||||
if (vm_modules[k] === "WTVNews") contextObj['wtvnewsserver'] = wtvnewsserver;
|
||||
if (vm_modules[k] === "WTVIRC") contextObj['wtvirc'] = wtvirc;
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -420,7 +417,7 @@ async function handleCGI(executable, cgi_file, socket, request_headers, vault, s
|
||||
const split_req = request_headers.request.split(' ');
|
||||
request_data.method = split_req[0];
|
||||
let request_type = (request_headers.request_url.indexOf(":/")) ? request_headers.request_url.split(":/")[0] : 'http';
|
||||
if (request_type != "http" && request_type != "https") {
|
||||
if (request_type !== "http" && request_type !== "https") {
|
||||
request_type = "wtvp";
|
||||
request_data.host = minisrv_config.config.service_ip;
|
||||
request_data.port = minisrv_config.services[service_name].port;
|
||||
@@ -467,14 +464,14 @@ async function handleCGI(executable, cgi_file, socket, request_headers, vault, s
|
||||
raw_header_split.forEach(function (header) {
|
||||
if (header) {
|
||||
header = header.split(": ");
|
||||
if (header[0] == "Request") return;
|
||||
if (header[0] === "Request") return;
|
||||
if (header[1]) {
|
||||
env["HTTP_"+header[0].toUpperCase().replaceAll("-","_")] = header[1];
|
||||
}
|
||||
}
|
||||
});
|
||||
env.SCRIPT_URI = request_type + "://" + request_data.host;
|
||||
if (request_data.port != 80 && request_data.port != 443 ) env.SCRIPT_URI += ":" + request_data.port;
|
||||
if (request_data.port !== 80 && request_data.port !== 443) env.SCRIPT_URI += ":" + request_data.port;
|
||||
env.SCRIPT_URI += env.SCRIPT_NAME;
|
||||
env.SCRIPT_URL = env.SCRIPT_NAME;
|
||||
env.PHP_SELF = env.SCRIPT_NAME;
|
||||
@@ -506,8 +503,8 @@ async function handleCGI(executable, cgi_file, socket, request_headers, vault, s
|
||||
options.gid = process.getgid();
|
||||
}
|
||||
|
||||
if (!minisrv_config.config.debug_flags.quiet) (executable == cgi_file) ? console.debug(" * Executing CGI:", executable) : console.debug(" * Executing CGI:", executable, cgi_file);
|
||||
const cgi = (executable == cgi_file) ? spawn(cgi_file, options=options) : spawn(executable, [cgi_file], options)
|
||||
if (!minisrv_config.config.debug_flags.quiet) (executable === cgi_file) ? console.debug(" * Executing CGI:", executable) : console.debug(" * Executing CGI:", executable, cgi_file);
|
||||
const cgi = (executable === cgi_file) ? spawn(cgi_file, options=options) : spawn(executable, [cgi_file], options)
|
||||
let data = "";
|
||||
let error = "";
|
||||
|
||||
@@ -523,7 +520,7 @@ async function handleCGI(executable, cgi_file, socket, request_headers, vault, s
|
||||
error += dat;
|
||||
});
|
||||
cgi.on('close', function (code) {
|
||||
if (code == 0) {
|
||||
if (code === 0) {
|
||||
const stdout = data.split("\r\n\r\n", 2);
|
||||
let headers = stdout[0];
|
||||
data = stdout[1];
|
||||
@@ -622,7 +619,7 @@ async function processPath(socket, service_vault_file_path, request_headers = []
|
||||
if (minisrv_config.services[service_name]) minisrv_catchall = minisrv_config.services[service_name].catchall_file_name || minisrv_config.config.catchall_file_name || null;
|
||||
else minisrv_catchall = minisrv_config.config.catchall_file_name || null;
|
||||
if (minisrv_catchall) {
|
||||
if (service_path_request_file == minisrv_catchall) {
|
||||
if (service_path_request_file === minisrv_catchall) {
|
||||
request_is_async = true;
|
||||
const errpage = wtvshared.doErrorPage(401, null, null, pc_services);
|
||||
sendToClient(socket, errpage[0], errpage[1]);
|
||||
@@ -726,7 +723,7 @@ async function processPath(socket, service_vault_file_path, request_headers = []
|
||||
service_vault_found = true;
|
||||
handlePHP(socket, request_headers, service_vault_file_path, service_vault_dir + path.sep + service_name, (pc_services) ? pc_service_name : service_name, (pc_services) ? null : ssid_sessions[socket.ssid], extra_path)
|
||||
return;
|
||||
} else if (service_vault_dir == vaults_to_scan[vaults_to_scan.length - 1]) {
|
||||
} else if (service_vault_dir === vaults_to_scan[vaults_to_scan.length - 1]) {
|
||||
const errpage = wtvshared.doErrorPage(404, null, null, pc_services);
|
||||
sendToClient(socket, errpage[0], errpage[1]);
|
||||
return;
|
||||
@@ -754,7 +751,7 @@ async function processPath(socket, service_vault_file_path, request_headers = []
|
||||
service_vault_found = true;
|
||||
handleCGI(service_vault_file_path, service_vault_file_path, socket, request_headers, service_vault_dir + path.sep + service_name, (pc_services) ? pc_service_name : service_name, (pc_services) ? null : ssid_sessions[socket.ssid], extra_path)
|
||||
return;
|
||||
} else if (service_vault_dir == vaults_to_scan[vaults_to_scan.length - 1]) {
|
||||
} else if (service_vault_dir === vaults_to_scan[vaults_to_scan.length - 1]) {
|
||||
const errpage = wtvshared.doErrorPage(404, null, null, pc_services);
|
||||
sendToClient(socket, errpage[0], errpage[1]);
|
||||
return;
|
||||
@@ -785,13 +782,13 @@ async function processPath(socket, service_vault_file_path, request_headers = []
|
||||
request_headers.service_file_path = service_vault_file_path;
|
||||
request_headers.raw_file = true;
|
||||
// process flashroms
|
||||
if (wtvshared.getFileExt(service_vault_file_path).toLowerCase() == "rom" || wtvshared.getFileExt(service_vault_file_path).toLowerCase() == "brom") {
|
||||
if (wtvshared.getFileExt(service_vault_file_path).toLowerCase() === "rom" || wtvshared.getFileExt(service_vault_file_path).toLowerCase() === "brom") {
|
||||
let bf0app_update = false;
|
||||
const request_path = request_headers.request_url.replace(service_name + ":/", "");
|
||||
const romtype = ssid_sessions[socket.ssid].get("wtv-client-rom-type");
|
||||
const bootver = ssid_sessions[socket.ssid].get("wtv-client-bootrom-version")
|
||||
|
||||
if ((romtype == "bf0app" || !romtype) && (bootver == "105" || !bootver)) {
|
||||
if ((romtype === "bf0app" || !romtype) && (bootver === "105" || !bootver)) {
|
||||
// assume old classic in flash mode, override user setting and send tellyscript
|
||||
// because it is required to proceed in flash mode
|
||||
bf0app_update = true;
|
||||
@@ -807,8 +804,8 @@ async function processPath(socket, service_vault_file_path, request_headers = []
|
||||
});
|
||||
|
||||
// service parsed files, we might not want to expose our service source files so we can protect them with a flag on the first line
|
||||
} else if (wtvshared.getFileExt(service_vault_file_path).toLowerCase() == "js" || wtvshared.getFileExt(service_vault_file_path).toLowerCase() == "txt") {
|
||||
if (wtvshared.getFileExt(service_vault_file_path).toLowerCase() == "js") {
|
||||
} else if (wtvshared.getFileExt(service_vault_file_path).toLowerCase() === "js" || wtvshared.getFileExt(service_vault_file_path).toLowerCase() === "txt") {
|
||||
if (wtvshared.getFileExt(service_vault_file_path).toLowerCase() === "js") {
|
||||
wtvshared.getLineFromFile(service_vault_file_path, 0, function (status, line) {
|
||||
if (!status) {
|
||||
if (line.match(/minisrv\_service\_file.*true/i)) {
|
||||
@@ -828,7 +825,7 @@ async function processPath(socket, service_vault_file_path, request_headers = []
|
||||
});
|
||||
}
|
||||
|
||||
if (wtvshared.getFileExt(service_vault_file_path).toLowerCase() == "txt") {
|
||||
if (wtvshared.getFileExt(service_vault_file_path).toLowerCase() === "txt") {
|
||||
wtvshared.getLineFromFile(service_vault_file_path, 0, function (status, line) {
|
||||
if (!status) {
|
||||
if (line.match(/^#!minisrv/i)) {
|
||||
@@ -860,7 +857,7 @@ async function processPath(socket, service_vault_file_path, request_headers = []
|
||||
const service_check_dir = service_vault_file_path.split(path.sep);
|
||||
service_check_dir.pop(); // pop filename
|
||||
|
||||
while (service_check_dir.join(path.sep) != service_vault_dir && service_check_dir.length > 0) {
|
||||
while (service_check_dir.join(path.sep) !== service_vault_dir && service_check_dir.length > 0) {
|
||||
const catchall_file = service_check_dir.join(path.sep) + path.sep + minisrv_catchall_file_name;
|
||||
if (fs.existsSync(catchall_file)) {
|
||||
|
||||
@@ -948,7 +945,7 @@ async function processPath(socket, service_vault_file_path, request_headers = []
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
if (headers == null && !request_is_async) {
|
||||
if (headers === null && !request_is_async) {
|
||||
const errpage = wtvshared.doErrorPage(400, null, null, pc_services);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
@@ -1048,7 +1045,7 @@ async function processURL(socket, request_headers, pc_services = false) {
|
||||
}
|
||||
} else {
|
||||
const qraw_split = post_data_string.split("=");
|
||||
if (qraw_split.length == 2) {
|
||||
if (qraw_split.length === 2) {
|
||||
const k = qraw_split[0];
|
||||
data = decodeURIComponent(qraw_split[1].replace(/\+/g, "%20"));
|
||||
if (request_headers.query[k]) {
|
||||
@@ -1131,21 +1128,21 @@ minisrv-no-mail-count: true`;
|
||||
|
||||
if (pc_services) {
|
||||
const ssl = (socket.ssl) ? true : false;
|
||||
if (original_service_name == service_name) console.log(" * " + ((ssl) ? "SSL " : "") + "PC request on service " + service_name + " for " + request_headers.request_url, 'on', socket.id);
|
||||
if (original_service_name === service_name) console.log(" * " + ((ssl) ? "SSL " : "") + "PC request on service " + service_name + " for " + request_headers.request_url, 'on', socket.id);
|
||||
else console.log(" * " + ((ssl) ? "SSL " : "") + "PC request on service " + original_service_name + " (Service Vault " + service_name + ") for " + request_headers.request_url, 'on', socket.id);
|
||||
}
|
||||
|
||||
if ((shortURL.includes(':/')) && (!shortURL.includes('://') || (shortURL.includes('://') && allow_double_slash))) {
|
||||
let ssid = socket.ssid;
|
||||
if (ssid == null) {
|
||||
if (ssid === null) {
|
||||
// prevent possible injection attacks via malformed SSID and filesystem SessionStore
|
||||
ssid = wtvshared.makeSafeSSID(request_headers["wtv-client-serial-number"]);
|
||||
if (ssid == "") ssid = null;
|
||||
if (ssid === "") ssid = null;
|
||||
}
|
||||
if (!pc_services) {
|
||||
let reqverb = "Request";
|
||||
if (request_headers.encrypted || request_headers.secure) reqverb = "Encrypted " + reqverb;
|
||||
if (ssid != null) {
|
||||
if (ssid !== null) {
|
||||
console.log(" * " + reqverb + " for " + request_headers.request_url + " from WebTV SSID " + (await wtvshared.filterSSID(ssid)), 'on', socket.id);
|
||||
} else {
|
||||
console.log(" * " + reqverb + " for " + request_headers.request_url, 'on', socket.id);
|
||||
@@ -1153,7 +1150,7 @@ minisrv-no-mail-count: true`;
|
||||
|
||||
if (!service_name) {
|
||||
// detect if client is trying to load wtv-star due to client-perceived error
|
||||
if (getSocketDestinationPort(socket) == getPortByService("wtv-star")) {
|
||||
if (getSocketDestinationPort(socket) === getPortByService("wtv-star")) {
|
||||
// is wtv-star
|
||||
if (minisrv_config.config.debug_flags.debug) console.debug(" * client requested", shortURL, "on wtv-star port", getSocketDestinationPort(socket))
|
||||
shortURL = "wtv-star:/star";
|
||||
@@ -1190,7 +1187,7 @@ minisrv-no-mail-count: true`;
|
||||
processPath(socket, urlToPath, request_headers, service_name, shared_romcache, pc_services);
|
||||
} else if (pc_services) {
|
||||
// if a directory, request index
|
||||
if (shortURL.indexOf("/ROMCache/") == 0 && minisrv_config.config.enable_shared_romcache) {
|
||||
if (shortURL.indexOf("/ROMCache/") === 0 && minisrv_config.config.enable_shared_romcache) {
|
||||
shared_romcache = wtvshared.fixPathSlashes(minisrv_config.config.SharedROMCache + path.sep + shortURL.split('/')[1] + '/' + shortURL.split('/')[2]);
|
||||
}
|
||||
if (shortURL.endsWith("/")) shortURL += "index";
|
||||
@@ -1380,7 +1377,7 @@ async function doHTTPProxy(socket, request_headers) {
|
||||
}
|
||||
|
||||
// RFC7239
|
||||
if (socket.remoteAddress != "127.0.0.1") {
|
||||
if (socket.remoteAddress !== "127.0.0.1") {
|
||||
options.headers["X-Forwarded-For"] = socket.remoteAddress;
|
||||
}
|
||||
|
||||
@@ -1446,7 +1443,7 @@ async function doHTTPProxy(socket, request_headers) {
|
||||
});
|
||||
}).on('error', function (err) {
|
||||
// severe errors, such as unable to connect.
|
||||
if (err.code == "ENOTFOUND" || err.message.indexOf("HostUnreachable") > 0) {
|
||||
if (err.code === "ENOTFOUND" || err.message.indexOf("HostUnreachable") > 0) {
|
||||
const errpage = wtvshared.doErrorPage(400, `The publisher <b>${request_data.host}</b> is unknown.`);
|
||||
sendToClient(socket, errpage[0], errpage[1]);
|
||||
} else {
|
||||
@@ -1484,7 +1481,7 @@ async function sendToClient(socket, headers_obj, data = null) {
|
||||
}
|
||||
if (!socket.res) {
|
||||
wtv_connection_close = (headers_obj["wtv-connection-close"]) ? true : false;
|
||||
if (typeof (headers_obj["wtv-connection-close"]) != 'undefined') delete headers_obj["wtv-connection-close"];
|
||||
if (typeof (headers_obj["wtv-connection-close"]) !== 'undefined') delete headers_obj["wtv-connection-close"];
|
||||
|
||||
if (!headers_obj['minisrv-no-mail-count']) {
|
||||
if (ssid_sessions[socket.ssid]) {
|
||||
@@ -1527,7 +1524,7 @@ async function sendToClient(socket, headers_obj, data = null) {
|
||||
// WebTV client
|
||||
headers_obj[contype_key] = headers_obj[contype_key].split(";")[0];
|
||||
}
|
||||
if (contype_key != "Content-type") {
|
||||
if (contype_key !== "Content-type") {
|
||||
headers_obj["Content-type"] = headers_obj[contype_key];
|
||||
delete headers_obj[contype_key];
|
||||
}
|
||||
@@ -1576,7 +1573,7 @@ async function sendToClient(socket, headers_obj, data = null) {
|
||||
if (content_length >= 256) compression_type = wtvmime.shouldWeCompress(ssid_sessions[socket.ssid], headers_obj);
|
||||
if (socket_sessions[socket.id].request_headers) {
|
||||
if (socket_sessions[socket.id].request_headers.query) {
|
||||
if (socket_sessions[socket.id].wtv_request_type == "download") {
|
||||
if (socket_sessions[socket.id].wtv_request_type === "download") {
|
||||
if (socket_sessions[socket.id].request_headers.query.dont_compress) {
|
||||
compression_type = 0;
|
||||
}
|
||||
@@ -1595,7 +1592,7 @@ async function sendToClient(socket, headers_obj, data = null) {
|
||||
}
|
||||
|
||||
if (socket.res) { // pc mode with response object available
|
||||
if (compression_type == 1) compression_type = 2; // wtv-lzpf not supported in pc mode
|
||||
if (compression_type === 1) compression_type = 2; // wtv-lzpf not supported in pc mode
|
||||
}
|
||||
|
||||
// compress if needed
|
||||
@@ -1619,7 +1616,7 @@ async function sendToClient(socket, headers_obj, data = null) {
|
||||
}
|
||||
|
||||
let compressed_content_length = 0;
|
||||
if (content_length == 0 || compression_type != 1) {
|
||||
if (content_length === 0 || compression_type !== 1) {
|
||||
// ultimately send compressed content length
|
||||
compressed_content_length = data.byteLength;
|
||||
content_length = compressed_content_length;
|
||||
@@ -1629,12 +1626,12 @@ async function sendToClient(socket, headers_obj, data = null) {
|
||||
}
|
||||
const compression_ratio = (uncompressed_content_length / compressed_content_length).toFixed(2);
|
||||
const compression_percentage = ((1 - (compressed_content_length / uncompressed_content_length)) * 100).toFixed(1);
|
||||
if (uncompressed_content_length != compressed_content_length) if (minisrv_config.config.debug_flags.debug) console.debug(" # Compression stats: Orig Size:", uncompressed_content_length, "~ Comp Size:", compressed_content_length, "~ Ratio:", compression_ratio, "~ Saved:", compression_percentage.toString() + "%");
|
||||
if (uncompressed_content_length !== compressed_content_length) if (minisrv_config.config.debug_flags.debug) console.debug(" # Compression stats: Orig Size:", uncompressed_content_length, "~ Comp Size:", compressed_content_length, "~ Ratio:", compression_ratio, "~ Saved:", compression_percentage.toString() + "%");
|
||||
}
|
||||
|
||||
if (!socket.res) {
|
||||
// encrypt if needed
|
||||
if (socket_sessions[socket.id].secure == true && !socket_sessions[socket.id].do_not_encrypt) {
|
||||
if (socket_sessions[socket.id].secure === true && !socket_sessions[socket.id].do_not_encrypt) {
|
||||
headers_obj["wtv-encrypted"] = 'true';
|
||||
headers_obj = wtvshared.moveObjectKey('wtv-encrypted', 'Connection', headers_obj);
|
||||
if (content_length > 0 && socket_sessions[socket.id].wtvsec) {
|
||||
@@ -1719,7 +1716,7 @@ async function sendToClient(socket, headers_obj, data = null) {
|
||||
else debug(" * ["+socket.remoteAddress+"] Outgoing Status "+headers_obj.Status+" headers on socket ID", socket.id, headers_obj);
|
||||
|
||||
Object.keys(headers_obj).forEach(function (k) {
|
||||
if (k == "Status") {
|
||||
if (k === "Status") {
|
||||
headers += headers_obj[k] + eol;
|
||||
} else {
|
||||
if (typeof headers_obj[k] === 'object') {
|
||||
@@ -1733,7 +1730,7 @@ async function sendToClient(socket, headers_obj, data = null) {
|
||||
});
|
||||
|
||||
if (headers_obj["Connection"]) {
|
||||
if (headers_obj["Connection"].toLowerCase() == "close" && wtv_connection_close) {
|
||||
if (headers_obj["Connection"].toLowerCase() === "close" && wtv_connection_close) {
|
||||
socket_sessions[socket.id].destroy_me = true;
|
||||
}
|
||||
}
|
||||
@@ -1757,12 +1754,12 @@ async function sendToClient(socket, headers_obj, data = null) {
|
||||
if (minisrv_config.config.debug_flags.quiet) console.debug(" * Sent response " + headers_obj.Status + " to PC client (Content-Type:", headers_obj['Content-type'], "~", headers_obj['Content-length'], "bytes)");
|
||||
} else {
|
||||
let toClient = null;
|
||||
if (typeof data == 'string') {
|
||||
if (typeof data === 'string') {
|
||||
toClient = headers + eol + data;
|
||||
sendToSocket(socket, Buffer.from(toClient));
|
||||
} else if (typeof data === 'object') {
|
||||
let verbosity_mod = (headers_obj["wtv-encrypted"] == 'true') ? " encrypted response" : "";
|
||||
if (socket_sessions[socket.id].secure_headers == true) {
|
||||
let verbosity_mod = (headers_obj["wtv-encrypted"] === 'true') ? " encrypted response" : "";
|
||||
if (socket_sessions[socket.id].secure_headers === true) {
|
||||
// encrypt headers
|
||||
if (minisrv_config.config.debug_flags.quiet) verbosity_mod += " with encrypted headers";
|
||||
const enc_headers = socket_sessions[socket.id].wtvsec.Encrypt(1, headers + eol);
|
||||
@@ -1780,9 +1777,9 @@ async function sendToSocket(socket, data) {
|
||||
let can_write = true;
|
||||
let close_socket = false;
|
||||
let expected_data_out = 0;
|
||||
while ((socket.bytesWritten == 0 || socket.bytesWritten != expected_data_out) && can_write) {
|
||||
while ((socket.bytesWritten === 0 || socket.bytesWritten !== expected_data_out) && can_write) {
|
||||
if (expected_data_out === 0) expected_data_out = data.byteLength + (socket_sessions[socket.id].socket_total_written || 0);
|
||||
if (socket.bytesWritten == expected_data_out) break;
|
||||
if (socket.bytesWritten === expected_data_out) break;
|
||||
|
||||
const data_left = (expected_data_out - socket.bytesWritten);
|
||||
// buffer size = lesser of chunk_size or size remaining
|
||||
@@ -1803,7 +1800,7 @@ async function sendToSocket(socket, data) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (socket.bytesWritten == expected_data_out || close_socket) {
|
||||
if (socket.bytesWritten === expected_data_out || close_socket) {
|
||||
socket_sessions[socket.id].socket_total_written = socket.bytesWritten;
|
||||
if (socket_sessions[socket.id].expecting_post_data) delete socket_sessions[socket.id].expecting_post_data;
|
||||
if (socket_sessions[socket.id].header_buffer) delete socket_sessions[socket.id].header_buffer;
|
||||
@@ -1851,7 +1848,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
}
|
||||
let data = Buffer.from(data_hex, 'hex').toString('ascii');
|
||||
if (typeof data === "string") {
|
||||
if ((data.includes("\r\n\r\n") || data.includes("\n\n") || data.includes("\n\r\n")) && typeof socket_sessions[socket.id].post_data == "undefined") {
|
||||
if ((data.includes("\r\n\r\n") || data.includes("\n\n") || data.includes("\n\r\n")) && typeof socket_sessions[socket.id].post_data === "undefined") {
|
||||
if (data.includes("\r\n\r\n")) {
|
||||
data = data.split("\r\n\r\n")[0];
|
||||
} else if (data.includes("\n\r\n")) {
|
||||
@@ -1861,7 +1858,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
data = data.split("\n\n")[0];
|
||||
}
|
||||
if (isUnencryptedString(data)) {
|
||||
if (headers.length != 0) {
|
||||
if (headers.length !== 0) {
|
||||
const new_header_obj = wtvshared.headerStringToObj(data);
|
||||
Object.keys(new_header_obj).forEach(function (k, v) {
|
||||
headers[k] = new_header_obj[k];
|
||||
@@ -1873,7 +1870,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
// if its a POST request, assume its a binary blob and not encrypted (dangerous)
|
||||
if (!encryptedRequest) {
|
||||
// its not a POST and it failed the isUnencryptedString test, so we think this is an encrypted blob
|
||||
if (socket_sessions[socket.id].secure != true) {
|
||||
if (socket_sessions[socket.id].secure !== true) {
|
||||
// first time so reroll sessions
|
||||
socket_sessions[socket.id].wtvsec = new WTVSec(minisrv_config);
|
||||
socket_sessions[socket.id].wtvsec.IssueChallenge();
|
||||
@@ -1902,7 +1899,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
|
||||
if (!headers) return;
|
||||
|
||||
if (headers["wtv-client-serial-number"] != null && socket.ssid == null) {
|
||||
if (headers["wtv-client-serial-number"] !== null && socket.ssid === null) {
|
||||
socket.ssid = wtvshared.makeSafeSSID(headers["wtv-client-serial-number"]);
|
||||
if (minisrv_config.config.require_valid_ssid) {
|
||||
if (!wtvshared.checkSSID(socket.ssid)) {
|
||||
@@ -1915,7 +1912,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
}
|
||||
}
|
||||
}
|
||||
if (socket.ssid != null) {
|
||||
if (socket.ssid !== null) {
|
||||
if (!ssid_sessions[socket.ssid]) {
|
||||
ssid_sessions[socket.ssid] = new WTVClientSessionData(minisrv_config, socket.ssid);
|
||||
ssid_sessions[socket.ssid].SaveIfRegistered();
|
||||
@@ -1930,7 +1927,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
if (!ssid_sessions[socket.ssid].getClientAddress()) ssid_sessions[socket.ssid].setClientAddress(socket.remoteAddress);
|
||||
if (ssid_sessions[socket.ssid]) ssid_sessions[socket.ssid].checkSecurity();
|
||||
|
||||
if (headers["wtv-capability-flags"] != null) {
|
||||
if (headers["wtv-capability-flags"] !== null) {
|
||||
if (!ssid_sessions[socket.ssid]) {
|
||||
ssid_sessions[socket.ssid] = new WTVClientSessionData(minisrv_config, socket.ssid);
|
||||
ssid_sessions[socket.ssid].SaveIfRegistered();
|
||||
@@ -1957,21 +1954,21 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
if (headers["wtv-incarnation"]) ssid_sessions[socket.ssid].data_store.wtvsec_login.set_incarnation(headers["wtv-incarnation"]);
|
||||
ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_b64 = headers["wtv-ticket"];
|
||||
ssid_sessions[socket.ssid].data_store.wtvsec_login.DecodeTicket(ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_b64);
|
||||
if (ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_store.user_id != null) {
|
||||
if (ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_store.user_id !== null) {
|
||||
if (ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_store.user_id >= 0) {
|
||||
ssid_sessions[socket.ssid].switchUserID(ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_store.user_id, true, false);
|
||||
ssid_sessions[socket.ssid].setUserLoggedIn(true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_b64 != headers["wtv-ticket"]) {
|
||||
if (ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_b64 !== headers["wtv-ticket"]) {
|
||||
if (!ssid_sessions[socket.ssid].data_store.wtvsec_login.update_ticket) {
|
||||
if (minisrv_config.config.debug_flags.debug) console.debug(" # New ticket from client");
|
||||
ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_b64 = headers["wtv-ticket"];
|
||||
ssid_sessions[socket.ssid].data_store.wtvsec_login.DecodeTicket(ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_b64);
|
||||
if (headers["wtv-incarnation"]) ssid_sessions[socket.ssid].data_store.wtvsec_login.set_incarnation(headers["wtv-incarnation"]);
|
||||
if (ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_store.user_id >= 0) {
|
||||
if (ssid_sessions[socket.ssid].user_id != ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_store.user_id) {
|
||||
if (ssid_sessions[socket.ssid].user_id !== ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_store.user_id) {
|
||||
ssid_sessions[socket.ssid].switchUserID(ssid_sessions[socket.ssid].data_store.wtvsec_login.ticket_store.user_id, true, false);
|
||||
ssid_sessions[socket.ssid].setUserLoggedIn(true);
|
||||
}
|
||||
@@ -1995,7 +1992,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
socket_sessions[socket.id].wtvsec.ticket_b64 = headers["wtv-ticket"];
|
||||
socket_sessions[socket.id].wtvsec.SecureOn();
|
||||
}
|
||||
if (socket_sessions[socket.id].secure != true) {
|
||||
if (socket_sessions[socket.id].secure !== true) {
|
||||
// first time so reroll sessions
|
||||
socket_sessions[socket.id].secure = true;
|
||||
}
|
||||
@@ -2016,7 +2013,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
socket_sessions[socket.id].secure_buffer += dec_data.toString(CryptoJS.enc.Hex);
|
||||
let secure_headers = null;
|
||||
if (headers['request']) {
|
||||
if (headers['request'] == "GET") {
|
||||
if (headers['request'] === "GET") {
|
||||
if (socket_sessions[socket.id].secure_buffer.indexOf("0d0a0d0a") || socket_sessions[socket.id].secure_buffer.indexOf("0a0d0a") ||socket_sessions[socket.id].secure_buffer.indexOf("0a0a")) {
|
||||
secure_headers = await processRequest(socket, socket_sessions[socket.id].secure_buffer, true, true);
|
||||
}
|
||||
@@ -2049,7 +2046,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
} else if (skipSecure) {
|
||||
if (headers) {
|
||||
if (headers['request']) {
|
||||
if (headers['request'].slice(0, 4) == "POST") {
|
||||
if (headers['request'].slice(0, 4) === "POST") {
|
||||
if (socket_sessions[socket.id].secure_buffer) delete socket_sessions[socket.id].secure_buffer;
|
||||
} else {
|
||||
return headers;
|
||||
@@ -2063,10 +2060,10 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
}
|
||||
// handle POST
|
||||
if (headers['request'] && !socket_sessions[socket.id].expecting_post_data) {
|
||||
if (headers['request'].slice(0, 4) == "POST") {
|
||||
if (headers['request'].slice(0, 4) === "POST") {
|
||||
let post_string = "POST";
|
||||
socket.setTimeout(minisrv_config.config.post_data_socket_timeout * 1000);
|
||||
if (typeof socket_sessions[socket.id].post_data == "undefined") {
|
||||
if (typeof socket_sessions[socket.id].post_data === "undefined") {
|
||||
if (socket_sessions[socket.id].post_data_percents_shown) delete socket_sessions[socket.id].post_data_percents_shown;
|
||||
socket_sessions[socket.id].post_data_length = parseInt(headers['Content-length'] || headers['Content-Length'] || 0);
|
||||
socket_sessions[socket.id].post_data = "";
|
||||
@@ -2084,7 +2081,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
}
|
||||
}
|
||||
|
||||
if (socket_sessions[socket.id].post_data.length == (socket_sessions[socket.id].post_data_length * 2)) {
|
||||
if (socket_sessions[socket.id].post_data.length === (socket_sessions[socket.id].post_data_length * 2)) {
|
||||
// got all expected data
|
||||
if (socket_sessions[socket.id].expecting_post_data) delete socket_sessions[socket.id].expecting_post_data;
|
||||
console.log(" * Incoming", post_string, "request on", socket.id, "from", wtvshared.filterSSID(socket.ssid), "to", headers['request_url'], "(got all expected", socket_sessions[socket.id].post_data_length, "bytes of data from client already)");
|
||||
@@ -2123,7 +2120,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
if (socket_sessions[socket.id].post_data_length > (minisrv_config.config.max_post_length * 1024 * 1024)) {
|
||||
cleanupSocket(socket);
|
||||
} else {
|
||||
if (headers.length == 0) {
|
||||
if (headers.length === 0) {
|
||||
headers = socket_sessions[socket.id].headers;
|
||||
} else {
|
||||
socket_sessions[socket.id].headers = headers;
|
||||
@@ -2142,7 +2139,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
socket_sessions[socket.id].post_data += dec_data.toString(CryptoJS.enc.Hex);
|
||||
|
||||
let post_string = "POST";
|
||||
if (socket_sessions[socket.id].secure == true) post_string = "Encrypted " + post_string;
|
||||
if (socket_sessions[socket.id].secure === true) post_string = "Encrypted " + post_string;
|
||||
|
||||
if (minisrv_config.config.post_debug) {
|
||||
// `post_debug` logging of every chunk
|
||||
@@ -2157,23 +2154,23 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
console.debug(" * Received", postPercent, "% of", socket_sessions[socket.id].post_data_length, "bytes on", socket.id, "from", wtvshared.filterSSID(socket.ssid));
|
||||
socket_sessions[socket.id].post_data_percents_shown[postPercent] = true;
|
||||
}
|
||||
if (postPercent == 100) delete socket_sessions[socket.id].post_data_percents_shown;
|
||||
if (postPercent === 100) delete socket_sessions[socket.id].post_data_percents_shown;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (socket_sessions[socket.id].post_data.length == (socket_sessions[socket.id].post_data_length * 2)) {
|
||||
}
|
||||
|
||||
if (socket_sessions[socket.id].post_data.length === (socket_sessions[socket.id].post_data_length * 2)) {
|
||||
// got all expected data
|
||||
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) {
|
||||
if (headers.length === 0) {
|
||||
const errpage = wtvshared.doErrorPage(400);
|
||||
sendToClient(socket, errpage[0], errpage[1]);
|
||||
return;
|
||||
}
|
||||
headers.post_data = CryptoJS.enc.Hex.parse(socket_sessions[socket.id].post_data);
|
||||
if (socket_sessions[socket.id].secure == true) {
|
||||
if (socket_sessions[socket.id].secure === true) {
|
||||
if (minisrv_config.config.debug_flags.debug) console.debug(" # Encrypted POST Content (SECURE ON)", "on", socket.id, "[", headers.post_data.sigBytes, "bytes ]");
|
||||
} else {
|
||||
if (minisrv_config.config.debug_flags.debug) console.debug(" # Unencrypted POST Content", "on", socket.id);
|
||||
@@ -2196,7 +2193,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
}
|
||||
} else if (!skipSecure) {
|
||||
if (!encryptedRequest) {
|
||||
if (socket_sessions[socket.id].secure != true) {
|
||||
if (socket_sessions[socket.id].secure !== true) {
|
||||
socket_sessions[socket.id].wtvsec = new WTVSec(minisrv_config);
|
||||
socket_sessions[socket.id].wtvsec.IssueChallenge();
|
||||
socket_sessions[socket.id].wtvsec.SecureOn();
|
||||
@@ -2220,7 +2217,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
socket_sessions[socket.id].secure_buffer += dec_data.toString(CryptoJS.enc.Hex);
|
||||
let secure_headers = null;
|
||||
if (headers['request']) {
|
||||
if (headers['request'] == "GET") {
|
||||
if (headers['request'] === "GET") {
|
||||
if (socket_sessions[socket.id].secure_buffer.indexOf("0d0a0d0a") || socket_sessions[socket.id].secure_buffer.indexOf("0a0d0a") || socket_sessions[socket.id].secure_buffer.indexOf("0a0a")) {
|
||||
secure_headers = await processRequest(socket, socket_sessions[socket.id].secure_buffer, true, true);
|
||||
}
|
||||
@@ -2238,7 +2235,7 @@ async function processRequest(socket, data_hex, skipSecure = false, encryptedReq
|
||||
headers[k] = secure_headers[k];
|
||||
});
|
||||
if (headers['request']) {
|
||||
if (headers['request'].slice(0, 4) == "POST") {
|
||||
if (headers['request'].slice(0, 4) === "POST") {
|
||||
if (!socket_sessions[socket.id].post_data) {
|
||||
socket_sessions[socket.id].post_data_length = headers['Content-length'] || headers['Content-Length'] || 0;
|
||||
socket_sessions[socket.id].post_data = "";
|
||||
@@ -2486,15 +2483,6 @@ Object.keys(minisrv_config.services).forEach(function (k) {
|
||||
|
||||
})
|
||||
|
||||
if (minisrv_config.config.irc) {
|
||||
if (minisrv_config.config.irc.enabled && minisrv_config.config.irc.port > 0) {
|
||||
if (!wtvirc) {
|
||||
wtvirc = new WTVIRC(minisrv_config, minisrv_config.config.bind_ip, minisrv_config.config.irc.port, minisrv_config.config.irc.debug || false);
|
||||
wtvirc.start();
|
||||
console.log(" * Configured Service: IRC Server on", minisrv_config.config.bind_ip + ":" + minisrv_config.config.irc.port);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (minisrv_config.config.hide_ssid_in_logs) console.log(" * Masking SSIDs in console logs for security");
|
||||
else console.log(" * Full SSIDs will be shown in console logs");
|
||||
|
||||
@@ -2703,8 +2691,8 @@ Content-type: text/html`;
|
||||
return false;
|
||||
});
|
||||
|
||||
if (bind_ports.length > 0) console.log(` * Started WTVP Server on port${bind_ports.length != 1 ? "s" : ""} ` + bind_ports.join(", ") + "...");
|
||||
if (pc_bind_ports.length > 0) console.log(` * Started HTTP Server on port${pc_bind_ports.length != 1 ? "s" : ""} ` + pc_bind_ports.join(", ") + "...");
|
||||
if (bind_ports.length > 0) console.log(` * Started WTVP Server on port${bind_ports.length !== 1 ? "s" : ""} ` + bind_ports.join(", ") + "...");
|
||||
if (pc_bind_ports.length > 0) console.log(` * Started HTTP Server on port${pc_bind_ports.length !== 1 ? "s" : ""} ` + pc_bind_ports.join(", ") + "...");
|
||||
|
||||
const listening_ip_string = (minisrv_config.config.bind_ip != "0.0.0.0") ? "IP: " + minisrv_config.config.bind_ip : "all interfaces";
|
||||
const listening_ip_string = (minisrv_config.config.bind_ip !== "0.0.0.0") ? "IP: " + minisrv_config.config.bind_ip : "all interfaces";
|
||||
console.log(" * Listening on", listening_ip_string, "~", "Service IP:", service_ip);
|
||||
@@ -73,7 +73,7 @@ const fileList = recursiveDirList(service_vault_dir);
|
||||
if (fileList.length > 0) {
|
||||
const diskmap = {};
|
||||
diskmap[group_name] = {};
|
||||
if (client_dest.slice(client_dest.length - 1, 1) != '/') client_dest += '/';
|
||||
if (client_dest.slice(client_dest.length - 1, 1) !== '/') client_dest += '/';
|
||||
diskmap[group_name].base = client_dest;
|
||||
diskmap[group_name].location = service_vault_subdir;
|
||||
diskmap[group_name].files = [];
|
||||
|
||||
@@ -25,7 +25,7 @@ class PBTemplate {
|
||||
<title>${title}</title>
|
||||
</head>
|
||||
<body vlink="#660000" link="#180d4b" bgcolor="#eeeeee" background="clipart/styleMedia/us_flag.gif">`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -34,7 +34,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ to return to editing it.
|
||||
this.styledata.text +
|
||||
`><b>${title}</b></font>
|
||||
</center>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class PBTemplate {
|
||||
</head>
|
||||
<body background="clipart/styleMedia/baseballfield.gif" text="#cccc99" link="#66ff66" vlink="#ccffcc">
|
||||
<center>`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -38,7 +38,7 @@ to return to editing it.
|
||||
<img src="clipart/styleMedia/baseball.gif" width="400" height="100" align="bottom">
|
||||
|
||||
</center><p>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ to return to editing it.
|
||||
this.styledata.text +
|
||||
`>${title}</font></H1></CENTER>`;
|
||||
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class PBTemplate {
|
||||
<title>${title}</title>
|
||||
</head>
|
||||
<body text="#7ac2d5" bgcolor="#11144c" link="#a5a033" vlink="#25a51f">`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -37,7 +37,7 @@ to return to editing it.
|
||||
<tbody><tr>
|
||||
<td>`;
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ to return to editing it.
|
||||
`>${title}</font></td>
|
||||
<td>`;
|
||||
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class PBTemplate {
|
||||
</head>
|
||||
<body vlink="#fa7474" text="#faf3ed" link="#fa9d46" background="clipart/styleMedia/tile5.gif">`;
|
||||
// Do some templating here for some fucking reason
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `
|
||||
<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
@@ -33,7 +33,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ to return to editing it.
|
||||
this.styledata.titheader += `
|
||||
${title}
|
||||
</font></h1></center>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class PBTemplate {
|
||||
<title>${title}</title>
|
||||
</head>
|
||||
<body bgcolor="#eeeeee">`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -34,13 +34,13 @@ to return to editing it.
|
||||
<tbody>`;
|
||||
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
this.styledata.titheader += `<center>
|
||||
<font size="7" color="#000000"><b>${title}</b></font></center>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,13 +50,13 @@ to return to editing it.
|
||||
</td>
|
||||
<td bgcolor="#464de3" >
|
||||
<center>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
this.styledata.titheader += `<b><font size="7" color="#e6e1e1">${title}</font></b></center>`;
|
||||
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ to return to editing it.
|
||||
<td><img src="clipart/styleMedia/so00483_.gif"></td>
|
||||
<td >
|
||||
<center>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -55,7 +55,7 @@ to return to editing it.
|
||||
this.styledata.text +
|
||||
`><b>${title}</b></font></center>`;
|
||||
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class PBTemplate {
|
||||
<title>${title}</title>
|
||||
</head>
|
||||
<body bgcolor="white" link="#180d4b" vlink="#660000" background="clipart/styleMedia/stars.gif">`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -35,7 +35,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ to return to editing it.
|
||||
this.styledata.text +
|
||||
`><b>${title}</b></font>`;
|
||||
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -61,13 +61,13 @@ to return to editing it.
|
||||
<td colspan=3 >
|
||||
<center>
|
||||
`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
this.styledata.titheader += `<font size="6" color="#000000"><b>${title}</b></font></center>`;
|
||||
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class PBTemplate {
|
||||
</head>
|
||||
<body background="clipart/styleMedia/tile9.gif" text="black" link="#09021e" vlink="#2f0001">
|
||||
<center>`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -32,7 +32,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ to return to editing it.
|
||||
<font size="+3" color=` +
|
||||
this.styledata.text +
|
||||
`><b>${title}</b></font>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class PBTemplate {
|
||||
</head>
|
||||
<body text="#ccffcc" bgcolor="#003300" link="#ffcc00" vlink="#ccb699">
|
||||
<center>`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -42,7 +42,7 @@ to return to editing it.
|
||||
</td>
|
||||
<td >
|
||||
<center>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -51,7 +51,7 @@ to return to editing it.
|
||||
<font size="6" color=` +
|
||||
this.styledata.text +
|
||||
`><b>${title}</b></font></center>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class PBTemplate {
|
||||
<title>${title}</title>
|
||||
</head>
|
||||
<BODY bgcolor=#ffffcc link=#006600 vlink=#660000>`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -34,13 +34,13 @@ to return to editing it.
|
||||
<TR>
|
||||
<TD><IMG src=clipart/Nature/Flowers/na00140_.gif width=253 height=273 align=left> </TD>
|
||||
<TD>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
this.styledata.titheader += `<FONT size=+3 color=#003300>${title}</FONT>`;
|
||||
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class PBTemplate {
|
||||
</head>
|
||||
<body background="clipart/styleMedia/footballfield.gif" text="#ffffcc" bgcolor="white" link="yellow" alink="#ccffcc" vlink="#ffcc99">
|
||||
<center>`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -35,7 +35,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = `<img src="clipart/styleMedia/football.gif" width="283" height="55" align="bottom"><p>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ to return to editing it.
|
||||
this.styledata.text +
|
||||
`>${title}</font></H1>`;
|
||||
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class PBTemplate {
|
||||
<title>${title}</title>
|
||||
</head>
|
||||
<body text="#97e373" bgcolor="#003300" link="#ccc63f" vlink="#22cc17">`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -38,7 +38,7 @@ to return to editing it.
|
||||
<td>`;
|
||||
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ to return to editing it.
|
||||
`>${title}</font></td>
|
||||
<td>`;
|
||||
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class PBTemplate {
|
||||
</head>
|
||||
<body text="#261373" link="blue" vlink="#2a6e73" background="clipart/styleMedia/tile6.gif">
|
||||
<center>`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -32,7 +32,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ to return to editing it.
|
||||
<font size="+3" color=` +
|
||||
this.styledata.text +
|
||||
`><b>${title}</b></font>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class PBTemplate {
|
||||
</head>
|
||||
<body bgcolor="silver" text="black" link="blue" alink="red" vlink="#ff00ff">
|
||||
<center>`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -32,7 +32,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ to return to editing it.
|
||||
<font size="+3" color=` +
|
||||
this.styledata.text +
|
||||
`><b>${title}</b></font>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -47,7 +47,7 @@ to return to editing it.
|
||||
<td><img height="150" width="150" src="clipart/Animations/j0205352.gif"></td>
|
||||
<td >
|
||||
<center>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -56,7 +56,7 @@ to return to editing it.
|
||||
this.styledata.text +
|
||||
`><b>${title}</b></font></center>`;
|
||||
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class PBTemplate {
|
||||
<title>${title}</title>
|
||||
</head>
|
||||
<BODY bgcolor="#c4dbff" link="#33309a">`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -34,13 +34,13 @@ to return to editing it.
|
||||
<TR>
|
||||
<TD><IMG src=clipart/styleMedia/AG00318_.gif align=left> </TD>
|
||||
<TD>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
this.styledata.titheader += `<FONT size=+3 color=#003300>${title}</FONT>`;
|
||||
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class PBTemplate {
|
||||
<title>${title}</title>
|
||||
</head>
|
||||
<BODY bgcolor="#deb1b1" link="#4c58b6" vlink="#519eb6">`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -34,13 +34,13 @@ to return to editing it.
|
||||
<TR>
|
||||
<TD><IMG src=clipart/styleMedia/AG00318_.gif align=left> </TD>
|
||||
<TD>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
this.styledata.titheader += `<FONT size=+3 color=#003300>${title}</FONT>`;
|
||||
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class PBTemplate {
|
||||
</head>
|
||||
<body text="#7eecf7" link="#c5c1ca" vlink="#b4c1fa" background="clipart/styleMedia/tile4.gif">
|
||||
<center>`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -32,7 +32,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ to return to editing it.
|
||||
<font size="+3" color=` +
|
||||
this.styledata.text +
|
||||
`><b><i>${title}</i></b></font>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class PBTemplate {
|
||||
</head>
|
||||
<body background="clipart/styleMedia/tile1.gif" text="#ffffa0" link="#fff81f" vlink="#ffa034">
|
||||
<center>`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -32,7 +32,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ to return to editing it.
|
||||
this.styledata.text +
|
||||
`>${title}</font>
|
||||
</H1></CENTER>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class PBTemplate {
|
||||
<title>${title}</title>
|
||||
</head>
|
||||
<body vlink="#CCFFFF" text="#FFFFFF" link="#00FFFF" bgcolor="#7189ae" background="clipart/styleMedia/oceantile.gif">`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -35,7 +35,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -47,7 +47,7 @@ to return to editing it.
|
||||
<td >
|
||||
<center>
|
||||
`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">`;
|
||||
}
|
||||
this.styledata.titheader +=
|
||||
@@ -56,7 +56,7 @@ to return to editing it.
|
||||
this.styledata.text +
|
||||
`><b>${title}</b></font></center>
|
||||
`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
this.styledata.titheader += `
|
||||
|
||||
@@ -23,7 +23,7 @@ class PBTemplate {
|
||||
</head>
|
||||
<body background="clipart/styleMedia/show-tile3.gif" text="#c8e7f1" link="#fffe67" vlink="#ff7171">
|
||||
<center>`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -32,7 +32,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ to return to editing it.
|
||||
<font size="+3" color=` +
|
||||
this.styledata.text +
|
||||
`><b>${title}</b></font>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class PBTemplate {
|
||||
<title>${title}</title>
|
||||
</head>
|
||||
<body text="#cabdc7" bgcolor="#660517" link="#cac534" vlink="#c8cac5">`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -38,7 +38,7 @@ to return to editing it.
|
||||
<td>`;
|
||||
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -48,7 +48,7 @@ to return to editing it.
|
||||
`>${title}</font></td>
|
||||
<td>`;
|
||||
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class PBTemplate {
|
||||
<title>${title}</title>
|
||||
</head>
|
||||
<body bgcolor="white" link="#180d4b" vlink="#660000" background="clipart/styleMedia/stars.gif">`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -35,7 +35,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -44,7 +44,7 @@ to return to editing it.
|
||||
this.styledata.text +
|
||||
`><b>${title}</b></font>`;
|
||||
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ class PBTemplate {
|
||||
<title>${title}</title>
|
||||
</head>
|
||||
<body text="black" link="#552768" bgcolor="white" vlink="#333333" background="clipart/styleMedia/ringbinder.gif">`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -37,13 +37,13 @@ to return to editing it.
|
||||
<TD >
|
||||
<CENTER>
|
||||
<FONT size=7>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
this.styledata.titheader +=
|
||||
`<font color=` + this.styledata.text + `><b>${title}</B>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class PBTemplate {
|
||||
</head>
|
||||
<body text="#e4ece6" link="#eceb9f" vlink="#e1903c" background="clipart/styleMedia/tile12.gif">
|
||||
<center>`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -32,7 +32,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ to return to editing it.
|
||||
<font size="+3" color=` +
|
||||
this.styledata.text +
|
||||
`><b>${title}</b></font>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class PBTemplate {
|
||||
</head>
|
||||
<body background="clipart/styleMedia/tile11.gif" link="#2a238c" vlink="#f17075">
|
||||
<center>`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -32,7 +32,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ to return to editing it.
|
||||
<font size="+3" color=` +
|
||||
this.styledata.text +
|
||||
`><b>${title}</b></font>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ class PBTemplate {
|
||||
<title>${title}</title>
|
||||
</head>
|
||||
<body vlink="#ffff99" text="#cccccc" link="#ffcc00" bgcolor="#333333" background="clipart/styleMedia/spacefield.gif">`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -30,7 +30,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -49,7 +49,7 @@ ${title}
|
||||
</tr>
|
||||
</tbody></table>
|
||||
</center>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class PBTemplate {
|
||||
</head>
|
||||
<body text="#ffffcc" bgcolor="white" link="#00ccff" vlink="#ccffff" background="clipart/styleMedia/stonesfield.gif">
|
||||
<center>`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -32,7 +32,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ to return to editing it.
|
||||
this.styledata.text +
|
||||
`><b><i>${title}</i></b></font>
|
||||
</center>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class PBTemplate {
|
||||
</head>
|
||||
<body background="clipart/styleMedia/tile3.gif" text="#cccccc" link="#50caca" vlink="#47ca92">
|
||||
<center>`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -32,7 +32,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -42,7 +42,7 @@ to return to editing it.
|
||||
this.styledata.text +
|
||||
`>${title}</font>
|
||||
</H1></CENTER>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class PBTemplate {
|
||||
</head>
|
||||
<body background="clipart/styleMedia/watertile.gif" text="white" link="aqua" alink="red" vlink="#ccffff">
|
||||
<center>`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -32,7 +32,7 @@ to return to editing it.
|
||||
</TABLE>`;
|
||||
}
|
||||
this.styledata.titheader = ``;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ to return to editing it.
|
||||
<font size="+3" color=` +
|
||||
this.styledata.text +
|
||||
`><b>${title}</b></font>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class PBTemplate {
|
||||
<title>${title}</title>
|
||||
</head>
|
||||
<body bgcolor="#97bfbb" text="#3f3a89" link="#6a298c" vlink="#6a298c">`;
|
||||
if (state == "previewing") {
|
||||
if (state === "previewing") {
|
||||
this.styledata.header += `<TABLE cellspacing=0 cellpadding=0 bgcolor=#1e4261 border=1 width=100%>
|
||||
<TR><TD valign=middle align=center><FONT color=#D1D1D1>
|
||||
You are previewing your page. Press <B>Back</B>
|
||||
@@ -40,13 +40,13 @@ to return to editing it.
|
||||
<td><img src="clipart/styleMedia/j0172489.gif" height="122" width="123"></td>
|
||||
<td >
|
||||
<center>`;
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `<a href="wtv-author:/edit-title?docName=${docName}&titleOnly=true">
|
||||
`;
|
||||
}
|
||||
this.styledata.titheader += `<FONT size=+3 color=#${this.styledata.text}><b>${title}</b></FONT></center>`;
|
||||
|
||||
if (state == "editing") {
|
||||
if (state === "editing") {
|
||||
this.styledata.titheader += `</a>`;
|
||||
}
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ the page's address.
|
||||
<form>
|
||||
<font color=ffcf69><shadow>
|
||||
<input type=button usestyle borderimage="file://ROM/Borders/ButtonBorder2.bif"`;
|
||||
if (request_headers.query.goBack == "true")
|
||||
if (request_headers.query.goBack === "true")
|
||||
data += "action=client:goback value=Done"
|
||||
else
|
||||
data += "action=Print value=Continue"
|
||||
|
||||
@@ -76,7 +76,7 @@ To add a new user now, choose this link:
|
||||
<form>
|
||||
<font color=ffcf69><shadow>
|
||||
<input type=button usestyle borderimage="file://ROM/Borders/ButtonBorder2.bif"`;
|
||||
if (request_headers.query.directLink == "true")
|
||||
if (request_headers.query.directLink === "true")
|
||||
data += "action=javascript:location=history.go(-1);"
|
||||
else
|
||||
data += "action=javascript:location=history.go(-2);"
|
||||
|
||||
@@ -64,7 +64,7 @@ Choose the first letter of the word you are looking for.
|
||||
data += `<td width=40>\n<a href="wtv-guide:/help?topic=Glossary&subtopic=${self.page_args.letters[k]}" selected><blackface>${self.page_args.letters[k]}</blackface></a>\n`
|
||||
i++;
|
||||
j++;
|
||||
if (i == 8 && self.page_args.letters.length != (j + 1)) {
|
||||
if (i === 8 && self.page_args.letters.length !== (j + 1)) {
|
||||
// add new <tr> every 8 entries, but only if its not the last entry
|
||||
i = 0;
|
||||
data += `<tr><td height=32>\n`;
|
||||
|
||||
@@ -63,11 +63,11 @@ Choose a word to see what it means.
|
||||
// test
|
||||
data += `<a href="wtv-guide:/help?topic=Glossary&subtopic=${self.page_args.letter}&page=${self.page_args.words[k].link}" selected>${self.page_args.words[k].word}</a><br>\n`
|
||||
words_rendered++;
|
||||
if (self.page_args.words.length % 2 != 0) {
|
||||
if (self.page_args.words.length % 2 !== 0) {
|
||||
// odd so split later to put extra on first row
|
||||
if (words_rendered - 1 == table_split) data += `<td>`;
|
||||
if (words_rendered - 1 === table_split) data += `<td>`;
|
||||
} else {
|
||||
if (words_rendered == table_split) data += `<td>`;
|
||||
if (words_rendered === table_split) data += `<td>`;
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ let site = "";
|
||||
if (minisrv_config.services['wtv-author'].public_domain) {
|
||||
site = minisrv_config.services['wtv-author'].public_domain;
|
||||
} else {
|
||||
if (minisrv_config.services['wtv-author'].publish_mode == "service") {
|
||||
if (minisrv_config.services['wtv-author'].publish_mode === "service") {
|
||||
const target_service = minisrv_config.services[minisrv_config.services['wtv-author'].publish_dest];
|
||||
if (target_service) {
|
||||
site = target_service.host + ":" + target_service.port;
|
||||
|
||||
@@ -9,7 +9,7 @@ if (auth === true) {
|
||||
const authheader = request_headers.authorization.split(' ');
|
||||
console.log(request_headers)
|
||||
|
||||
if (authheader[0] == "Basic") {
|
||||
if (authheader[0] === "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
password = password.split(':')[1];
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ if (auth === true) {
|
||||
const authheader = request_headers.authorization.split(' ');
|
||||
console.log(request_headers)
|
||||
|
||||
if (authheader[0] == "Basic") {
|
||||
if (authheader[0] === "Basic") {
|
||||
let password = Buffer.from(authheader[1], 'base64').toString();
|
||||
password = password.split(':')[1];
|
||||
}
|
||||
@@ -29,7 +29,7 @@ Content-Type: text/html`
|
||||
Welcome to the zefie minisrv v${minisrv_config.version} Account Administration
|
||||
</p>
|
||||
`;
|
||||
if (request_headers.query.cmd == "list") {
|
||||
if (request_headers.query.cmd === "list") {
|
||||
data += `<hr>`;
|
||||
if (request_headers.query.msg) {
|
||||
data += decodeURI(request_headers.query.msg) + "<hr>";
|
||||
@@ -41,7 +41,7 @@ Welcome to the zefie minisrv v${minisrv_config.version} Account Administration
|
||||
});
|
||||
data += `</table>`;
|
||||
|
||||
} else if (request_headers.query.cmd == "ssid") {
|
||||
} else if (request_headers.query.cmd === "ssid") {
|
||||
const ssid = request_headers.query.ssid;
|
||||
if (!ssid) {
|
||||
redirectmsg = `An SSID is required for the ${request_headers.query.cmd} command.`;
|
||||
@@ -78,7 +78,7 @@ function validateSelection(cmd, ssid, friendlymsg) {
|
||||
if (Object.keys(user_info.account_users).length > 1) {
|
||||
data += `<tr><td style="vertical-align: top">Additional Users:</td><td>`;
|
||||
Object.keys(user_info.account_users).forEach(function (k) {
|
||||
if (k == "subscriber") return;
|
||||
if (k === "subscriber") return;
|
||||
data += user_info.account_users[k].subscriber_username + "<br>";
|
||||
})
|
||||
data += `</td></tr>`
|
||||
@@ -91,7 +91,7 @@ function validateSelection(cmd, ssid, friendlymsg) {
|
||||
data += "The SSID does not exist in the SessionStore."
|
||||
}
|
||||
}
|
||||
} else if (request_headers.query.cmd == "delete") {
|
||||
} else if (request_headers.query.cmd === "delete") {
|
||||
redirectmsg = "";
|
||||
const ssid = request_headers.query.ssid;
|
||||
if (ssid) {
|
||||
@@ -102,7 +102,7 @@ function validateSelection(cmd, ssid, friendlymsg) {
|
||||
redirectmsg = `An SSID is required for the ${request_headers.query.cmd} command.`;
|
||||
}
|
||||
headers = "302 OK\nLocation: /admin/?cmd=list&msg=" + encodeURI(redirectmsg);
|
||||
} else if (request_headers.query.cmd == "ban") {
|
||||
} else if (request_headers.query.cmd === "ban") {
|
||||
redirectmsg = "";
|
||||
const ssid = request_headers.query.ssid;
|
||||
if (ssid) {
|
||||
@@ -110,7 +110,7 @@ function validateSelection(cmd, ssid, friendlymsg) {
|
||||
if (result === wtva.SUCCESS) {
|
||||
reloadConfig();
|
||||
redirectmsg = "The SSID is now banned.";
|
||||
} else if (result == wtva.REASON_EXISTS) {
|
||||
} else if (result === wtva.REASON_EXISTS) {
|
||||
redirectmsg = "The SSID was already banned.";
|
||||
} else {
|
||||
redirectmsg = "Unknown response " + result.toString();
|
||||
@@ -119,7 +119,7 @@ function validateSelection(cmd, ssid, friendlymsg) {
|
||||
redirectmsg = `An SSID is required for the ${request_headers.query.cmd} command.`;
|
||||
}
|
||||
headers = "302 OK\nLocation: /admin/?cmd=ssid&ssid=" + encodeURI(ssid) + "&msg=" + encodeURI(redirectmsg);
|
||||
} else if (request_headers.query.cmd == "unban") {
|
||||
} else if (request_headers.query.cmd === "unban") {
|
||||
redirectmsg = "The SSID was not banned, so it could not be unbanned.";
|
||||
const ssid = request_headers.query.ssid;
|
||||
if (ssid) {
|
||||
@@ -127,7 +127,7 @@ function validateSelection(cmd, ssid, friendlymsg) {
|
||||
if (result === wtva.SUCCESS) {
|
||||
reloadConfig();
|
||||
redirectmsg = "The SSID is now unbanned.";
|
||||
} else if (result == wtva.REASON_EXISTS) {
|
||||
} else if (result === wtva.REASON_EXISTS) {
|
||||
redirectmsg = "The SSID was not banned.";
|
||||
} else {
|
||||
redirectmsg = "Unknown response " + result.toString();
|
||||
|
||||
@@ -74,7 +74,7 @@ const patch_limits = {
|
||||
|
||||
function getPatchDataType(type, invert = false) {
|
||||
let patch_data = false;
|
||||
if ((type == "wtv-incarnation" && !invert) || (type == "wtv-encryption" && invert)) {
|
||||
if ((type === "wtv-incarnation" && !invert) || (type === "wtv-encryption" && invert)) {
|
||||
patch_data = "wtv-client-serial-number: %s\r\n"
|
||||
patch_data += "wtv-user-requested-upgrade: %s\r\n";
|
||||
patch_data += "wtv-system-cpuprid: %s\r\n";
|
||||
@@ -87,7 +87,7 @@ function getPatchDataType(type, invert = false) {
|
||||
patch_data += "wtv-system-chipversion: %s\r\n";
|
||||
patch_data += "User-Agent: %s\r\n";
|
||||
}
|
||||
else if ((type == "wtv-encryption" && !invert) || (type == "wtv-incarnation" && invert) ) {
|
||||
else if ((type === "wtv-encryption" && !invert) || (type === "wtv-incarnation" && invert) ) {
|
||||
patch_data = "wtv-tourist-enabled: %s\r\n";
|
||||
patch_data += "wtv-demo-enabled: %s\r\n";
|
||||
patch_data += "wtv-default-client-scriptprops: %s\r\n";
|
||||
@@ -106,7 +106,7 @@ function getPatchDataType(type, invert = false) {
|
||||
|
||||
function getResData(file) {
|
||||
let res_data = null;
|
||||
if (file.slice(-2, 2).toLowerCase() == "gz") {
|
||||
if (file.slice(-2, 2).toLowerCase() === "gz") {
|
||||
const res_gz_data = wtvshared.getServiceDep("/viewergen/" + file);
|
||||
res_data = zlib.gunzipSync(res_gz_data);
|
||||
} else {
|
||||
@@ -227,14 +227,14 @@ function getPatchData(fname, client_data_obj, start_url = "client:GoToConn", def
|
||||
const val = customized_patch_data[idx];
|
||||
if (typeof val === 'string') {
|
||||
// start url override
|
||||
if (start_url != patch_defaults.start_url && start_url.length <= patch_limits.start_url) {
|
||||
if (val.slice(0, patch_defaults.start_url.length) == patch_defaults.start_url)
|
||||
if (start_url !== patch_defaults.start_url && start_url.length <= patch_limits.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.slice(0, patch_defaults.default_ip.length) == patch_defaults.default_ip)
|
||||
if (default_ip !== patch_defaults.default_ip && default_ip.length <= patch_limits.default_ip) {
|
||||
if (val.slice(0, patch_defaults.default_ip.length) === patch_defaults.default_ip)
|
||||
customized_patch_data[idx] = default_ip + "\x00";
|
||||
}
|
||||
} else {
|
||||
@@ -242,7 +242,7 @@ function getPatchData(fname, client_data_obj, start_url = "client:GoToConn", def
|
||||
// not a buffer object
|
||||
let patch_data_string = "";
|
||||
const block_length = val['length'];
|
||||
const patch_data = getPatchDataType(val['type'], (fname.slice(12, 3) != "1.1"));
|
||||
const patch_data = getPatchDataType(val['type'], (fname.slice(12, 3) !== "1.1"));
|
||||
if (patch_data) {
|
||||
const patch_data_array = patch_data.split("\r\n");
|
||||
|
||||
@@ -256,7 +256,7 @@ function getPatchData(fname, client_data_obj, start_url = "client:GoToConn", def
|
||||
}
|
||||
});
|
||||
}
|
||||
if (fname.slice(12, 3) != "2.5") {
|
||||
if (fname.slice(12, 3) !== "2.5") {
|
||||
const length_difference = block_length - patch_data_string.length;
|
||||
if (length_difference > 0)
|
||||
patch_data_string += "\x00".repeat(length_difference - (val['type'].length + 1));
|
||||
@@ -292,7 +292,7 @@ function patchBinary(patchDataObject) {
|
||||
function generateSSID() {
|
||||
const ssid_template = "91xxxxxxaeb002";
|
||||
let ssid = ssid_template;
|
||||
while (ssid.indexOf("x") != -1) {
|
||||
while (ssid.indexOf("x") !== -1) {
|
||||
// random hex char from 0-F
|
||||
ssid = ssid.replace("x", Math.floor(Math.random() * 16).toString(16))
|
||||
}
|
||||
@@ -458,7 +458,7 @@ if (request_headers.query.viewer &&
|
||||
const viewer_gz_data = wtvshared.getServiceDep("/viewergen/" + viewer_file + ".gz");
|
||||
const viewer_data = zlib.gunzipSync(viewer_gz_data);
|
||||
const viewer_md5 = crypto.createHash('md5').update(viewer_data).digest("hex");
|
||||
if (viewer_md5 != viewer_stock_md5s[viewer_file]) {
|
||||
if (viewer_md5 !== viewer_stock_md5s[viewer_file]) {
|
||||
console.error(viewer_file, "md5sum error. expected:", viewer_stock_md5s[viewer_file], ", got:", viewer_md5)
|
||||
const errpage = wtvshared.doErrorPage("500", null, socket.minisrv_pc_mode)
|
||||
headers = errpage[0];
|
||||
@@ -514,7 +514,7 @@ Content-Disposition: attachment; filename="${viewer_file.replace(".exe", ".zip")
|
||||
console.log(request_headers)
|
||||
let update_str = "http://" + request_headers.host + request_headers.request_url.split('?')[0] + "?ssid=" + client_ssid;
|
||||
Object.keys(request_headers.query).forEach((k) => {
|
||||
if (k != "random_ssid") {
|
||||
if (k !== "random_ssid") {
|
||||
update_str += "&" + encodeURIComponent(k) + "=" + encodeURIComponent(request_headers.query[k]);
|
||||
}
|
||||
});
|
||||
@@ -525,7 +525,7 @@ Content-Disposition: attachment; filename="${viewer_file.replace(".exe", ".zip")
|
||||
const romset_zip = new AdmZip(wtvshared.getServiceDep("/viewergen/" + viewer_file.replace(".exe", "").replace("WebTVIntel", "AppData") + ".zip", true));
|
||||
const zipEntries = romset_zip.getEntries();
|
||||
zipEntries.forEach(function (zipEntry) {
|
||||
if (zipEntry.entryName == "Setup.bmp" && request_headers.query.logo) {
|
||||
if (zipEntry.entryName === "Setup.bmp" && request_headers.query.logo) {
|
||||
const logo_file = logos[parseInt(request_headers.query.logo) || 0];
|
||||
if (logo_file) {
|
||||
const logo_gz_data = wtvshared.getServiceDep("/viewergen/" + logo_file + ".gz");
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
const minisrv_service_file = true;
|
||||
let wtvsec_login;
|
||||
|
||||
if (socket.ssid != null && !session_data.get("wtvsec_login")) {
|
||||
if (socket.ssid !== null && !session_data.get("wtvsec_login")) {
|
||||
wtvsec_login = session_data.createWTVSecSession();
|
||||
wtvsec_login.IssueChallenge();
|
||||
if (request_headers["wtv-incarnation"]) wtvsec_login.set_incarnation(request_headers["wtv-incarnation"]);
|
||||
session_data.set("wtvsec_login", wtvsec_login);
|
||||
} else if (socket.ssid != null) {
|
||||
} else if (socket.ssid !== null) {
|
||||
wtvsec_login = session_data.get("wtvsec_login");
|
||||
}
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@ let gourl = "wtv-head-waiter:/login?";
|
||||
let file_path = null;
|
||||
|
||||
if (session_data) {
|
||||
if (session_data.loadSessionData() == true) {
|
||||
if (session_data.loadSessionData() === true) {
|
||||
console.log(" * Loaded session data from disk for", wtvshared.filterSSID(socket.ssid))
|
||||
session_data.setSessionData("registered", (session_data.getSessionData("registered") == true) ? true : false);
|
||||
session_data.setSessionData("registered", (session_data.getSessionData("registered") === true) ? true : false);
|
||||
} else {
|
||||
session_data.session_data = {};
|
||||
session_data.setSessionData("registered", false);
|
||||
@@ -14,8 +14,8 @@ if (session_data) {
|
||||
if (session_data.data_store.sockets) {
|
||||
let i = 0;
|
||||
session_data.data_store.sockets.forEach(function (k) {
|
||||
if (typeof k != "undefined") {
|
||||
if (k != socket) {
|
||||
if (typeof k !== "undefined") {
|
||||
if (k !== socket) {
|
||||
k.destroy();
|
||||
session_data.data_store.sockets.delete(k);
|
||||
i++;
|
||||
@@ -59,7 +59,7 @@ if (session_data.data_store.wtvsec_login) {
|
||||
let send_tellyscript = (minisrv_config.services[service_name].send_tellyscripts && !request_headers.query.relogin && !bootrom !== 0);
|
||||
const wtv_script_id = parseInt(session_data.get("wtv-script-id"));
|
||||
const wtv_script_mod = parseInt(session_data.get("wtv-script-mod"));
|
||||
if ((request_headers.query.reconnect || request_headers.query.relogin) && wtv_script_id != 0) send_tellyscript = false;
|
||||
if ((request_headers.query.reconnect || request_headers.query.relogin) && wtv_script_id !== 0) send_tellyscript = false;
|
||||
if (wtv_script_id !== 0 && wtv_script_mod !== 0) send_tellyscript = false;
|
||||
if (!minisrv_config.services[service_name].send_tellyscript_to_mame) {
|
||||
if (wtvshared.parseSSID(socket.ssid).boxType === "MAME") {
|
||||
@@ -68,7 +68,7 @@ if (session_data.data_store.wtvsec_login) {
|
||||
}
|
||||
|
||||
if (minisrv_config.services[service_name].tellyscript_ssid_blacklist) {
|
||||
send_tellyscript = (minisrv_config.services[service_name].tellyscript_ssid_blacklist.findIndex(element => element == socket.ssid) == -1)
|
||||
send_tellyscript = (minisrv_config.services[service_name].tellyscript_ssid_blacklist.findIndex(element => element === socket.ssid) === -1)
|
||||
}
|
||||
|
||||
if (send_tellyscript) {
|
||||
@@ -157,8 +157,8 @@ if (session_data.data_store.wtvsec_login) {
|
||||
|
||||
if (request_headers.query.reconnect) gourl = null;
|
||||
|
||||
if (file_path != null && send_tellyscript && !minisrv_config.config.debug_flags.quiet) console.log(" * Sending TellyScript", file_path, "on socket", socket.id);
|
||||
if (template != null && send_tellyscript && !minisrv_config.config.debug_flags.quiet) console.log(" * Generating TellyScript on socket", socket.id);
|
||||
if (file_path !== null && send_tellyscript && !minisrv_config.config.debug_flags.quiet) console.log(" * Sending TellyScript", file_path, "on socket", socket.id);
|
||||
if (template !== null && send_tellyscript && !minisrv_config.config.debug_flags.quiet) console.log(" * Generating TellyScript on socket", socket.id);
|
||||
|
||||
|
||||
headers = "200 OK\n"
|
||||
@@ -181,7 +181,7 @@ if (session_data.data_store.wtvsec_login) {
|
||||
headers += "wtv-boot-url: wtv-head-waiter:/login?relogin=true";
|
||||
headers += "\n";
|
||||
}
|
||||
if (gourl != null) headers += "wtv-visit: " + gourl + "\n";
|
||||
if (gourl !== null) headers += "wtv-visit: " + gourl + "\n";
|
||||
if (!bf0app_update && session_data.get("wtv-open-access")) headers += "wtv-open-isp-disabled: false\n";
|
||||
headers += "wtv-client-time-zone: GMT -0000\n";
|
||||
headers += "wtv-client-time-dst-rule: GMT\n"
|
||||
|
||||
@@ -7,7 +7,7 @@ if (auth === true) {
|
||||
let password = null;
|
||||
if (request_headers.Authorization) {
|
||||
const authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
if (authheader[0] === "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ if (auth === true) {
|
||||
let result, ssid, password;
|
||||
if (request_headers.Authorization) {
|
||||
const authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
if (authheader[0] === "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
@@ -44,10 +44,10 @@ wtv-expire-all: wtv-admin:/ban`;
|
||||
<input type="submit" value="Ban SSID">
|
||||
</form><br><br>`
|
||||
if (request_headers.query.ssid) {
|
||||
if (result == wtva.REASON_SELF) {
|
||||
if (result === wtva.REASON_SELF) {
|
||||
data += "<strong>Cannot ban yourself.</strong>"
|
||||
} else {
|
||||
if (result == wtva.REASON_EXISTS) {
|
||||
if (result === wtva.REASON_EXISTS) {
|
||||
data += "<strong>SSID " + request_headers.query.ssid + " is already in the ban list.</strong><br><br>";
|
||||
} else if (result === wtva.SUCCESS) {
|
||||
reloadConfig();
|
||||
|
||||
@@ -8,7 +8,7 @@ if (auth === true) {
|
||||
let ssid_match = false;
|
||||
if (request_headers.Authorization) {
|
||||
const authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
if (authheader[0] === "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
@@ -19,7 +19,7 @@ if (auth === true) {
|
||||
user_info = wtva.getAccountInfoBySSID(ssid);
|
||||
if (request_headers.query.confirm_delete) {
|
||||
user_info = null;
|
||||
if (ssid == socket.ssid) {
|
||||
if (ssid === socket.ssid) {
|
||||
ssid_match = true;
|
||||
} else {
|
||||
// delete
|
||||
@@ -63,7 +63,7 @@ wtv-noback-all: wtv-admin:/deleteaccount`;
|
||||
if (Object.keys(user_info.account_users).length > 1) {
|
||||
data += `<tr><td>Additional Users:</td><td>`;
|
||||
Object.keys(user_info.account_users).forEach(function (k) {
|
||||
if (k == "subscriber") return;
|
||||
if (k === "subscriber") return;
|
||||
data += user_info.account_users[k].subscriber_username + "<br>";
|
||||
})
|
||||
data += `</td></tr>`
|
||||
|
||||
@@ -12,7 +12,7 @@ if (auth === true) {
|
||||
const show_box_was_unregistered = false;
|
||||
if (request_headers.Authorization) {
|
||||
const authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
if (authheader[0] === "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
@@ -22,7 +22,7 @@ if (auth === true) {
|
||||
|
||||
user_info = wtva.getAccountInfo(request_headers.query.username.toLowerCase()); // username search
|
||||
if (user_info) {
|
||||
if (user_info.ssid == socket.ssid) {
|
||||
if (user_info.ssid === socket.ssid) {
|
||||
show_cannot_modify_self = true;
|
||||
}
|
||||
if (request_headers.query.confirm_delete) {
|
||||
|
||||
@@ -8,7 +8,7 @@ if (auth === true) {
|
||||
let password = null;
|
||||
if (request_headers.Authorization) {
|
||||
const authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
if (authheader[0] === "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
@@ -53,7 +53,7 @@ wtv-noback-all: wtv-admin:/findaccount`;
|
||||
if (Object.keys(user_info.account_users).length > 1) {
|
||||
data += `<tr><td>Additional Users:</td><td>`;
|
||||
Object.keys(user_info.account_users).forEach(function (k) {
|
||||
if (k == "subscriber") return;
|
||||
if (k === "subscriber") return;
|
||||
data += user_info.account_users[k].subscriber_username + "<br>";
|
||||
})
|
||||
data += `</td></tr>`
|
||||
|
||||
@@ -20,15 +20,15 @@ function generateFormField(type, confvar, options = null) {
|
||||
confvar_value = user_config.config[confvar] || minisrv_config.config[confvar];
|
||||
}
|
||||
|
||||
if (type == "input")
|
||||
if (type === "input")
|
||||
return `<input bgcolor="101010" text="ee44bb" type="text" name="${confvar}" value="${confvar_value}"${(options) ? ' '+options : ''}>`
|
||||
if (type == "checkbox")
|
||||
if (type === "checkbox")
|
||||
return `<input type="hidden" name="${confvar}" value="false">\n<input type=checkbox name="${confvar}" ${wtvshared.parseBool(confvar_value) ? "checked=checked" : ''}${(options) ? ' ' + options : ''}>`
|
||||
if (type == "select") {
|
||||
if (type === "select") {
|
||||
let out = `<select name="${confvar}">\n`
|
||||
if (options) {
|
||||
Object.keys(options).forEach((k) => {
|
||||
out += `<option value="${options[k].value}"${(confvar_value == options[k].value) ? ' selected' : ''}>${options[k].name}</option>\n`
|
||||
out += `<option value="${options[k].value}"${(confvar_value === options[k].value) ? ' selected' : ''}>${options[k].name}</option>\n`
|
||||
});
|
||||
}
|
||||
return out + "</select>";
|
||||
@@ -39,7 +39,7 @@ if (auth === true) {
|
||||
let password = null;
|
||||
if (request_headers.Authorization) {
|
||||
const authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
if (authheader[0] === "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ if (auth === true) {
|
||||
let password = null;
|
||||
if (request_headers.Authorization) {
|
||||
const authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
if (authheader[0] === "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
@@ -79,7 +79,7 @@ data += `
|
||||
</form><br><br>`
|
||||
if (request_headers.query.username) {
|
||||
if (user_info && !request_headers.query.confirm && !request_headers.query.reset) {
|
||||
if (user_info.username == session_data.getSessionData("subscriber_username")) {
|
||||
if (user_info.username === session_data.getSessionData("subscriber_username")) {
|
||||
data += `Are you sure you want to Polyzoot <b>yourself</b>?<br>Are you a masochist?`;
|
||||
} else {
|
||||
data += `Are you sure you want to Polyzoot <b>${user_info.username}</b>?<br>Are you a sadist?`;
|
||||
|
||||
@@ -8,7 +8,7 @@ if (auth === true) {
|
||||
let password = null;
|
||||
if (request_headers.Authorization) {
|
||||
const authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
if (authheader[0] === "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ if (auth === true) {
|
||||
let password = null;
|
||||
if (request_headers.Authorization) {
|
||||
const authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
if (authheader[0] === "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ if (auth === true) {
|
||||
let password = null;
|
||||
if (request_headers.Authorization) {
|
||||
const authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
if (authheader[0] === "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
@@ -19,7 +19,7 @@ if (auth === true) {
|
||||
if (request_headers.query.username) {
|
||||
user_info = wtva.getAccountInfo(request_headers.query.username.toLowerCase()); // username search
|
||||
if (user_info) {
|
||||
if (user_info.ssid == socket.ssid) {
|
||||
if (user_info.ssid === socket.ssid) {
|
||||
show_cannot_modify_self = true;
|
||||
}
|
||||
const userAccount = wtva.getAccountBySSID(user_info.ssid);
|
||||
|
||||
@@ -10,7 +10,7 @@ if (auth === true) {
|
||||
let password = null;
|
||||
if (request_headers.Authorization) {
|
||||
const authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
if (authheader[0] === "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
@@ -22,7 +22,7 @@ if (auth === true) {
|
||||
if (!fake_config.config.ssid_block_list) fake_config.config.ssid_block_list = [];
|
||||
if (typeof request_headers.query.unban_ssid === 'string') {
|
||||
Object.keys(fake_config.config.ssid_block_list).forEach(function (k) {
|
||||
if (fake_config.config.ssid_block_list[k] == request_headers.query.unban_ssid) {
|
||||
if (fake_config.config.ssid_block_list[k] === request_headers.query.unban_ssid) {
|
||||
fake_config.config.ssid_block_list.splice(k, 1);
|
||||
ssids_removed.push(request_headers.query.unban_ssid)
|
||||
config_changed = true;
|
||||
@@ -30,9 +30,9 @@ if (auth === true) {
|
||||
});
|
||||
} else {
|
||||
Object.keys(fake_config.config.ssid_block_list).forEach(function (k) {
|
||||
Object.keys(request_headers.query.unban_ssid).forEach(function (j) {
|
||||
if (fake_config.config.ssid_block_list[k] == request_headers.query.unban_ssid[j]) {
|
||||
fake_config.config.ssid_block_list.splice(k,1);
|
||||
Object.keys(request_headers.query.unban_ssid).forEach(function (j) {
|
||||
if (fake_config.config.ssid_block_list[k] === request_headers.query.unban_ssid[j]) {
|
||||
fake_config.config.ssid_block_list.splice(k, 1);
|
||||
ssids_removed.push(request_headers.query.unban_ssid[j])
|
||||
config_changed = true;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ if (auth === true) {
|
||||
let password = null;
|
||||
if (request_headers.Authorization) {
|
||||
const authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
if (authheader[0] === "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ const oldPosition = request_headers.query.oldBlockNum;
|
||||
const editing = request_headers.query.editing;
|
||||
let page;
|
||||
|
||||
if (editing == "true"){
|
||||
if (editing === "true"){
|
||||
session_data.pagestore.editPhotoBlock(docName, request_headers.query.blockNum, request_headers.query.newBlockNum, null, null, request_headers.query.blockTitle, request_headers.query.photoBlockCaption);
|
||||
headers = `300 OK
|
||||
wtv-expire-all: wtv-author:/block-preview
|
||||
@@ -22,14 +22,14 @@ Location: wtv-author:/show-blocks?docName=${docName}`
|
||||
} else {
|
||||
const page = session_data.pagestore.loadPage(docName);
|
||||
const blockNum = request_headers.query.blockNum;
|
||||
if (request_headers.query.scrapbookID != undefined) {
|
||||
if (request_headers.query.scrapbookID !== undefined) {
|
||||
const image = session_data.pagestore.getScrapbookImage(parseInt(request_headers.query.scrapbookID));
|
||||
if (page.blocks[blockNum] != undefined)
|
||||
if (page.blocks[blockNum] !== undefined)
|
||||
session_data.pagestore.editPhotoBlock(docName, request_headers.query.blockNum, request_headers.query.blockNum, image, "scrapbook", null, null);
|
||||
else
|
||||
session_data.pagestore.createPhotoBlock(docName, image, "scrapbook");
|
||||
} else {
|
||||
if (page.blocks[blockNum] != undefined)
|
||||
if (page.blocks[blockNum] !== undefined)
|
||||
session_data.pagestore.editPhotoBlock(docName, request_headers.query.blockNum, request_headers.query.blockNum, request_headers.query.mediaPath, "clipart", null, null);
|
||||
else
|
||||
session_data.pagestore.createPhotoBlock(docName, request_headers.query.mediaPath, "clipart");
|
||||
|
||||
@@ -3,7 +3,7 @@ const minisrv_service_file = true;
|
||||
const pagestore_exists = session_data.pagestore.pagestoreExists();
|
||||
const docName = request_headers.query.docName;
|
||||
|
||||
if (pagestore_exists != true)
|
||||
if (pagestore_exists !== true)
|
||||
{
|
||||
session_data.pagestore.createPagestore();
|
||||
headers = `300 OK
|
||||
@@ -129,7 +129,7 @@ ${page.title}
|
||||
</B></font>
|
||||
<P>
|
||||
<font size=2 color=AEBFD1>`
|
||||
if (page.published == true)
|
||||
if (page.published === true)
|
||||
data += `published ${page.publishdate}`
|
||||
else
|
||||
data += "not published"
|
||||
@@ -163,7 +163,7 @@ Change how your page is listed
|
||||
<tr>
|
||||
<td>
|
||||
<img src=wtv-author:/ROMCache/pointer.gif align=absmiddle width=13 height=22 hspace=0> `
|
||||
if (page.published != true)
|
||||
if (page.published !== true)
|
||||
data += `<a href=publish?docName=${docName}
|
||||
><font effect=shadow><B>Publish page</B></font></a>
|
||||
<BR><spacer type=block width=18 height=30 align=top>
|
||||
|
||||
@@ -4,7 +4,7 @@ const pagestore_exists = session_data.pagestore.pagestoreExists();
|
||||
|
||||
const site = session_data.pagestore.getPublishDomain();
|
||||
|
||||
if (pagestore_exists != true)
|
||||
if (pagestore_exists !== true)
|
||||
session_data.pagestore.createPagestore();
|
||||
|
||||
const pagearray = session_data.pagestore.listPages();
|
||||
@@ -163,7 +163,7 @@ data = `<HTML>
|
||||
`
|
||||
for (let i = 0; i < numofpages; i++) {
|
||||
data += `<tr> <td rowspan=2 valign=top>`
|
||||
if (i == 0)
|
||||
if (i === 0)
|
||||
data += `<img src="/ROMCache/left_mark.gif" width=5 height=9>
|
||||
<td colspan=4><img src="/ROMCache/horiz_line_top.gif" width=347 height=9>
|
||||
<td rowspan=2 valign=top><img src="/ROMCache/right_mark.gif" width=5 height=9>`
|
||||
@@ -181,7 +181,7 @@ ${pagearray[i].description}
|
||||
</I></font>
|
||||
<P>
|
||||
<font size=1 color=AEBFD1>`
|
||||
if (pagearray[i].published == true)
|
||||
if (pagearray[i].published === true)
|
||||
data += `published ${pagearray[i].publishdate}`
|
||||
else
|
||||
data += "not published"
|
||||
|
||||
@@ -203,7 +203,7 @@ Add text to your document
|
||||
<TD>Text size:`
|
||||
const textsize = pagedata.blocks[oldBlockNum].size
|
||||
|
||||
if (textsize == "-1")
|
||||
if (textsize === "-1")
|
||||
{
|
||||
data += `<TD><INPUT type=radio value=-1 name=textBlockSize checked onClick=ReWrite()>
|
||||
<font size=-1>Small</font></TD>
|
||||
@@ -211,7 +211,7 @@ if (textsize == "-1")
|
||||
Medium</TD>
|
||||
<TD><INPUT type=radio value=+1 name=textBlockSize onClick=ReWrite()>
|
||||
<font size=+1>Large</font></TD>`
|
||||
} else if (textsize == "+1")
|
||||
} else if (textsize === "+1")
|
||||
{
|
||||
data += `<TD><INPUT type=radio value=-1 name=textBlockSize onClick=ReWrite()>
|
||||
<font size=-1>Small</font></TD>
|
||||
@@ -233,7 +233,7 @@ data += `
|
||||
<TD>Text style:`
|
||||
const textstyle = pagedata.blocks[oldBlockNum].style
|
||||
|
||||
if (textstyle == "B")
|
||||
if (textstyle === "B")
|
||||
{
|
||||
data += `
|
||||
<TD><INPUT type=radio name=textBlockStyle onClick=ReWrite()>
|
||||
@@ -243,7 +243,7 @@ Plain</TD>
|
||||
<TD><INPUT type=radio value=I name=textBlockStyle onClick=ReWrite()>
|
||||
<I>Italic</I></TD>
|
||||
</TABLE>`
|
||||
} else if (textstyle == "I") {
|
||||
} else if (textstyle === "I") {
|
||||
data += `
|
||||
<TD><INPUT type=radio name=textBlockStyle onClick=ReWrite()>
|
||||
Plain</TD>
|
||||
@@ -461,11 +461,11 @@ if (showIt)
|
||||
{ document.viewOptionEmbed.document.write('
|
||||
<BODY text=AEBFD1 link=B8BDC7 vlink=B8BDC7>
|
||||
<img src=wtv-author:/ROMCache/pointer.gif align=absmiddle width=13 height=22 hspace=0> `
|
||||
if (blockType == "snapshot" || blockType == "scrapbook") {
|
||||
if (blockType === "snapshot" || blockType === "scrapbook") {
|
||||
data += `<a href=wtv-author:/get-photo?docName=${docName}&blockNum=${oldBlockNum}
|
||||
><font effect=shadow><B>View this picture</B></font></a>
|
||||
</BODY>`
|
||||
} else if (blockType == "clipart")
|
||||
} else if (blockType === "clipart")
|
||||
data += `<a href=wtv-author:/${photo}
|
||||
><font effect=shadow><B>View this picture</B></font></a>
|
||||
</BODY>`
|
||||
@@ -551,9 +551,9 @@ vspace=0
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td height=100 valign=middle rowspan=5>`
|
||||
if (blockType == "snapshot") {
|
||||
if (blockType === "snapshot") {
|
||||
data += `<img src=wtv-author:/get-photo?docName=${docName}&blockNum=${oldBlockNum} width=131 height=100 border=1 onError="DisplayViewOption(false)">`
|
||||
} else if (blockType == "clipart") {
|
||||
} else if (blockType === "clipart") {
|
||||
data += `<img src=wtv-author:/${thumbnail} width=64 height=64 border=1 onError="DisplayViewOption(false)">`
|
||||
}
|
||||
data += `
|
||||
@@ -579,7 +579,7 @@ DisplayViewOption(true);
|
||||
<tr>
|
||||
<td colspan=2 absheight=28>
|
||||
<input type=text name="blockTitle" id="blockTitle" value="`
|
||||
if (pagedata.blocks[oldBlockNum].title != null)
|
||||
if (pagedata.blocks[oldBlockNum].title !== null)
|
||||
data += `${pagedata.blocks[oldBlockNum].title}`
|
||||
data += `" selected width=100% text=CACA4A bgcolor=192133 font=proportional autoactivate>
|
||||
<tr>
|
||||
@@ -597,7 +597,7 @@ autohiragana
|
||||
growable
|
||||
width=100%
|
||||
value="`
|
||||
if (pagedata.blocks[oldBlockNum].caption != null)
|
||||
if (pagedata.blocks[oldBlockNum].caption !== null)
|
||||
data += `${pagedata.blocks[oldBlockNum].caption}`
|
||||
data += `"
|
||||
cols=45 rows=3></TEXTAREA>
|
||||
@@ -837,14 +837,14 @@ Add a heading to your document
|
||||
<TABLE>
|
||||
<TR>
|
||||
<TD>Text size:`
|
||||
if (pagedata.blocks[oldBlockNum].size == "H3")
|
||||
if (pagedata.blocks[oldBlockNum].size === "H3")
|
||||
data += `<TD><INPUT type=radio value=H3 name=headingBlockSize checked onClick=ReWrite()>
|
||||
<FONT size=-1>Small</FONT></TD>
|
||||
<TD><INPUT type=radio value=H2 name=headingBlockSize onClick=ReWrite()>
|
||||
Medium</TD>
|
||||
<TD><INPUT type=radio value=H1 name=headingBlockSize onClick=ReWrite()>
|
||||
<FONT size=+1>Large</FONT></TD>`
|
||||
else if (pagedata.blocks[oldBlockNum].size == "H1")
|
||||
else if (pagedata.blocks[oldBlockNum].size === "H1")
|
||||
data += `<TD><INPUT type=radio value=H3 name=headingBlockSize onClick=ReWrite()>
|
||||
<FONT size=-1>Small</FONT></TD>
|
||||
<TD><INPUT type=radio value=H2 name=headingBlockSize onClick=ReWrite()>
|
||||
@@ -862,7 +862,7 @@ data += `
|
||||
<TR>
|
||||
<TD>Add a divider line:</TD>
|
||||
<TD colspan=3><INPUT type=checkbox name=headingBlockDividerBefore `
|
||||
if (pagedata.blocks[oldBlockNum].dividerBefore == "on")
|
||||
if (pagedata.blocks[oldBlockNum].dividerBefore === "on")
|
||||
data += "checked"
|
||||
data += `>
|
||||
Before the heading</TD>
|
||||
@@ -870,7 +870,7 @@ Before the heading</TD>
|
||||
<TR>
|
||||
<TD></TD>
|
||||
<TD colspan=3><INPUT type=checkbox name=headingBlockDividerAfter `
|
||||
if (pagedata.blocks[oldBlockNum].dividerAfter == "on")
|
||||
if (pagedata.blocks[oldBlockNum].dividerAfter === "on")
|
||||
data += "checked"
|
||||
data += `>
|
||||
After the heading</TD>
|
||||
@@ -1204,7 +1204,7 @@ function SetListItems()
|
||||
|
||||
for (let i = 0; i < pagedata.blocks[oldBlockNum].items.length; i++) {
|
||||
data += `ListElements[${i}] = new Object;`
|
||||
if (pagedata.blocks[oldBlockNum].items[i].name == undefined)
|
||||
if (typeof pagedata.blocks[oldBlockNum].items[i].name === 'undefined')
|
||||
data += `ListElements[${i}].desc = "";`
|
||||
else
|
||||
data += `ListElements[${i}].desc = "${pagedata.blocks[oldBlockNum].items[i].name}";`
|
||||
|
||||
@@ -7,7 +7,7 @@ headers = `200 OK
|
||||
Connection: Keep-Alive
|
||||
Content-Type: text/html`
|
||||
|
||||
if (request_headers.query.publishing == "true") {
|
||||
if (request_headers.query.publishing === "true") {
|
||||
data = `<HTML>
|
||||
<HEAD>
|
||||
<DISPLAY fontsize=medium>
|
||||
@@ -110,7 +110,7 @@ cols=45 rows=4 MAXLENGTH=128></TEXTAREA>
|
||||
</BODY>
|
||||
</HTML>
|
||||
`
|
||||
} else if (request_headers.query.titleOnly == "true") {
|
||||
} else if (request_headers.query.titleOnly === "true") {
|
||||
data = `<HTML>
|
||||
<HEAD>
|
||||
<DISPLAY fontsize=medium>
|
||||
@@ -194,7 +194,7 @@ as well as in the list of your pages.
|
||||
<tr><td colspan=2>
|
||||
<input type=hidden name="hideTitle" value="">
|
||||
<input type=checkbox value=${!page.showtitle} `
|
||||
if (page.showtitle == true)
|
||||
if (page.showtitle === true)
|
||||
data += "checked"
|
||||
data += `
|
||||
onChange="SetHideTitle(this.checked)">
|
||||
|
||||
@@ -4,7 +4,7 @@ const docName = request_headers.query.docName;
|
||||
const page = session_data.pagestore.loadPage(docName);
|
||||
const site = session_data.pagestore.getPublishDomain();
|
||||
|
||||
if (request_headers.query.publishStage == "1") {
|
||||
if (request_headers.query.publishStage === "1") {
|
||||
headers = `200 OK
|
||||
Content-Type: text/html`
|
||||
|
||||
@@ -77,7 +77,7 @@ Your public list of pages will be at:<BR>
|
||||
<tr>
|
||||
<td colspan=3 valign=top>
|
||||
<input type=checkbox name="includeInPublicList" value=${page.inlist} `
|
||||
if (page.inlist == true)
|
||||
if (page.inlist === true)
|
||||
data += "checked"
|
||||
data += `>
|
||||
Include in public list
|
||||
@@ -116,24 +116,24 @@ Include in public list
|
||||
</BODY>
|
||||
</HTML>
|
||||
`
|
||||
} else if (request_headers.query.publishStage == "2") {
|
||||
} else if (request_headers.query.publishStage === "2") {
|
||||
let inlist;
|
||||
if (request_headers.query.includeInPublicList != undefined) {
|
||||
if (typeof request_headers.query.includeInPublicList !== 'undefined') {
|
||||
inlist = true;
|
||||
} else {
|
||||
inlist = false;
|
||||
}
|
||||
const result = session_data.pagestore.publishPage(docName, inlist);
|
||||
if (result == true) {
|
||||
if (result === true) {
|
||||
headers = `300 OK
|
||||
wtv-expire-all: wtv-author:/documents
|
||||
Location: wtv-author:/congrats?docName=${docName}`
|
||||
} else {
|
||||
headers = `400 ${result}`
|
||||
}
|
||||
} else if (request_headers.query.unpublish == "1") {
|
||||
} else if (request_headers.query.unpublish === "1") {
|
||||
const result = session_data.pagestore.unpublishPage(docName);
|
||||
if (result == true) {
|
||||
if (result === true) {
|
||||
headers = `300 OK
|
||||
wtv-expire-all: wtv-author:/documents
|
||||
wtv-expire-all: wtv-author:/doc-info
|
||||
|
||||
@@ -11,9 +11,9 @@ const editing = request_headers.query.editing;
|
||||
const blockClass = request_headers.query.blockClass;
|
||||
switch(blockClass) {
|
||||
case "23":
|
||||
if (editing == "true") {
|
||||
if (editing === "true") {
|
||||
const photo = request_headers.query.photoBlockPhoto;
|
||||
if (request_headers.query.toSnapshot == "true")
|
||||
if (request_headers.query.toSnapshot === "true")
|
||||
session_data.pagestore.editPhotoBlock(docName, request_headers.query.blockNum, request_headers.query.newBlockNum, photo, "snapshot", request_headers.query.blockTitle, request_headers.query.photoBlockCaption);
|
||||
else
|
||||
session_data.pagestore.editPhotoBlock(docName, request_headers.query.blockNum, request_headers.query.newBlockNum, null, null, request_headers.query.blockTitle, request_headers.query.photoBlockCaption);
|
||||
@@ -36,14 +36,14 @@ Location: ${request_headers.query.returnPageURL + "&numOfBlocks=" + page.blocks.
|
||||
}
|
||||
break;
|
||||
case "21":
|
||||
if (caption.length == 0) {
|
||||
if (caption.length === 0) {
|
||||
headers = "400 You must enter a caption. Please enter a caption and try again."
|
||||
} else {
|
||||
if (editing == "true") {
|
||||
if (size.length == 0)
|
||||
if (editing === "true") {
|
||||
if (size.length === 0)
|
||||
size = null;
|
||||
|
||||
if (style.length == 0)
|
||||
|
||||
if (style.length === 0)
|
||||
style = null;
|
||||
session_data.pagestore.editTextBlock(docName, title, caption, size, style, position, oldPosition);
|
||||
headers = `300 OK
|
||||
@@ -53,10 +53,10 @@ Location: ${request_headers.query.returnPageURL + "&numOfBlocks=" + page.blocks.
|
||||
wtv-expire-all: wtv-author:/edit-block
|
||||
Location: wtv-author:/show-blocks?docName=${docName}`
|
||||
} else {
|
||||
if (size.length == 0)
|
||||
if (size.length === 0)
|
||||
size = null;
|
||||
|
||||
if (style.length == 0)
|
||||
|
||||
if (style.length === 0)
|
||||
style = null;
|
||||
session_data.pagestore.createTextBlock(docName, title, caption, size, style, position);
|
||||
headers = `300 OK
|
||||
@@ -72,10 +72,10 @@ Location: ${request_headers.query.returnPageURL + "&numOfBlocks=" + page.blocks.
|
||||
size = request_headers.query.headingBlockSize
|
||||
const dividerBefore = request_headers.query.headingBlockDividerBefore
|
||||
const dividerAfter = request_headers.query.headingBlockDividerAfter
|
||||
if (header.length == 0) {
|
||||
if (header.length === 0) {
|
||||
headers = "400 You must enter a header. Please enter a header and try again."
|
||||
} else {
|
||||
if (editing == "true") {
|
||||
if (editing === "true") {
|
||||
session_data.pagestore.editHeaderBlock(docName, header, size, dividerBefore, dividerAfter, position, request_headers.query.blockNum);
|
||||
headers = `300 OK
|
||||
wtv-expire-all: wtv-author:/block-preview
|
||||
@@ -94,7 +94,7 @@ Location: wtv-author:/show-blocks?docName=${docName}`
|
||||
}
|
||||
break;
|
||||
case "24":
|
||||
if (editing == "true") {
|
||||
if (editing === "true") {
|
||||
const listItems = request_headers.query.listItemText.filter(function(e){ return e.replace(/(\r\n|\n|\r)/gm,"")});
|
||||
session_data.pagestore.editListBlock(docName, title, listItems, position, request_headers.query.blockNum);
|
||||
headers = `300 OK
|
||||
@@ -114,7 +114,7 @@ Location: wtv-author:/show-blocks?docName=${docName}`
|
||||
}
|
||||
break;
|
||||
case "25":
|
||||
if (editing == "true") {
|
||||
if (editing === "true") {
|
||||
const listItems = request_headers.query.listItemText;
|
||||
const linkItems = request_headers.query.linkItemURL;
|
||||
session_data.pagestore.editLinkBlock(docName, title, listItems, linkItems, position, request_headers.query.blockNum);
|
||||
@@ -137,7 +137,7 @@ Location: wtv-author:/show-blocks?docName=${docName}`
|
||||
break;
|
||||
|
||||
case "27":
|
||||
if (editing == "true") {
|
||||
if (editing === "true") {
|
||||
session_data.pagestore.editBreakBlock(docName, position, request_headers.query.blockNum);
|
||||
headers = `300 OK
|
||||
wtv-expire-all: wtv-author:/block-preview
|
||||
|
||||
@@ -3,7 +3,7 @@ const minisrv_service_file = true;
|
||||
const docName = request_headers.query.docName;
|
||||
const docTitle = request_headers.query.docTitle;
|
||||
|
||||
if (docTitle.length == 0) {
|
||||
if (docTitle.length === 0) {
|
||||
headers = "400 You must enter a title for your page. Please enter a title and try again."
|
||||
} else {
|
||||
const pagedata = session_data.pagestore.loadPage(docName);
|
||||
|
||||
@@ -48,7 +48,7 @@ if (!request_headers.query.mediaData && !request_headers.query.mediaPath) {
|
||||
function isValidImageType(contentType, url) {
|
||||
// Check content-type header or file extension
|
||||
if (contentType) {
|
||||
return contentType === 'image/jpeg' || contentType == 'image/jpg' || contentType === 'image/gif';
|
||||
return contentType === 'image/jpeg' || contentType === 'image/jpg' || contentType === 'image/gif';
|
||||
}
|
||||
return url.endsWith('.jpg') || url.endsWith('.jpeg') || url.endsWith('.gif');
|
||||
}
|
||||
|
||||
@@ -109,12 +109,12 @@ Chat Home
|
||||
<table>
|
||||
<tr>
|
||||
<td abswidth="120">Server:</td>
|
||||
<td><input width="240" bgcolor=262626 text=D6D6D6 cursor=cc9933 font=proportional type="text" name="host" value="${request_headers.query.host || (minisrv_config.config.irc.enabled) ? minisrv_config.config.service_ip : "irc.libera.chat"}"></td>
|
||||
<td><input width="240" bgcolor=262626 text=D6D6D6 cursor=cc9933 font=proportional type="text" name="host" value="${request_headers.query.host || "irc.libera.chat"}"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Port:</td>
|
||||
<td><input width="240" bgcolor=262626 text=D6D6D6 cursor=cc9933 font=proportional type="text" name="port" value="${request_headers.query.port || (minisrv_config.config.irc.enabled) ? minisrv_config.config.irc.port : 6667}"></td>
|
||||
<td><input width="240" bgcolor=262626 text=D6D6D6 cursor=cc9933 font=proportional type="text" name="port" value="${request_headers.query.port || 6667}"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
|
||||
@@ -12,7 +12,7 @@ let diskmap_data = {};
|
||||
|
||||
if (!request_headers.query.url) {
|
||||
Object.keys(service_vaults).forEach(function (g) {
|
||||
if (diskmap_json_file != null) return;
|
||||
if (diskmap_json_file !== null) return;
|
||||
diskmap_json_file = service_vaults[g] + "/" + service_name + "/" + diskmap_dir + diskmap + ".json";
|
||||
if (!fs.existsSync(diskmap_json_file)) diskmap_json_file = null;
|
||||
});
|
||||
|
||||
@@ -3,12 +3,12 @@ const minisrv_service_file = true;
|
||||
const diskmap = request_headers.query[wtvshared.getCaseInsensitiveKey("DiskMap", request_headers.query)];
|
||||
const wtvdl = new WTVDisk(minisrv_config, service_name);
|
||||
|
||||
const force_update = (request_headers.query.force == "true") ? true : false;
|
||||
const no_delete = (request_headers.query.dont_delete_files == "true") ? true : false;
|
||||
const force_update = (request_headers.query.force === "true") ? true : false;
|
||||
const no_delete = (request_headers.query.dont_delete_files === "true") ? true : false;
|
||||
const content_dir = "content/"
|
||||
const diskmap_dir = content_dir + "diskmaps/";
|
||||
|
||||
if (request_headers['wtv-request-type'] == 'download') {
|
||||
if (request_headers['wtv-request-type'] === 'download') {
|
||||
|
||||
function generateDownloadList(diskmap_group_name, update_list, diskmap_group_data) {
|
||||
wtvdl.reset();
|
||||
@@ -34,7 +34,7 @@ if (request_headers['wtv-request-type'] == 'download') {
|
||||
if (force_update && !no_delete) {
|
||||
// don't delete Browser partition, ever, but allow deleting of Browser partition subdirs
|
||||
if (!diskmap_group_data.base.match(/disk\/browser(\/)?$/i)) {
|
||||
if (diskmap_group_data.client_group_data.path.toLowerCase() == diskmap_group_data.base.toLowerCase()) {
|
||||
if (diskmap_group_data.client_group_data.path.toLowerCase() === diskmap_group_data.base.toLowerCase()) {
|
||||
wtvdl.delete(diskmap_group_data.base, null);
|
||||
} else {
|
||||
wtvdl.delete(diskmap_group_data.base, diskmap_group_data.client_group_data.group);
|
||||
@@ -60,7 +60,7 @@ if (request_headers['wtv-request-type'] == 'download') {
|
||||
Object.keys(update_list).forEach(function (k) {
|
||||
// file { "action": "delete" }
|
||||
// Useful to purge files we no longer want on the client
|
||||
if (update_list[k].action != "DELETE" && update_list[k].action != "DELETEONLY") {
|
||||
if (update_list[k].action !== "DELETE" && update_list[k].action !== "DELETEONLY") {
|
||||
// skip deleting valid files if we aren't specifically requesting their deletion
|
||||
if (update_list[k].checksum_match && !force_update) return;
|
||||
if (!update_list[k].invalid && !force_update) return;
|
||||
@@ -75,7 +75,7 @@ if (request_headers['wtv-request-type'] == 'download') {
|
||||
Object.keys(update_list).forEach(function (k) {
|
||||
if (update_list[k].checksum_match && !force_update) return;
|
||||
if (!update_list[k].invalid && !force_update) return;
|
||||
if (update_list[k].action == "DELETEONLY") return;
|
||||
if (update_list[k].action === "DELETEONLY") return;
|
||||
if (update_list[k].display) wtvdl.display(update_list[k].display);
|
||||
switch (update_list[k].action) {
|
||||
case "PUT":
|
||||
@@ -98,7 +98,7 @@ if (request_headers['wtv-request-type'] == 'download') {
|
||||
Object.keys(update_list).forEach(function (k) {
|
||||
if (update_list[k].checksum_match && !force_update) return;
|
||||
if (!update_list[k].invalid && !force_update) return;
|
||||
if (update_list[k].action == "DELETEONLY") return;
|
||||
if (update_list[k].action === "DELETEONLY") return;
|
||||
wtvdl.rename(update_list[k].file.replace(diskmap_group_data.base, ""), update_list[k].file.replace(diskmap_group_data.base, ""), diskmap_group_name, diskmap_group_name, update_list[k].rename || update_list[k].original_filename || null);
|
||||
});
|
||||
|
||||
@@ -143,7 +143,7 @@ if (request_headers['wtv-request-type'] == 'download') {
|
||||
let post_data_current_checksum = false;
|
||||
let post_data_last_checkup_time = 0;
|
||||
Object.keys(post_data).forEach(function (k) {
|
||||
if (post_data[k].slice(0, 7) == "file://") {
|
||||
if (post_data[k].slice(0, 7) === "file://") {
|
||||
entry_type = "folder";
|
||||
post_data_current_file = false;
|
||||
post_data_current_version = false;
|
||||
@@ -185,13 +185,13 @@ if (request_headers['wtv-request-type'] == 'download') {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
if (!entry_type && post_data[k] != "") {
|
||||
if (!entry_type && post_data[k] !== "") {
|
||||
entry_type = "file";
|
||||
post_data_current_file = post_data[k];
|
||||
}
|
||||
|
||||
if (post_data[k] == "" && entry_type) {
|
||||
const post_data_current_path = ((entry_type == "file") ? (post_data_current_directory + post_data_current_file) : post_data_current_directory);
|
||||
if (post_data[k] === "" && entry_type) {
|
||||
const post_data_current_path = ((entry_type === "file") ? (post_data_current_directory + post_data_current_file) : post_data_current_directory);
|
||||
const index = post_data_current_path.replace(/[\:\/]/g, "_").toLowerCase() + "_" + post_data_current_group;
|
||||
if (index.match(/\/$/)) entry_type = "folder";
|
||||
if (!post_data_fileinfo[index]) post_data_fileinfo[index] = {};
|
||||
@@ -215,7 +215,7 @@ if (request_headers['wtv-request-type'] == 'download') {
|
||||
if (!diskmap_group_data.files[k].location) diskmap_group_data.files[k].location = wtvshared.makeSafePath(diskmap_group_data.location,diskmap_group_data.files[k].file.replace(diskmap_group_data.base, ""), true);
|
||||
let diskmap_data_file = null;
|
||||
Object.keys(service_vaults).forEach(function (g) {
|
||||
if (diskmap_data_file != null) return;
|
||||
if (diskmap_data_file !== null) return;
|
||||
diskmap_data_file = service_vaults[g] + "/" + service_name + "/" + diskmap_group_data.files[k].location;
|
||||
if (!fs.existsSync(diskmap_data_file) || !fs.lstatSync(diskmap_data_file).isFile()) diskmap_data_file = null;
|
||||
});
|
||||
@@ -232,7 +232,7 @@ if (request_headers['wtv-request-type'] == 'download') {
|
||||
diskmap_group_data.files[k].action = (diskmap_group_data.files[k].action) ? diskmap_group_data.files[k].action.toUpperCase() : "GET";
|
||||
|
||||
// we need the checksum of the uncompressed data
|
||||
if (wtvshared.getFileExt(diskmap_data_file).toLowerCase() == "gz") {
|
||||
if (wtvshared.getFileExt(diskmap_data_file).toLowerCase() === "gz") {
|
||||
const diskmap_data_filename = path.basename(diskmap_data_file);
|
||||
const gunzipped = zlib.gunzipSync(diskmap_file_data);
|
||||
diskmap_group_data.files[k].checksum = CryptoJS.MD5(CryptoJS.lib.WordArray.create(gunzipped)).toString(CryptoJS.enc.Hex).toLowerCase();
|
||||
@@ -256,14 +256,14 @@ if (request_headers['wtv-request-type'] == 'download') {
|
||||
Object.keys(wtv_download_list).forEach(function (k) {
|
||||
wtv_download_list[k].version = newest_file_epoch;
|
||||
Object.keys(post_data_fileinfo).forEach(function (g) {
|
||||
if (post_data_fileinfo[g].file == wtv_download_list[k].file || post_data_fileinfo[g].file == wtv_download_list[k].base) {
|
||||
if (post_data_fileinfo[g].file === wtv_download_list[k].file || post_data_fileinfo[g].file === wtv_download_list[k].base) {
|
||||
diskmap_group_data.group_exists = true;
|
||||
if (wtv_download_list[k].checksum && wtv_download_list[k].checksum.toLowerCase() == post_data_fileinfo[g].checksum) wtv_download_list[k].invalid = false;
|
||||
else if (post_data_fileinfo[g].version == wtv_download_list[k].version && post_data_fileinfo[g].state !== "invalid") wtv_download_list[k].invalid = false;
|
||||
if (wtv_download_list[k].checksum && wtv_download_list[k].checksum.toLowerCase() === post_data_fileinfo[g].checksum) wtv_download_list[k].invalid = false;
|
||||
else if (post_data_fileinfo[g].version === wtv_download_list[k].version && post_data_fileinfo[g].state !== "invalid") wtv_download_list[k].invalid = false;
|
||||
}
|
||||
});
|
||||
});
|
||||
const diskmap_group_name = (diskmap_subgroup == null) ? diskmap_primary_group : diskmap_primary_group + "-" + diskmap_subgroup;
|
||||
const diskmap_group_name = (diskmap_subgroup === null) ? diskmap_primary_group : diskmap_primary_group + "-" + diskmap_subgroup;
|
||||
diskmap_group_data.client_group_data = client_group_data[diskmap_group_name] || null;
|
||||
output_data = generateDownloadList(diskmap_group_name, wtv_download_list, diskmap_group_data);
|
||||
return output_data;
|
||||
@@ -272,12 +272,12 @@ if (request_headers['wtv-request-type'] == 'download') {
|
||||
if (diskmap && request_headers.query.group) {
|
||||
let diskmap_json_file = null;
|
||||
Object.keys(service_vaults).forEach(function (g) {
|
||||
if (diskmap_json_file != null) return;
|
||||
if (diskmap_json_file !== null) return;
|
||||
diskmap_json_file = service_vaults[g] + "/" + service_name + "/" + diskmap_dir + diskmap + ".json";
|
||||
if (!fs.existsSync(diskmap_json_file)) diskmap_json_file = null;
|
||||
});
|
||||
|
||||
if (diskmap_json_file != null) {
|
||||
if (diskmap_json_file !== null) {
|
||||
try {
|
||||
// read diskmap
|
||||
const json_stats = fs.lstatSync(diskmap_json_file);
|
||||
|
||||
@@ -24,7 +24,7 @@ if (request_headers.post_data) {
|
||||
function getTitle(url) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
let page_title = "Web Page";
|
||||
const request_type = (url.slice(0, 5) == "https") ? "https" : "http";
|
||||
const request_type = (url.slice(0, 5) === "https") ? "https" : "http";
|
||||
let proxy_agent = null;
|
||||
switch (request_type) {
|
||||
case "https":
|
||||
@@ -40,7 +40,7 @@ function getTitle(url) {
|
||||
}
|
||||
const request = proxy_agent.get(url, options, (response) => {
|
||||
let req_data = '';
|
||||
if (response.statusCode == 301 || response.statusCode == 302) {
|
||||
if (response.statusCode === 301 || response.statusCode === 302) {
|
||||
redirects++;
|
||||
if (redirects < max_redirects) resolve(getTitle(response.headers.location));
|
||||
else reject(`Too many redirects. Max: ${max_redirects}, Current: ${redirects}`);
|
||||
@@ -107,7 +107,7 @@ async function saveFavorite(favstore, title, folder, imagetype, favurl) {
|
||||
image = "canned/favorite_default.gif"
|
||||
}
|
||||
|
||||
if (favoritenum == minisrv_config.services[service_name].max_favorites_per_folder) {
|
||||
if (favoritenum === minisrv_config.services[service_name].max_favorites_per_folder) {
|
||||
headers = `400 You can only have ${minisrv_config.services[service_name].max_favorites_per_folder} favorites in a folder. Discard some favorites or choose a different folder, then try again.`
|
||||
} else {
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@ const query = request_headers.query
|
||||
const discardAll = request_headers.query.DiscardAll
|
||||
let strName;
|
||||
|
||||
if (discardAll != "Discard All")
|
||||
if (discardAll !== "Discard All")
|
||||
{
|
||||
for(strName in query)
|
||||
{
|
||||
if (strName != "favorite_folder_name")
|
||||
if (strName !== "favorite_folder_name")
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ if (request_headers.query.ForwardToBrowser)
|
||||
Connection: Keep-Alive
|
||||
Content-Type: text/html
|
||||
Location: wtv-favorite:/serve-browser?favorite_folder_name=${folder}`
|
||||
} else if (strName != "getCaseInsensitiveKey") {
|
||||
} else if (strName !== "getCaseInsensitiveKey") {
|
||||
const favorite = session_data.favstore.getFavorite(folder, strName);
|
||||
|
||||
if (errpage) {
|
||||
@@ -33,7 +33,7 @@ Location: wtv-favorite:/serve-browser?favorite_folder_name=${folder}`
|
||||
} else {
|
||||
if (!request_headers.query.confirm_remove) {
|
||||
let message, removeurl;
|
||||
if (discardAll == "Discard All")
|
||||
if (discardAll === "Discard All")
|
||||
{
|
||||
message = `Are you sure you want to discard all favorites in this folder?`;
|
||||
removeurl = request_headers.request_url + "&confirm_remove=true&DiscardAll=Discard All";
|
||||
@@ -58,7 +58,7 @@ Location: ${confirmAlert}`
|
||||
} else {
|
||||
|
||||
const gourl = `wtv-favorite:/serve-discard-favorites?favorite_folder_name=${folder}`;
|
||||
if (discardAll == "Discard All")
|
||||
if (discardAll === "Discard All")
|
||||
{
|
||||
session_data.favstore.clearFolder(folder);
|
||||
} else {
|
||||
|
||||
@@ -33,7 +33,7 @@ Location: wtv-favorite:/favorite`
|
||||
} else {
|
||||
if (!request_headers.query.confirm_remove) {
|
||||
let message = '';
|
||||
if (numoffavorites == 0) {
|
||||
if (numoffavorites === 0) {
|
||||
message = `Are you sure you want to remove <b>${folder}</b>?`;
|
||||
} else {
|
||||
message = `Removing <b>${folder}</b> will also remove the ${numoffavorites} favorites it contains.`;
|
||||
|
||||
@@ -12,14 +12,14 @@ else {
|
||||
// one favorite
|
||||
const favid = request_headers.query.favoriteid;
|
||||
const favfolder = request_headers.query.favoritefolder;
|
||||
if (folder != favfolder) session_data.favstore.moveFavorite(folder, favfolder, favid);
|
||||
if (folder !== favfolder) session_data.favstore.moveFavorite(folder, favfolder, favid);
|
||||
} else {
|
||||
if (request_headers.query.favoriteid.length == request_headers.query.favoritefolder.length) {
|
||||
// both queries should have the same number of entries
|
||||
if (request_headers.query.favoriteid.length === request_headers.query.favoritefolder.length) {
|
||||
// both queries should have the same number of entries
|
||||
Object.keys(request_headers.query.favoriteid).forEach(function (k) {
|
||||
const favid = request_headers.query.favoriteid[k];
|
||||
const favfolder = request_headers.query.favoritefolder[k];
|
||||
if (folder != favfolder) session_data.favstore.moveFavorite(folder, favfolder, favid);
|
||||
if (folder !== favfolder) session_data.favstore.moveFavorite(folder, favfolder, favid);
|
||||
})
|
||||
} else {
|
||||
error_occured = true;
|
||||
|
||||
@@ -13,23 +13,22 @@ totalfavorites = folder_array.length;
|
||||
|
||||
if (totalfavorites < 14)
|
||||
{
|
||||
if (createFun == "true")
|
||||
if (createFun === "true")
|
||||
session_data.favstore.createTemplateFolder("Fun");
|
||||
|
||||
if (createMoney == "true")
|
||||
if (createMoney === "true")
|
||||
session_data.favstore.createTemplateFolder("Money");
|
||||
|
||||
if (createMovies == "true")
|
||||
if (createMovies === "true")
|
||||
session_data.favstore.createTemplateFolder("Movies");
|
||||
|
||||
if (createNews == "true")
|
||||
if (createNews === "true")
|
||||
session_data.favstore.createTemplateFolder("News");
|
||||
|
||||
if (createRecommended == "true")
|
||||
if (createRecommended === "true")
|
||||
session_data.favstore.createTemplateFolder("Recommended");
|
||||
console.log("FUGHFVJSGHJFDGIJUFDSHGFJDSKHJKLGFHJKHDJKHJKLGF " + createRecommended)
|
||||
|
||||
if (createReference == "true")
|
||||
if (createReference === "true")
|
||||
session_data.favstore.createTemplateFolder("Reference");
|
||||
|
||||
headers = `300 OK
|
||||
|
||||
@@ -2,7 +2,7 @@ const minisrv_service_file = true;
|
||||
|
||||
const favstore_exists = session_data.favstore.favstoreExists();
|
||||
|
||||
if (favstore_exists != true)
|
||||
if (favstore_exists !== true)
|
||||
{
|
||||
session_data.favstore.createFavstore();
|
||||
headers = `300 OK
|
||||
@@ -13,7 +13,7 @@ const folder_array = session_data.favstore.getFolders();
|
||||
const url = request_headers.request;
|
||||
const key = url.split('?')[1]
|
||||
const scfav = session_data.favstore.getShortcutKey(key);
|
||||
if (!scfav.id || scfav.id == "none") {
|
||||
if (!scfav.id || scfav.id === "none") {
|
||||
headers = `400 You have not assigned a favorite to ${key}`
|
||||
} else {
|
||||
const fav = session_data.favstore.getFavorite(scfav.folder, scfav.id);
|
||||
|
||||
@@ -2,16 +2,15 @@ const minisrv_service_file = true;
|
||||
|
||||
const favstore_exists = session_data.favstore.favstoreExists();
|
||||
|
||||
if (favstore_exists != true)
|
||||
if (favstore_exists !== true)
|
||||
{
|
||||
session_data.favstore.createFavstore();
|
||||
headers = `300 OK
|
||||
wtv-expire-all: wtv-favorite:/favorite
|
||||
Location: wtv-favorite:/favorite`
|
||||
} else {
|
||||
|
||||
const folder_array = session_data.favstore.getFolders();
|
||||
const totalfavorites = folder_array.length;
|
||||
const stopdrawing = false;
|
||||
|
||||
headers = `200 OK
|
||||
Connection: Keep-Alive
|
||||
@@ -151,8 +150,8 @@ for ${session_data.getSessionData("subscriber_username") || "You"}
|
||||
let kval = 0;
|
||||
// process evens
|
||||
Object.keys(folder_array).forEach(function (k) {
|
||||
if (k == 0) return; // skip 0 since it was processed above
|
||||
if (parseInt(k) % 2 == 0) {
|
||||
if (parseInt(k)=== 0) return; // skip 0 since it was processed above
|
||||
if (parseInt(k) % 2 === 0) {
|
||||
// even
|
||||
// Left Middle
|
||||
data += `</td></tr><tr><td width="225" valign="middle" height="42" background="ROMCache/LeftMiddle.gif" align="center">
|
||||
@@ -171,7 +170,7 @@ for ${session_data.getSessionData("subscriber_username") || "You"}
|
||||
|
||||
// process end if total is even
|
||||
if (folder_array.length > 1) {
|
||||
if (folder_array.length % 2 == 0) {
|
||||
if (folder_array.length % 2 === 0) {
|
||||
data += `</td></tr><tr><td width="225" valign="middle" height="42" background="ROMCache/LeftBottom.gif" align="center">
|
||||
<table width="50%" cellspacing="0" cellpadding="0">
|
||||
<tr><td width="40" height="20">
|
||||
@@ -182,7 +181,7 @@ for ${session_data.getSessionData("subscriber_username") || "You"}
|
||||
}
|
||||
|
||||
// process middle (folder 2 (id 1))
|
||||
if (folder_array.length == 1) {
|
||||
if (folder_array.length === 1) {
|
||||
// no folder 2
|
||||
data += `<tr><td><table cellspacing="0" cellpadding="0">
|
||||
<tr><td width="6" height="12"><img src="wtv-home:/ROMCache/Spacer.gif" width="1" height="1">
|
||||
@@ -223,8 +222,8 @@ for ${session_data.getSessionData("subscriber_username") || "You"}
|
||||
|
||||
// process odds
|
||||
Object.keys(folder_array).forEach(function (k) {
|
||||
if (k == 1) return; // skip 1 since it was processed above
|
||||
if (parseInt(k) % 2 != 0) {
|
||||
if (parseInt(k) === 1) return; // skip 1 since it was processed above
|
||||
if (parseInt(k) % 2 !== 0) {
|
||||
// odd
|
||||
// Right Middle
|
||||
data += `</td></tr><tr><td width="225" valign="middle" height="42" background="ROMCache/RightMiddle.gif" align="center">
|
||||
@@ -242,7 +241,7 @@ for ${session_data.getSessionData("subscriber_username") || "You"}
|
||||
|
||||
// process end if total is odd
|
||||
if (folder_array.length > 1) {
|
||||
if (folder_array.length % 2 != 0) {
|
||||
if (folder_array.length % 2 !== 0) {
|
||||
data += `</td></tr><tr><td width="225" valign="middle" height="42" background="ROMCache/RightBottom.gif" align="center">
|
||||
<table width="50%" cellspacing="0" cellpadding="0">
|
||||
<tr><td width="5" height="20">
|
||||
|
||||
@@ -188,7 +188,7 @@ by name only.
|
||||
<td valign=top>
|
||||
<input type=hidden name=autosubmit autosubmit=onleave>
|
||||
<INPUT TYPE="checkbox" NAME="with_pictures" `
|
||||
if (session_data.getSessionData("subscriber_fav_images") == "true")
|
||||
if (session_data.getSessionData("subscriber_fav_images") === "true")
|
||||
console.log("SELECTED")
|
||||
data += "checked"
|
||||
data += ` selected>
|
||||
|
||||
@@ -207,7 +207,7 @@ Object.keys(favarray).forEach(function (k) {
|
||||
data += `</td><td abswidth="139" valign="top">
|
||||
<table href="${url}" bgcolor="191919">
|
||||
<tbody><tr><td abswidth="139" align="center">`;
|
||||
if (favarray[k].imagetype == "url")
|
||||
if (favarray[k].imagetype === "url")
|
||||
data += `<img src="${favarray[k].image}" width="70" vspace="5" height="52"><br>`;
|
||||
else
|
||||
data += `<img src="get-thumbnail?folder=${favarray[k].folder}&id=${favarray[k].id}" width="70" vspace="5" height="52"><br>`;
|
||||
@@ -218,7 +218,7 @@ ${favarray[k].title}
|
||||
</font>
|
||||
</td></tr></tbody></table>
|
||||
</td></tr></tbody></table>`;
|
||||
if ((parseInt(k) + 1) % 3 == 0) {
|
||||
if ((parseInt(k) + 1) % 3 === 0) {
|
||||
// every 3 objects
|
||||
data += `</td></tr></tbody></table>
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
|
||||
@@ -112,7 +112,7 @@ let fav;
|
||||
for (let i = 1; i <= 8; i++) {
|
||||
const key = "F" + i;
|
||||
const scfav = session_data.favstore.getShortcutKey(key);
|
||||
if (scfav && scfav.id != "none") {
|
||||
if (scfav && scfav.id !== "none") {
|
||||
fav = session_data.favstore.getFavorite(scfav.folder, scfav.id);
|
||||
} else {
|
||||
fav = { image: "wtv-home:/ROMCache/Spacer.gif", title: "Not assigned" };
|
||||
@@ -135,7 +135,7 @@ ${fav.title}<br>
|
||||
</td><td>
|
||||
<font size="-2" color="#F1F1F1">`;
|
||||
|
||||
if (fav.title != favoritedata.title) {
|
||||
if (fav.title !== favoritedata.title) {
|
||||
data += `<input type="radio" NAME="Choose" VALUE=${key} > ${key}`
|
||||
}
|
||||
|
||||
|
||||
@@ -125,7 +125,7 @@ Discard favorites
|
||||
<input type=hidden name=favorite_folder_name value="${foldername}">
|
||||
<tbody><tr><spacer type=block WIDTH=199 HEIGHT=0><td width="5" height="13"><img src="wtv-home:/ROMCache/Spacer.gif" width="199" height="1">
|
||||
</td></tr></tbody></table></table>`
|
||||
if (favoritenum == 0)
|
||||
if (favoritenum === 0)
|
||||
{
|
||||
data += "<font size=2> <i>There are no favorites to discard in this folder.</i></font>";
|
||||
} else {
|
||||
@@ -133,7 +133,7 @@ for (let i = 0; i < favoritenum; i++) {
|
||||
data += `<tr><table cellspacing=0 cellpadding=0>
|
||||
<td abswidth=15><img src="wtv-home:/ROMCache/Spacer.gif" width=1 height=1>
|
||||
<td abswidth=75 height=52 align=center valign=center>`
|
||||
if (favarray[i].imagetype == "url")
|
||||
if (favarray[i].imagetype === "url")
|
||||
data += `<img src="${favarray[i].image}" width="70" vspace="5" height="52"><br>`
|
||||
else
|
||||
data += `<img src="get-thumbnail?folder=${favarray[i].folder}&id=${favarray[i].id}" width="70" vspace="5" height="52"><br>`
|
||||
@@ -190,7 +190,7 @@ data += `
|
||||
<td align=right valign=center>
|
||||
<td valign=center>
|
||||
<font color="#E7CE4A" size=-1><shadow>`
|
||||
if (favoritenum != 0)
|
||||
if (favoritenum !== 0)
|
||||
{
|
||||
data += `
|
||||
<input
|
||||
|
||||
@@ -120,7 +120,7 @@ data += `<tr><td width=225>
|
||||
</table>
|
||||
</table>`
|
||||
}
|
||||
if (totalfavorites == 1)
|
||||
if (totalfavorites === 1)
|
||||
data += `<tr><td align=left valign=top> </table>
|
||||
<td valign=top align=left>
|
||||
<table cellspacing=0 cellpadding=0 width=115><tr><td width=227 height=20 bgcolor=#2b2b2b>
|
||||
@@ -175,7 +175,7 @@ data += `
|
||||
</table>
|
||||
</table>
|
||||
</form>`
|
||||
if (totalfavorites == 1)
|
||||
if (totalfavorites === 1)
|
||||
data += "<i> You cannot delete your last folder.</i>"
|
||||
data += `
|
||||
<hr width=420>
|
||||
|
||||
@@ -12,7 +12,7 @@ let folderlist = `<select name="newfolder" width=140>
|
||||
<option value="${foldername}" selected="">${foldername}</option>
|
||||
`
|
||||
for (let i = 0; i < foldernum; i++) {
|
||||
if (folder_array[i] == foldername)
|
||||
if (folder_array[i] === foldername)
|
||||
{
|
||||
} else {
|
||||
folderlist += `<option value="${folder_array[i]}">${folder_array[i]}</option>
|
||||
@@ -140,7 +140,7 @@ Move favorites
|
||||
<input type=hidden name=favorite_folder_name value="${foldername}">
|
||||
<tbody><tr><spacer type=block WIDTH=199 HEIGHT=0><td width="5" height="13"><img src="wtv-home:/ROMCache/Spacer.gif" width="199" height="1">
|
||||
</td></tr></tbody></table></table>`
|
||||
if (favoritenum == 0)
|
||||
if (favoritenum === 0)
|
||||
{
|
||||
data += "<font size=2> <i>There are no favorites to move in this folder.</i></font>";
|
||||
} else {
|
||||
@@ -148,7 +148,7 @@ for (let i = 0; i < favoritenum; i++) {
|
||||
data += `<tr><table cellspacing=0 cellpadding=0>
|
||||
<td abswidth=15><img src="wtv-home:/ROMCache/Spacer.gif" width=1 height=1>
|
||||
<td abswidth=75 height=52 align=center valign=center>`
|
||||
if (favarray[i].imagetype == "url")
|
||||
if (favarray[i].imagetype === "url")
|
||||
data += `<img src="${favarray[i].image}" width="70" vspace="5" height="52"><br>`
|
||||
else
|
||||
data += `<img src="get-thumbnail?folder=${favarray[i].folder}&id=${favarray[i].id}" width="70" vspace="5" height="52"><br>`
|
||||
@@ -165,7 +165,7 @@ data += `<select name="favoritefolder" width=140>
|
||||
<option value="${foldername}" selected="">${foldername}</option>
|
||||
`
|
||||
for (let i = 0; i < foldernum; i++) {
|
||||
if (folder_array[i] == foldername)
|
||||
if (folder_array[i] === foldername)
|
||||
{
|
||||
} else {
|
||||
data += `<option value="${folder_array[i]}">${folder_array[i]}</option>
|
||||
|
||||
@@ -126,7 +126,7 @@ Rename favorites
|
||||
<input type=hidden name=favorite_folder_name value="${foldername}">
|
||||
<tbody><tr><spacer type=block WIDTH=199 HEIGHT=0><td width="5" height="13"><img src="wtv-home:/ROMCache/Spacer.gif" width="199" height="1">
|
||||
</td></tr></tbody></table></table>`
|
||||
if (favoritenum == 0)
|
||||
if (favoritenum === 0)
|
||||
{
|
||||
data += "<font size=2> <i>There are no favorites to rename in this folder.</i></font>";
|
||||
} else {
|
||||
@@ -134,7 +134,7 @@ for (let i = 0; i < favoritenum; i++) {
|
||||
data += `<tr><table cellspacing=0 cellpadding=0>
|
||||
<td abswidth=15><img src="wtv-home:/ROMCache/Spacer.gif" width=1 height=1>
|
||||
<td abswidth=75 height=52 align=center valign=center>`
|
||||
if (favarray[i].imagetype == "url")
|
||||
if (favarray[i].imagetype === "url")
|
||||
data += `<img src="${favarray[i].image}" width="70" vspace="5" height="52"><br>`
|
||||
else
|
||||
data += `<img src="get-thumbnail?folder=${favarray[i].folder}&id=${favarray[i].id}" width="70" vspace="5" height="52"><br>`
|
||||
|
||||
@@ -104,7 +104,7 @@ by going to the folder and choosing <b>Organize</b>.<br>
|
||||
<td width=25>
|
||||
<tr>
|
||||
<td width=25>`
|
||||
if (session_data.favstore.folderExists("Fun") == true)
|
||||
if (session_data.favstore.folderExists("Fun") === true)
|
||||
{
|
||||
data += `
|
||||
<td width=50% absheight=30 align=left valign=middle>
|
||||
@@ -124,7 +124,7 @@ if (session_data.favstore.folderExists("Fun") == true)
|
||||
<input type="checkbox" name="Fun" value="true"> Fun
|
||||
</font>`
|
||||
}
|
||||
if (session_data.favstore.folderExists("Money") == true)
|
||||
if (session_data.favstore.folderExists("Money") === true)
|
||||
{
|
||||
data += `
|
||||
<td width=50% absheight=30 align=left valign=middle>
|
||||
@@ -147,7 +147,7 @@ if (session_data.favstore.folderExists("Money") == true)
|
||||
<td width=25>
|
||||
<tr>
|
||||
<td width=25>`
|
||||
if (session_data.favstore.folderExists("Movies") == true)
|
||||
if (session_data.favstore.folderExists("Movies") === true)
|
||||
{
|
||||
data += `
|
||||
<td width=50% absheight=30 align=left valign=middle>
|
||||
@@ -167,7 +167,7 @@ if (session_data.favstore.folderExists("Movies") == true)
|
||||
<input type="checkbox" name="Movies" value="true"> Movies
|
||||
</font>`
|
||||
}
|
||||
if (session_data.favstore.folderExists("News") == true)
|
||||
if (session_data.favstore.folderExists("News") === true)
|
||||
{
|
||||
data += `
|
||||
<td width=50% absheight=30 align=left valign=middle>
|
||||
@@ -191,7 +191,7 @@ data += `
|
||||
<td width=25>
|
||||
<tr>
|
||||
<td width=25>`
|
||||
if (session_data.favstore.folderExists("Recommended") == true)
|
||||
if (session_data.favstore.folderExists("Recommended") === true)
|
||||
{
|
||||
data += `
|
||||
<td width=50% absheight=30 align=left valign=middle>
|
||||
@@ -211,7 +211,7 @@ if (session_data.favstore.folderExists("Recommended") == true)
|
||||
<input type="checkbox" name="Recommended" value="true"> Recommended
|
||||
</font>`
|
||||
}
|
||||
if (session_data.favstore.folderExists("Reference") == true)
|
||||
if (session_data.favstore.folderExists("Reference") === true)
|
||||
{
|
||||
data += `
|
||||
<td width=50% absheight=30 align=left valign=middle>
|
||||
|
||||
@@ -77,7 +77,7 @@ let fav;
|
||||
for (let i = 1; i <= 8; i++) {
|
||||
const key = "F" + i;
|
||||
const scfav = session_data.favstore.getShortcutKey(key);
|
||||
if (scfav && scfav.id != "none") {
|
||||
if (scfav && scfav.id !== "none") {
|
||||
fav = session_data.favstore.getFavorite(scfav.folder, scfav.id);
|
||||
} else {
|
||||
fav = { image: "wtv-home:/ROMCache/Spacer.gif", title: "Not assigned" };
|
||||
|
||||
@@ -113,7 +113,7 @@ Assign shortcut to favorite
|
||||
</td></tr><tr><td width="15">
|
||||
</td><td valign="middle" align="left">
|
||||
<font size="-1" color="#42BC52">`
|
||||
if (favoritenum == 0)
|
||||
if (favoritenum === 0)
|
||||
{
|
||||
data += "<font size=2> <i>There are no favorites to move in this folder.</i></font>";
|
||||
} else {
|
||||
@@ -141,7 +141,7 @@ for (let i = 0; i < favoritenum; i++) {
|
||||
<table bgcolor="191919">
|
||||
<tbody><tr><td abswidth="70" valign="center" align="center">
|
||||
`
|
||||
if (favarray[i].imagetype == "url")
|
||||
if (favarray[i].imagetype === "url")
|
||||
data += `<img src="${favarray[i].image}" width="70" vspace="5" height="52"><br>`
|
||||
else
|
||||
data += `<img src="get-thumbnail?folder=${favarray[i].folder}&id=${favarray[i].id}" width="70" vspace="5" height="52"><br>`
|
||||
|
||||
@@ -6,7 +6,7 @@ const request_path = request_headers.request_url.replace(service_name + ":/", ""
|
||||
const romtype = session_data.get("wtv-client-rom-type");
|
||||
const bootver = session_data.get("wtv-client-bootrom-version")
|
||||
|
||||
if ((romtype == "bf0app" || !romtype) && (bootver == "105" || !bootver)) {
|
||||
if ((romtype === "bf0app" || !romtype) && (bootver === "105" || !bootver)) {
|
||||
// assume old classic in flash mode, override user setting and send tellyscript
|
||||
// because it is required to proceed in flash mode
|
||||
bf0app_update = true;
|
||||
|
||||
@@ -15,7 +15,7 @@ let bf0app_update = true;
|
||||
if (request_headers.query.path) request_path = request_headers.query.path;
|
||||
else request_path = default_build_to_send;
|
||||
|
||||
if (session_data.get("wtv-client-rom-type") == "bf0app" && session_data.get("wtv-client-bootrom-version") == "105") {
|
||||
if (session_data.get("wtv-client-rom-type") === "bf0app" && session_data.get("wtv-client-bootrom-version") === "105") {
|
||||
// assume old classic in flash mode, override user setting and send tellyscript
|
||||
// because it is required to proceed in flash mode
|
||||
bf0app_update = true;
|
||||
|
||||
@@ -7,7 +7,7 @@ const request_path = request_headers.query.path;
|
||||
const romtype = session_data.get("wtv-client-rom-type");
|
||||
const bootver = session_data.get("wtv-client-bootrom-version");
|
||||
|
||||
if ((romtype == "bf0app" || !romtype) && (bootver == "105" || !bootver)) {
|
||||
if ((romtype === "bf0app" || !romtype) && (bootver === "105" || !bootver)) {
|
||||
// assume old classic in flash mode, override user setting and send tellyscript
|
||||
// because it is required to proceed in flash mode
|
||||
bf0app_update = true;
|
||||
|
||||
@@ -7,7 +7,7 @@ if (!request_headers.query.path) {
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
} else {
|
||||
if (request_headers.Referer == service_name + ":/lc2-download-complete?") {
|
||||
if (request_headers.Referer === service_name + ":/lc2-download-complete?") {
|
||||
headers = `200 OK
|
||||
Content-type: text/html
|
||||
minisrv-no-mail-count: true
|
||||
@@ -34,7 +34,7 @@ async function processLC2DownloadPage(flashrom_info, headers, numparts = null) {
|
||||
sendToClient(socket, headers, data);
|
||||
return false;
|
||||
}
|
||||
if (numparts != null) flashrom_info.part_count = parseInt(numparts);
|
||||
if (numparts !== null) flashrom_info.part_count = parseInt(numparts);
|
||||
if (!flashrom_info.part_count) flashrom_info.part_count = parseInt(flashrom_info.message.slice(flashrom_info.message.length - 4).replace(/\D/g, ''));
|
||||
if (parseInt(flashrom_info.part_number) >= 0 && flashrom_info.rompath && flashrom_info.next_rompath) {
|
||||
if (!flashrom_info.message && flashrom_info.is_bootrom) {
|
||||
@@ -129,7 +129,7 @@ Your ${session_data.getBoxName()} is being<br>updated automatically.
|
||||
<p> <font size=+1>
|
||||
This will take about ${downloadTime} minutes and<br>then you can use your ${session_data.getBoxName()} again.
|
||||
`;
|
||||
if (flashrom_info.is_bootrom && flashrom_info.part_number == (flashrom_info.part_count - 1)) {
|
||||
if (flashrom_info.is_bootrom && flashrom_info.part_number === (flashrom_info.part_count - 1)) {
|
||||
data += `<p>
|
||||
The system will pause for about 30 seconds at the end of this
|
||||
update. Please <strong>do not</strong> interrupt the system
|
||||
|
||||
@@ -3,7 +3,7 @@ const minisrv_service_file = true;
|
||||
if (request_headers.query.path) {
|
||||
let url = service_name + ":/get-lc2-page?path=" + encodeURIComponent(request_headers.query.path);
|
||||
const romtype = session_data.get("wtv-client-rom-type");
|
||||
if (romtype == "bf0app") {
|
||||
if (romtype === "bf0app") {
|
||||
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 {
|
||||
|
||||
@@ -15,7 +15,7 @@ const bf0app_update = true;
|
||||
if (request_headers.query.path) request_path = request_headers.query.path;
|
||||
else request_path = default_build_to_send;
|
||||
|
||||
if (session_data.get("wtv-client-rom-type") == "bf0app" && session_data.get("wtv-client-bootrom-version") == "105") {
|
||||
if (session_data.get("wtv-client-rom-type") === "bf0app" && session_data.get("wtv-client-bootrom-version") === "105") {
|
||||
// assume old classic in flash mode, override user setting and send tellyscript
|
||||
// because it is required to proceed in flash mode
|
||||
session_data.set("bf0app_update", bf0app_update);
|
||||
|
||||
@@ -5,7 +5,7 @@ let challenge_response, gourl, wtvsec_login;
|
||||
|
||||
const hasPendingTransfer = session_data.hasPendingTransfer()
|
||||
if (hasPendingTransfer) {
|
||||
if (hasPendingTransfer.type == "target") {
|
||||
if (hasPendingTransfer.type === "target") {
|
||||
const xferSession = new WTVClientSessionData(minisrv_config, hasPendingTransfer.ssid);
|
||||
xferSession.user_id = 0
|
||||
const primary_username = xferSession.listPrimaryAccountUsers()['subscriber']['subscriber_username'];
|
||||
@@ -21,7 +21,7 @@ if (hasPendingTransfer) {
|
||||
const errpage = wtvshared.doRedirect(transferPendingDest);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
} else if (hasPendingTransfer.type == "source") {
|
||||
} else if (hasPendingTransfer.type === "source") {
|
||||
const transferPendingSrc = new clientShowAlert({
|
||||
'image': minisrv_config.config.service_logo,
|
||||
'message': "There is a pending transfer of this account to <b>" + hasPendingTransfer.ssid + "</b>. In order to use this box, you need to complete or cancel the transfer.",
|
||||
@@ -58,11 +58,11 @@ wtv-visit: client:hangupphone`
|
||||
}
|
||||
let errpage;
|
||||
if (socket.ssid !== null) {
|
||||
if (wtvsec_login.ticket_b64 == null) {
|
||||
if (wtvsec_login.ticket_b64 === null) {
|
||||
challenge_response = wtvsec_login.challenge_response;
|
||||
client_challenge_response = request_headers["wtv-challenge-response"] || null;
|
||||
if (challenge_response && client_challenge_response) {
|
||||
if (challenge_response.toString(CryptoJS.enc.Base64) == client_challenge_response) {
|
||||
if (challenge_response.toString(CryptoJS.enc.Base64) === client_challenge_response) {
|
||||
console.log(" * wtv-challenge-response success for " + wtvshared.filterSSID(socket.ssid));
|
||||
wtvsec_login.PrepareTicket();
|
||||
gourl = "wtv-head-waiter:/login-stage-two?";
|
||||
@@ -84,8 +84,8 @@ wtv-visit: client:hangupphone`
|
||||
}
|
||||
}
|
||||
if (!errpage) {
|
||||
if (user_id != null && !request_headers.query.initial_login && !request_headers.query.user_login && !request_headers.query.relogin && !request_headers.query.reconnect) {
|
||||
if (request_headers.query.password == "") {
|
||||
if (user_id !== null && !request_headers.query.initial_login && !request_headers.query.user_login && !request_headers.query.relogin && !request_headers.query.reconnect) {
|
||||
if (request_headers.query.password === "") {
|
||||
headers = `403 Please enter your password and try again
|
||||
minisrv-no-mail-count: true`;
|
||||
} else if (session_data.validateUserPassword(request_headers.query.password)) {
|
||||
|
||||
@@ -82,10 +82,10 @@ let accounts_listed = 0;
|
||||
for (const [key, value] of Object.entries(accounts)) {
|
||||
let user_id;
|
||||
data += "<td absheight=37><td valign=middle abswidth=50% maxlines=1>";
|
||||
if (key == "subscriber") user_id = 0;
|
||||
if (key === "subscriber") user_id = 0;
|
||||
else user_id = key.replace("user", '');
|
||||
data += `<a href=/ValidateLogin?user_id=${user_id}&user_login=true nocancel>`;
|
||||
if (key == "subscriber") data += `<font size=+1><b>${value['subscriber_username']}</b></font></a>`;
|
||||
if (key === "subscriber") data += `<font size=+1><b>${value['subscriber_username']}</b></font></a>`;
|
||||
else data += `<font size=+1>${value['subscriber_username']}</font>`
|
||||
data += "<td width=15><td nowrap> <font color=42BD52>";
|
||||
const userSession = new WTVClientSessionData(minisrv_config, socket.ssid);
|
||||
|
||||
@@ -7,7 +7,7 @@ if (socket.ssid && session_data) {
|
||||
socket_sessions[socket.id].wtvsec.ticket_b64 = request_headers["wtv-ticket"];
|
||||
//socket_sessions[socket.id].secure == true;
|
||||
}
|
||||
} else if (socket_sessions[socket.id].wtvsec.ticket_b64 == null) {
|
||||
} else if (socket_sessions[socket.id].wtvsec.ticket_b64 === null) {
|
||||
// TODO: client should have a ticket and send it back by now, if not we should handle this correctly
|
||||
}
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ else {
|
||||
if (session_data.getSessionData("subscriber_smtp_password") === null) {
|
||||
session_data.setUserSMTPPassword(wtvshared.generatePassword(16));
|
||||
}
|
||||
if (session_data.user_id == 0) {
|
||||
if (session_data.user_id === 0) {
|
||||
const accounts = session_data.listPrimaryAccountUsers();
|
||||
let offline_user_list_str = "<user-list>\n";
|
||||
let i = 0;
|
||||
@@ -167,7 +167,7 @@ wtv-inactive-timeout: 1440
|
||||
headers += "wtv-home-url: " + home_url + "\n";
|
||||
}
|
||||
|
||||
if (session_data.get('wtv-need-upgrade') != 'true' && !request_headers.query.reconnect && !limitedLogin && !limitedLoginRegistered)
|
||||
if (session_data.get('wtv-need-upgrade') !== 'true' && !request_headers.query.reconnect && !limitedLogin && !limitedLoginRegistered)
|
||||
headers += "wtv-settings-url: wtv-setup:/get\n";
|
||||
|
||||
if (!limitedLogin && !limitedLoginRegistered) {
|
||||
|
||||
@@ -14,7 +14,7 @@ let send_to_relogin = true;
|
||||
|
||||
if (session_data) {
|
||||
if (request_headers["wtv-ticket"]) {
|
||||
if (session_data.data_store.wtvsec_login.ticket_b64 == null) {
|
||||
if (session_data.data_store.wtvsec_login.ticket_b64 === null) {
|
||||
if (request_headers["wtv-ticket"].length > 8) {
|
||||
session_data.data_store.wtvsec_login.DecodeTicket(request_headers["wtv-ticket"]);
|
||||
session_data.data_store.wtvsec_login.ticket_b64 = request_headers["wtv-ticket"];
|
||||
@@ -25,7 +25,7 @@ if (session_data) {
|
||||
if (session_data.data_store.wtvsec_login) {
|
||||
const client_challenge_response = request_headers["wtv-challenge-response"] || null;
|
||||
if (challenge_response && client_challenge_response) {
|
||||
if (challenge_response.toString(CryptoJS.enc.Base64).slice(0, 85) == client_challenge_response.slice(0, 85)) {
|
||||
if (challenge_response.toString(CryptoJS.enc.Base64).slice(0, 85) === client_challenge_response.slice(0, 85)) {
|
||||
console.log(" * wtv-challenge-response success for " + socket.ssid);
|
||||
session_data.data_store.wtvsec_login.PrepareTicket();
|
||||
send_to_relogin = false;
|
||||
@@ -50,7 +50,7 @@ Expires: Wed, 09 Oct 1991 22:00:00 GMT
|
||||
wtv-expire-all: wtv-head-waiter:
|
||||
`+ getServiceString('wtv-log') + `
|
||||
wtv-log-url: wtv-log:/log`;
|
||||
if (challenge_header != "") headers += "\n" + challenge_header;
|
||||
if (challenge_header !== "") headers += "\n" + challenge_header;
|
||||
headers += `
|
||||
wtv-country: US
|
||||
wtv-language-header: en-US,en
|
||||
|
||||
@@ -4,7 +4,7 @@ const action = request_headers.query.action;
|
||||
|
||||
let address_book = null
|
||||
address_book = session_data.getSessionData("address_book")
|
||||
if (address_book == null) {
|
||||
if (address_book === null) {
|
||||
session_data.setSessionData("address_book", [])
|
||||
address_book = [];
|
||||
}
|
||||
@@ -625,9 +625,9 @@ text="E7CE4A"
|
||||
font=proportional
|
||||
name="nickname"
|
||||
value="`;
|
||||
if (action == 'editfromheader') {
|
||||
if (action === 'editfromheader') {
|
||||
data += request_headers.query.nickname
|
||||
} else if (action == 'edit' && request_headers.query.id) {
|
||||
} else if (action === 'edit' && request_headers.query.id) {
|
||||
data += address_book[request_headers.query.id].name
|
||||
}
|
||||
data += `"
|
||||
@@ -652,9 +652,9 @@ font=proportional
|
||||
nosoftbreaks nohardbreaks
|
||||
name="address"
|
||||
value="`;
|
||||
if (action == 'editfromheader') {
|
||||
if (action === 'editfromheader') {
|
||||
data += request_headers.query.address
|
||||
} else if (action == 'edit' && request_headers.query.id) {
|
||||
} else if (action === 'edit' && request_headers.query.id) {
|
||||
data += address_book[request_headers.query.id].address
|
||||
}
|
||||
data += `"
|
||||
@@ -784,7 +784,7 @@ Location: wtv-mail:/addressbook`;
|
||||
break;
|
||||
|
||||
case "discard":
|
||||
if (address_book.length == 1) {
|
||||
if (address_book.length === 1) {
|
||||
address_book = []
|
||||
} else {
|
||||
address_book.splice(request_headers.query.id, 1)
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user