clean up file structure
|
After Width: | Height: | Size: 167 B |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 65 B |
|
After Width: | Height: | Size: 47 B |
|
After Width: | Height: | Size: 3.4 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
|
After Width: | Height: | Size: 669 B |
|
After Width: | Height: | Size: 84 B |
BIN
zefie_wtvp_minisrv/includes/ServiceVault/SharedROMCache/Chat.gif
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
|
After Width: | Height: | Size: 1.6 KiB |
|
After Width: | Height: | Size: 98 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 843 B |
|
After Width: | Height: | Size: 967 B |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 763 B |
|
After Width: | Height: | Size: 5.7 KiB |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 117 B |
|
After Width: | Height: | Size: 66 B |
|
After Width: | Height: | Size: 186 B |
|
After Width: | Height: | Size: 1.8 KiB |
|
After Width: | Height: | Size: 185 B |
|
After Width: | Height: | Size: 87 B |
|
After Width: | Height: | Size: 484 B |
|
After Width: | Height: | Size: 111 B |
|
After Width: | Height: | Size: 111 B |
|
After Width: | Height: | Size: 84 B |
|
After Width: | Height: | Size: 111 B |
|
After Width: | Height: | Size: 111 B |
|
After Width: | Height: | Size: 84 B |
|
After Width: | Height: | Size: 111 B |
|
After Width: | Height: | Size: 111 B |
|
After Width: | Height: | Size: 83 B |
|
After Width: | Height: | Size: 83 B |
|
After Width: | Height: | Size: 83 B |
|
After Width: | Height: | Size: 83 B |
|
After Width: | Height: | Size: 83 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 91 B |
|
After Width: | Height: | Size: 1.2 KiB |
|
After Width: | Height: | Size: 44 B |
|
After Width: | Height: | Size: 120 B |
|
After Width: | Height: | Size: 84 B |
|
After Width: | Height: | Size: 127 B |
|
After Width: | Height: | Size: 128 B |
|
After Width: | Height: | Size: 875 B |
|
After Width: | Height: | Size: 43 B |
|
After Width: | Height: | Size: 1.5 KiB |
|
After Width: | Height: | Size: 169 B |
|
After Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 4.7 KiB |
BIN
zefie_wtvp_minisrv/includes/ServiceVault/SharedROMCache/kb.gif
Normal file
|
After Width: | Height: | Size: 3.9 KiB |
|
After Width: | Height: | Size: 3.8 KiB |
|
After Width: | Height: | Size: 4.3 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 8.8 KiB |
|
After Width: | Height: | Size: 8.0 KiB |
BIN
zefie_wtvp_minisrv/includes/ServiceVault/http_pc/favicon.ico
Normal file
|
After Width: | Height: | Size: 15 KiB |
15
zefie_wtvp_minisrv/includes/ServiceVault/http_pc/index.js
Normal file
@@ -0,0 +1,15 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
headers = `200 OK
|
||||
Content-Type: text/html`
|
||||
|
||||
data = `<html>
|
||||
<head>
|
||||
<title>zefie minisrv v${minisrv_config.version}</title>
|
||||
</head>
|
||||
<body bgcolor="#000000" text="#449944">
|
||||
<p>
|
||||
Welcome to the zefie minisrv v${minisrv_config.version} PC Services
|
||||
</p>
|
||||
</body>
|
||||
</html>`;
|
||||
@@ -0,0 +1,696 @@
|
||||
var minisrv_service_file = true;
|
||||
var viewer = 2 // debug override
|
||||
|
||||
var viewers = {
|
||||
0: "WebTVIntel--1.0.exe",
|
||||
1: "WebTVIntel--1.1.exe",
|
||||
2: "WebTVIntel--2.5.exe",
|
||||
3: "WebTVIntel--1.0-HE.exe",
|
||||
4: "WebTVIntel--2.5-HE.exe"
|
||||
}
|
||||
|
||||
var logos = {
|
||||
0: null,
|
||||
1: "SuperViewer_Setup.bmp",
|
||||
2: "HackersEdition_Setup.bmp"
|
||||
}
|
||||
|
||||
var disksets = {
|
||||
0: null,
|
||||
98: "HackTV_min.zip"
|
||||
}
|
||||
|
||||
var viewer_stock_md5s = {
|
||||
"WebTVIntel--1.0.exe": "d7bde1adbe3549f58dd95425d3ac2af9",
|
||||
"WebTVIntel--1.1.exe": "ce7b6d1734b5e3d1cbd5f068609223d1",
|
||||
"WebTVIntel--2.5.exe": "4c5754bb8b69739b6f414c2d159051da",
|
||||
"WebTVIntel--1.0-HE.exe": "391f303fd70034e69d3a50583de72c89",
|
||||
"WebTVIntel--2.5-HE.exe": "64edab977ec19a663c5842176bec306a"
|
||||
}
|
||||
|
||||
/*
|
||||
var modpacks = {
|
||||
0: {
|
||||
"name": "Background Sound",
|
||||
"description": "Enables the Viewer to continue playing sound when it is not the currently active window.",
|
||||
"file": "BackgroundSound.zip",
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
var modpacks = {};
|
||||
|
||||
|
||||
var feature_bits = {
|
||||
2: {
|
||||
0: {
|
||||
"offset": 2063881,
|
||||
"name": "Background Sound",
|
||||
"description": "Enables the Viewer to continue playing sound when it is not the currently active window.",
|
||||
"value": Buffer.from("\x80", 'ascii')
|
||||
}
|
||||
},
|
||||
4: {
|
||||
0: {
|
||||
"offset": 2063881,
|
||||
"name": "Background Sound",
|
||||
"description": "Enables the Viewer to continue playing sound when it is not the currently active window.",
|
||||
"value": Buffer.from("\x80", 'ascii')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
var patch_defaults = {
|
||||
"start_url": "client:GoToConn",
|
||||
"default_ip": "10.0.0.1"
|
||||
}
|
||||
|
||||
var patch_limits = {
|
||||
"start_url": 26,
|
||||
"default_ip": 11,
|
||||
}
|
||||
|
||||
function getPatchDataType(type, invert = false) {
|
||||
var patch_data = false;
|
||||
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";
|
||||
patch_data += "wtv-system-version: %s\r\n";
|
||||
patch_data += "wtv-capability-flags: %s\r\n";
|
||||
patch_data += "wtv-client-bootrom-version: %s\r\n";
|
||||
patch_data += "wtv-need-upgrade: %s\r\n";
|
||||
patch_data += "wtv-used-8675309: %s\r\n";
|
||||
patch_data += "wtv-client-rom-type: %s\r\n";
|
||||
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) ) {
|
||||
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";
|
||||
patch_data += "wtv-default-client-useragent: %s\r\n";
|
||||
patch_data += "wtv-system-cpuspeed: %s\r\n";
|
||||
patch_data += "wtv-system-sysconfig: %s\r\n";
|
||||
patch_data += "wtv-my-disk-sucks-sucks-sucks: %s\r\n";
|
||||
patch_data += "wtv-disk-first-error: %s\r\n";
|
||||
patch_data += "wtv-disk-size: %s\r\n";
|
||||
patch_data += "wtv-client-address: %s\r\n";
|
||||
patch_data += "wtv-viewer: %s\r\n";
|
||||
}
|
||||
return patch_data;
|
||||
}
|
||||
|
||||
|
||||
function getResData(file) {
|
||||
var res_data = null;
|
||||
if (file.substr(-2, 2).toLowerCase() == "gz") {
|
||||
var res_gz_data = wtvshared.getServiceDep("/viewergen/" + file);
|
||||
res_data = zlib.gunzipSync(res_gz_data);
|
||||
} else {
|
||||
res_data = wtvshared.getServiceDep("/viewergen/" + file);
|
||||
}
|
||||
return res_data;
|
||||
}
|
||||
|
||||
var patch_data = {
|
||||
"WebTVIntel--1.0.exe": {
|
||||
225: Buffer.from("\xD8", 'ascii'),
|
||||
273: Buffer.from("\x60", 'ascii'),
|
||||
332: Buffer.from("\x00\xAA", 'ascii'),
|
||||
568: Buffer.from("\x00\xA8", 'ascii'),
|
||||
577: Buffer.from("\xAA", 'ascii'),
|
||||
624: {
|
||||
length: 383,
|
||||
type: "wtv-incarnation"
|
||||
},
|
||||
132022: Buffer.from("\x68\xE8\x65\x5D\x00", 'ascii'), // patch pre-register pt1
|
||||
157861: Buffer.from("\x68\x70\x02\x40\x00", 'ascii'), // Prepare incarnation hack
|
||||
1016856: Buffer.from("\x68\xCC\x04\x5E\x00", 'ascii'),
|
||||
1074080: Buffer.from("\x68\xCC\x04\x5E\x00", 'ascii'),
|
||||
1263129: Buffer.from("\x68\x70\x6C\x5A\x00", 'ascii'), // Prepare encryption hack
|
||||
1919952: Buffer.from("scriptless-visit-reason\x00", 'ascii'), // patch pre-register pt2
|
||||
1919976: Buffer.from("10\x00", 'ascii'), // patch pre-register pt3
|
||||
1728624: {
|
||||
length: 398,
|
||||
type: "wtv-encryption"
|
||||
},
|
||||
1931552: Buffer.from(patch_defaults.default_ip + "\x00", 'ascii'), // patch default service address
|
||||
1960460: Buffer.from(patch_defaults.start_url + "\x00", 'ascii'), // patch startup url
|
||||
1960496: Buffer.from(patch_defaults.start_url + "\x00", 'ascii'), // patch startup url
|
||||
1967796: Buffer.from("\x00".repeat(41), 'ascii'), // remove unwanted headers
|
||||
1967856: Buffer.from("\x00".repeat(24), 'ascii'), // remove unwanted headers
|
||||
2003968: getResData("ResData--1.0.res.gz")
|
||||
},
|
||||
"WebTVIntel--1.0-HE.exe": {
|
||||
624: {
|
||||
length: 383,
|
||||
type: "wtv-incarnation"
|
||||
},
|
||||
1728624: {
|
||||
length: 398,
|
||||
type: "wtv-encryption"
|
||||
}
|
||||
},
|
||||
"WebTVIntel--1.1.exe": {
|
||||
209: Buffer.from("\xFA", 'ascii'),
|
||||
257: Buffer.from("\x90", 'ascii'),
|
||||
316: Buffer.from("\x00\xB6", 'ascii'),
|
||||
552: Buffer.from("\x00\xB4", 'ascii'),
|
||||
561: Buffer.from("\xB6", 'ascii'),
|
||||
620: {
|
||||
length: 383,
|
||||
type: "wtv-incarnation"
|
||||
},
|
||||
132118: Buffer.from("\x68\xE4\x75\x5D\x00", 'ascii'), // patch pre-register pt1
|
||||
157861: Buffer.from("\x68\xCC\x72\x5A\x00", 'ascii'), // Prepare encryption hack
|
||||
1015384: Buffer.from("\x68\xCC\x14\x5E\x00", 'ascii'),
|
||||
1073264: Buffer.from("\x68\xCC\x14\x5E\x00", 'ascii'),
|
||||
1264057: Buffer.from("\x68\x6C\x02\x40\x00", 'ascii'), // Prepare incarnation hack
|
||||
1730252: {
|
||||
length: 307,
|
||||
type: "wtv-encryption"
|
||||
},
|
||||
1921484: Buffer.from("scriptless-visit-reason\x00", 'ascii'), // patch pre-register pt2
|
||||
1921508: Buffer.from("10\x00", 'ascii'), // patch pre-register pt3
|
||||
1933064: Buffer.from(patch_defaults.default_ip + "\x00", 'ascii'), // patch default service address
|
||||
1962188: Buffer.from(patch_defaults.start_url + "\x00", 'ascii'), // patch startup url
|
||||
1962224: Buffer.from(patch_defaults.start_url + "\x00", 'ascii'), // patch startup url
|
||||
1969540: Buffer.from("\x00".repeat(84), 'ascii'), // remove unwanted headers
|
||||
2005504: getResData("ResData--1.1.res.gz")
|
||||
},
|
||||
|
||||
"WebTVIntel--2.5.exe": {
|
||||
396: Buffer.from("\x00\x50", 'ascii'),
|
||||
720: {
|
||||
length: 3356,
|
||||
type: "wtv-encryption"
|
||||
},
|
||||
279771: Buffer.from("\x68\xB8\x04\x75\x00", 'ascii'), // patch pre-register pt1
|
||||
299023: Buffer.from("\x08", 'ascii'), // Change the call location from ecx+16 to ecx+15 to unlock the communication stream
|
||||
329666: Buffer.from("\x68\x82\x6C\x70\x00", 'ascii'), // Prepare incarnation hack
|
||||
1893931: Buffer.from("\x71", 'ascii'), // Unlock the wtv- url access from the address bar.
|
||||
2201731: Buffer.from("\x68\xD0\x02\x40\x00", 'ascii'), // Prepare encryption hack
|
||||
3173506: {
|
||||
length: 865,
|
||||
type: "wtv-incarnation"
|
||||
},
|
||||
3473396: Buffer.from("\x00", 'ascii'),
|
||||
3474616: Buffer.from("10\x00", 'ascii'), // patch pre-register pt3
|
||||
3746504: Buffer.from(patch_defaults.default_ip + "\x00", 'ascii'), // patch default service address
|
||||
3474628: Buffer.from("scriptless-visit-reason\x00", 'ascii'), // patch pre-register pt2
|
||||
3482832: Buffer.from("\x00".repeat(10), 'ascii'), // remove unwanted headers
|
||||
3808684: Buffer.from(patch_defaults.start_url + "\x00", 'ascii'), // patch startup url
|
||||
3808720: Buffer.from(patch_defaults.start_url + "\x00", 'ascii'), // patch startup url
|
||||
3808748: Buffer.from(patch_defaults.start_url + "\x00", 'ascii'), // patch startup url
|
||||
3826408: Buffer.from("\x00".repeat(66), 'ascii'), // remove unwanted headers
|
||||
3826356: Buffer.from("\x00".repeat(24), 'ascii'), // remove unwanted headers
|
||||
3940352: getResData("ResData--2.5.res.gz")
|
||||
},
|
||||
"WebTVIntel--2.5-HE.exe": {
|
||||
720: {
|
||||
length: 3356,
|
||||
type: "wtv-encryption"
|
||||
},
|
||||
3173506: {
|
||||
length: 865,
|
||||
type: "wtv-incarnation"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function getPatchData(fname, client_data_obj, start_url = "client:GoToConn", default_ip = "10.0.0.1") {
|
||||
var customized_patch_data = patch_data[fname];
|
||||
Object.keys(customized_patch_data).forEach(function (idx) {
|
||||
var 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.substr(0, patch_defaults.start_url.length) == patch_defaults.start_url)
|
||||
customized_patch_data[idx] = start_url + "\x00";
|
||||
}
|
||||
|
||||
// default service ip override
|
||||
if (default_ip != patch_defaults.default_ip && default_ip.length <= patch_limits.default_ip) {
|
||||
if (val.substr(0, patch_defaults.default_ip.length) == patch_defaults.default_ip)
|
||||
customized_patch_data[idx] = default_ip + "\x00";
|
||||
}
|
||||
} else {
|
||||
if (!val.byteLength) {
|
||||
// not a buffer object
|
||||
var block_length = val['length'];
|
||||
var patch_data = getPatchDataType(val['type'], (fname.substr(12, 3) != "1.1"));
|
||||
if (patch_data) {
|
||||
var patch_data_array = patch_data.split("\r\n");
|
||||
var patch_data_string = "";
|
||||
Object.keys(patch_data_array).forEach(function (didx) {
|
||||
var header_end = patch_data_array[didx].indexOf(":");
|
||||
if (header_end) {
|
||||
var patch_data_header = patch_data_array[didx].substr(0, header_end);
|
||||
var client_value = client_data_obj[patch_data_header];
|
||||
if (client_value)
|
||||
patch_data_string += patch_data_array[didx].replace("%s", client_value) + "\r\n";
|
||||
}
|
||||
});
|
||||
}
|
||||
if (fname.substr(12, 3) != "2.5") {
|
||||
var length_difference = block_length - patch_data_string.length;
|
||||
if (length_difference > 0)
|
||||
patch_data_string += "\x00".repeat(length_difference - (val['type'].length + 1));
|
||||
patch_data_string += val['type'] + "\x00";
|
||||
} else {
|
||||
patch_data_string += val['type'] + "\x00";
|
||||
var length_difference = block_length - patch_data_string.length;
|
||||
if (length_difference > 0)
|
||||
patch_data_string += "\x00".repeat(length_difference);
|
||||
}
|
||||
customized_patch_data[idx] = Buffer.from(patch_data_string, 'ascii');
|
||||
}
|
||||
}
|
||||
})
|
||||
return customized_patch_data;
|
||||
}
|
||||
|
||||
function applyPatch(data, patch_data, offset) {
|
||||
var data_length = patch_data.byteLength || patch_data.length;
|
||||
var data = data.fill(patch_data, offset, data_length + offset);
|
||||
return data;
|
||||
}
|
||||
|
||||
function patchBinary(patchDataObject) {
|
||||
var patched_file = patchDataObject.data;
|
||||
Object.keys(patchDataObject.patch_data).forEach(function (idx) {
|
||||
idx = parseInt(idx);
|
||||
patched_file = applyPatch(patched_file, patchDataObject.patch_data[idx], idx);
|
||||
})
|
||||
return patched_file;
|
||||
}
|
||||
|
||||
|
||||
function generateSSID() {
|
||||
var ssid_template = "91xxxxxxaeb002";
|
||||
var ssid = ssid_template;
|
||||
while (ssid.indexOf("x") != -1) {
|
||||
// random hex char from 0-F
|
||||
ssid = ssid.replace("x", Math.floor(Math.random() * 16).toString(16))
|
||||
}
|
||||
return ssid + wtvshared.getSSIDCRC(ssid);
|
||||
}
|
||||
|
||||
function buildProfile(build) {
|
||||
var buildProfile = null;
|
||||
switch (build) {
|
||||
case 1235:
|
||||
buildProfile = {
|
||||
"wtv-system-version": build,
|
||||
"wtv-capability-flags": "1009c93bef",
|
||||
"wtv-client-bootrom-version": 105,
|
||||
"wtv-client-rom-type": "bf0app",
|
||||
"wtv-system-chipversion": 16842752,
|
||||
"User-Agent": "Mozilla/4.0 WebTV/1.4.2 (compatible; MSIE 3.0)",
|
||||
"wtv-system-cpuspeed": 112790760,
|
||||
"wtv-system-sysconfig": 736935823
|
||||
}
|
||||
break;
|
||||
|
||||
case 7181:
|
||||
buildProfile = {
|
||||
"wtv-system-version": build,
|
||||
"wtv-capability-flags": "10935ffc8f",
|
||||
"wtv-client-bootrom-version": 2046,
|
||||
"wtv-client-rom-type": "US-LC2-disk-0MB-8MB",
|
||||
"wtv-system-chipversion": 51511296,
|
||||
"User-Agent": "Mozilla/4.0 WebTV/2.2.6.1 (compatible; MSIE 4.0)",
|
||||
"wtv-system-cpuspeed": 166187148,
|
||||
"wtv-system-sysconfig": 4163328,
|
||||
"wtv-disk-size": 8006
|
||||
}
|
||||
break;
|
||||
|
||||
case 71810:
|
||||
buildProfile = {
|
||||
"wtv-capability-flags": "d10094938ef",
|
||||
"wtv-system-version": 7181,
|
||||
"wtv-client-rom-type": "bf0app",
|
||||
"wtv-client-bootrom-version": 105,
|
||||
"wtv-system-chipversion": 16842752,
|
||||
"wtv-system-sysconfig": 736935823,
|
||||
"wtv-system-cpuspeed": 112790760,
|
||||
"User-Agent": "Mozilla/4.0 WebTV/2.5 (compatible; MSIE 4.0)",
|
||||
}
|
||||
break;
|
||||
case 16276:
|
||||
buildProfile = {
|
||||
"wtv-system-version": build,
|
||||
"wtv-capability-flags": "1fee0e1d9b1ffdef",
|
||||
"wtv-client-bootrom-version": 2046,
|
||||
"wtv-client-rom-type": "US-LC2-disk-0MB-8MB",
|
||||
"wtv-system-chipversion": 53608448,
|
||||
"User-Agent": "Mozilla/4.0 WebTV/2.8.2 (compatible; MSIE 4.0)",
|
||||
"wtv-system-cpuspeed": 166164662,
|
||||
"wtv-system-sysconfig": 3116068,
|
||||
"wtv-disk-size": 8006
|
||||
}
|
||||
break;
|
||||
}
|
||||
return buildProfile;
|
||||
}
|
||||
|
||||
var enable_full_hacktv = false;
|
||||
if (wtvshared.getServiceDep("/viewergen/" + "HackTV.zip", true)) {
|
||||
enable_full_hacktv = true;
|
||||
disksets['99'] = "HackTV.zip";
|
||||
}
|
||||
|
||||
if (request_headers.query.viewer &&
|
||||
(request_headers.query.client_ssid || request_headers.query.random_ssid)) {
|
||||
var client_ssid = null;
|
||||
if (request_headers.query.client_ssid)
|
||||
client_ssid = request_headers.query.client_ssid;
|
||||
|
||||
if (request_headers.query.random_ssid)
|
||||
client_ssid = generateSSID();
|
||||
|
||||
var viewer_file = viewers[request_headers.query.viewer];
|
||||
var needs_hacktv_mini = (viewer_file === "WebTVIntel--2.5-HE.exe") ? true : false
|
||||
if (!viewer_file) {
|
||||
errpage = wtvshared.doErrorPage("500", null, socket.minisrv_pc_mode)
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
} else {
|
||||
var viewer_gz_data = wtvshared.getServiceDep("/viewergen/" + viewer_file + ".gz");
|
||||
var viewer_data = zlib.gunzipSync(viewer_gz_data);
|
||||
var viewer_md5 = crypto.createHash('md5').update(viewer_data).digest("hex");
|
||||
if (viewer_md5 != viewer_stock_md5s[viewer_file]) {
|
||||
console.error(viewer_file, "md5sum error. expected:", viewer_stock_md5s[viewer_file], ", got:", viewer_md5)
|
||||
errpage = wtvshared.doErrorPage("500", null, socket.minisrv_pc_mode)
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
} else {
|
||||
var build = request_headers.query.build;
|
||||
var client_data_obj = null
|
||||
|
||||
if (build) {
|
||||
if (parseInt(build) > 0) {
|
||||
client_data_obj = buildProfile(parseInt(build));
|
||||
}
|
||||
}
|
||||
// fallback
|
||||
if (!client_data_obj)
|
||||
client_data_obj = buildProfile(7181);
|
||||
|
||||
var viewer_tag = viewer_file.split('.');
|
||||
viewer_tag.pop();
|
||||
client_data_obj['wtv-viewer'] = viewer_tag.join('.');
|
||||
client_data_obj["wtv-client-serial-number"] = client_ssid;
|
||||
var patchDataObject = {
|
||||
data: viewer_data,
|
||||
patch_data: getPatchData(viewer_file, client_data_obj)
|
||||
}
|
||||
|
||||
if (!patchDataObject.patch_data) {
|
||||
errpage = wtvshared.doErrorPage("500", null, socket.minisrv_pc_mode)
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
} else {
|
||||
var patched_file = patchBinary(patchDataObject);
|
||||
var enabled_feature_bits = [];
|
||||
Object.keys(request_headers.query).forEach((k) => {
|
||||
if (k.substring(0, 12) === "feature_bit_") {
|
||||
enabled_feature_bits.push(parseInt(k.substring(12)));
|
||||
}
|
||||
});
|
||||
Object.keys(enabled_feature_bits).forEach((k) => {
|
||||
var bit = feature_bits[request_headers.query.viewer][enabled_feature_bits[k]];
|
||||
if (bit) {
|
||||
patched_file = applyPatch(patched_file, bit.value, bit.offset);
|
||||
}
|
||||
});
|
||||
|
||||
headers = `200 OK
|
||||
Content-Type: application/octet-stream
|
||||
Content-Disposition: attachment; filename="${viewer_file.replace(".exe", ".zip")}"`
|
||||
var AdmZip = require("adm-zip");
|
||||
var zip = new AdmZip();
|
||||
|
||||
zip.addZipComment("Viewer SSID: " + client_ssid);
|
||||
zip.addFile(viewer_file.replace("--", "-" + client_ssid + "-"), patched_file);
|
||||
if (!request_headers.query.viewer_only) {
|
||||
var romset_zip = new AdmZip(wtvshard.getServiceDep("/viewergen/" + viewer_file.replace(".exe", "").replace("WebTVIntel", "AppData") + ".zip", true));
|
||||
var zipEntries = romset_zip.getEntries();
|
||||
zipEntries.forEach(function (zipEntry) {
|
||||
if (zipEntry.entryName == "Setup.bmp" && request_headers.query.logo) {
|
||||
var logo_file = logos[parseInt(request_headers.query.logo) || 0];
|
||||
if (logo_file) {
|
||||
var logo_gz_data = wtvshard.getServiceDep("/viewergen/" + logo_file + ".gz");
|
||||
var logo_data = zlib.gunzipSync(logo_gz_data);
|
||||
zip.addFile(zipEntry.entryName, logo_data);
|
||||
} else {
|
||||
zip.addFile(zipEntry.entryName, zipEntry.getData());
|
||||
}
|
||||
} else {
|
||||
zip.addFile(zipEntry.entryName, zipEntry.getData());
|
||||
}
|
||||
});
|
||||
if (request_headers.query.diskset || needs_hacktv_mini) {
|
||||
var diskset_file = 0;
|
||||
if (needs_hacktv_mini) diskset_file = disksets[98];
|
||||
else diskset_file = disksets[parseInt(request_headers.query.diskset) || 0];
|
||||
if (diskset_file) {
|
||||
var diskset_zip = new AdmZip(wtvshard.getServiceDep("/viewergen/" + diskset_file, true));
|
||||
var zipEntries = diskset_zip.getEntries();
|
||||
zipEntries.forEach(function (zipEntry) {
|
||||
zip.addFile("Disk/" + zipEntry.entryName, zipEntry.getData());
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var embed_modpacks = [];
|
||||
Object.keys(request_headers.query).forEach((k) => {
|
||||
if (k.substring(0, 8) === "modpack_") {
|
||||
embed_modpacks.push(parseInt(k.substring(8)));
|
||||
}
|
||||
});
|
||||
|
||||
if (embed_modpacks.length > 0) {
|
||||
Object.keys(embed_modpacks).forEach((k) => {
|
||||
var modpack_file = wtvshard.getServiceDep("/viewergen/" + modpacks[k].file, true);
|
||||
if (fs.existsSync(modpack_file)) {
|
||||
var modpack_zip = new AdmZip(modpack_file);
|
||||
var zipEntries = modpack_zip.getEntries();
|
||||
zipEntries.forEach(function (zipEntry) {
|
||||
zip.addFile(zipEntry.entryName, zipEntry.getData());
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
data = zip.toBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
headers = `200 OK
|
||||
Content-Type: text/html`
|
||||
|
||||
data = `<html>
|
||||
<head>
|
||||
<title>zefie minisrv v${minisrv_config.version}</title>
|
||||
<style type="Text/css">
|
||||
table, td {
|
||||
border: 1px dotted;
|
||||
}
|
||||
td {
|
||||
padding: 5px;
|
||||
vertical-align: text-top;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<script>
|
||||
window.onload = function() {
|
||||
updateFeatureBits();
|
||||
}
|
||||
|
||||
function getSSIDCRC(ssid) {
|
||||
let crc = 0;
|
||||
var ssid = ssid.substr(0, 14);
|
||||
for (let i = 0; i < ssid.length; i += 2) {
|
||||
let inbyte = parseInt(ssid.substring(i, i+2), 16);
|
||||
for (let ii = 8; ii > 0; ii--) {
|
||||
let mix = (crc ^ inbyte) & 0x01;
|
||||
crc >>= 1;
|
||||
if (mix != 0) crc ^= 0x8C;
|
||||
inbyte >>= 1;
|
||||
}
|
||||
|
||||
if(isNaN(crc)) crc = 0;
|
||||
}
|
||||
|
||||
var out = crc.toString(16);
|
||||
if (out.length == 1) return "0" + out;
|
||||
else return out;
|
||||
}
|
||||
|
||||
function generateSSID() {
|
||||
var ssid_template = "91xxxxxxaeb002";
|
||||
var ssid = ssid_template;
|
||||
while (ssid.indexOf("x") != -1) {
|
||||
// random hex char from 0-F
|
||||
ssid = ssid.replace("x", Math.floor(Math.random() * 16).toString(16))
|
||||
}
|
||||
document.getElementById('client_ssid').value = ssid + getSSIDCRC(ssid);
|
||||
}
|
||||
|
||||
function validateForm() {
|
||||
var ssidForm = document.getElementById('client_ssid');
|
||||
if (document.getElementById('random_ssid').checked) {
|
||||
document.getElementById('viewergen').submit();
|
||||
} else {
|
||||
if (validateSSID(ssidForm.value)) {
|
||||
document.getElementById('viewergen').submit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function updateFeatureBits() {
|
||||
var feature_bit_html = document.getElementById('feature_bits');
|
||||
var viewer_select = document.getElementById('viewer');
|
||||
var selected_viewer = parseInt(viewer_select[viewer_select.selectedIndex].value);
|
||||
`;
|
||||
var bits = 0;
|
||||
Object.keys(feature_bits).forEach((k) => {
|
||||
data += `\t${(bits === 0) ? "if" : "else if"} (selected_viewer == parseInt(${k})) {\n`;
|
||||
data += `\t\tfeature_bit_html.innerHTML = "";\n`
|
||||
Object.keys(feature_bits[k]).forEach((j) => {
|
||||
data += `\t\tfeature_bit_html.innerHTML += "<input type=\\"checkbox\\" name=\\"feature_bit_${j}\\"${(feature_bits[k][j].default) ? "checked=checked" : ""}>${feature_bits[k][j].name}<br> <em>${feature_bits[k][j].description}</em><br>"\n`;
|
||||
});
|
||||
data += "\t}\n";
|
||||
bits++;
|
||||
});
|
||||
|
||||
data += ` else {
|
||||
feature_bit_html.innerHTML = "None available";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function validateSSID(ssid) {
|
||||
if (ssid.length != 16) {
|
||||
alert("Please choose a valid SSID and try again.");
|
||||
return false;
|
||||
}
|
||||
if ((ssid.substr(0,1) != "0" && ssid.substr(0,1) != "8" && ssid.substr(0,1) != "9") ||
|
||||
(ssid.substr(6,1) != "0") ||
|
||||
(ssid.substr(9,5) != "0b002")) {
|
||||
alert("Your SSID is not proper, but I'll allow it.")
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function toggleRandomizer(cbox) {
|
||||
document.getElementById('client_ssid').disabled = cbox.checked;
|
||||
document.getElementById('generate_ssid').disabled = cbox.checked;
|
||||
}
|
||||
|
||||
function toggleLogoOption(cbox) {
|
||||
document.getElementById('logo').disabled = cbox.checked;
|
||||
document.getElementById('diskset').disabled = cbox.checked;
|
||||
}
|
||||
|
||||
</script>
|
||||
<body bgcolor="#000000" text="#449944">
|
||||
<p>
|
||||
Welcome to the zefie minisrv v${minisrv_config.version} PC Services<Br>
|
||||
<hr>
|
||||
<form method="GET" id="viewergen">
|
||||
<table>
|
||||
<tr>
|
||||
<td><strong>Viewer Version:</strong></td>
|
||||
<td>
|
||||
<select name="viewer" id="viewer" onchange="updateFeatureBits()">
|
||||
<option value="0">WebTV Viewer v1.0 Build 146 (w/ B210 ROMs)</option>
|
||||
<option value="1">WebTV Viewer v1.1 Build 220</option>
|
||||
<option value="2">WebTV Viewer v2.5 Build 117</option>
|
||||
<option value="3">WebTV Viewer v1.0 Build 210 (Hackers Edition)</option>
|
||||
<option selected value="4">WebTV Viewer v2.5 Build 117 (Hackers Edition)</option>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>SSID:</strong></td>
|
||||
<td><input name="client_ssid" id="client_ssid" maxlength=16" value="91" disabled=disabled>
|
||||
<input type="button" onclick="generateSSID()" id="generate_ssid" value="Randomize SSID" disabled=disabled/><br>
|
||||
<em>Viewer clients should use SSIDs starting with <strong>91</strong>,<br>
|
||||
unless you are intentionally trying to spoof a box.</em>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Startup Logo</strong></td>
|
||||
<td><select name="logo" id="logo">
|
||||
<option selected value="0">WebTV Viewer Default</option>
|
||||
<option value="1">SuperViewer 4.0</option>
|
||||
<option value="2">WebTV Viewer Hacker's Edition</option>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Disk Set</strong></td>
|
||||
<td><select name="diskset" id="diskset">
|
||||
<option selected value="0">WebTV Viewer Default</option>`;
|
||||
if (enable_full_hacktv)
|
||||
data += `<option value="99">MattMan69's HackTV(Full Content)</option>`;
|
||||
data += `
|
||||
</select>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Build Spoof</strong></td>
|
||||
<td><select name="build" id="build">
|
||||
<option value="1235">Build 1235 (Old Classic)</option>
|
||||
<option value="71810">Build 7181 (Old Classic)</option>
|
||||
<option selected value="7181">Build 7181 (Old Plus)</option>
|
||||
<option value="16276">Build 16276 (Old Plus)</option>
|
||||
</select><br>
|
||||
<em>This legacy option has little impact on minisrv servers,<br>
|
||||
although certain advanced server operators may use these flags<br>
|
||||
to determine what your "box" can do, and as such, may offer<br>
|
||||
features that do not work in the Viewer, especially older ones</em>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><strong>Feature Packs</strong></td>
|
||||
<td><div id="feature_bits">None available</div></td>
|
||||
</tr>`;
|
||||
if (modpacks.length > 0) {
|
||||
data += `<tr>
|
||||
<td><strong>Mod Packs</strong></td>
|
||||
<td>`;
|
||||
|
||||
Object.keys(modpacks).forEach((k) => {
|
||||
data += `<input type="checkbox" name="modpack_${k}"${(modpacks[k].default) ? " checked=checked" : ""}>${modpacks[k].name}<br> <em>${modpacks[k].description}</em><br>`
|
||||
})
|
||||
|
||||
data += `</td>
|
||||
</tr>`;
|
||||
}
|
||||
|
||||
data += `
|
||||
<tr>
|
||||
<td><strong>Other Flags</strong>:</td>
|
||||
<td>
|
||||
<input type="checkbox" name="random_ssid" id="random_ssid" onchange="toggleRandomizer(this)" checked=checked> Let the server choose the SSID (Ignores SSID above)<br>
|
||||
<input type="checkbox" name="viewer_only" onchange="toggleLogoOption(this)"> Only include Viewer EXE, not ROM files or Logos (Advanced Users Only)
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<tr>
|
||||
<td colspan="2" style="text-align: right">
|
||||
<br>
|
||||
<input type="button" onclick="validateForm()" value="Get Modified WebTV Viewer">
|
||||
</table>
|
||||
</form>
|
||||
</body>
|
||||
</html>`;
|
||||
}
|
||||
48
zefie_wtvp_minisrv/includes/ServiceVault/wtv-1800/noflash.js
Normal file
@@ -0,0 +1,48 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
if (socket.ssid != null && !session_data.get("wtvsec_login")) {
|
||||
var 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) {
|
||||
var wtvsec_login = session_data.get("wtvsec_login");
|
||||
}
|
||||
|
||||
if (wtvsec_login) {
|
||||
|
||||
|
||||
headers = `200 OK
|
||||
Connection: Keep-Alive
|
||||
minisrv-use-carriage-return: false
|
||||
minisrv-no-mail-count: true
|
||||
wtv-initial-key: ` + wtvsec_login.challenge_key.toString(CryptoJS.enc.Base64) + `
|
||||
Content-Type: text/tellyscript
|
||||
wtv-service: reset
|
||||
${getServiceString('wtv-1800')}
|
||||
${getServiceString('wtv-head-waiter')}
|
||||
${getServiceString('wtv-star', { "no_star_word": true })}
|
||||
${getServiceString('wtv-flashrom')}
|
||||
wtv-boot-url: wtv-head-waiter:/login?
|
||||
wtv-visit: wtv-head-waiter:/login?
|
||||
wtv-client-time-zone: GMT -0000
|
||||
wtv-client-time-dst-rule: GMT
|
||||
wtv-client-date: `+ strftime("%a, %d %b %Y %H:%M:%S", new Date(new Date().toUTCString())) + ` GMT`;
|
||||
|
||||
var file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/bf0app/bf0app_WTV_18006138199.tok", true);
|
||||
|
||||
if (file_path) {
|
||||
request_is_async = true;
|
||||
fs.readFile(file_path, null, function (err, file_read_data) {
|
||||
if (err) {
|
||||
headers=`500 Some error occurred...`
|
||||
}
|
||||
sendToClient(socket, headers, file_read_data);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
console.log(" * Something bad happened (we don't know the client ssid???)");
|
||||
headers=`500 missing ssid`
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var gourl = "wtv-1800:/finish-prereg?";
|
||||
if (request_headers.query.relogin) gourl += "relogin=true";
|
||||
|
||||
|
||||
if (request_headers["wtv-ticket"]) {
|
||||
gourl = "wtv-head-waiter:/login-stage-two?";
|
||||
}
|
||||
|
||||
headers = `200 OK
|
||||
Connection: Keep-Alive
|
||||
minisrv-no-mail-count: true
|
||||
wtv-expire-all: wtv-
|
||||
wtv-open-isp-disabled: false
|
||||
wtv-visit: `+ gourl + `
|
||||
Content-type: text/html`;
|
||||
200
zefie_wtvp_minisrv/includes/ServiceVault/wtv-1800/preregister.js
Normal file
@@ -0,0 +1,200 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var gourl = "wtv-head-waiter:/login?";
|
||||
|
||||
|
||||
if (session_data) {
|
||||
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);
|
||||
} else {
|
||||
session_data.session_data = {};
|
||||
session_data.setSessionData("registered", false);
|
||||
}
|
||||
if (session_data.data_store) {
|
||||
if (session_data.data_store.sockets) {
|
||||
var i = 0;
|
||||
session_data.data_store.sockets.forEach(function (k) {
|
||||
if (typeof k != "undefined") {
|
||||
if (k != socket) {
|
||||
k.destroy();
|
||||
session_data.data_store.sockets.delete(k);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
});
|
||||
if (i > 0 && minisrv_config.config.debug_flags.debug) console.log(" # Closed", i, "previous sockets for", wtvshared.filterSSID(socket.ssid));
|
||||
}
|
||||
}
|
||||
if (session_data.data_store.wtvsec_login) {
|
||||
if (minisrv_config.config.debug_flags.debug) console.log(" # Recreating primary WTVSec login instance for", wtvshared.filterSSID(socket.ssid));
|
||||
delete session_data.data_store.wtvsec_login;
|
||||
}
|
||||
|
||||
session_data.data_store.wtvsec_login = session_data.createWTVSecSession();
|
||||
session_data.data_store.wtvsec_login.IssueChallenge();
|
||||
if (request_headers["wtv-incarnation"]) session_data.data_store.wtvsec_login.set_incarnation(request_headers["wtv-incarnation"]);
|
||||
} else {
|
||||
console.log(" * Something bad happened (we don't know the client ssid???)");
|
||||
var errpage = wtvshared.doErrorPage(400)
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
|
||||
if (request_headers.query.relogin && session_data.getSessionData("registered")) {
|
||||
gourl += "relogin=true";
|
||||
session_data.setUserLoggedIn(false);
|
||||
}
|
||||
if (request_headers.query.reconnect && session_data.getSessionData("registered")) gourl += "reconnect=true";
|
||||
|
||||
if (session_data.data_store.wtvsec_login) {
|
||||
var prereg_contype = "text/html";
|
||||
|
||||
if (request_headers.query.relogin || request_headers.query.guest_login) { // relogin
|
||||
session_data.data_store.wtvsec_login.ticket_b64 = null; // clear old ticket
|
||||
}
|
||||
|
||||
// if relogin and wtv-script-id != 0, skip tellyscript
|
||||
session_data.set("wtv-open-access", (request_headers['wtv-open-access'] == "true") ? true : false);
|
||||
var file_path = null;
|
||||
var bf0app_update = false;
|
||||
var romtype = session_data.get("wtv-client-rom-type");
|
||||
var bootrom = parseInt(session_data.get("wtv-client-bootrom-version"));
|
||||
var send_tellyscript = (minisrv_config.services[service_name].send_tellyscripts && !request_headers.query.relogin && !request_headers.query.guest_login && !bootrom !== 0);
|
||||
var wtv_script_id = parseInt(session_data.get("wtv-script-id"));
|
||||
var 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 (wtv_script_id !== 0 && wtv_script_mod !== 0) send_tellyscript = false;
|
||||
if (send_tellyscript) {
|
||||
if (minisrv_config.services[service_name].send_tellyscript_ssid_whitelist) {
|
||||
var send_telly_to_ssid = (minisrv_config.services[service_name].send_tellyscript_ssid_whitelist.findIndex(element => element == socket.ssid) != -1)
|
||||
if (send_telly_to_ssid) {
|
||||
romtype = session_data.get("wtv-client-rom-type");
|
||||
}
|
||||
} else {
|
||||
romtype = session_data.get("wtv-client-rom-type");
|
||||
}
|
||||
switch (romtype) {
|
||||
case "US-LC2-disk-0MB-8MB":
|
||||
case "US-LC2-disk-0MB-8MB-softmodem-CPU5230":
|
||||
case "US-BPS-flashdisk-0MB-8MB-softmodem-CPU5230":
|
||||
case "US-LC2-flashdisk-0MB-16MB-softmodem-CPU5230":
|
||||
case "US-WEBSTAR-disk-0MB-16MB-softmodem-CPU5230":
|
||||
prereg_contype = "text/tellyscript";
|
||||
// if wtv-open-access: true then client expects OpenISP
|
||||
if (session_data.get("wtv-open-access")) file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/LC2/LC2_OpenISP_56k.tok", true);
|
||||
else file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/LC2/LC2_WTV_18006138199.tok", true);
|
||||
break;
|
||||
|
||||
case "US-DTV-disk-0MB-32MB-softmodem-CPU5230":
|
||||
if (wtvshared.isMiniBrowser(session_data)) {
|
||||
prereg_contype = "text/tellyscript";
|
||||
if (session_data.get("wtv-open-access")) file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/LC2/LC2_OpenISP_56k.tok", true);
|
||||
else file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/LC2/LC2_WTV_18006138199.tok", true);
|
||||
} else {
|
||||
prereg_contype = "text/dialscript";
|
||||
if (session_data.get("wtv-lan") == "true") {
|
||||
file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/UTV/utv_hsd.tok", true);
|
||||
} else {
|
||||
// todo OpenISP telly
|
||||
file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/UTV/utv_normal.tok", true);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case "bf0app":
|
||||
prereg_contype = "text/tellyscript";
|
||||
// if wtv-open-access: true then client expects OpenISP
|
||||
if (session_data.get("wtv-open-access")) file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/bf0app/bf0app_OISP.tok", true);
|
||||
else file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/bf0app/bf0app_WTV_18006138199.tok", true);
|
||||
break;
|
||||
|
||||
// the following are not yet zefie generated and may have an unknown username/password attached
|
||||
|
||||
case "JP-Fiji":
|
||||
prereg_contype = "text/tellyscript";
|
||||
// if wtv-open-access: true then client expects OpenISP
|
||||
if (session_data.get("wtv-open-access")) var file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/FIJI/dc_production_normal.tok", true);
|
||||
else var file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/FIJI/dc_production_normal.tok", true);
|
||||
break;
|
||||
|
||||
default:
|
||||
data = '';
|
||||
break;
|
||||
}
|
||||
|
||||
if (socket.ssid.substr(0, 8) == "MSTVSIMU") {
|
||||
prereg_contype = "text/dialscript";
|
||||
var file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/UTV/utv_hsd.tok", true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!request_headers['wtv-client-rom-type'] && bootrom == "105") {
|
||||
// assume old classic in flash mode, override user setting and send tellyscript
|
||||
// because it is required to proceed in flash mode
|
||||
prereg_contype = "text/tellyscript";
|
||||
var file_path = wtvshared.getServiceDep("/wtv-1800/tellyscripts/bf0app/bf0app_WTV_18006138199.tok", true);
|
||||
var bf0app_update = true;
|
||||
session_data.set("bf0app_update", bf0app_update);
|
||||
}
|
||||
|
||||
if (request_headers["wtv-ticket"] && !request_headers.query.reconnect) {
|
||||
gourl = "wtv-head-waiter:/login-stage-two?relogin=true";
|
||||
}
|
||||
|
||||
if (request_headers.query.reconnect) gourl = null;
|
||||
|
||||
if (request_headers.query.guest_login) {
|
||||
send_tellyscript = false;
|
||||
if (gourl != null) gourl += "&guest_login=true"
|
||||
if (request_headers.query.skip_splash) gourl += "&skip_splash=true";
|
||||
}
|
||||
|
||||
if (!file_path != null && send_tellyscript && !minisrv_config.config.debug_flags.quiet) console.log(" * Sending TellyScript", file_path, "on socket", socket.id);
|
||||
|
||||
|
||||
headers = "200 OK\n"
|
||||
headers += "minisrv-no-mail-count: true\n";
|
||||
if (bf0app_update) headers += "minisrv-use-carriage-return: false\n";
|
||||
headers += "Connection: Keep-Alive\n";
|
||||
headers += "wtv-initial-key: " + session_data.data_store.wtvsec_login.challenge_key.toString(CryptoJS.enc.Base64) + "\n";
|
||||
headers += "Content-Type: " + prereg_contype + "\n";
|
||||
if (!request_headers.query.reconnect) headers += "wtv-service: reset\n";
|
||||
if (!bf0app_update) headers += getServiceString('wtv-1800') + "\n";
|
||||
|
||||
if (bf0app_update) headers += getServiceString('wtv-head-waiter', { "flags": "0x00000001" }) + "\n";
|
||||
else headers += getServiceString('wtv-head-waiter') + "\n";
|
||||
|
||||
if (bf0app_update) headers += getServiceString('wtv-star', { "no_star_word": true }) + "\n";
|
||||
else headers += getServiceString('wtv-star') + "\n";
|
||||
if (request_headers.query.reconnect && !session_data.isRegistered() && !session_data.lockdown) headers += getServiceString('wtv-register') + "\n";
|
||||
if (!session_data.lockdown) headers += getServiceString('wtv-flashrom') + "\n";
|
||||
if (bf0app_update) headers += "wtv-boot-url: " + gourl + "\n";
|
||||
else {
|
||||
headers += "wtv-boot-url: wtv-head-waiter:/relogin?relogin=true";
|
||||
if (request_headers.query.guest_login) headers += "&guest_login=true";
|
||||
headers += "\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"
|
||||
headers += "wtv-client-date: " + strftime("%a, %d %b %Y %H:%M:%S", new Date(new Date().toUTCString())) + " GMT";
|
||||
|
||||
if (file_path) {
|
||||
request_is_async = true;
|
||||
fs.readFile(file_path, null, function (err, file_read_data) {
|
||||
if (err) {
|
||||
var errmsg = wtvshared.doErrorPage(400);
|
||||
headers = errmsg[0];
|
||||
file_read_data = errmsg[1] + "\n" + err.toString();
|
||||
}
|
||||
sendToClient(socket, headers, file_read_data);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(400);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
headers = `200 OK
|
||||
Content-type: text/html
|
||||
minisrv-no-mail-count: true`;
|
||||
|
||||
data = `<html>
|
||||
<head>
|
||||
<title>
|
||||
Access Denied
|
||||
</title>
|
||||
<display nostatus nooptions switchtowebmode nohome>
|
||||
</head>
|
||||
<body noscroll bgcolor="#191919" text="#42CC55" link="36d5ff"
|
||||
hspace=0 vspace=0 fontsize="large"
|
||||
>
|
||||
<table cellspacing=0 cellpadding=0^C>
|
||||
<tr>
|
||||
<td width=104 height=74 valign=middle align=center bgcolor="3B3A4D">
|
||||
<img src="${minisrv_config.config.service_logo}" width=86 height=64>
|
||||
<td width=20 valign=top align=left bgcolor="3B3A4D">
|
||||
<img src="ROMCache/Spacer.gif"
|
||||
width=1 height=1>
|
||||
<td colspan=10 width=436 valign=middle align=left bgcolor="3B3A4D">
|
||||
<font color="D6DFD0" size="+2">
|
||||
<blackface>
|
||||
<shadow>
|
||||
<img src="ROMCache/Spacer.gif"
|
||||
width=1 height=4>
|
||||
<br>
|
||||
Access Denied
|
||||
</shadow>
|
||||
</blackface>
|
||||
</font>
|
||||
<tr>
|
||||
<td colspan=12 width=560 height=10 valign=top align=left>
|
||||
<img src="ROMCache/Shadow.gif" width=560 height=6>
|
||||
<tr>
|
||||
<td width=104 height=10 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
<td width=67 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
<td width=67 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
<td width=67 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
<td width=67 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
<td width=68 valign=top align=left>
|
||||
<td width=20 valign=top align=left>
|
||||
<form action="client:poweroff"
|
||||
>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 width=100 height=258 valign=top align=left>
|
||||
<font size=-1>You are not authorized to use this service. <p>Reason: ${session_data.lockdownReason}</font>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=10 height=2 valign=middle align=center bgcolor="2B2B2B">
|
||||
<img src="ROMCache/Spacer.gif" width=436 height=1>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 height=1 valign=top align=left>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=10 height=2 valign=top align=left bgcolor="0D0D0D">
|
||||
<img src="ROMCache/Spacer.gif" width=436 height=1>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 height=4 valign=top align=left>
|
||||
<tr>
|
||||
<td width=104 valign=middle align=center>
|
||||
<td width=20 valign=middle align=center>
|
||||
<td colspan=9 width=416 valign=top align=left>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=306 valign=top align=left>
|
||||
<font size="-1"><i>
|
||||
</i></font><td width=112 valign=top align=right>
|
||||
<font size="-1" color="#E7CE4A">
|
||||
<shadow>
|
||||
<input selected
|
||||
name="Power Off"
|
||||
value="Power Off"
|
||||
type=submit Value=Continue name="Continue" borderimage="file://ROM/Borders/ButtonBorder2.bif" usestyle width=110>
|
||||
</shadow>
|
||||
</font>
|
||||
</form>
|
||||
</table>
|
||||
<td width=20 valign=middle align=center>
|
||||
</table>
|
||||
</body>
|
||||
</html>`;
|
||||
94
zefie_wtvp_minisrv/includes/ServiceVault/wtv-admin/admin.js
Normal file
@@ -0,0 +1,94 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var WTVAdmin = require(classPath + "/WTVAdmin.js");
|
||||
var wtva = new WTVAdmin(minisrv_config, session_data, service_name);
|
||||
var auth = wtva.isAuthorized();
|
||||
if (auth === true) {
|
||||
var password = null;
|
||||
if (request_headers.Authorization) {
|
||||
var authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
}
|
||||
if (wtva.checkPassword(password)) {
|
||||
headers = "200 OK\r\nContent-Type: text/html";
|
||||
data = `<html>
|
||||
<body>
|
||||
<display nosave nosend>
|
||||
<title>${minisrv_config.config.service_name} Admin Tricks</title>
|
||||
<sidebar width=20%>
|
||||
<img src="wtv-tricks:/images/Favorites_bg.jpg">
|
||||
</sidebar>
|
||||
<body bgcolor="#101010" text="#FF3455" link="#ff55ff" vlink="#ff55ff" vspace=0>
|
||||
<font size="-1">
|
||||
<br>
|
||||
<br>
|
||||
<h1>${minisrv_config.config.service_name} Admin Tricks</h1>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan=3 height=6>
|
||||
<tr>
|
||||
<td width=170><a href="wtv-tricks:/tricks">Standard Tricks</a>
|
||||
<td width=10>
|
||||
<td><a href="wtv-admin:/findaccount">Account Lookup</a>
|
||||
<tr>
|
||||
<td colspan=3 height=6>
|
||||
<tr>
|
||||
<td><a href="wtv-admin:/ban">Ban an SSID</a>
|
||||
<td width = 10>
|
||||
<td><a href="wtv-admin:/deleteaccount">Delete an Account</a>
|
||||
<tr>
|
||||
<td colspan=3 height=6>
|
||||
<tr>
|
||||
<td><a href="wtv-admin:/unban">Unban an SSID</a>
|
||||
<td width = 10>
|
||||
<td><a href="wtv-admin:/deleteuser">Delete User from Account</a>
|
||||
<tr>
|
||||
<td colspan=3 height=6>
|
||||
<tr>
|
||||
<td><strike><a href="wtv-admin:/whitelist">Whitelist an SSID</a></strike>
|
||||
<td width = 10>
|
||||
<td><a href="wtv-admin:/removeuserpasswd">Remove Pass from User </a>
|
||||
<tr>
|
||||
<td colspan=3 height=6>
|
||||
<tr>
|
||||
<td><strike><a href="wtv-admin:/addadmin">Grant Admin to SSID</a></strike>
|
||||
<td width = 10>
|
||||
<td><a href="wtv-admin:/polyzoot">Polyzoot a User</a>
|
||||
<tr>
|
||||
<td colspan=3 height=6>
|
||||
<tr>
|
||||
<td><strike><a href="wtv-admin:/modadmin">Modify Admin for SSID</a></strike>
|
||||
<td width = 10>
|
||||
<td><a href="wtv-admin:/operatortweaks">Edit Config</a>
|
||||
<tr>
|
||||
<td colspan=3 height=6>
|
||||
<tr>
|
||||
<td><a href="wtv-admin:/regenfavs">Restore Favs for User</a>
|
||||
<td width = 10>
|
||||
<td><a href="wtv-admin:/reloadconfig">Reload Config</a>
|
||||
<tr>
|
||||
<td colspan=3 height=6>
|
||||
<tr>
|
||||
<td><!-- TODO -->
|
||||
<td width = 10>
|
||||
<td>
|
||||
<!-- TODO -->
|
||||
<td width = 10>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(401, "Please enter the administration password, you can leave the username blank.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(403, auth);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
94
zefie_wtvp_minisrv/includes/ServiceVault/wtv-admin/ban.js
Normal file
@@ -0,0 +1,94 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var WTVAdmin = require(classPath + "/WTVAdmin.js");
|
||||
var wtva = new WTVAdmin(minisrv_config, session_data, service_name);
|
||||
var auth = wtva.isAuthorized();
|
||||
if (auth === true) {
|
||||
var password = null;
|
||||
if (request_headers.Authorization) {
|
||||
var authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
}
|
||||
if (wtva.checkPassword(password)) {
|
||||
if (request_headers.query.ssid) {
|
||||
var ssid = request_headers.query.ssid.toLowerCase();
|
||||
if (ssid == socket.ssid) {
|
||||
var nobanself = true;
|
||||
} else {
|
||||
var fake_config = wtvshared.getUserConfig();
|
||||
if (!fake_config.config) fake_config.config = {};
|
||||
if (!fake_config.config.ssid_block_list) fake_config.config.ssid_block_list = [];
|
||||
var entry_exists = false;
|
||||
Object.keys(fake_config.config.ssid_block_list).forEach(function (k) {
|
||||
if (fake_config.config.ssid_block_list[k] == ssid) {
|
||||
entry_exists = true;
|
||||
}
|
||||
});
|
||||
if (!entry_exists) {
|
||||
fake_config.config.ssid_block_list.push(ssid);
|
||||
wtvshared.writeToUserConfig(fake_config);
|
||||
reloadConfig();
|
||||
}
|
||||
}
|
||||
}
|
||||
headers = `200 OK
|
||||
Content-Type: text/html
|
||||
wtv-expire-all: wtv-admin:/ban`;
|
||||
if (ssid) {
|
||||
headers += "\nwtv-noback-all: wtv-admin:/ban";
|
||||
}
|
||||
data = `<html>
|
||||
<body>
|
||||
<display nosave nosend>
|
||||
<title>${minisrv_config.config.service_name} Admin Tricks</title>
|
||||
<sidebar width=20%>
|
||||
<img src="wtv-admin:/images/nuke.gif">
|
||||
</sidebar>
|
||||
<body bgcolor="#101010" text="#FF3455" link="#ff55ff" vlink="#ff55ff" vspace=0>
|
||||
<br>
|
||||
<br>
|
||||
<h1>${minisrv_config.config.service_name} Admin Tricks</h1>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan=3 height=6>
|
||||
<h3>Ban an SSID</h3>
|
||||
<form action="wtv-admin:/ban" method="POST">
|
||||
<input type="text" name="ssid" value="${(ssid) ? ssid : ""}">
|
||||
<input type="submit" value="Ban SSID">
|
||||
</form><br><br>`
|
||||
if (request_headers.query.ssid) {
|
||||
if (nobanself) {
|
||||
data += "<strong>Cannot ban yourself.</strong>"
|
||||
} else {
|
||||
if (entry_exists) {
|
||||
data += "<strong>SSID " + request_headers.query.ssid + " is already in the ban list.</strong><br><br>";
|
||||
} else {
|
||||
data += "<strong>SSID " + request_headers.query.ssid + " added to the ban list.</strong><br><br>";
|
||||
}
|
||||
}
|
||||
}
|
||||
data += `
|
||||
<br>
|
||||
<br>
|
||||
<tr>
|
||||
</table>
|
||||
<p align="right">
|
||||
<a href="client:goback">Go Back</a>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(401, "Please enter the administration password, you can leave the username blank.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(403, auth);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var WTVAdmin = require(classPath + "/WTVAdmin.js");
|
||||
var wtva = new WTVAdmin(minisrv_config, session_data, service_name);
|
||||
var auth = wtva.isAuthorized();
|
||||
if (auth === true) {
|
||||
var password = null;
|
||||
if (request_headers.Authorization) {
|
||||
var authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
}
|
||||
if (wtva.checkPassword(password)) {
|
||||
if (request_headers.query.ssid) {
|
||||
var ssid_match = false;
|
||||
var ssid = request_headers.query.ssid.toLowerCase();
|
||||
var user_info = wtva.getAccountInfoBySSID(ssid);
|
||||
if (request_headers.query.confirm_delete) {
|
||||
user_info = null;
|
||||
if (ssid == socket.ssid) {
|
||||
ssid_match = true;
|
||||
} else {
|
||||
// delete
|
||||
var userAccount = wtva.getAccountBySSID(ssid);
|
||||
userAccount.unregisterBox();
|
||||
}
|
||||
}
|
||||
}
|
||||
headers = `200 OK
|
||||
Content-Type: text/html
|
||||
wtv-expire-all: wtv-admin:/deleteaccount
|
||||
wtv-noback-all: wtv-admin:/deleteaccount`;
|
||||
data = `<html>
|
||||
<body>
|
||||
<display nosave nosend>
|
||||
<title>${minisrv_config.config.service_name} Admin Tricks</title>
|
||||
<sidebar width=20%>
|
||||
<img src="wtv-admin:/images/nuke.gif">
|
||||
</sidebar>
|
||||
<body bgcolor="#101010" text="#FF3455" link="#ff55ff" vlink="#ff55ff" vspace=0>
|
||||
<br>
|
||||
<br>
|
||||
<h1>${minisrv_config.config.service_name} Admin Tricks</h1>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan=3 height=6>
|
||||
<h3>Delete an Account</h3>
|
||||
<form action="wtv-admin:/deleteaccount" method="POST">
|
||||
<input type="text" name="ssid" value="${(ssid) ? ssid : ""}"> <input type="submit" value="Look Up SSID">
|
||||
</form><br><br>`
|
||||
if (ssid) {
|
||||
if (user_info) {
|
||||
data += `
|
||||
<strong>User Information:</strong>
|
||||
<table border=1 cellpadding=3 width=400>
|
||||
<tr><td>Username:</td><td>${user_info.username} (User ID: ${user_info.user_id})</td></tr>
|
||||
<tr><td>SSID:</td><td>${user_info.ssid}</td></tr>`;
|
||||
if (user_info.account_users) {
|
||||
data += `<tr><td>Primary User:</td><td>${user_info.account_users['subscriber'].subscriber_username}</td></tr>`;
|
||||
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;
|
||||
data += user_info.account_users[k].subscriber_username + "<br>";
|
||||
})
|
||||
data += `</td></tr>`
|
||||
}
|
||||
}
|
||||
data += `
|
||||
<tr>
|
||||
<td border=0 colspan=2 align=right>
|
||||
<form action="wtv-admin:/deleteaccount" method="POST">
|
||||
<input type="hidden" name="ssid" value="${user_info.ssid}">
|
||||
<input type="hidden" name="confirm_delete" value="true">
|
||||
<input type="submit" value="Confirm Delete">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
`
|
||||
data += `</table>`;
|
||||
} else if (request_headers.query.confirm_delete && ssid_match) {
|
||||
data += `<strong>Cannot delete yourself in this manner.<br>Try ${minisrv_config.config.service_name} Tricks Unregister.</strong><br><br>`;
|
||||
} else if (request_headers.query.confirm_delete) {
|
||||
data += "<strong>Account for SSID \"" + ssid + "\" has been deleted.</strong><br><br>";
|
||||
} else {
|
||||
data += "<strong>Could not find an account for SSID \"" + ssid + "\"</strong><br><br>";
|
||||
}
|
||||
}
|
||||
data += `
|
||||
<br>
|
||||
<br>
|
||||
<tr>
|
||||
</table>
|
||||
<p align="right">
|
||||
<a href="client:goback">Go Back</a>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(401, "Please enter the administration password, you can leave the username blank.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(403, auth);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
118
zefie_wtvp_minisrv/includes/ServiceVault/wtv-admin/deleteuser.js
Normal file
@@ -0,0 +1,118 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var WTVAdmin = require(classPath + "/WTVAdmin.js");
|
||||
var wtva = new WTVAdmin(minisrv_config, session_data, service_name);
|
||||
var auth = wtva.isAuthorized();
|
||||
if (auth === true) {
|
||||
var password = null;
|
||||
if (request_headers.Authorization) {
|
||||
var authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
}
|
||||
if (wtva.checkPassword(password)) {
|
||||
if (request_headers.query.username) {
|
||||
var show_cannot_modify_self = false;
|
||||
var show_cannot_remove_primary = false;
|
||||
var show_box_was_unregistered = false;
|
||||
var user_info = wtva.getAccountInfo(request_headers.query.username.toLowerCase()); // username search
|
||||
if (user_info) {
|
||||
if (user_info.ssid == socket.ssid) {
|
||||
show_cannot_modify_self = true;
|
||||
}
|
||||
if (request_headers.query.confirm_delete) {
|
||||
if (!show_cannot_modify_self) {
|
||||
// delete
|
||||
var userAccount = wtva.getAccountBySSID(user_info.ssid);
|
||||
userAccount.switchUserID(0, false, false);
|
||||
var userCount = Object.keys(user_info.account_users).length;
|
||||
if (user_info.user_id === 0) {
|
||||
show_cannot_remove_primary = true;
|
||||
} else {
|
||||
var result = userAccount.removeUser(user_info.user_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
headers = `200 OK
|
||||
Content-Type: text/html
|
||||
wtv-expire-all: wtv-admin:/deleteuser
|
||||
wtv-noback-all: wtv-admin:/deleteuser`;
|
||||
data = `<html>
|
||||
<body>
|
||||
<display nosave nosend>
|
||||
<title>${minisrv_config.config.service_name} Admin Tricks</title>
|
||||
<sidebar width=20%>
|
||||
<img src="wtv-admin:/images/nuke.gif">
|
||||
</sidebar>
|
||||
<body bgcolor="#101010" text="#FF3455" link="#ff55ff" vlink="#ff55ff" vspace=0>
|
||||
<br>
|
||||
<br>
|
||||
<h1>${minisrv_config.config.service_name} Admin Tricks</h1>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan=3 height=6>
|
||||
<h3>Delete a user from an account</h3>
|
||||
<form action="wtv-admin:/deleteuser" method="POST">
|
||||
<input type="text" name="username" value="${(request_headers.query.username) ? request_headers.query.username : ""}"> <input type="submit" value="Look Up User">
|
||||
</form><br><br>`
|
||||
if (request_headers.query.username) {
|
||||
if (user_info && !request_headers.query.confirm_delete) {
|
||||
data += `
|
||||
<strong>User Information:</strong>
|
||||
<table border=1 cellpadding=3 width=400>
|
||||
<tr><td>Username:</td><td>${user_info.username} (User ID: ${user_info.user_id})</td></tr>
|
||||
<tr><td>SSID:</td><td>${user_info.ssid}</td></tr>`;
|
||||
if (user_info.account_users) {
|
||||
data += `<tr><td>Primary User:</td><td>${user_info.account_users['subscriber'].subscriber_username}</td></tr>`;
|
||||
}
|
||||
data += `
|
||||
<tr>
|
||||
<td border=0 colspan=2 align=right>
|
||||
<form action="wtv-admin:/deleteuser" method="POST">
|
||||
<input type="hidden" name="username" value="${user_info.username}">
|
||||
<input type="hidden" name="confirm_delete" value="true">
|
||||
<input type="submit" value="Confirm Delete">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
`
|
||||
data += `</table>`;
|
||||
} else if (request_headers.query.confirm_delete && show_cannot_modify_self) {
|
||||
data += `<strong>Cannot modify your account in this manner.<br>Try <a href="wtv-setup:/remove-users">wtv-setup</a>.</strong><br><br>`;
|
||||
} else if (request_headers.query.confirm_delete && show_cannot_remove_primary) {
|
||||
data += `<strong>Cannot delete a primary user in this manner.<br>Try <a href="wtv-admin:/deleteaccount?ssid=${user_info.ssid}">deleting the account</a>.<br><br>`;
|
||||
} else if (request_headers.query.confirm_delete && show_box_was_unregistered) {
|
||||
data += `<strong>Account for "${user_info.username}" was deleted, and SSID ${user_info.ssid} unregistered, as it was the only user.<br><br>`;
|
||||
} else if (request_headers.query.confirm_delete) {
|
||||
if (result) data += `<strong>User "${user_info.username}" has been deleted from account belonging to SSID ${user_info.ssid}.</strong><br><br>`;
|
||||
else data += `<strong>Could not delete "${user_info.username}" from SSID ${user_info.ssid}.</strong><br><br>`;
|
||||
} else {
|
||||
data += "<strong>Could not find an account for user \"" + request_headers.query.username + "\"</strong><br><br>";
|
||||
}
|
||||
}
|
||||
data += `
|
||||
<br>
|
||||
<br>
|
||||
<tr>
|
||||
</table>
|
||||
<p align="right">
|
||||
<a href="client:goback">Go Back</a>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(401, "Please enter the administration password, you can leave the username blank.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(403, auth);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var WTVAdmin = require(classPath + "/WTVAdmin.js");
|
||||
var wtva = new WTVAdmin(minisrv_config, session_data, service_name);
|
||||
var auth = wtva.isAuthorized();
|
||||
if (auth === true) {
|
||||
var password = null;
|
||||
if (request_headers.Authorization) {
|
||||
var authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
}
|
||||
if (wtva.checkPassword(password)) {
|
||||
if (request_headers.query.username) {
|
||||
var user_info = wtva.getAccountInfo(request_headers.query.username.toLowerCase()); // username search
|
||||
if (!user_info) user_info = wtva.getAccountInfoBySSID(request_headers.query.username.toLowerCase()); // ssid search
|
||||
}
|
||||
headers = `200 OK
|
||||
Content-Type: text/html
|
||||
wtv-expire-all: wtv-admin:/findaccount
|
||||
wtv-noback-all: wtv-admin:/findaccount`;
|
||||
data = `<html>
|
||||
<body>
|
||||
<display nosave nosend>
|
||||
<title>${minisrv_config.config.service_name} Admin Tricks</title>
|
||||
<sidebar width=20%>
|
||||
<img src="wtv-tricks:/images/Favorites_bg.jpg">
|
||||
</sidebar>
|
||||
<body bgcolor="#101010" text="#FF3455" link="#ff55ff" vlink="#ff55ff" vspace=0>
|
||||
<br>
|
||||
<br>
|
||||
<h1>${minisrv_config.config.service_name} Admin Tricks</h1>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan=3 height=6>
|
||||
<h3>Account Lookup</h3>
|
||||
<form action="wtv-admin:/findaccount" method="POST">
|
||||
<input type="text" name="username" value="${(request_headers.query.username) ? request_headers.query.username : ""}"> <input type="submit" value="Look Up User / SSID">
|
||||
</form><br><br>`
|
||||
if (request_headers.query.username) {
|
||||
if (user_info) {
|
||||
data += `
|
||||
<strong>User Information:</strong>
|
||||
<table border=1 cellpadding=3>
|
||||
<tr><td>Username:</td><td>${user_info.username} (User ID: ${user_info.user_id})</td></tr>
|
||||
<tr><td>SSID:</td><td>${user_info.ssid}</td></tr>`;
|
||||
if (user_info.account_users) {
|
||||
data += `<tr><td>Primary User:</td><td>${user_info.account_users['subscriber'].subscriber_username}</td></tr>`;
|
||||
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;
|
||||
data += user_info.account_users[k].subscriber_username + "<br>";
|
||||
})
|
||||
data += `</td></tr>`
|
||||
}
|
||||
}
|
||||
data += `
|
||||
<tr>
|
||||
<td border=0 colspan=2>`;
|
||||
if (wtva.isBanned(user_info.ssid)) {
|
||||
data += `<a href="wtv-admin:/unban?ssid=${user_info.ssid}">Unban SSID</a>`;
|
||||
data += " ".repeat(28);
|
||||
} else {
|
||||
data += `<a href="wtv-admin:/ban?ssid=${user_info.ssid}">Ban SSID</a>`;
|
||||
data += " ".repeat(32);
|
||||
}
|
||||
data += `<a href="wtv-admin:/deleteaccount?ssid=${user_info.ssid}">Delete Account</span>
|
||||
</td>
|
||||
</tr>
|
||||
`
|
||||
data += `</table>`;
|
||||
} else {
|
||||
data += "<strong>Could not find user \"" + request_headers.query.username + "\"</strong><br><br>";
|
||||
}
|
||||
}
|
||||
data += `
|
||||
<br>
|
||||
<br>
|
||||
<tr>
|
||||
</table>
|
||||
<p align="right">
|
||||
<a href="client:goback">Go Back</a>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(401, "Please enter the administration password, you can leave the username blank.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(403, auth);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 9.3 KiB |
@@ -0,0 +1,272 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var WTVAdmin = require(classPath + "/WTVAdmin.js");
|
||||
var wtva = new WTVAdmin(minisrv_config, session_data, service_name);
|
||||
var auth = wtva.isAuthorized();
|
||||
|
||||
function generateFormField(type, confvar, options = null) {
|
||||
if (confvar.indexOf('.') > 0) {
|
||||
var confvar_split = confvar.split('.');
|
||||
// not operater error resistant, be mindful if you modify this page
|
||||
if (user_config.config[confvar_split[0]])
|
||||
var confvar_value = user_config.config[confvar_split[0]][confvar_split[1]] || minisrv_config.config[confvar_split[0]][confvar_split[1]]
|
||||
else
|
||||
var confvar_value = minisrv_config.config[confvar_split[0]][confvar_split[1]];
|
||||
|
||||
confvar = confvar.replace(".", "-");
|
||||
} else
|
||||
var confvar_value = user_config.config[confvar] || minisrv_config.config[confvar];
|
||||
|
||||
if (type == "input")
|
||||
return `<input bgcolor="101010" text="ee44bb" type="text" name="${confvar}" value="${confvar_value}"${(options) ? ' '+options : ''}>`
|
||||
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") {
|
||||
var 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`
|
||||
});
|
||||
}
|
||||
return out + "</select>";
|
||||
}
|
||||
}
|
||||
|
||||
if (auth === true) {
|
||||
var password = null;
|
||||
if (request_headers.Authorization) {
|
||||
var authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
}
|
||||
if (wtva.checkPassword(password)) {
|
||||
var user_config = wtvshared.getUserConfig();
|
||||
headers = "200 OK\r\nContent-Type: text/html";
|
||||
data = `<html>
|
||||
<body>
|
||||
<display nosave nosend>
|
||||
<title>${minisrv_config.config.service_name} Operator Tweaks</title>
|
||||
<script type="text/javascript">
|
||||
|
||||
function forceNumeric(e) {
|
||||
switch (e.keyCode) {
|
||||
case 8:
|
||||
case 9:
|
||||
case 13:
|
||||
case 48:
|
||||
case 49:
|
||||
case 50:
|
||||
case 51:
|
||||
case 52:
|
||||
case 53:
|
||||
case 54:
|
||||
case 55:
|
||||
case 56:
|
||||
case 57:
|
||||
return true;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function passwordFieldToggle(check) {
|
||||
document.forms[0]['passwords-min_length'].disabled = !check.checked;
|
||||
document.forms[0]['passwords-min_length'].readonly = !check.checked;
|
||||
document.forms[0]['passwords-max_length'].disabled = !check.checked;
|
||||
document.forms[0]['passwords-max_length'].readonly = !check.checked;
|
||||
document.forms[0]['passwords-form_size'].disabled = !check.checked;
|
||||
document.forms[0]['passwords-form_size'].readonly = !check.checked;
|
||||
}
|
||||
|
||||
function validateNumber(field, min, max, def) {
|
||||
var num = parseInt(field.value);
|
||||
if (num === NaN) num = def;
|
||||
if (num < min) num = min;
|
||||
if (num > max) num = max;
|
||||
if (field.value != num) field.value = num;
|
||||
}
|
||||
</script>
|
||||
<sidebar width=20%>
|
||||
<img src="wtv-tricks:/images/Favorites_bg.jpg">
|
||||
</sidebar>
|
||||
<body bgcolor="#101010" text="#EE44bb" link="#ff55ff" vlink="#ff55ff" vspace=0>
|
||||
<font size="-1">
|
||||
<br>
|
||||
<br>
|
||||
<h1><font color=#FF3455>${minisrv_config.config.service_name} Operator Tweaks</font></h1>
|
||||
|
||||
<font size=-1><i>These settings can be updated without restarting minisrv</i></font>
|
||||
<hr>
|
||||
<table>
|
||||
<tr>
|
||||
<TD>
|
||||
<TR>
|
||||
<td>
|
||||
<tr>
|
||||
<td WIDTH=198 VALIGN=top ALIGN=left>
|
||||
<table cellspacing=0 cellpadding=5>
|
||||
<tr><td absheight=60 valign=top>
|
||||
<font size=-1><b>service_owner</b><br>The name of the server
|
||||
operator
|
||||
<tr><td absheight=60 valign=top>
|
||||
<font size=-1><b>service_owner_account</b><br>The minisrv account name of the server
|
||||
operator
|
||||
<tr><td absheight=90 valign=top>
|
||||
<font size=-1><b>service_owner_contact</b><br>The email address or username of the
|
||||
server operator where users can contact them
|
||||
<tr><td absheight=100 valign=top>
|
||||
<font size=-1><b>service_owner_<br>contact_method</b><br>The method by which the user can
|
||||
contact the server operator (eg. email, Discord, Twitter, etc...)
|
||||
<tr><td absheight=60 valign=top>
|
||||
<font size=-1><b>service_name</b><br>The name of the service (eg. WebTV)
|
||||
<tr><td absheight=90 valign=top>
|
||||
<font size=-1><b>service_logo</b><br>The logo for the service. Absolute URL, or file name in the Shared ROMCache.
|
||||
<tr><td absheight=90 valign=top>
|
||||
<font size=-1><b>service_splash_logo</b><br>The splash page logo for the service. Absolute URL, or file name in the Shared ROMCache.
|
||||
<tr><td absheight=60 valign=top>
|
||||
<font size=-1><b>show_detailed_splash</b><br>Show service information and client connection speed on the splash page.
|
||||
<tr><td absheight=60 valign=top>
|
||||
<font size=-1><b>hide_ssid_in_logs</b><br>Filter SSIDs in console logs and log files.
|
||||
<tr><td absheight=90 valign=top>
|
||||
<font size=-1><b>filter_<br>passwords_in_logs</b><br>Filter passwords (if the form field contains 'pass') in console logs and log files.
|
||||
<tr><td absheight=45 valign=top>
|
||||
<font size=-1><b>verbosity</b><br>Console log debug level.
|
||||
<tr><td absheight=60 valign=top>
|
||||
<font size=-1><b>show_diskmap</b><br>Useful for debugging wtv-disk downloads.
|
||||
<tr><td absheight=140 valign=top>
|
||||
<font size=-1><b>allow_guests</b><br>Allows users to use the service without having to register.
|
||||
Guest session data is destroyed upon logout, and some features are not available to guests.
|
||||
<tr><td absheight=90 valign=top>
|
||||
<font size=-1><b>enable_<br>lzpf_compression</b><br>Toggles whether LZPF compression will be considered or not
|
||||
<tr><td absheight=90 valign=top>
|
||||
<font size=-1><b>enable_<br>gzip_compression</b><br>Toggles whether GZIP compression will be considered or not
|
||||
<tr><td absheight=45 valign=top>
|
||||
<font size=-1><b>Max Users Per Account</b>
|
||||
<tr><td absheight=45 valign=top>
|
||||
<font size=-1><b>Min Username Length</b>
|
||||
<tr><td absheight=45 valign=top>
|
||||
<font size=-1><b>Max Username Length</b>
|
||||
<tr><td absheight=120 valign=top>
|
||||
<font size=-1><b>Enable Passwords</b><br>
|
||||
When disabled, accounts will not be able to use passwords, if they had a password set prior, the account will be accessible without it.
|
||||
<tr><td absheight=45 valign=top>
|
||||
<font size=-1><b>Min Password Length</b>
|
||||
<tr><td absheight=45 valign=top>
|
||||
<font size=-1><b>Max Password Length</b>
|
||||
<tr><td absheight=60 valign=top>
|
||||
<font size=-1><b>Password Field Size</b>
|
||||
The size of the field on the login password page
|
||||
</table>
|
||||
<TD WIDTH=15>
|
||||
<TD WIDTH=198 absheight=1640 VALIGN=top ALIGN=left colspan=2>
|
||||
<form action="wtv-admin:/validate-operator-tweaks">
|
||||
<input type=hidden name=autosubmit value=true autosubmit=onleave>
|
||||
<table cellspacing=0 cellpadding=5>
|
||||
<tr><td valign=top>
|
||||
<table>
|
||||
<tr>
|
||||
<td absheight=60 valign=top>
|
||||
${generateFormField('input', 'service_owner')}
|
||||
<tr>
|
||||
<td absheight=60 valign=top>
|
||||
${generateFormField('input', 'service_owner_account')}
|
||||
<tr>
|
||||
<td absheight=90 valign=top>
|
||||
${generateFormField('input', 'service_owner_contact')}
|
||||
<tr>
|
||||
<td absheight=90 valign=top>
|
||||
${generateFormField('input', 'service_owner_contact_method')}
|
||||
<tr>
|
||||
<td absheight=55 valign=top>
|
||||
${generateFormField('input', 'service_name')}
|
||||
<tr>
|
||||
<td absheight=85 valign=top>
|
||||
${generateFormField('input', 'service_logo')}
|
||||
<tr>
|
||||
<td absheight=90 valign=top>
|
||||
${generateFormField('input', 'service_splash_logo')}
|
||||
<tr>
|
||||
<td absheight=60 valign=top>
|
||||
${generateFormField('checkbox', 'show_detailed_splash')}
|
||||
<tr>
|
||||
<td absheight=60 valign=top>
|
||||
${generateFormField('checkbox', 'hide_ssid_in_logs')}
|
||||
<tr>
|
||||
<td absheight=80 valign=top>
|
||||
${generateFormField('checkbox', 'filter_passwords_in_logs')}
|
||||
<tr>
|
||||
<td absheight=50 valign=top>
|
||||
${generateFormField('select', 'verbosity', [
|
||||
{ "name": "Quiet (0)", value: 0 },
|
||||
{ "name": "Show Headers (1)", value: 1 },
|
||||
{ "name": "Verbose, without Headers (2)", value: 2 },
|
||||
{ "name": "Verbose, with headers (3)", value: 3 },
|
||||
{ "name": "Debug (4)", value: 4 },
|
||||
])}
|
||||
<tr>
|
||||
<td absheight=60 valign=top>
|
||||
${generateFormField('checkbox', 'show_diskmap')}
|
||||
<tr>
|
||||
<td absheight=140 valign=top>
|
||||
${generateFormField('checkbox', 'allow_guests')}
|
||||
<tr>
|
||||
<td absheight=85 valign=top>
|
||||
${generateFormField('checkbox', 'enable_lzpf_compression')}
|
||||
<tr>
|
||||
<td absheight=80 valign=top>
|
||||
${generateFormField('checkbox', 'enable_gzip_compression')}
|
||||
<tr>
|
||||
<td absheight=42 valign=top>
|
||||
${generateFormField('input', 'user_accounts.max_users_per_account', "size=2 onkeypress='return forceNumeric(event)' onchange='validateNumber(this,1,50,6)' maxlength=2")}
|
||||
<tr>
|
||||
<td absheight=42 valign=top>
|
||||
${generateFormField('input', 'user_accounts.min_username_length', "size=2 onkeypress='return forceNumeric(event)' onchange='validateNumber(this,3,50,5)' maxlength=2")}
|
||||
<tr>
|
||||
<td absheight=50 valign=top>
|
||||
${generateFormField('input', 'user_accounts.max_username_length', "size=2 onkeypress='return forceNumeric(event)' onchange='validateNumber(this,3,50,18)' maxlength=2")}
|
||||
<tr>
|
||||
<td absheight=113 valign=top>
|
||||
${generateFormField('checkbox', 'passwords.enabled', "onchange='passwordFieldToggle(this)'")}
|
||||
<tr>
|
||||
<td absheight=40 valign=top>
|
||||
${generateFormField('input', 'passwords.min_length', "size=2 onkeypress='return forceNumeric(event)' onchange='validateNumber(this,3,32,5)' maxlength=2")}
|
||||
<tr>
|
||||
<td absheight=46 valign=top>
|
||||
${generateFormField('input', 'passwords.max_length', "size=2 onkeypress='return forceNumeric(event)' onchange='validateNumber(this,3,256,32)' maxlength=2")}
|
||||
<tr>
|
||||
<td absheight=60 valign=top>
|
||||
${generateFormField('input', 'passwords.form_size', "size=2 onkeypress='return forceNumeric(event)' onchange='validateNumber(this,5,99,16)' maxlength=2")}
|
||||
</table>
|
||||
</table>
|
||||
</form>
|
||||
<tr>
|
||||
<td colspan=4><hr>
|
||||
|
||||
<TR>
|
||||
<TD>
|
||||
<TD COLSPAN=2 VALIGN=top ALIGN=left>
|
||||
<TD VALIGN=top ALIGN=right>
|
||||
<FORM action="client:goback">
|
||||
<FONT COLOR="#E7CE4A" SIZE=-1><SHADOW>
|
||||
<INPUT TYPE=SUBMIT BORDERIMAGE="file://ROM/Borders/ButtonBorder2.bif" Value=Done NAME="Done" USESTYLE WIDTH=103>
|
||||
</SHADOW></FONT></FORM>
|
||||
<TD><TD>
|
||||
<tr><td>
|
||||
</TABLE>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(401, "Please enter the administration password, you can leave the username blank.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(403, auth);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
133
zefie_wtvp_minisrv/includes/ServiceVault/wtv-admin/polyzoot.js
Normal file
@@ -0,0 +1,133 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var WTVAdmin = require(classPath + "/WTVAdmin.js");
|
||||
var wtva = new WTVAdmin(minisrv_config, session_data, service_name);
|
||||
var auth = wtva.isAuthorized();
|
||||
if (auth === true) {
|
||||
var password = null;
|
||||
if (request_headers.Authorization) {
|
||||
var authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
}
|
||||
if (wtva.checkPassword(password)) {
|
||||
if (request_headers.query.username) {
|
||||
var user_info = wtva.getAccountInfo(request_headers.query.username.toLowerCase()); // username search
|
||||
if (user_info) {
|
||||
var userAccount = wtva.getAccountBySSID(user_info.ssid);
|
||||
userAccount.switchUserID(user_info.user_id, false, false);
|
||||
if (request_headers.query.confirm) {
|
||||
var polyzooot = 1407;
|
||||
var WTVBGMusic = require(classPath + "/WTVBGMusic.js");
|
||||
var wtvbgm = new WTVBGMusic(minisrv_config, userAccount);
|
||||
var bgmcat = wtvbgm.getSongCategory(polyzooot);
|
||||
var music_obj = wtvbgm.getMusicObj();
|
||||
music_obj.enableCategories = [bgmcat];
|
||||
music_obj.enableSongs = [polyzooot];
|
||||
music_obj = Object.assign({}, music_obj)
|
||||
userAccount.setSessionData("wtv-bgmusic", music_obj);
|
||||
var settings_obj = userAccount.getSessionData("wtv-setup");
|
||||
if (settings_obj === null) settings_obj = {};
|
||||
settings_obj['setup-play-bgm'] = 1;
|
||||
userAccount.setSessionData("wtv-setup", Object.assign({}, settings_obj));
|
||||
userAccount.saveSessionData();
|
||||
}
|
||||
if (request_headers.query.reset) {
|
||||
var WTVBGMusic = require(classPath + "/WTVBGMusic.js");
|
||||
userAccount.deleteSessionData("wtv-bgmusic")
|
||||
var wtvbgm = new WTVBGMusic(minisrv_config, userAccount);
|
||||
var music_obj = wtvbgm.getMusicObj(true);
|
||||
var settings_obj = userAccount.getSessionData("wtv-setup");
|
||||
if (settings_obj === null) settings_obj = {};
|
||||
settings_obj['setup-play-bgm'] = 0;
|
||||
userAccount.setSessionData("wtv-setup", Object.assign({}, settings_obj));
|
||||
userAccount.saveSessionData();
|
||||
}
|
||||
}
|
||||
}
|
||||
headers = `200 OK
|
||||
Content-Type: text/html
|
||||
wtv-expire-all: wtv-admin:/polyzoot
|
||||
wtv-noback-all: wtv-admin:/polyzoot`;
|
||||
data = `<html>
|
||||
<body>
|
||||
<display nosave nosend>
|
||||
<title>${minisrv_config.config.service_name} Admin Tricks</title>
|
||||
<sidebar width=20%>
|
||||
<img src="wtv-admin:/images/polyzoot.jpg">
|
||||
</sidebar>
|
||||
<body bgcolor="#101010" text="#FF3455" link="#ff55ff" vlink="#ff55ff" vspace=0>
|
||||
<br>
|
||||
<br>
|
||||
<h1>${minisrv_config.config.service_name} Admin Tricks</h1>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan=3 height=6>
|
||||
<h3>Polyzoot a User</h3>`;
|
||||
|
||||
if (!request_headers.query.username) {
|
||||
data += `"Polyzooting" a user will replace their Background Music with only Polyzoot,
|
||||
and turn on BGM if they have it disabled. This will not work on Old Classic clients.
|
||||
Also, the only way to undo a "Polyzooting" is to reset the user's music selection to default.<br><br>`
|
||||
}
|
||||
|
||||
data += `
|
||||
<form action="wtv-admin:/polyzoot" method="POST">
|
||||
<input type="text" name="username" value="${(request_headers.query.username) ? request_headers.query.username : ""}"> <input type="submit" value="Look Up User">
|
||||
</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")) {
|
||||
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?`;
|
||||
}
|
||||
data += `
|
||||
<br><br>
|
||||
<tr>
|
||||
<td>
|
||||
<form action="wtv-admin:/polyzoot" method="POST">
|
||||
<input type="hidden" name="username" value="${user_info.username}">
|
||||
<input type="hidden" name="reset" value="true">
|
||||
<input type="submit" value="Release This Soul (Reset)">
|
||||
</td>
|
||||
<td>
|
||||
<form action="wtv-admin:/polyzoot" method="POST">
|
||||
<input type="hidden" name="username" value="${user_info.username}">
|
||||
<input type="hidden" name="confirm" value="true">
|
||||
<input type="submit" value="Torture This Soul">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
`
|
||||
data += `</table>`;
|
||||
} else if (request_headers.query.confirm) {
|
||||
data += `You have condemned <strong>${user_info.username}</strong><br> to endless loops of Polyzoot.<br><br>It will take effect upon their next login.<br><br>`;
|
||||
} else if (request_headers.query.reset) {
|
||||
data += `You have freed <strong>${user_info.username}'s</strong> soul<br> from the bounds of Polyzoot.<br><br>It will take effect upon their next login.<br><br>`;
|
||||
}
|
||||
}
|
||||
data += `
|
||||
<br>
|
||||
<br>
|
||||
<tr>
|
||||
</table>
|
||||
<p align="right">
|
||||
<a href="client:goback">Go Back</a>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(401, "Please enter the administration password, you can leave the username blank.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(403, auth);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var WTVAdmin = require(classPath + "/WTVAdmin.js");
|
||||
var wtva = new WTVAdmin(minisrv_config, session_data, service_name);
|
||||
var auth = wtva.isAuthorized();
|
||||
if (auth === true) {
|
||||
var password = null;
|
||||
if (request_headers.Authorization) {
|
||||
var authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
}
|
||||
if (wtva.checkPassword(password)) {
|
||||
if (request_headers.query.username) {
|
||||
var user_info = wtva.getAccountInfo(request_headers.query.username.toLowerCase()); // username search
|
||||
if (user_info) {
|
||||
var userAccount = wtva.getAccountBySSID(user_info.ssid);
|
||||
userAccount.switchUserID(user_info.user_id, false, false);
|
||||
if (request_headers.query.folder) {
|
||||
if (userAccount.favstore.favstoreExists()) {
|
||||
if (userAccount.favstore.folderExists(request_headers.query.folder)) {
|
||||
userAccount.favstore.deleteFolder(request_headers.query.folder);
|
||||
}
|
||||
userAccount.favstore.createTemplateFolder(request_headers.query.folder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
headers = `200 OK
|
||||
Content-Type: text/html
|
||||
wtv-expire-all: wtv-admin:/regenfavs
|
||||
wtv-noback-all: wtv-admin:/regenfavs`;
|
||||
data = `<html>
|
||||
<body>
|
||||
<display nosave nosend>
|
||||
<title>${minisrv_config.config.service_name} Admin Tricks</title>
|
||||
<sidebar width=20%>
|
||||
<img src="wtv-tricks:/images/Favorites_bg.jpg">
|
||||
</sidebar>
|
||||
<body bgcolor="#101010" text="#FF3455" link="#ff55ff" vlink="#ff55ff" vspace=0>
|
||||
<br>
|
||||
<br>
|
||||
<h1>${minisrv_config.config.service_name} Admin Tricks</h1>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan=3 height=6>
|
||||
<h3>Restore a default favorites folder for a User</h3>
|
||||
<form action="wtv-admin:/regenfavs" method="POST">
|
||||
<input type="text" name="username" value="${(request_headers.query.username) ? request_headers.query.username : ""}"> <input type="submit" value="Look Up User">
|
||||
</form><br><br>`
|
||||
if (request_headers.query.username) {
|
||||
if (user_info && !request_headers.query.folder) {
|
||||
if (userAccount.favstore.favstoreExists()) {
|
||||
data += `<form action="wtv-admin:/regenfavs" method="POST">
|
||||
<input type="hidden" name="username" value="${user_info.username}">
|
||||
<select name="folder">`;
|
||||
|
||||
Object.keys(minisrv_config.favorites.folder_templates).forEach(function (k) {
|
||||
data += `<option value="${k}">${k}</option`;
|
||||
});
|
||||
data += `</select>
|
||||
<input type="submit" value="Restore Folder">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
`
|
||||
data += `</table>`;
|
||||
} else {
|
||||
data += `<strong>${user_info.username} has not initialized their favorites.</strong><br><br>`;
|
||||
}
|
||||
} else {
|
||||
data += `<strong>Successfully regenerated folder ${request_headers.query.folder} for user "${user_info.username}"</strong><br><br>`;
|
||||
}
|
||||
}
|
||||
data += `
|
||||
<br>
|
||||
<br>
|
||||
<tr>
|
||||
</table>
|
||||
<p align="right">
|
||||
<a href="client:goback">Go Back</a>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(401, "Please enter the administration password, you can leave the username blank.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(403, auth);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var WTVAdmin = require(classPath + "/WTVAdmin.js");
|
||||
var wtva = new WTVAdmin(minisrv_config, session_data, service_name);
|
||||
var auth = wtva.isAuthorized();
|
||||
if (auth === true) {
|
||||
var password = null;
|
||||
if (request_headers.Authorization) {
|
||||
var authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
}
|
||||
if (wtva.checkPassword(password)) {
|
||||
reloadConfig();
|
||||
headers = `200 OK
|
||||
Content-Type: text/html
|
||||
wtv-expire-all: wtv-admin:/reloadconfig
|
||||
wtv-noback-all: wtv-admin:/reloadconfig`;
|
||||
data = `<html>
|
||||
<body>
|
||||
<display nosave nosend>
|
||||
<title>${minisrv_config.config.service_name} Admin Tricks</title>
|
||||
<sidebar width=20%>
|
||||
<img src="wtv-tricks:/images/Favorites_bg.jpg">
|
||||
</sidebar>
|
||||
<body bgcolor="#101010" text="#FF3455" link="#ff55ff" vlink="#ff55ff" vspace=0>
|
||||
<br>
|
||||
<br>
|
||||
<h1>${minisrv_config.config.service_name} Admin Tricks</h1>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan=3 height=6>
|
||||
<h3>Reload Config</h3>
|
||||
The config.json and user_config.json files has been reloaded.<br>
|
||||
If you added a new service, it will not bind without a restart.
|
||||
<tr>
|
||||
</table>
|
||||
<p align="right">
|
||||
<a href="client:goback">Go Back</a>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(401, "Please enter the administration password, you can leave the username blank.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(403, auth);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var WTVAdmin = require(classPath + "/WTVAdmin.js");
|
||||
var wtva = new WTVAdmin(minisrv_config, session_data, service_name);
|
||||
var auth = wtva.isAuthorized();
|
||||
if (auth === true) {
|
||||
var password = null;
|
||||
if (request_headers.Authorization) {
|
||||
var authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
}
|
||||
if (wtva.checkPassword(password)) {
|
||||
if (request_headers.query.username) {
|
||||
var show_cannot_modify_self = false;
|
||||
var show_user_has_no_password = false;
|
||||
var user_info = wtva.getAccountInfo(request_headers.query.username.toLowerCase()); // username search
|
||||
if (user_info) {
|
||||
if (user_info.ssid == socket.ssid) {
|
||||
show_cannot_modify_self = true;
|
||||
}
|
||||
var userAccount = wtva.getAccountBySSID(user_info.ssid);
|
||||
userAccount.switchUserID(user_info.user_id, false, false);
|
||||
if (!userAccount.getUserPasswordEnabled()) {
|
||||
show_user_has_no_password = true;
|
||||
}
|
||||
if (request_headers.query.confirm_remove) {
|
||||
if (!show_cannot_modify_self && !show_user_has_no_password) {
|
||||
userAccount.disableUserPassword();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
headers = `200 OK
|
||||
Content-Type: text/html
|
||||
wtv-expire-all: wtv-admin:/removeuserpasswd
|
||||
wtv-noback-all: wtv-admin:/removeuserpasswd`;
|
||||
data = `<html>
|
||||
<body>
|
||||
<display nosave nosend>
|
||||
<title>${minisrv_config.config.service_name} Admin Tricks</title>
|
||||
<sidebar width=20%>
|
||||
<img src="wtv-admin:/images/nuke.gif">
|
||||
</sidebar>
|
||||
<body bgcolor="#101010" text="#FF3455" link="#ff55ff" vlink="#ff55ff" vspace=0>
|
||||
<br>
|
||||
<br>
|
||||
<h1>${minisrv_config.config.service_name} Admin Tricks</h1>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan=3 height=6>
|
||||
<h3>Remove Password from a User Account</h3>
|
||||
<form action="wtv-admin:/removeuserpasswd" method="POST">
|
||||
<input type="text" name="username" value="${(request_headers.query.username) ? request_headers.query.username : ""}"> <input type="submit" value="Look Up User">
|
||||
</form><br><br>`
|
||||
if (request_headers.query.username) {
|
||||
if (user_info && !request_headers.query.confirm_remove && !show_user_has_no_password && !show_cannot_modify_self) {
|
||||
data += `
|
||||
<strong>User Information:</strong>
|
||||
<table border=1 cellpadding=3 width=400>
|
||||
<tr><td>Username:</td><td>${user_info.username} (User ID: ${user_info.user_id})</td></tr>
|
||||
<tr><td>SSID:</td><td>${user_info.ssid}</td></tr>`;
|
||||
if (user_info.account_users) {
|
||||
data += `<tr><td>Primary User:</td><td>${user_info.account_users['subscriber'].subscriber_username}</td></tr>`;
|
||||
}
|
||||
data += `
|
||||
<tr>
|
||||
<td border=0 colspan=2 align=right>
|
||||
<form action="wtv-admin:/removeuserpasswd" method="POST">
|
||||
<input type="hidden" name="username" value="${user_info.username}">
|
||||
<input type="hidden" name="confirm_remove" value="true">
|
||||
<input type="submit" value="Confirm Password Removal">
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
`
|
||||
data += `</table>`;
|
||||
} else if (show_cannot_modify_self) {
|
||||
data += `<strong>Cannot modify your account in this manner.<br>Try <a href="wtv-setup:/accounts">wtv-setup</a>.</strong><br><br>`;
|
||||
} else if (show_user_has_no_password) {
|
||||
data += `<strong>${user_info.username} has no password,<br>so there nothing to do.<br><br>`;
|
||||
} else {
|
||||
data += `<strong>Password removed from account "${user_info.username}"</strong><br><br>`;
|
||||
}
|
||||
}
|
||||
data += `
|
||||
<br>
|
||||
<br>
|
||||
<tr>
|
||||
</table>
|
||||
<p align="right">
|
||||
<a href="client:goback">Go Back</a>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(401, "Please enter the administration password, you can leave the username blank.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(403, auth);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
108
zefie_wtvp_minisrv/includes/ServiceVault/wtv-admin/unban.js
Normal file
@@ -0,0 +1,108 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var WTVAdmin = require(classPath + "/WTVAdmin.js");
|
||||
var wtva = new WTVAdmin(minisrv_config, session_data, service_name);
|
||||
var auth = wtva.isAuthorized();
|
||||
var ssids_removed = [];
|
||||
if (auth === true) {
|
||||
var password = null;
|
||||
if (request_headers.Authorization) {
|
||||
var authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
}
|
||||
if (wtva.checkPassword(password)) {
|
||||
if (request_headers.query.unban_ssid) {
|
||||
var config_changed = false;
|
||||
var fake_config = wtvshared.getUserConfig();
|
||||
if (!fake_config.config) fake_config.config = {};
|
||||
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) {
|
||||
fake_config.config.ssid_block_list.splice(k, 1);
|
||||
ssids_removed.push(request_headers.query.unban_ssid)
|
||||
config_changed = 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);
|
||||
ssids_removed.push(request_headers.query.unban_ssid[j])
|
||||
config_changed = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
if (config_changed) {
|
||||
wtvshared.writeToUserConfig(fake_config);
|
||||
minisrv_config = reloadConfig();
|
||||
}
|
||||
}
|
||||
headers = `200 OK
|
||||
Content-Type: text/html
|
||||
wtv-expire-all: wtv-admin:/unban`;
|
||||
if (request_headers.query.unban_ssid) {
|
||||
headers += "\nwtv-noback-all: wtv-admin:/unban";
|
||||
}
|
||||
data = `<html>
|
||||
<body>
|
||||
<display nosave nosend>
|
||||
<title>${minisrv_config.config.service_name} Admin Tricks</title>
|
||||
<sidebar width=20%>
|
||||
<img src="wtv-admin:/images/nuke_inverted.gif">
|
||||
</sidebar>
|
||||
<body bgcolor="#101010" text="#FF3455" link="#ff55ff" vlink="#ff55ff" vspace=0>
|
||||
<br>
|
||||
<br>
|
||||
<h1>${minisrv_config.config.service_name} Admin Tricks</h1>
|
||||
<br>
|
||||
<table>
|
||||
<tr>
|
||||
<td colspan=3 height=6>
|
||||
<h3>Unban an SSID</h3>`;
|
||||
if (minisrv_config.config.ssid_block_list) {
|
||||
if (minisrv_config.config.ssid_block_list.length > 0) {
|
||||
data += '<form action="wtv-admin:/unban" method="POST">';
|
||||
data += '<select name="unban_ssid" multiple size="8">';
|
||||
Object.keys(minisrv_config.config.ssid_block_list).forEach(function (k) {
|
||||
var ssid = minisrv_config.config.ssid_block_list[k];
|
||||
data += "<option value=\"" + ssid + "\">" + ssid + "</option>\n";
|
||||
});
|
||||
data += '</select><br><input type="submit" value="Unban SSID(s)"></form>';
|
||||
} else {
|
||||
data += "No SSIDs are in the ban list.<br><br>";
|
||||
}
|
||||
} else {
|
||||
data += "No SSIDs are in the ban list.<br><br>";
|
||||
}
|
||||
if (ssids_removed.length > 0) {
|
||||
if (config_changed) {
|
||||
data += "<strong>SSID(s) " + ssids_removed + " removed from the ban list.</strong><br><br>";
|
||||
}
|
||||
}
|
||||
data += `
|
||||
<br>
|
||||
<br>
|
||||
<tr>
|
||||
</table>
|
||||
<p align="right">
|
||||
<a href="client:goback">Go Back</a>
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
`;
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(401, "Please enter the administration password, you can leave the username blank.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage(403, auth);
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var WTVAdmin = require(classPath + "/WTVAdmin.js");
|
||||
var wtva = new WTVAdmin(minisrv_config, session_data, service_name);
|
||||
var auth = wtva.isAuthorized();
|
||||
|
||||
if (auth === true) {
|
||||
var password = null;
|
||||
if (request_headers.Authorization) {
|
||||
var authheader = request_headers.Authorization.split(' ');
|
||||
if (authheader[0] == "Basic") {
|
||||
password = Buffer.from(authheader[1], 'base64').toString();
|
||||
if (password) password = password.split(':')[1];
|
||||
}
|
||||
}
|
||||
if (wtva.checkPassword(password)) {
|
||||
var user_config = wtvshared.getUserConfig();
|
||||
Object.keys(request_headers.query).forEach((k) => {
|
||||
if (k === "autosubmit") return;
|
||||
var v = request_headers.query[k];
|
||||
|
||||
// enable_multi_query may send ["false", "on"] for checkboxes due to webtvism
|
||||
if (isArray(v)) v = v[(v.length - 1)];
|
||||
|
||||
// convert numbers back to int before writing to config
|
||||
if (!isNaN(parseInt(v))) v = parseInt(v);
|
||||
|
||||
// convert string back to boolean before writing to config
|
||||
if (v === "on" || v === "true" || v === "false") v = wtvshared.parseBool(v);
|
||||
|
||||
if (k.indexOf("-") > 0) {
|
||||
// handle sub-config items
|
||||
var s = k.split("-");
|
||||
if (!user_config.config[s[0]]) user_config.config[s[0]] = {}
|
||||
user_config.config[s[0]][s[1]] = v;
|
||||
} else {
|
||||
user_config.config[k] = v;
|
||||
}
|
||||
});
|
||||
var res = wtvshared.writeToUserConfig(user_config);
|
||||
if (res) {
|
||||
console.log(" * Configuration updated from wtv-admin, reloading")
|
||||
reloadConfig();
|
||||
headers = "200 OK\nwtv-expire-all: wtv-admin:/operatortweaks\nContent-Type: text/html";
|
||||
} else {
|
||||
err = wtvshared.doErrorPage(400, "Error writing userconfig");
|
||||
headers = err[0];
|
||||
data = err[1];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!headers) {
|
||||
err = wtvshared.doErrorPage();
|
||||
headers = err[0];
|
||||
data = err[1];
|
||||
}
|
||||
@@ -0,0 +1,156 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
headers = "200 OK";
|
||||
if (request_headers.query.nick) headers += "\n" + session_data.setIRCNick(request_headers.query.nick);
|
||||
headers += "\nContent-Type: text/html";
|
||||
|
||||
if (request_headers.query.host && request_headers.query.port && request_headers.query.channel) {
|
||||
data = `<html>
|
||||
<display address="${request_headers.query.host}, port ${request_headers.query.port}, room ${request_headers.query.channel}">
|
||||
<wtvchat
|
||||
host="${request_headers.query.host}"
|
||||
port="${request_headers.query.port}"
|
||||
channel="#${request_headers.query.channel}"
|
||||
bgcolor="#101C1E"
|
||||
>
|
||||
<head>
|
||||
<title>
|
||||
${request_headers.query.channel}
|
||||
</title>
|
||||
</head>
|
||||
<body bgcolor="#101C1E" text="#A2ACB5" link="#CFC382" vlink="#E1EOE3" fontsize="medium" vspace=0 hspace=0>
|
||||
<sidebar width=109>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=104 height=420 bgcolor=#69758B valign=top>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td height=7 colspan=3>
|
||||
<spacer type=vertical size=7>
|
||||
<tr>
|
||||
<td width=7>
|
||||
<spacer type=horizontal size=7>
|
||||
<td width=87 href="wtv-home:/home">
|
||||
<img src="${minisrv_config.config.service_logo}" width=87 height=67>
|
||||
<td width=10>
|
||||
<spacer type=horizontal size=10>
|
||||
</table>
|
||||
<spacer type=vertical size=6>
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr> <td bgcolor=#2E3A54 height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valign=middle>
|
||||
<table cellspacing=0 cellpadding=0 href="javascript:void(window.open('newChatChannel.panel'))" >
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td><shadow><font sizerange=medium color=#E1EOE3>Create</font></shadow>
|
||||
</table>
|
||||
<td width=5>
|
||||
<tr> <td bgcolor=#2E3A54 height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valign=middle>
|
||||
<table cellspacing=0 cellpadding=0 href="client:ListChannelUsers" >
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td><shadow><font sizerange=medium color=#E1EOE3>People</font></shadow>
|
||||
</table>
|
||||
<td width=5>
|
||||
<tr> <td bgcolor=#2E3A54 height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valign=middle>
|
||||
<table cellspacing=0 cellpadding=0 href="client:OpenChatWhisperPanel" >
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td><shadow><font sizerange=medium color=#E1EOE3>Whisper</font></shadow>
|
||||
</table>
|
||||
<td width=5>
|
||||
<tr> <td bgcolor=#2E3A54 height=2 width=104 colspan=3>
|
||||
</table>
|
||||
<td width=5 bgcolor=#2E3A54>
|
||||
</table>
|
||||
</sidebar>
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td width=451 colspan=2 align=center bgcolor=#2E3A54>
|
||||
<spacer type=vertical size=13>
|
||||
<tr>
|
||||
<td><img src="wtv-chat:/images/top_corner_dark.jpg" width=8 height=8>
|
||||
<td width=60>
|
||||
<tr>
|
||||
<td bgcolor=#101C1E width=13>
|
||||
<spacer type=horizontal size=13>
|
||||
<td bgcolor=#101C1E width=438 valign=top>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=105 height=9><spacer type=vertical size=9>
|
||||
<td>
|
||||
</table>
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td width=375 height=25 bgcolor=#101C1E gradcolor=#3C4652 gradangle=90>
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td width=366 valign=middle>
|
||||
<blackface><font color=#D6D6D6> ${request_headers.query.channel}
|
||||
</font></blackface><td>
|
||||
<table cellspacing=0 cellpadding=0 border=0 bgcolor=#3C4652 gradcolor=#2E3A54 gradangle=90>
|
||||
<tr>
|
||||
<td><img src="wtv-chat:/images/widget.gif" width=16 height=16>
|
||||
<td width=3>
|
||||
<td width=84>
|
||||
<spacer type=vertical size=1><br>
|
||||
<a href="wtv-chat:/home"><font size=-1 color=#E7CE4A><b> Home</b></font></a>
|
||||
</table>
|
||||
</table>
|
||||
</table>
|
||||
<spacer type=vertical size=12> <table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td colspan=3 height=12>
|
||||
<spacer type=vertical size=12> <tr>
|
||||
<td abswidth=14>
|
||||
<td>
|
||||
<wtvchattranscript height=250 width=100%>
|
||||
<td abswidth=20>
|
||||
<tr>
|
||||
<td height=10>
|
||||
<tr>
|
||||
<td>
|
||||
<td colspan=2 height=2>
|
||||
<spacer>
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td>
|
||||
<td colspan=2 height=2>
|
||||
<spacer>
|
||||
<tr>
|
||||
<td height=6>
|
||||
</table>
|
||||
<table cellspacing=0 cellpadding=0 width=100%>
|
||||
<tr>
|
||||
<form action="client:ChatAddMessage" ONSUBMIT="this.chatinput.focus()">
|
||||
<td abswidth=14>
|
||||
<td>
|
||||
<input id="chatinput" name="message" type="text" value="" size=32 bgcolor=262626 text=ffc342 cursor=cc9933 font=proportional selected autoactivate nohighlight>
|
||||
<td align=right>
|
||||
<font color=e7ce4a><shadow>
|
||||
<input type=submit borderimage="file://ROM/Borders/ButtonBorder2.bif" value="Send" usestyle width=80>
|
||||
<td abswidth=9>
|
||||
</form>
|
||||
<tr> <TD HEIGHT=8>
|
||||
</table>
|
||||
</body>
|
||||
</html>`;
|
||||
} else {
|
||||
var errpage = wtvshared.doErrorPage("400 Chat requires host, port and channel arguments. Do not use the # on channels.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
146
zefie_wtvp_minisrv/includes/ServiceVault/wtv-chat/home.js
Normal file
@@ -0,0 +1,146 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
var irc_nick = "";
|
||||
headers = "200 OK";
|
||||
if (request_headers.query.nick) headers += "\n" + session_data.setIRCNick(request_headers.query.nick);
|
||||
else if (!session_data.getSessionData("subscriber_irc_nick")) session_data.getSessionData("subscriber_username") || session_data.setIRCNick(minisrv_config.config.service_name + '_' + Math.floor(Math.random() * 100000)).substring(0, 16);
|
||||
headers += "\nContent-Type: text/html";
|
||||
|
||||
var irc_nick = session_data.getSessionData("subscriber_irc_nick") || session_data.getSessionData("subscriber_username");
|
||||
|
||||
data = `<html>
|
||||
<head>
|
||||
<title>
|
||||
Chat Home (Testing)
|
||||
</title>
|
||||
</head>
|
||||
<body bgcolor="#101C1E" text="#A2ACB5" link="#CFC382" vlink="#E1EOE3" fontsize="medium" vspace=0 hspace=0>
|
||||
<display noscroll>
|
||||
<sidebar width=109>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=104 height=420 bgcolor=#69758B valign=top>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td height=7 colspan=3>
|
||||
<spacer type=vertical size=7>
|
||||
<tr>
|
||||
<td width=7>
|
||||
<spacer type=horizontal size=7>
|
||||
<td width=87 href="wtv-home:/home">
|
||||
<img src="${minisrv_config.config.service_logo}" width=87 height=67>
|
||||
<td width=10>
|
||||
<spacer type=horizontal size=10>
|
||||
</table>
|
||||
<spacer type=vertical size=6>
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr> <td bgcolor=#2E3A54 height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valign=middle>
|
||||
<table cellspacing=0 cellpadding=0 href="client:relog" >
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td><shadow><font sizerange=medium color=#E1EOE3>Relogin</font></shadow>
|
||||
</table>
|
||||
<td width=5>
|
||||
<tr> <td bgcolor=#2E3A54 height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valign=middle>
|
||||
<table cellspacing=0 cellpadding=0 href="wtv-home:/home" >
|
||||
<tr>
|
||||
<td height=1>
|
||||
<tr>
|
||||
<td><shadow><font sizerange=medium color=#E1EOE3>Home</font></shadow>
|
||||
</table>
|
||||
<td width=5>
|
||||
<tr> <td bgcolor=#2E3A54 height=2 width=104 colspan=3>
|
||||
<tr>
|
||||
<td width=10 height=26>
|
||||
<td width=89 valign=middle>
|
||||
</table>
|
||||
<td width=5 bgcolor=#2E3A54>
|
||||
</table>
|
||||
</sidebar>
|
||||
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td width=451 colspan=2 align=center bgcolor=#2E3A54>
|
||||
<spacer type=vertical size=13>
|
||||
<tr>
|
||||
<td><img src="wtv-chat:/images/top_corner_dark.jpg" width=8 height=8>
|
||||
<td width=60>
|
||||
<tr>
|
||||
<td bgcolor=#101C1E width=13>
|
||||
<spacer type=horizontal size=13>
|
||||
<td bgcolor=#101C1E width=438 valign=top>
|
||||
<table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td width=105 height=9><spacer type=vertical size=9>
|
||||
<td>
|
||||
</table>
|
||||
<tr>
|
||||
<td colspan=2>
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td width=375 height=25 bgcolor=#101C1E gradcolor=#3C4652 gradangle=90>
|
||||
<table cellspacing=0 cellpadding=0 border=0>
|
||||
<tr>
|
||||
<td width=366 valign=middle>
|
||||
<blackface><font color=#D6D6D6>
|
||||
</font></blackface><td>
|
||||
<table cellspacing=0 cellpadding=0 border=0 bgcolor=#3C4652 gradcolor=#2E3A54 gradangle=90>
|
||||
<tr>
|
||||
<td width=21>
|
||||
<td width=400>
|
||||
<td width=34>
|
||||
</table>
|
||||
</table>
|
||||
</table>
|
||||
<spacer type=vertical size=12> <table cellspacing=0 cellpadding=0>
|
||||
<tr>
|
||||
<td colspan=3 height=12>
|
||||
<spacer type=vertical size=22> <tr>
|
||||
<td abswidth=14>
|
||||
<td abswidth=400>
|
||||
<form action="wtv-chat:/MakeChatPage" method="get">
|
||||
<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 || "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 || 6667}"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td>Channel:</td>
|
||||
<td><input width="240" bgcolor=262626 text=D6D6D6 cursor=cc9933 font=proportional type="text" name="channel" value="${request_headers.query.channel || "WebTV"}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>IRC Nick<sup>*</sup>:</td>
|
||||
<td><input width="240" bgcolor=262626 text=D6D6D6 cursor=cc9933 font=proportional maxlength=16 type="text" name="nick" value="${irc_nick}"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right">
|
||||
<input type=submit borderimage="file://ROM/Borders/ButtonBorder2.bif" value="Connect" text=D6D6D6 width=100>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<br>
|
||||
|
||||
<small><sup>*</sup>Note: Once you are connected to the IRC Server, you cannot change your nickname until you disconnect.
|
||||
What triggers the WebTV to disconnect from the chat server is not yet known,
|
||||
it does maintain a connection to the IRC server, but leaves the channel, when you leave the chat page.
|
||||
The connection times out after some time. Only then will any future attempts to change your name work.</small>
|
||||
|
||||
<td abswidth=9>
|
||||
</form>
|
||||
<tr> <TD HEIGHT=8>
|
||||
</table>
|
||||
</body>
|
||||
</html>`;
|
||||
|
After Width: | Height: | Size: 3.7 KiB |
|
After Width: | Height: | Size: 2.0 KiB |
|
After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 405 B |
17
zefie_wtvp_minisrv/includes/ServiceVault/wtv-cookie/add.js
Normal file
@@ -0,0 +1,17 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
if (socket.ssid) {
|
||||
if (request_headers.post_data) {
|
||||
if (session_data) {
|
||||
session_data.addCookie(request_headers.query.domain,request_headers.query.path,request_headers.query.expires,request_headers.query.cookie);
|
||||
headers = "200 OK\n";
|
||||
headers += "Content-Type: text/html";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!headers) {
|
||||
var errpage = wtvshared.doErrorPage(400)
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
19
zefie_wtvp_minisrv/includes/ServiceVault/wtv-cookie/get.js
Normal file
@@ -0,0 +1,19 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
if (request_headers.post_data) {
|
||||
if (request_headers.query.domain && request_headers.query.path) {
|
||||
if (socket.ssid) {
|
||||
if (session_data) {
|
||||
data = session_data.getCookieString(request_headers.query.domain, request_headers.query.path);
|
||||
headers = "200 OK\n";
|
||||
headers += "Content-Type: text/plain";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!headers) {
|
||||
var errpage = wtvshared.doErrorPage(400)
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
16
zefie_wtvp_minisrv/includes/ServiceVault/wtv-cookie/list.js
Normal file
@@ -0,0 +1,16 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
if (socket.ssid) {
|
||||
if (session_data) {
|
||||
|
||||
data = session_data.listCookies();
|
||||
headers = "200 OK\n";
|
||||
headers += "Content-Type: text/plain";
|
||||
}
|
||||
}
|
||||
|
||||
if (!headers) {
|
||||
var errpage = wtvshared.doErrorPage(400)
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
27
zefie_wtvp_minisrv/includes/ServiceVault/wtv-cookie/reset.js
Normal file
@@ -0,0 +1,27 @@
|
||||
var minisrv_service_file = true;
|
||||
|
||||
if (socket.ssid) {
|
||||
if (session_data) {
|
||||
session_data.resetCookies();
|
||||
headers = "200 OK\n";
|
||||
headers += "Content-Type: text/html";
|
||||
data = `<html>
|
||||
<head>
|
||||
<display fontsize=medium>
|
||||
<title>Cookies cleared!</title>
|
||||
<meta http-equiv=Refresh content="3; url=client:goback?">
|
||||
</head>
|
||||
<body bgcolor="#000000" text="gold" link="gold" alink="gold" vlink="gold">
|
||||
<br><br>
|
||||
Your cookies have successfully been cleared!<br>
|
||||
Redirecting shortly... <a href="client:goback">Go Back</a>
|
||||
</body>
|
||||
</html>`;
|
||||
}
|
||||
}
|
||||
|
||||
if (!headers) {
|
||||
var errpage = wtvshared.doErrorPage(400)
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
}
|
||||
|
After Width: | Height: | Size: 73 KiB |
|
After Width: | Height: | Size: 45 KiB |
|
After Width: | Height: | Size: 64 KiB |
|
After Width: | Height: | Size: 103 KiB |
|
After Width: | Height: | Size: 31 KiB |