| `;
- var i = 0;
- var j = 0;
- var self = this;
+ let i = 0;
+ let j = 0;
+ const self = this;
Object.keys(this.page_args.letters).forEach(function (k) {
data += ` | \n${self.page_args.letters[k]}\n`
i++;
diff --git a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/templates/glossary_word_index.js b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/templates/glossary_word_index.js
index 0c36c61b..959c7c61 100644
--- a/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/templates/glossary_word_index.js
+++ b/zefie_wtvp_minisrv/includes/ServiceDeps/templates/wtv-guide/templates/glossary_word_index.js
@@ -7,7 +7,7 @@ class WTVTemplate {
}
getTemplatePage() {
- var data = `
+ let data = `
Web words: ${this.page_args.letter}
`;
- var table_split = Math.floor(this.page_args.words.length / 2);
- var words_rendered = 0;
- var self = this;
+ const table_split = Math.floor(this.page_args.words.length / 2);
+ let words_rendered = 0;
+ const self = this;
Object.keys(this.page_args.words).forEach(function (k) {
// test
data += `${self.page_args.words[k].word} \n`
diff --git a/zefie_wtvp_minisrv/includes/ServiceVault/http_pb/index.js b/zefie_wtvp_minisrv/includes/ServiceVault/http_pb/index.js
index 41e48057..a5ff3626 100644
--- a/zefie_wtvp_minisrv/includes/ServiceVault/http_pb/index.js
+++ b/zefie_wtvp_minisrv/includes/ServiceVault/http_pb/index.js
@@ -1,12 +1,12 @@
-var minisrv_service_file = true;
+const minisrv_service_file = true;
-var site = "";
+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") {
- var target_service = minisrv_config.services[minisrv_config.services['wtv-author'].publish_dest];
+ const target_service = minisrv_config.services[minisrv_config.services['wtv-author'].publish_dest];
if (target_service) {
site = target_service.host + ":" + target_service.port;
}
diff --git a/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/admin/index.js b/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/admin/index.js
index 168d0037..b26c332b 100644
--- a/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/admin/index.js
+++ b/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/admin/index.js
@@ -1,12 +1,12 @@
-var minisrv_service_file = true;
+const minisrv_service_file = true;
-WTVAdmin = require(classPath + "/WTVAdmin.js")
-var wtva = new WTVAdmin(minisrv_config, socket, service_name);
-var auth = wtva.isAuthorized();
+const WTVAdmin = require(classPath + "/WTVAdmin.js")
+const wtva = new WTVAdmin(minisrv_config, socket, service_name);
+const auth = wtva.isAuthorized();
if (auth === true) {
- var password = null;
+ let password = null;
if (request_headers.authorization) {
- var authheader = request_headers.authorization.split(' ');
+ const authheader = request_headers.authorization.split(' ');
console.log(request_headers)
if (authheader[0] == "Basic") {
@@ -18,7 +18,7 @@ if (auth === true) {
headers = `200 OK
Content-Type: text/html`
- htmlhead = `
+ data = `
zefie minisrv v${minisrv_config.version} account administration
@@ -27,7 +27,6 @@ Content-Type: text/html`
Welcome to the zefie minisrv v${minisrv_config.version} Account Administration
`;
- data = htmlhead;
data += `Please select an option to get started:
List all SSIDs and their Primary User
@@ -36,13 +35,13 @@ Welcome to the zefie minisrv v${minisrv_config.version} Account Administration
`;
} else {
- var errpage = wtvshared.doErrorPage(401, "Please enter the administration password, you can leave the username blank.");
+ const errpage = wtvshared.doErrorPage(401, "Please enter the administration password, you can leave the username blank.");
headers = errpage[0];
headers += "\nWWW-Authenticate: Basic";
data = errpage[1];
}
} else {
- var errpage = wtvshared.doErrorPage(403, auth);
+ const errpage = wtvshared.doErrorPage(403, auth);
headers = errpage[0];
data = errpage[1];
}
\ No newline at end of file
diff --git a/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/admin/ssid.js b/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/admin/ssid.js
index fc1f04fb..1fb1a48c 100644
--- a/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/admin/ssid.js
+++ b/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/admin/ssid.js
@@ -1,24 +1,26 @@
-var minisrv_service_file = true;
+const minisrv_service_file = true;
-WTVAdmin = require(classPath + "/WTVAdmin.js")
-var wtva = new WTVAdmin(minisrv_config, socket, service_name);
-var auth = wtva.isAuthorized();
+const WTVAdmin = require(classPath + "/WTVAdmin.js")
+const wtva = new WTVAdmin(minisrv_config, socket, service_name);
+const auth = wtva.isAuthorized();
if (auth === true) {
- var password = null;
+ const password = null;
if (request_headers.authorization) {
- var authheader = request_headers.authorization.split(' ');
+ const authheader = request_headers.authorization.split(' ');
console.log(request_headers)
if (authheader[0] == "Basic") {
- password = Buffer.from(authheader[1], 'base64').toString();
+ let password = Buffer.from(authheader[1], 'base64').toString();
password = password.split(':')[1];
}
}
if (wtva.checkPassword(password)) {
+ let redirectmsg = "";
+ let result = false;
headers = `200 OK
Content-Type: text/html`
- htmlhead = `
+ data = `
zefie minisrv v${minisrv_config.version} account administration
@@ -27,21 +29,20 @@ Content-Type: text/html`
Welcome to the zefie minisrv v${minisrv_config.version} Account Administration
`;
- data = htmlhead;
if (request_headers.query.cmd == "list") {
data += ` `;
if (request_headers.query.msg) {
data += decodeURI(request_headers.query.msg) + " ";
}
data += ``;
- accounts = wtva.listRegisteredSSIDs();
+ const accounts = wtva.listRegisteredSSIDs();
Object.keys(accounts).forEach(function (k) {
data += `| ${accounts[k][0]} | ${(accounts[k][1]['username'] === undefined) ? "Unregistered SSID" : accounts[k][1]['username'] } | `;
});
data += ` `;
} else if (request_headers.query.cmd == "ssid") {
- var ssid = request_headers.query.ssid;
+ const ssid = request_headers.query.ssid;
if (!ssid) {
redirectmsg = `An SSID is required for the ${request_headers.query.cmd} command.`;
} else {
@@ -70,7 +71,7 @@ function validateSelection(cmd, ssid, friendlymsg) {
}
data += "Back to SSID List";
data += " ";
- user_info = wtva.getAccountInfoBySSID(ssid);
+ const user_info = wtva.getAccountInfoBySSID(ssid);
if (user_info.account_users) {
if (user_info.account_users['subscriber']) {
data += `| Primary User: | ${user_info.account_users['subscriber'].subscriber_username} | `;
@@ -92,9 +93,9 @@ function validateSelection(cmd, ssid, friendlymsg) {
}
} else if (request_headers.query.cmd == "delete") {
redirectmsg = "";
- var ssid = request_headers.query.ssid;
+ const ssid = request_headers.query.ssid;
if (ssid) {
- var userAccount = wtva.getAccountBySSID(ssid);
+ const userAccount = wtva.getAccountBySSID(ssid);
userAccount.unregisterBox();
redirectmsg = `All data for SSID ${ssid} has been deleted. Please note that this does not include Usenet posts made by this account.`;
} else {
@@ -103,9 +104,9 @@ function validateSelection(cmd, ssid, friendlymsg) {
headers = "302 OK\nLocation: /admin/?cmd=list&msg=" + encodeURI(redirectmsg);
} else if (request_headers.query.cmd == "ban") {
redirectmsg = "";
- var ssid = request_headers.query.ssid;
+ const ssid = request_headers.query.ssid;
if (ssid) {
- var result = wtva.banSSID(ssid);
+ result = wtva.banSSID(ssid);
if (result === wtva.SUCCESS) {
reloadConfig();
redirectmsg = "The SSID is now banned.";
@@ -120,9 +121,9 @@ function validateSelection(cmd, ssid, friendlymsg) {
headers = "302 OK\nLocation: /admin/?cmd=ssid&ssid=" + encodeURI(ssid) + "&msg=" + encodeURI(redirectmsg);
} else if (request_headers.query.cmd == "unban") {
redirectmsg = "The SSID was not banned, so it could not be unbanned.";
- var ssid = request_headers.query.ssid;
+ const ssid = request_headers.query.ssid;
if (ssid) {
- var result = wtv.unbanSSID(ssid);
+ result = wtva.unbanSSID(ssid);
if (result === wtva.SUCCESS) {
reloadConfig();
redirectmsg = "The SSID is now unbanned.";
@@ -136,19 +137,19 @@ function validateSelection(cmd, ssid, friendlymsg) {
}
headers = "302 OK\nLocation: /admin/?cmd=ssid&ssid=" + encodeURI(ssid) + "&msg=" + encodeURI(redirectmsg);
} else {
- var errpage = wtvshared.doErrorPage(401, "Missing command.");
+ const errpage = wtvshared.doErrorPage(401, "Missing command.");
headers = errpage[0];
headers += "\nWWW-Authenticate: Basic";
data = errpage[1];
}
} else {
- var errpage = wtvshared.doErrorPage(401, "Please enter the administration password, you can leave the username blank.");
+ const errpage = wtvshared.doErrorPage(401, "Please enter the administration password, you can leave the username blank.");
headers = errpage[0];
headers += "\nWWW-Authenticate: Basic";
data = errpage[1];
}
} else {
- var errpage = wtvshared.doErrorPage(403, auth);
+ const errpage = wtvshared.doErrorPage(403, auth);
headers = errpage[0];
data = errpage[1];
}
diff --git a/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/index.js b/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/index.js
index 5f29f54a..786addf2 100644
--- a/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/index.js
+++ b/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/index.js
@@ -1,4 +1,4 @@
-var minisrv_service_file = true;
+const minisrv_service_file = true;
headers = `200 OK
Content-Type: text/html`
diff --git a/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/indexer.js b/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/indexer.js
index d88c438b..7eb98a9f 100644
--- a/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/indexer.js
+++ b/zefie_wtvp_minisrv/includes/ServiceVault/http_pc/indexer.js
@@ -1,14 +1,15 @@
-var minisrv_service_file = true;
+const minisrv_service_file = true;
+
try {
- var relativePath = request_headers.request_url;
+ let relativePath = request_headers.request_url;
if (relativePath.indexOf('?') > -1) relativePath = relativePath.split('?')[0];
while (relativePath.endsWith('/')) relativePath = relativePath.substring(0, relativePath.length - 1);
- var dir = service_name + relativePath;
- var num_per_page = 25;
- var dirs = ['| Directory | Parent Directory | - | - | '];
- var files = [];
- vault_found = false;
+ const dir = service_name + relativePath;
+ const num_per_page = 25;
+ const dirs = ['| Directory | Parent Directory | - | - | '];
+ const files = [];
+ let vault_found = false;
// Iterate through each service vault to find the first occurrence
@@ -25,7 +26,7 @@ try {
// Check if entry exists in all service vaults
let found = false;
- var checkPath = "";
+ let checkPath = "";
for (let j = 0; j < service_vaults.length; j++) {
checkPath = path.join(service_vaults[j], dir || '', entry);
if (fs.existsSync(checkPath)) {
@@ -41,7 +42,7 @@ try {
const stats = fs.statSync(fullPath);
const isDir = stats.isDirectory();
const mimeType = (isDir) ? "Directory" : wtvmime.getContentType(fullPath)[1];
- var readableSize = '-';
+ let readableSize = '-';
// Get file size with unit
if (!isDir) {
const fileSize = stats.size;
@@ -85,7 +86,7 @@ try {
}
if (!vault_found) {
- var errpage = wtvshared.doErrorPage(404);
+ const errpage = wtvshared.doErrorPage(404);
headers = errpage[0];
data = errpage[1];
} else {
@@ -105,7 +106,7 @@ try {
const merged_files = dirs.concat(files);
const paginatedFiles = merged_files.slice(start_index, end_index);
- let paginationHtml = `
+ const paginationHtml = `
| |