fix/optimize ServiceDeps, http_pb, and http_pc
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
var minisrv_service_file = true;
|
const minisrv_service_file = true;
|
||||||
|
|
||||||
headers = `200 OK
|
headers = `200 OK
|
||||||
Connection: Keep-Alive
|
Connection: Keep-Alive
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
var minisrv_service_file = true;
|
const minisrv_service_file = true;
|
||||||
|
|
||||||
headers = `200 OK
|
headers = `200 OK
|
||||||
Connection: Keep-Alive
|
Connection: Keep-Alive
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class WTVTemplate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getTemplatePage() {
|
getTemplatePage() {
|
||||||
var data = `<html>
|
return `<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Web words: ${this.page_args.word}</title>
|
<title>Web words: ${this.page_args.word}</title>
|
||||||
<display
|
<display
|
||||||
@@ -77,7 +77,6 @@ selected>
|
|||||||
</table>
|
</table>
|
||||||
</body>
|
</body>
|
||||||
</html>`;
|
</html>`;
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
module.exports = WTVTemplate;
|
module.exports = WTVTemplate;
|
||||||
@@ -7,7 +7,7 @@ class WTVTemplate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getTemplatePage() {
|
getTemplatePage() {
|
||||||
var data = `<html>
|
let data = `<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Web words: Index</title>
|
<title>Web words: Index</title>
|
||||||
<display
|
<display
|
||||||
@@ -57,9 +57,9 @@ Web words
|
|||||||
Choose the first letter of the word you are looking for.
|
Choose the first letter of the word you are looking for.
|
||||||
<spacer type=vertical height=20><br>
|
<spacer type=vertical height=20><br>
|
||||||
<tr><td height=32>`;
|
<tr><td height=32>`;
|
||||||
var i = 0;
|
let i = 0;
|
||||||
var j = 0;
|
let j = 0;
|
||||||
var self = this;
|
const self = this;
|
||||||
Object.keys(this.page_args.letters).forEach(function (k) {
|
Object.keys(this.page_args.letters).forEach(function (k) {
|
||||||
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`
|
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++;
|
i++;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ class WTVTemplate {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getTemplatePage() {
|
getTemplatePage() {
|
||||||
var data = `<html>
|
let data = `<html>
|
||||||
<head>
|
<head>
|
||||||
<title>Web words: ${this.page_args.letter}</title>
|
<title>Web words: ${this.page_args.letter}</title>
|
||||||
<display
|
<display
|
||||||
@@ -56,9 +56,9 @@ Choose a word to see what it means.
|
|||||||
<td width=180>
|
<td width=180>
|
||||||
<tr>
|
<tr>
|
||||||
<td>`;
|
<td>`;
|
||||||
var table_split = Math.floor(this.page_args.words.length / 2);
|
const table_split = Math.floor(this.page_args.words.length / 2);
|
||||||
var words_rendered = 0;
|
let words_rendered = 0;
|
||||||
var self = this;
|
const self = this;
|
||||||
Object.keys(this.page_args.words).forEach(function (k) {
|
Object.keys(this.page_args.words).forEach(function (k) {
|
||||||
// test
|
// 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`
|
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`
|
||||||
|
|||||||
@@ -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) {
|
if (minisrv_config.services['wtv-author'].public_domain) {
|
||||||
site = minisrv_config.services['wtv-author'].public_domain;
|
site = minisrv_config.services['wtv-author'].public_domain;
|
||||||
} else {
|
} else {
|
||||||
if (minisrv_config.services['wtv-author'].publish_mode == "service") {
|
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) {
|
if (target_service) {
|
||||||
site = target_service.host + ":" + target_service.port;
|
site = target_service.host + ":" + target_service.port;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,12 +1,12 @@
|
|||||||
var minisrv_service_file = true;
|
const minisrv_service_file = true;
|
||||||
|
|
||||||
WTVAdmin = require(classPath + "/WTVAdmin.js")
|
const WTVAdmin = require(classPath + "/WTVAdmin.js")
|
||||||
var wtva = new WTVAdmin(minisrv_config, socket, service_name);
|
const wtva = new WTVAdmin(minisrv_config, socket, service_name);
|
||||||
var auth = wtva.isAuthorized();
|
const auth = wtva.isAuthorized();
|
||||||
if (auth === true) {
|
if (auth === true) {
|
||||||
var password = null;
|
let password = null;
|
||||||
if (request_headers.authorization) {
|
if (request_headers.authorization) {
|
||||||
var authheader = request_headers.authorization.split(' ');
|
const authheader = request_headers.authorization.split(' ');
|
||||||
console.log(request_headers)
|
console.log(request_headers)
|
||||||
|
|
||||||
if (authheader[0] == "Basic") {
|
if (authheader[0] == "Basic") {
|
||||||
@@ -18,7 +18,7 @@ if (auth === true) {
|
|||||||
headers = `200 OK
|
headers = `200 OK
|
||||||
Content-Type: text/html`
|
Content-Type: text/html`
|
||||||
|
|
||||||
htmlhead = `<html>
|
data = `<html>
|
||||||
<head>
|
<head>
|
||||||
<title>zefie minisrv v${minisrv_config.version} account administration</title>
|
<title>zefie minisrv v${minisrv_config.version} account administration</title>
|
||||||
</head>
|
</head>
|
||||||
@@ -27,7 +27,6 @@ Content-Type: text/html`
|
|||||||
Welcome to the zefie minisrv v${minisrv_config.version} Account Administration
|
Welcome to the zefie minisrv v${minisrv_config.version} Account Administration
|
||||||
</p>
|
</p>
|
||||||
`;
|
`;
|
||||||
data = htmlhead;
|
|
||||||
data += `Please select an option to get started:
|
data += `Please select an option to get started:
|
||||||
<hr>
|
<hr>
|
||||||
<a href="/admin/ssid?cmd=list">List all SSIDs and their Primary User</a><br>
|
<a href="/admin/ssid?cmd=list">List all SSIDs and their Primary User</a><br>
|
||||||
@@ -36,13 +35,13 @@ Welcome to the zefie minisrv v${minisrv_config.version} Account Administration
|
|||||||
</html >`;
|
</html >`;
|
||||||
|
|
||||||
} else {
|
} 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 = errpage[0];
|
||||||
headers += "\nWWW-Authenticate: Basic";
|
headers += "\nWWW-Authenticate: Basic";
|
||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var errpage = wtvshared.doErrorPage(403, auth);
|
const errpage = wtvshared.doErrorPage(403, auth);
|
||||||
headers = errpage[0];
|
headers = errpage[0];
|
||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
}
|
}
|
||||||
@@ -1,24 +1,26 @@
|
|||||||
var minisrv_service_file = true;
|
const minisrv_service_file = true;
|
||||||
|
|
||||||
WTVAdmin = require(classPath + "/WTVAdmin.js")
|
const WTVAdmin = require(classPath + "/WTVAdmin.js")
|
||||||
var wtva = new WTVAdmin(minisrv_config, socket, service_name);
|
const wtva = new WTVAdmin(minisrv_config, socket, service_name);
|
||||||
var auth = wtva.isAuthorized();
|
const auth = wtva.isAuthorized();
|
||||||
if (auth === true) {
|
if (auth === true) {
|
||||||
var password = null;
|
const password = null;
|
||||||
if (request_headers.authorization) {
|
if (request_headers.authorization) {
|
||||||
var authheader = request_headers.authorization.split(' ');
|
const authheader = request_headers.authorization.split(' ');
|
||||||
console.log(request_headers)
|
console.log(request_headers)
|
||||||
|
|
||||||
if (authheader[0] == "Basic") {
|
if (authheader[0] == "Basic") {
|
||||||
password = Buffer.from(authheader[1], 'base64').toString();
|
let password = Buffer.from(authheader[1], 'base64').toString();
|
||||||
password = password.split(':')[1];
|
password = password.split(':')[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (wtva.checkPassword(password)) {
|
if (wtva.checkPassword(password)) {
|
||||||
|
let redirectmsg = "";
|
||||||
|
let result = false;
|
||||||
headers = `200 OK
|
headers = `200 OK
|
||||||
Content-Type: text/html`
|
Content-Type: text/html`
|
||||||
|
|
||||||
htmlhead = `<html>
|
data = `<html>
|
||||||
<head>
|
<head>
|
||||||
<title>zefie minisrv v${minisrv_config.version} account administration</title>
|
<title>zefie minisrv v${minisrv_config.version} account administration</title>
|
||||||
</head>
|
</head>
|
||||||
@@ -27,21 +29,20 @@ Content-Type: text/html`
|
|||||||
Welcome to the zefie minisrv v${minisrv_config.version} Account Administration
|
Welcome to the zefie minisrv v${minisrv_config.version} Account Administration
|
||||||
</p>
|
</p>
|
||||||
`;
|
`;
|
||||||
data = htmlhead;
|
|
||||||
if (request_headers.query.cmd == "list") {
|
if (request_headers.query.cmd == "list") {
|
||||||
data += `<hr>`;
|
data += `<hr>`;
|
||||||
if (request_headers.query.msg) {
|
if (request_headers.query.msg) {
|
||||||
data += decodeURI(request_headers.query.msg) + "<hr>";
|
data += decodeURI(request_headers.query.msg) + "<hr>";
|
||||||
}
|
}
|
||||||
data += `<table border=1>`;
|
data += `<table border=1>`;
|
||||||
accounts = wtva.listRegisteredSSIDs();
|
const accounts = wtva.listRegisteredSSIDs();
|
||||||
Object.keys(accounts).forEach(function (k) {
|
Object.keys(accounts).forEach(function (k) {
|
||||||
data += `<tr><td><a href="?cmd=ssid&ssid=${accounts[k][0]}">${accounts[k][0]}</a></td><td>${(accounts[k][1]['username'] === undefined) ? "Unregistered SSID" : accounts[k][1]['username'] }</td></tr>`;
|
data += `<tr><td><a href="?cmd=ssid&ssid=${accounts[k][0]}">${accounts[k][0]}</a></td><td>${(accounts[k][1]['username'] === undefined) ? "Unregistered SSID" : accounts[k][1]['username'] }</td></tr>`;
|
||||||
});
|
});
|
||||||
data += `</table>`;
|
data += `</table>`;
|
||||||
|
|
||||||
} else if (request_headers.query.cmd == "ssid") {
|
} else if (request_headers.query.cmd == "ssid") {
|
||||||
var ssid = request_headers.query.ssid;
|
const ssid = request_headers.query.ssid;
|
||||||
if (!ssid) {
|
if (!ssid) {
|
||||||
redirectmsg = `An SSID is required for the ${request_headers.query.cmd} command.`;
|
redirectmsg = `An SSID is required for the ${request_headers.query.cmd} command.`;
|
||||||
} else {
|
} else {
|
||||||
@@ -70,7 +71,7 @@ function validateSelection(cmd, ssid, friendlymsg) {
|
|||||||
}
|
}
|
||||||
data += "<p><a href='?cmd=list'>Back to SSID List</a>";
|
data += "<p><a href='?cmd=list'>Back to SSID List</a>";
|
||||||
data += "<p><table border=1>";
|
data += "<p><table border=1>";
|
||||||
user_info = wtva.getAccountInfoBySSID(ssid);
|
const user_info = wtva.getAccountInfoBySSID(ssid);
|
||||||
if (user_info.account_users) {
|
if (user_info.account_users) {
|
||||||
if (user_info.account_users['subscriber']) {
|
if (user_info.account_users['subscriber']) {
|
||||||
data += `<tr><td>Primary User:</td><td>${user_info.account_users['subscriber'].subscriber_username}</td></tr>`;
|
data += `<tr><td>Primary User:</td><td>${user_info.account_users['subscriber'].subscriber_username}</td></tr>`;
|
||||||
@@ -92,9 +93,9 @@ function validateSelection(cmd, ssid, friendlymsg) {
|
|||||||
}
|
}
|
||||||
} else if (request_headers.query.cmd == "delete") {
|
} else if (request_headers.query.cmd == "delete") {
|
||||||
redirectmsg = "";
|
redirectmsg = "";
|
||||||
var ssid = request_headers.query.ssid;
|
const ssid = request_headers.query.ssid;
|
||||||
if (ssid) {
|
if (ssid) {
|
||||||
var userAccount = wtva.getAccountBySSID(ssid);
|
const userAccount = wtva.getAccountBySSID(ssid);
|
||||||
userAccount.unregisterBox();
|
userAccount.unregisterBox();
|
||||||
redirectmsg = `All data for SSID ${ssid} has been deleted. Please note that this does not include Usenet posts made by this account.`;
|
redirectmsg = `All data for SSID ${ssid} has been deleted. Please note that this does not include Usenet posts made by this account.`;
|
||||||
} else {
|
} else {
|
||||||
@@ -103,9 +104,9 @@ function validateSelection(cmd, ssid, friendlymsg) {
|
|||||||
headers = "302 OK\nLocation: /admin/?cmd=list&msg=" + encodeURI(redirectmsg);
|
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 = "";
|
redirectmsg = "";
|
||||||
var ssid = request_headers.query.ssid;
|
const ssid = request_headers.query.ssid;
|
||||||
if (ssid) {
|
if (ssid) {
|
||||||
var result = wtva.banSSID(ssid);
|
result = wtva.banSSID(ssid);
|
||||||
if (result === wtva.SUCCESS) {
|
if (result === wtva.SUCCESS) {
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
redirectmsg = "The SSID is now banned.";
|
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);
|
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.";
|
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) {
|
if (ssid) {
|
||||||
var result = wtv.unbanSSID(ssid);
|
result = wtva.unbanSSID(ssid);
|
||||||
if (result === wtva.SUCCESS) {
|
if (result === wtva.SUCCESS) {
|
||||||
reloadConfig();
|
reloadConfig();
|
||||||
redirectmsg = "The SSID is now unbanned.";
|
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);
|
headers = "302 OK\nLocation: /admin/?cmd=ssid&ssid=" + encodeURI(ssid) + "&msg=" + encodeURI(redirectmsg);
|
||||||
} else {
|
} else {
|
||||||
var errpage = wtvshared.doErrorPage(401, "Missing command.");
|
const errpage = wtvshared.doErrorPage(401, "Missing command.");
|
||||||
headers = errpage[0];
|
headers = errpage[0];
|
||||||
headers += "\nWWW-Authenticate: Basic";
|
headers += "\nWWW-Authenticate: Basic";
|
||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
}
|
}
|
||||||
} else {
|
} 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 = errpage[0];
|
||||||
headers += "\nWWW-Authenticate: Basic";
|
headers += "\nWWW-Authenticate: Basic";
|
||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
var errpage = wtvshared.doErrorPage(403, auth);
|
const errpage = wtvshared.doErrorPage(403, auth);
|
||||||
headers = errpage[0];
|
headers = errpage[0];
|
||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
var minisrv_service_file = true;
|
const minisrv_service_file = true;
|
||||||
|
|
||||||
headers = `200 OK
|
headers = `200 OK
|
||||||
Content-Type: text/html`
|
Content-Type: text/html`
|
||||||
|
|||||||
@@ -1,14 +1,15 @@
|
|||||||
var minisrv_service_file = true;
|
const minisrv_service_file = true;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
var relativePath = request_headers.request_url;
|
let relativePath = request_headers.request_url;
|
||||||
if (relativePath.indexOf('?') > -1) relativePath = relativePath.split('?')[0];
|
if (relativePath.indexOf('?') > -1) relativePath = relativePath.split('?')[0];
|
||||||
while (relativePath.endsWith('/')) relativePath = relativePath.substring(0, relativePath.length - 1);
|
while (relativePath.endsWith('/')) relativePath = relativePath.substring(0, relativePath.length - 1);
|
||||||
|
|
||||||
var dir = service_name + relativePath;
|
const dir = service_name + relativePath;
|
||||||
var num_per_page = 25;
|
const num_per_page = 25;
|
||||||
var dirs = ['<tr><td>Directory</td><td><a href="' + relativePath + '/..">Parent Directory</a></td><td>-</td><td>-</td></tr > '];
|
const dirs = ['<tr><td>Directory</td><td><a href="' + relativePath + '/..">Parent Directory</a></td><td>-</td><td>-</td></tr > '];
|
||||||
var files = [];
|
const files = [];
|
||||||
vault_found = false;
|
let vault_found = false;
|
||||||
|
|
||||||
|
|
||||||
// Iterate through each service vault to find the first occurrence
|
// Iterate through each service vault to find the first occurrence
|
||||||
@@ -25,7 +26,7 @@ try {
|
|||||||
|
|
||||||
// Check if entry exists in all service vaults
|
// Check if entry exists in all service vaults
|
||||||
let found = false;
|
let found = false;
|
||||||
var checkPath = "";
|
let checkPath = "";
|
||||||
for (let j = 0; j < service_vaults.length; j++) {
|
for (let j = 0; j < service_vaults.length; j++) {
|
||||||
checkPath = path.join(service_vaults[j], dir || '', entry);
|
checkPath = path.join(service_vaults[j], dir || '', entry);
|
||||||
if (fs.existsSync(checkPath)) {
|
if (fs.existsSync(checkPath)) {
|
||||||
@@ -41,7 +42,7 @@ try {
|
|||||||
const stats = fs.statSync(fullPath);
|
const stats = fs.statSync(fullPath);
|
||||||
const isDir = stats.isDirectory();
|
const isDir = stats.isDirectory();
|
||||||
const mimeType = (isDir) ? "Directory" : wtvmime.getContentType(fullPath)[1];
|
const mimeType = (isDir) ? "Directory" : wtvmime.getContentType(fullPath)[1];
|
||||||
var readableSize = '-';
|
let readableSize = '-';
|
||||||
// Get file size with unit
|
// Get file size with unit
|
||||||
if (!isDir) {
|
if (!isDir) {
|
||||||
const fileSize = stats.size;
|
const fileSize = stats.size;
|
||||||
@@ -85,7 +86,7 @@ try {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!vault_found) {
|
if (!vault_found) {
|
||||||
var errpage = wtvshared.doErrorPage(404);
|
const errpage = wtvshared.doErrorPage(404);
|
||||||
headers = errpage[0];
|
headers = errpage[0];
|
||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
} else {
|
} else {
|
||||||
@@ -105,7 +106,7 @@ try {
|
|||||||
const merged_files = dirs.concat(files);
|
const merged_files = dirs.concat(files);
|
||||||
const paginatedFiles = merged_files.slice(start_index, end_index);
|
const paginatedFiles = merged_files.slice(start_index, end_index);
|
||||||
|
|
||||||
let paginationHtml = `
|
const paginationHtml = `
|
||||||
<div style="text-align: center; margin-top: 20px;">
|
<div style="text-align: center; margin-top: 20px;">
|
||||||
<form action="" method="get" style="display: inline;">
|
<form action="" method="get" style="display: inline;">
|
||||||
<input type=button onclick="window.location.href='?page=1'" ${(current_page === 1) ? 'disabled' : ''} value="First"></input>
|
<input type=button onclick="window.location.href='?page=1'" ${(current_page === 1) ? 'disabled' : ''} value="First"></input>
|
||||||
@@ -156,7 +157,7 @@ try {
|
|||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('Error:', err);
|
console.error('Error:', err);
|
||||||
var err = wtvshared.doErrorPage(404);
|
const errpage = wtvshared.doErrorPage(404);
|
||||||
headers = err[0];
|
headers = errpage[0];
|
||||||
data = err[1];
|
data = errpage[1];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
var minisrv_service_file = true;
|
const minisrv_service_file = true;
|
||||||
|
|
||||||
var viewers = {
|
const viewers = {
|
||||||
0: "WebTVIntel--1.0.exe",
|
0: "WebTVIntel--1.0.exe",
|
||||||
1: "WebTVIntel--1.1.exe",
|
1: "WebTVIntel--1.1.exe",
|
||||||
2: "WebTVIntel--2.5.exe",
|
2: "WebTVIntel--2.5.exe",
|
||||||
@@ -8,18 +8,18 @@ var viewers = {
|
|||||||
4: "WebTVIntel--2.5-HE.exe"
|
4: "WebTVIntel--2.5-HE.exe"
|
||||||
}
|
}
|
||||||
|
|
||||||
var logos = {
|
const logos = {
|
||||||
0: null,
|
0: null,
|
||||||
1: "SuperViewer_Setup.bmp",
|
1: "SuperViewer_Setup.bmp",
|
||||||
2: "HackersEdition_Setup.bmp"
|
2: "HackersEdition_Setup.bmp"
|
||||||
}
|
}
|
||||||
|
|
||||||
var disksets = {
|
const disksets = {
|
||||||
0: null,
|
0: null,
|
||||||
98: "HackTV_min.zip"
|
98: "HackTV_min.zip"
|
||||||
}
|
}
|
||||||
|
|
||||||
var viewer_stock_md5s = {
|
const viewer_stock_md5s = {
|
||||||
"WebTVIntel--1.0.exe": "d7bde1adbe3549f58dd95425d3ac2af9",
|
"WebTVIntel--1.0.exe": "d7bde1adbe3549f58dd95425d3ac2af9",
|
||||||
"WebTVIntel--1.1.exe": "ce7b6d1734b5e3d1cbd5f068609223d1",
|
"WebTVIntel--1.1.exe": "ce7b6d1734b5e3d1cbd5f068609223d1",
|
||||||
"WebTVIntel--2.5.exe": "4c5754bb8b69739b6f414c2d159051da",
|
"WebTVIntel--2.5.exe": "4c5754bb8b69739b6f414c2d159051da",
|
||||||
@@ -28,7 +28,7 @@ var viewer_stock_md5s = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
var modpacks = {
|
const modpacks = {
|
||||||
0: {
|
0: {
|
||||||
"name": "Background Sound",
|
"name": "Background Sound",
|
||||||
"description": "Enables the Viewer to continue playing sound when it is not the currently active window.",
|
"description": "Enables the Viewer to continue playing sound when it is not the currently active window.",
|
||||||
@@ -38,10 +38,10 @@ var modpacks = {
|
|||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
var modpacks = {};
|
const modpacks = {};
|
||||||
|
|
||||||
|
|
||||||
var feature_bits = {
|
const feature_bits = {
|
||||||
2: {
|
2: {
|
||||||
0: {
|
0: {
|
||||||
"offset": 2063881,
|
"offset": 2063881,
|
||||||
@@ -62,18 +62,18 @@ var feature_bits = {
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
var patch_defaults = {
|
const patch_defaults = {
|
||||||
"start_url": "client:GoToConn",
|
"start_url": "client:GoToConn",
|
||||||
"default_ip": "10.0.0.1"
|
"default_ip": "10.0.0.1"
|
||||||
}
|
}
|
||||||
|
|
||||||
var patch_limits = {
|
const patch_limits = {
|
||||||
"start_url": 26,
|
"start_url": 26,
|
||||||
"default_ip": 11,
|
"default_ip": 11,
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPatchDataType(type, invert = false) {
|
function getPatchDataType(type, invert = false) {
|
||||||
var patch_data = 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-client-serial-number: %s\r\n"
|
||||||
patch_data += "wtv-user-requested-upgrade: %s\r\n";
|
patch_data += "wtv-user-requested-upgrade: %s\r\n";
|
||||||
@@ -105,9 +105,9 @@ function getPatchDataType(type, invert = false) {
|
|||||||
|
|
||||||
|
|
||||||
function getResData(file) {
|
function getResData(file) {
|
||||||
var res_data = null;
|
let res_data = null;
|
||||||
if (file.slice(-2, 2).toLowerCase() == "gz") {
|
if (file.slice(-2, 2).toLowerCase() == "gz") {
|
||||||
var res_gz_data = wtvshared.getServiceDep("/viewergen/" + file);
|
const res_gz_data = wtvshared.getServiceDep("/viewergen/" + file);
|
||||||
res_data = zlib.gunzipSync(res_gz_data);
|
res_data = zlib.gunzipSync(res_gz_data);
|
||||||
} else {
|
} else {
|
||||||
res_data = wtvshared.getServiceDep("/viewergen/" + file);
|
res_data = wtvshared.getServiceDep("/viewergen/" + file);
|
||||||
@@ -115,7 +115,7 @@ function getResData(file) {
|
|||||||
return res_data;
|
return res_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
var patch_data = {
|
const patch_data = {
|
||||||
"WebTVIntel--1.0.exe": {
|
"WebTVIntel--1.0.exe": {
|
||||||
225: Buffer.from("\xD8", 'ascii'),
|
225: Buffer.from("\xD8", 'ascii'),
|
||||||
273: Buffer.from("\x60", 'ascii'),
|
273: Buffer.from("\x60", 'ascii'),
|
||||||
@@ -222,9 +222,9 @@ var patch_data = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getPatchData(fname, client_data_obj, start_url = "client:GoToConn", default_ip = "10.0.0.1") {
|
function getPatchData(fname, client_data_obj, start_url = "client:GoToConn", default_ip = "10.0.0.1") {
|
||||||
var customized_patch_data = patch_data[fname];
|
const customized_patch_data = patch_data[fname];
|
||||||
Object.keys(customized_patch_data).forEach(function (idx) {
|
Object.keys(customized_patch_data).forEach(function (idx) {
|
||||||
var val = customized_patch_data[idx];
|
const val = customized_patch_data[idx];
|
||||||
if (typeof val === 'string') {
|
if (typeof val === 'string') {
|
||||||
// start url override
|
// start url override
|
||||||
if (start_url != patch_defaults.start_url && start_url.length <= patch_limits.start_url) {
|
if (start_url != patch_defaults.start_url && start_url.length <= patch_limits.start_url) {
|
||||||
@@ -240,29 +240,30 @@ function getPatchData(fname, client_data_obj, start_url = "client:GoToConn", def
|
|||||||
} else {
|
} else {
|
||||||
if (!val.byteLength) {
|
if (!val.byteLength) {
|
||||||
// not a buffer object
|
// not a buffer object
|
||||||
var block_length = val['length'];
|
let patch_data_string = "";
|
||||||
var patch_data = getPatchDataType(val['type'], (fname.slice(12, 3) != "1.1"));
|
const block_length = val['length'];
|
||||||
|
const patch_data = getPatchDataType(val['type'], (fname.slice(12, 3) != "1.1"));
|
||||||
if (patch_data) {
|
if (patch_data) {
|
||||||
var patch_data_array = patch_data.split("\r\n");
|
const patch_data_array = patch_data.split("\r\n");
|
||||||
var patch_data_string = "";
|
|
||||||
Object.keys(patch_data_array).forEach(function (didx) {
|
Object.keys(patch_data_array).forEach(function (didx) {
|
||||||
var header_end = patch_data_array[didx].indexOf(":");
|
const header_end = patch_data_array[didx].indexOf(":");
|
||||||
if (header_end) {
|
if (header_end) {
|
||||||
var patch_data_header = patch_data_array[didx].slice(0, header_end);
|
const patch_data_header = patch_data_array[didx].slice(0, header_end);
|
||||||
var client_value = client_data_obj[patch_data_header];
|
const client_value = client_data_obj[patch_data_header];
|
||||||
if (client_value)
|
if (client_value)
|
||||||
patch_data_string += patch_data_array[didx].replace("%s", client_value) + "\r\n";
|
patch_data_string += patch_data_array[didx].replace("%s", client_value) + "\r\n";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
if (fname.slice(12, 3) != "2.5") {
|
if (fname.slice(12, 3) != "2.5") {
|
||||||
var length_difference = block_length - patch_data_string.length;
|
const length_difference = block_length - patch_data_string.length;
|
||||||
if (length_difference > 0)
|
if (length_difference > 0)
|
||||||
patch_data_string += "\x00".repeat(length_difference - (val['type'].length + 1));
|
patch_data_string += "\x00".repeat(length_difference - (val['type'].length + 1));
|
||||||
patch_data_string += val['type'] + "\x00";
|
patch_data_string += val['type'] + "\x00";
|
||||||
} else {
|
} else {
|
||||||
patch_data_string += val['type'] + "\x00";
|
patch_data_string += val['type'] + "\x00";
|
||||||
var length_difference = block_length - patch_data_string.length;
|
const length_difference = block_length - patch_data_string.length;
|
||||||
if (length_difference > 0)
|
if (length_difference > 0)
|
||||||
patch_data_string += "\x00".repeat(length_difference);
|
patch_data_string += "\x00".repeat(length_difference);
|
||||||
}
|
}
|
||||||
@@ -274,13 +275,12 @@ function getPatchData(fname, client_data_obj, start_url = "client:GoToConn", def
|
|||||||
}
|
}
|
||||||
|
|
||||||
function applyPatch(data, patch_data, offset) {
|
function applyPatch(data, patch_data, offset) {
|
||||||
var data_length = patch_data.byteLength || patch_data.length;
|
const data_length = patch_data.byteLength || patch_data.length;
|
||||||
var data = data.fill(patch_data, offset, data_length + offset);
|
return data.fill(patch_data, offset, data_length + offset);
|
||||||
return data;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function patchBinary(patchDataObject) {
|
function patchBinary(patchDataObject) {
|
||||||
var patched_file = patchDataObject.data;
|
let patched_file = patchDataObject.data;
|
||||||
Object.keys(patchDataObject.patch_data).forEach(function (idx) {
|
Object.keys(patchDataObject.patch_data).forEach(function (idx) {
|
||||||
idx = parseInt(idx);
|
idx = parseInt(idx);
|
||||||
patched_file = applyPatch(patched_file, patchDataObject.patch_data[idx], idx);
|
patched_file = applyPatch(patched_file, patchDataObject.patch_data[idx], idx);
|
||||||
@@ -290,8 +290,8 @@ function patchBinary(patchDataObject) {
|
|||||||
|
|
||||||
|
|
||||||
function generateSSID() {
|
function generateSSID() {
|
||||||
var ssid_template = "91xxxxxxaeb002";
|
const ssid_template = "91xxxxxxaeb002";
|
||||||
var ssid = ssid_template;
|
let ssid = ssid_template;
|
||||||
while (ssid.indexOf("x") != -1) {
|
while (ssid.indexOf("x") != -1) {
|
||||||
// random hex char from 0-F
|
// random hex char from 0-F
|
||||||
ssid = ssid.replace("x", Math.floor(Math.random() * 16).toString(16))
|
ssid = ssid.replace("x", Math.floor(Math.random() * 16).toString(16))
|
||||||
@@ -300,7 +300,7 @@ function generateSSID() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function buildProfile(build) {
|
function buildProfile(build) {
|
||||||
var buildProfile = null;
|
let buildProfile = null;
|
||||||
switch (build) {
|
switch (build) {
|
||||||
case 1235:
|
case 1235:
|
||||||
buildProfile = {
|
buildProfile = {
|
||||||
@@ -433,7 +433,7 @@ function buildProfile(build) {
|
|||||||
return buildProfile;
|
return buildProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
var enable_full_hacktv = false;
|
let enable_full_hacktv = false;
|
||||||
if (wtvshared.getServiceDep("/viewergen/" + "HackTV.zip", true)) {
|
if (wtvshared.getServiceDep("/viewergen/" + "HackTV.zip", true)) {
|
||||||
enable_full_hacktv = true;
|
enable_full_hacktv = true;
|
||||||
disksets['99'] = "HackTV.zip";
|
disksets['99'] = "HackTV.zip";
|
||||||
@@ -441,31 +441,31 @@ if (wtvshared.getServiceDep("/viewergen/" + "HackTV.zip", true)) {
|
|||||||
|
|
||||||
if (request_headers.query.viewer &&
|
if (request_headers.query.viewer &&
|
||||||
(request_headers.query.client_ssid || request_headers.query.random_ssid)) {
|
(request_headers.query.client_ssid || request_headers.query.random_ssid)) {
|
||||||
var client_ssid = null;
|
let client_ssid = null;
|
||||||
if (request_headers.query.client_ssid)
|
if (request_headers.query.client_ssid)
|
||||||
client_ssid = request_headers.query.client_ssid;
|
client_ssid = request_headers.query.client_ssid;
|
||||||
|
|
||||||
if (request_headers.query.random_ssid)
|
if (request_headers.query.random_ssid)
|
||||||
client_ssid = generateSSID();
|
client_ssid = generateSSID();
|
||||||
|
|
||||||
var viewer_file = viewers[request_headers.query.viewer];
|
const viewer_file = viewers[request_headers.query.viewer];
|
||||||
var needs_hacktv_mini = (viewer_file === "WebTVIntel--2.5-HE.exe") ? true : false
|
const needs_hacktv_mini = (viewer_file === "WebTVIntel--2.5-HE.exe") ? true : false
|
||||||
if (!viewer_file) {
|
if (!viewer_file) {
|
||||||
errpage = wtvshared.doErrorPage("500", null, socket.minisrv_pc_mode)
|
const errpage = wtvshared.doErrorPage("500", null, socket.minisrv_pc_mode)
|
||||||
headers = errpage[0];
|
headers = errpage[0];
|
||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
} else {
|
} else {
|
||||||
var viewer_gz_data = wtvshared.getServiceDep("/viewergen/" + viewer_file + ".gz");
|
const viewer_gz_data = wtvshared.getServiceDep("/viewergen/" + viewer_file + ".gz");
|
||||||
var viewer_data = zlib.gunzipSync(viewer_gz_data);
|
const viewer_data = zlib.gunzipSync(viewer_gz_data);
|
||||||
var viewer_md5 = crypto.createHash('md5').update(viewer_data).digest("hex");
|
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)
|
console.error(viewer_file, "md5sum error. expected:", viewer_stock_md5s[viewer_file], ", got:", viewer_md5)
|
||||||
errpage = wtvshared.doErrorPage("500", null, socket.minisrv_pc_mode)
|
const errpage = wtvshared.doErrorPage("500", null, socket.minisrv_pc_mode)
|
||||||
headers = errpage[0];
|
headers = errpage[0];
|
||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
} else {
|
} else {
|
||||||
var build = request_headers.query.build;
|
const build = request_headers.query.build;
|
||||||
var client_data_obj = null
|
let client_data_obj = null
|
||||||
|
|
||||||
if (build) {
|
if (build) {
|
||||||
if (parseInt(build) > 0) {
|
if (parseInt(build) > 0) {
|
||||||
@@ -476,29 +476,29 @@ if (request_headers.query.viewer &&
|
|||||||
if (!client_data_obj)
|
if (!client_data_obj)
|
||||||
client_data_obj = buildProfile(7181);
|
client_data_obj = buildProfile(7181);
|
||||||
|
|
||||||
var viewer_tag = viewer_file.split('.');
|
const viewer_tag = viewer_file.split('.');
|
||||||
viewer_tag.pop();
|
viewer_tag.pop();
|
||||||
client_data_obj['wtv-viewer'] = viewer_tag.join('.');
|
client_data_obj['wtv-viewer'] = viewer_tag.join('.');
|
||||||
client_data_obj["wtv-client-serial-number"] = client_ssid;
|
client_data_obj["wtv-client-serial-number"] = client_ssid;
|
||||||
var patchDataObject = {
|
const patchDataObject = {
|
||||||
data: viewer_data,
|
data: viewer_data,
|
||||||
patch_data: getPatchData(viewer_file, client_data_obj)
|
patch_data: getPatchData(viewer_file, client_data_obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!patchDataObject.patch_data) {
|
if (!patchDataObject.patch_data) {
|
||||||
errpage = wtvshared.doErrorPage("500", null, socket.minisrv_pc_mode)
|
const errpage = wtvshared.doErrorPage("500", null, socket.minisrv_pc_mode)
|
||||||
headers = errpage[0];
|
headers = errpage[0];
|
||||||
data = errpage[1];
|
data = errpage[1];
|
||||||
} else {
|
} else {
|
||||||
var patched_file = patchBinary(patchDataObject);
|
let patched_file = patchBinary(patchDataObject);
|
||||||
var enabled_feature_bits = [];
|
const enabled_feature_bits = [];
|
||||||
Object.keys(request_headers.query).forEach((k) => {
|
Object.keys(request_headers.query).forEach((k) => {
|
||||||
if (k.slice(0, 12) === "feature_bit_") {
|
if (k.slice(0, 12) === "feature_bit_") {
|
||||||
enabled_feature_bits.push(parseInt(k.slice(12)));
|
enabled_feature_bits.push(parseInt(k.slice(12)));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Object.keys(enabled_feature_bits).forEach((k) => {
|
Object.keys(enabled_feature_bits).forEach((k) => {
|
||||||
var bit = feature_bits[request_headers.query.viewer][enabled_feature_bits[k]];
|
const bit = feature_bits[request_headers.query.viewer][enabled_feature_bits[k]];
|
||||||
if (bit) {
|
if (bit) {
|
||||||
patched_file = applyPatch(patched_file, bit.value, bit.offset);
|
patched_file = applyPatch(patched_file, bit.value, bit.offset);
|
||||||
}
|
}
|
||||||
@@ -507,12 +507,12 @@ if (request_headers.query.viewer &&
|
|||||||
headers = `200 OK
|
headers = `200 OK
|
||||||
Content-Type: application/octet-stream
|
Content-Type: application/octet-stream
|
||||||
Content-Disposition: attachment; filename="${viewer_file.replace(".exe", ".zip")}"`
|
Content-Disposition: attachment; filename="${viewer_file.replace(".exe", ".zip")}"`
|
||||||
var AdmZip = require("adm-zip");
|
const AdmZip = require("adm-zip");
|
||||||
var zip = new AdmZip();
|
const zip = new AdmZip();
|
||||||
|
|
||||||
zip.addZipComment("Viewer SSID: " + client_ssid);
|
zip.addZipComment("Viewer SSID: " + client_ssid);
|
||||||
console.log(request_headers)
|
console.log(request_headers)
|
||||||
update_str = "http://" + request_headers.host + request_headers.request_url.split('?')[0] + "?ssid=" + client_ssid;
|
let update_str = "http://" + request_headers.host + request_headers.request_url.split('?')[0] + "?ssid=" + client_ssid;
|
||||||
Object.keys(request_headers.query).forEach((k) => {
|
Object.keys(request_headers.query).forEach((k) => {
|
||||||
if (k != "random_ssid") {
|
if (k != "random_ssid") {
|
||||||
update_str += "&" + encodeURIComponent(k) + "=" + encodeURIComponent(request_headers.query[k]);
|
update_str += "&" + encodeURIComponent(k) + "=" + encodeURIComponent(request_headers.query[k]);
|
||||||
@@ -522,14 +522,14 @@ Content-Disposition: attachment; filename="${viewer_file.replace(".exe", ".zip")
|
|||||||
|
|
||||||
zip.addFile(viewer_file.replace("--", "-" + client_ssid + "-"), patched_file);
|
zip.addFile(viewer_file.replace("--", "-" + client_ssid + "-"), patched_file);
|
||||||
if (!request_headers.query.viewer_only) {
|
if (!request_headers.query.viewer_only) {
|
||||||
var romset_zip = new AdmZip(wtvshared.getServiceDep("/viewergen/" + viewer_file.replace(".exe", "").replace("WebTVIntel", "AppData") + ".zip", true));
|
const romset_zip = new AdmZip(wtvshared.getServiceDep("/viewergen/" + viewer_file.replace(".exe", "").replace("WebTVIntel", "AppData") + ".zip", true));
|
||||||
var zipEntries = romset_zip.getEntries();
|
const zipEntries = romset_zip.getEntries();
|
||||||
zipEntries.forEach(function (zipEntry) {
|
zipEntries.forEach(function (zipEntry) {
|
||||||
if (zipEntry.entryName == "Setup.bmp" && request_headers.query.logo) {
|
if (zipEntry.entryName == "Setup.bmp" && request_headers.query.logo) {
|
||||||
var logo_file = logos[parseInt(request_headers.query.logo) || 0];
|
const logo_file = logos[parseInt(request_headers.query.logo) || 0];
|
||||||
if (logo_file) {
|
if (logo_file) {
|
||||||
var logo_gz_data = wtvshared.getServiceDep("/viewergen/" + logo_file + ".gz");
|
const logo_gz_data = wtvshared.getServiceDep("/viewergen/" + logo_file + ".gz");
|
||||||
var logo_data = zlib.gunzipSync(logo_gz_data);
|
const logo_data = zlib.gunzipSync(logo_gz_data);
|
||||||
zip.addFile(zipEntry.entryName, logo_data);
|
zip.addFile(zipEntry.entryName, logo_data);
|
||||||
} else {
|
} else {
|
||||||
zip.addFile(zipEntry.entryName, zipEntry.getData());
|
zip.addFile(zipEntry.entryName, zipEntry.getData());
|
||||||
@@ -539,19 +539,19 @@ Content-Disposition: attachment; filename="${viewer_file.replace(".exe", ".zip")
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (request_headers.query.diskset || needs_hacktv_mini) {
|
if (request_headers.query.diskset || needs_hacktv_mini) {
|
||||||
var diskset_file = 0;
|
let diskset_file = 0;
|
||||||
if (needs_hacktv_mini && request_headers.query.diskset === 0) diskset_file = disksets[98];
|
if (needs_hacktv_mini && request_headers.query.diskset === 0) diskset_file = disksets[98];
|
||||||
else diskset_file = disksets[parseInt(request_headers.query.diskset) || 0];
|
else diskset_file = disksets[parseInt(request_headers.query.diskset) || 0];
|
||||||
if (diskset_file) {
|
if (diskset_file) {
|
||||||
var diskset_zip = new AdmZip(wtvshared.getServiceDep("/viewergen/" + diskset_file, true));
|
const diskset_zip = new AdmZip(wtvshared.getServiceDep("/viewergen/" + diskset_file, true));
|
||||||
var zipEntries = diskset_zip.getEntries();
|
const zipEntries = diskset_zip.getEntries();
|
||||||
zipEntries.forEach(function (zipEntry) {
|
zipEntries.forEach(function (zipEntry) {
|
||||||
zip.addFile("Disk/" + zipEntry.entryName, zipEntry.getData());
|
zip.addFile("Disk/" + zipEntry.entryName, zipEntry.getData());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var embed_modpacks = [];
|
const embed_modpacks = [];
|
||||||
Object.keys(request_headers.query).forEach((k) => {
|
Object.keys(request_headers.query).forEach((k) => {
|
||||||
if (k.slice(0, 8) === "modpack_") {
|
if (k.slice(0, 8) === "modpack_") {
|
||||||
embed_modpacks.push(parseInt(k.slice(8)));
|
embed_modpacks.push(parseInt(k.slice(8)));
|
||||||
@@ -560,10 +560,10 @@ Content-Disposition: attachment; filename="${viewer_file.replace(".exe", ".zip")
|
|||||||
|
|
||||||
if (embed_modpacks.length > 0) {
|
if (embed_modpacks.length > 0) {
|
||||||
Object.keys(embed_modpacks).forEach((k) => {
|
Object.keys(embed_modpacks).forEach((k) => {
|
||||||
var modpack_file = wtvshared.getServiceDep("/viewergen/" + modpacks[k].file, true);
|
const modpack_file = wtvshared.getServiceDep("/viewergen/" + modpacks[k].file, true);
|
||||||
if (fs.existsSync(modpack_file)) {
|
if (fs.existsSync(modpack_file)) {
|
||||||
var modpack_zip = new AdmZip(modpack_file);
|
const modpack_zip = new AdmZip(modpack_file);
|
||||||
var zipEntries = modpack_zip.getEntries();
|
const zipEntries = modpack_zip.getEntries();
|
||||||
zipEntries.forEach(function (zipEntry) {
|
zipEntries.forEach(function (zipEntry) {
|
||||||
zip.addFile(zipEntry.entryName, zipEntry.getData());
|
zip.addFile(zipEntry.entryName, zipEntry.getData());
|
||||||
});
|
});
|
||||||
@@ -645,7 +645,7 @@ function updateFeatureBits() {
|
|||||||
var viewer_select = document.getElementById('viewer');
|
var viewer_select = document.getElementById('viewer');
|
||||||
var selected_viewer = parseInt(viewer_select[viewer_select.selectedIndex].value);
|
var selected_viewer = parseInt(viewer_select[viewer_select.selectedIndex].value);
|
||||||
`;
|
`;
|
||||||
var bits = 0;
|
let bits = 0;
|
||||||
Object.keys(feature_bits).forEach((k) => {
|
Object.keys(feature_bits).forEach((k) => {
|
||||||
data += `\t${(bits === 0) ? "if" : "else if"} (selected_viewer == parseInt(${k})) {\n`;
|
data += `\t${(bits === 0) ? "if" : "else if"} (selected_viewer == parseInt(${k})) {\n`;
|
||||||
data += `\t\tfeature_bit_html.innerHTML = "";\n`
|
data += `\t\tfeature_bit_html.innerHTML = "";\n`
|
||||||
|
|||||||
@@ -85,6 +85,7 @@ function checkScopeErrors(file) {
|
|||||||
"cwd": "readonly",
|
"cwd": "readonly",
|
||||||
"request_headers": "readonly",
|
"request_headers": "readonly",
|
||||||
"session_data": "readonly",
|
"session_data": "readonly",
|
||||||
|
"service_name": "readonly"
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check if this is a privileged service by examining the file path
|
// Check if this is a privileged service by examining the file path
|
||||||
|
|||||||
Reference in New Issue
Block a user