v0.9.58
- critical fix in adding users (again) - fixed wtv-tricks (revert theme)
This commit is contained in:
@@ -11,7 +11,7 @@ if (request_headers.query.user_id) {
|
||||
// security
|
||||
if (session_data.user_id != 0 && session_data.user_id != request_headers.query.user_id) {
|
||||
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];
|
||||
data = errpage[1];
|
||||
}
|
||||
@@ -30,7 +30,7 @@ wtv-noback-all: wtv-setup:/edit-user`
|
||||
}
|
||||
|
||||
if (!userSession.loadSessionData()) {
|
||||
var errpage = doErrorPage(400, "Invalid user ID.");
|
||||
var errpage = wtvshared.doErrorPage(400, "Invalid user ID.");
|
||||
headers = errpage[0];
|
||||
data = errpage[1];
|
||||
} else {
|
||||
|
||||
@@ -6,19 +6,27 @@ Connection: Keep-Alive
|
||||
wtv-expire-all: wtv-tricks:/benchmark
|
||||
Content-type: text/html`
|
||||
data = `<html>
|
||||
<body>
|
||||
<display nosave nosend skipback>
|
||||
<script src=/ROMCache/h.js></script><script src=/ROMCache/n.js></script><script>
|
||||
head('Speed Test Result')</script>`;
|
||||
<title>${minisrv_config.config.service_name} Tricks</title>
|
||||
<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"));
|
||||
if (isNaN(start_time)) {
|
||||
data += "Invalid data, please try your benchmark again";
|
||||
} else {
|
||||
var end_time = Math.floor(new Date().getTime());
|
||||
if (!session_data.getTicketData("benchmark_endtime")) {
|
||||
if (!session_data.getTicketData("benchmark_endtime")) {
|
||||
session_data.setTicketData("benchmark_endtime", end_time);
|
||||
} else {
|
||||
end_time = session_data.getTicketData("benchmark_endtime");
|
||||
}
|
||||
}
|
||||
var download_time = end_time - start_time;
|
||||
var image_filename = wtvshared.getServiceDep("/wtv-tricks/benchmark.jpg", true);
|
||||
var image_size = fs.statSync(image_filename).size
|
||||
@@ -30,7 +38,7 @@ if (isNaN(start_time)) {
|
||||
<tr>
|
||||
<td height=5>
|
||||
<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 valign=top>☎
|
||||
<tr>
|
||||
@@ -44,7 +52,7 @@ if (isNaN(start_time)) {
|
||||
<tr>
|
||||
<td height=40>
|
||||
<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 valign=top>${image_size_kb} KBytes
|
||||
<tr>
|
||||
@@ -72,7 +80,7 @@ data += `
|
||||
<p>
|
||||
<table>
|
||||
<tr>
|
||||
<td width=120>
|
||||
<td width=100>
|
||||
<td><a selected href="wtv-tricks:/benchmark">Re-Test</a>
|
||||
<td width=30>
|
||||
<td><a href="wtv-tricks:/tricks">Back to Tricks</a>
|
||||
|
||||
@@ -17,10 +17,7 @@ data = `<html>
|
||||
http-equiv=refresh
|
||||
content="1; url=`+ visit_url +`"
|
||||
>
|
||||
<script src=file://rom/Cache/h.js></script><script src=file://rom/Cache/n.js></script><script>
|
||||
head('${minisrv_config.config.service_name} Tricks - Blast Blacklist','','','',1)</script>
|
||||
<table cellspacing=0 cellpadding=0><tr><td abswidth=10> <td colspan=3>
|
||||
<br>
|
||||
<body bgcolor="black" text="gold" link="gold" vlink="gold" alink="gold">
|
||||
Successfully expired service URL cache<br>
|
||||
Any previously cached pages should be reloaded from the network.<br><br>
|
||||
<a href="`+visit_url+`">Not loading? Click here.</a>
|
||||
|
||||
@@ -31,9 +31,15 @@ Content-Type: text/html`
|
||||
data = `<html>
|
||||
<!--- *=* Copyright 1996, 1997 WebTV Networks, Inc. All rights reserved. --->
|
||||
<display nosave nosend skipback>
|
||||
<script src=/ROMCache/h.js></script><script src=/ROMCache/n.js></script><script>
|
||||
head('${minisrv_config.config.service_name} Info')</script>
|
||||
|
||||
<title>${minisrv_config.config.service_name} Info</title>
|
||||
<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> <td colspan=3>
|
||||
<table>
|
||||
<tr>
|
||||
|
||||
@@ -14,7 +14,6 @@ Content-Type: text/html`
|
||||
|
||||
tricks = [
|
||||
["wtv-tricks:/info", minisrv_config.config.service_name + " info"],
|
||||
["wtv-tricks:/themes", "Theme Switcher"],
|
||||
["wtv-cookie:list", "List Cookies"],
|
||||
["wtv-cookie:reset", "Clear Cookies"],
|
||||
["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
|
||||
|
||||
data = `<html>
|
||||
<body>
|
||||
<display nosave nosend>
|
||||
<script src=/ROMCache/h.js></script><script src=/ROMCache/n.js></script><script>
|
||||
head('${minisrv_config.config.service_name} Tricks')</script>
|
||||
<title>${minisrv_config.config.service_name} Tricks</title>
|
||||
<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> <td colspan=3>
|
||||
<table><tc><td width=50> </td></tc><tc><td><table>`;
|
||||
<table><tc><td> </td></tc><tc><td><table>`;
|
||||
|
||||
for (i = 0; i < tricks.length; i += 2) {
|
||||
data += `<tr>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -218,7 +218,7 @@ class WTVClientSessionData {
|
||||
if (user_id == null) user_id = this.user_id;
|
||||
var userstore = this.getAccountStoreDirectory() + this.path.sep + this.ssid + 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) {
|
||||
|
||||
@@ -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} directory Root directory
|
||||
*/
|
||||
getAbsolutePath(path = '', directory = '.') {
|
||||
if (directory[0] == "/" || directory.substr(1, 2) == ":" + this.path.sep) {
|
||||
var newpath = 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;
|
||||
return this.path.resolve(directory + this.path.sep + path);
|
||||
}
|
||||
try {
|
||||
// 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 == '.') {
|
||||
return appdir;
|
||||
@@ -874,27 +862,8 @@ class WTVShared {
|
||||
// If there's an error accessing the directory, log it or handle as needed
|
||||
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
|
||||
return this.path.resolve(path) + ((add_sep) ? this.path.sep : '');
|
||||
return this.path.resolve(path);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user