- critical fix in adding users (again)
- fixed wtv-tricks (revert theme)
This commit is contained in:
zefie
2025-01-22 19:35:42 -05:00
parent 184e91d784
commit c74e2fb71b
10 changed files with 349 additions and 363 deletions

View File

@@ -11,7 +11,7 @@ if (request_headers.query.user_id) {
// security // security
if (session_data.user_id != 0 && session_data.user_id != request_headers.query.user_id) { if (session_data.user_id != 0 && session_data.user_id != request_headers.query.user_id) {
user_id = null; // force unset user_id = null; // force unset
var errpage = doErrorPage(400, "You are not authorized to edit the selected user."); var errpage = wtvshared.doErrorPage(400, "You are not authorized to edit the selected user.");
headers = errpage[0]; headers = errpage[0];
data = errpage[1]; data = errpage[1];
} }
@@ -30,7 +30,7 @@ wtv-noback-all: wtv-setup:/edit-user`
} }
if (!userSession.loadSessionData()) { if (!userSession.loadSessionData()) {
var errpage = doErrorPage(400, "Invalid user ID."); var errpage = wtvshared.doErrorPage(400, "Invalid user ID.");
headers = errpage[0]; headers = errpage[0];
data = errpage[1]; data = errpage[1];
} else { } else {

View File

@@ -6,9 +6,17 @@ Connection: Keep-Alive
wtv-expire-all: wtv-tricks:/benchmark wtv-expire-all: wtv-tricks:/benchmark
Content-type: text/html` Content-type: text/html`
data = `<html> data = `<html>
<body>
<display nosave nosend skipback> <display nosave nosend skipback>
<script src=/ROMCache/h.js></script><script src=/ROMCache/n.js></script><script> <title>${minisrv_config.config.service_name} Tricks</title>
head('Speed Test Result')</script>`; <sidebar width=20%>
<img src="wtv-tricks:/images/Favorites_bg.jpg">
</sidebar>
<body bgcolor="#191919" text="#44cc55" link="36d5ff" vlink="36d5ff" vspace=0>
<br>
<br>
<h1>${minisrv_config.config.service_name} Tricks</h1>`;
var start_time = parseInt(session_data.getTicketData("benchmark_starttime")); var start_time = parseInt(session_data.getTicketData("benchmark_starttime"));
if (isNaN(start_time)) { if (isNaN(start_time)) {
data += "Invalid data, please try your benchmark again"; data += "Invalid data, please try your benchmark again";
@@ -30,7 +38,7 @@ if (isNaN(start_time)) {
<tr> <tr>
<td height=5> <td height=5>
<tr> <tr>
<td valign=top align=right width=200><shadow>POP Number:</shadow> <td valign=top align=right width=150><shadow>POP Number:</shadow>
<td width=10> <td width=10>
<td valign=top>&phone; <td valign=top>&phone;
<tr> <tr>
@@ -44,7 +52,7 @@ if (isNaN(start_time)) {
<tr> <tr>
<td height=40> <td height=40>
<tr> <tr>
<td valign=top align=right width=200><shadow>Image Size:</shadow> <td valign=top align=right width=150><shadow>Image Size:</shadow>
<td width=10> <td width=10>
<td valign=top>${image_size_kb} KBytes <td valign=top>${image_size_kb} KBytes
<tr> <tr>
@@ -72,7 +80,7 @@ data += `
<p> <p>
<table> <table>
<tr> <tr>
<td width=120> <td width=100>
<td><a selected href="wtv-tricks:/benchmark">Re-Test</a> <td><a selected href="wtv-tricks:/benchmark">Re-Test</a>
<td width=30> <td width=30>
<td><a href="wtv-tricks:/tricks">Back to Tricks</a> <td><a href="wtv-tricks:/tricks">Back to Tricks</a>

View File

@@ -17,10 +17,7 @@ data = `<html>
http-equiv=refresh http-equiv=refresh
content="1; url=`+ visit_url +`" content="1; url=`+ visit_url +`"
> >
<script src=file://rom/Cache/h.js></script><script src=file://rom/Cache/n.js></script><script> <body bgcolor="black" text="gold" link="gold" vlink="gold" alink="gold">
head('${minisrv_config.config.service_name} Tricks - Blast Blacklist','','','',1)</script>
<table cellspacing=0 cellpadding=0><tr><td abswidth=10>&nbsp;<td colspan=3>
<br>
Successfully expired service URL cache<br> Successfully expired service URL cache<br>
Any previously cached pages should be reloaded from the network.<br><br> Any previously cached pages should be reloaded from the network.<br><br>
<a href="`+visit_url+`">Not loading? Click here.</a> <a href="`+visit_url+`">Not loading? Click here.</a>

View File

@@ -31,9 +31,15 @@ Content-Type: text/html`
data = `<html> data = `<html>
<!--- *=* Copyright 1996, 1997 WebTV Networks, Inc. All rights reserved. ---> <!--- *=* Copyright 1996, 1997 WebTV Networks, Inc. All rights reserved. --->
<display nosave nosend skipback> <display nosave nosend skipback>
<script src=/ROMCache/h.js></script><script src=/ROMCache/n.js></script><script> <title>${minisrv_config.config.service_name} Info</title>
head('${minisrv_config.config.service_name} Info')</script> <sidebar width=20%>
<img src="wtv-tricks:/images/About_bg.jpg">
</sidebar>
<body bgcolor="#191919" text="#44cc55" link="36d5ff" vlink="36d5ff" vspace=0>
<br>
<br>
<br>
<h1>${minisrv_config.config.service_name} Info</h1>
<table cellspacing=0 cellpadding=0><tr><td abswidth=10>&nbsp;<td colspan=3> <table cellspacing=0 cellpadding=0><tr><td abswidth=10>&nbsp;<td colspan=3>
<table> <table>
<tr> <tr>

View File

@@ -14,7 +14,6 @@ Content-Type: text/html`
tricks = [ tricks = [
["wtv-tricks:/info", minisrv_config.config.service_name + " info"], ["wtv-tricks:/info", minisrv_config.config.service_name + " info"],
["wtv-tricks:/themes", "Theme Switcher"],
["wtv-cookie:list", "List Cookies"], ["wtv-cookie:list", "List Cookies"],
["wtv-cookie:reset", "Clear Cookies"], ["wtv-cookie:reset", "Clear Cookies"],
["wtv-tricks:/blastblacklist?return_to=wtv-tricks%3A%2Ftricks", "Blast Blacklist"], ["wtv-tricks:/blastblacklist?return_to=wtv-tricks%3A%2Ftricks", "Blast Blacklist"],
@@ -28,11 +27,18 @@ tricks.push((session_data.getSessionData("registered")) ? ["wtv-tricks:/unregist
tricks.push((wtvshared.isAdmin(session_data)) ? ["wtv-admin:/admin", minisrv_config.config.service_name + " Admin"] : [notAdminAlert, minisrv_config.config.service_name + " Admin"]); // wtv-admin tricks.push((wtvshared.isAdmin(session_data)) ? ["wtv-admin:/admin", minisrv_config.config.service_name + " Admin"] : [notAdminAlert, minisrv_config.config.service_name + " Admin"]); // wtv-admin
data = `<html> data = `<html>
<body>
<display nosave nosend> <display nosave nosend>
<script src=/ROMCache/h.js></script><script src=/ROMCache/n.js></script><script> <title>${minisrv_config.config.service_name} Tricks</title>
head('${minisrv_config.config.service_name} Tricks')</script> <sidebar width=20%>
<img src="wtv-tricks:/images/Favorites_bg.jpg">
</sidebar>
<body bgcolor="#191919" text="#44cc55" link="36d5ff" vlink="36d5ff" vspace=0>
<br>
<br>
<h1>${minisrv_config.config.service_name} Tricks</h1>
<table cellspacing=0 cellpadding=0><tr><td abswidth=10>&nbsp;<td colspan=3> <table cellspacing=0 cellpadding=0><tr><td abswidth=10>&nbsp;<td colspan=3>
<table><tc><td width=50>&nbsp;</td></tc><tc><td><table>`; <table><tc><td>&nbsp;</td></tc><tc><td><table>`;
for (i = 0; i < tricks.length; i += 2) { for (i = 0; i < tricks.length; i += 2) {
data += `<tr> data += `<tr>

File diff suppressed because it is too large Load Diff

View File

@@ -218,7 +218,7 @@ class WTVClientSessionData {
if (user_id == null) user_id = this.user_id; if (user_id == null) user_id = this.user_id;
var userstore = this.getAccountStoreDirectory() + this.path.sep + this.ssid + this.path.sep; var userstore = this.getAccountStoreDirectory() + this.path.sep + this.ssid + this.path.sep;
if (!subscriber) userstore += "user" + user_id + this.path.sep; if (!subscriber) userstore += "user" + user_id + this.path.sep;
return this.wtvshared.getAbsolutePath(userstore); return this.wtvshared.getAbsolutePath(userstore) + this.path.sep;
} }
removeUser(user_id) { removeUser(user_id) {

View File

@@ -832,29 +832,17 @@ class WTVShared {
} }
/** /**
* Returns an absolute path with an trailing path seperator * Returns an absolute path without an trailing path seperator
* @param {string} path * @param {string} path
* @param {string} directory Root directory * @param {string} directory Root directory
*/ */
getAbsolutePath(path = '', directory = '.') { getAbsolutePath(path = '', directory = '.') {
if (directory[0] == "/" || directory.substr(1, 2) == ":" + this.path.sep) { if (directory[0] == "/" || directory.substr(1, 2) == ":" + this.path.sep) {
var newpath = this.path.resolve(directory + this.path.sep + path); return this.path.resolve(directory + this.path.sep + path);
if (this.fs.existsSync(newpath)) {
this.fs.statSync(newpath, (err, stats) => {
if (err) {
console.log('Error checking path:', err);
} else {
if (stats.isDirectory()) {
newpath += this.path.sep
}
}
});
}
return newpath;
} }
try { try {
// start with our absolute path (of app.js) // start with our absolute path (of app.js)
const appdir = this.path.resolve(__dirname + this.path.sep + '..' + this.path.sep + '..') + this.path.sep const appdir = this.path.resolve(__dirname + this.path.sep + '..' + this.path.sep + '..')
if (path == '' && directory == '.') { if (path == '' && directory == '.') {
return appdir; return appdir;
@@ -874,27 +862,8 @@ class WTVShared {
// If there's an error accessing the directory, log it or handle as needed // If there's an error accessing the directory, log it or handle as needed
console.error('Error resolving directory:', e); console.error('Error resolving directory:', e);
} }
// determine if the final path is a directory, and add a final path.sep if so
var add_sep = false;
if (this.fs.existsSync(path)) {
this.fs.statSync(path, (err, stats) => {
if (err) {
console.log('Error checking path:', err);
} else {
if (stats.isDirectory()) {
add_sep = true
}
}
});
} else {
// path doesn't exist, we have to guess if its a directory
var path_split = this.path.resolve(path).split(this.path.sep);
if (path_split[(path_split.length - 1)].indexOf('.') > -1) {
add_sep = true;
}
}
// The path.resolve method will take care of normalizing slashes // The path.resolve method will take care of normalizing slashes
return this.path.resolve(path) + ((add_sep) ? this.path.sep : ''); return this.path.resolve(path);
} }

View File

@@ -1,12 +1,12 @@
{ {
"name": "zefie_wtvp_minisrv", "name": "zefie_wtvp_minisrv",
"version": "0.9.57", "version": "0.9.58",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "zefie_wtvp_minisrv", "name": "zefie_wtvp_minisrv",
"version": "0.9.57-pre", "version": "0.9.58-pre",
"license": "GPL3", "license": "GPL3",
"dependencies": { "dependencies": {
"adm-zip": "^0.5.12", "adm-zip": "^0.5.12",

View File

@@ -1,6 +1,6 @@
{ {
"name": "zefie_wtvp_minisrv", "name": "zefie_wtvp_minisrv",
"version": "0.9.57", "version": "0.9.58",
"description": "WebTV Service (WTVP) Emulation Server", "description": "WebTV Service (WTVP) Emulation Server",
"main": "app.js", "main": "app.js",
"homepage": "https://github.com/zefie/zefie_wtvp_minisrv", "homepage": "https://github.com/zefie/zefie_wtvp_minisrv",