fix pagebuilder stuff

add index for http_pb service
allow pc services access to ROMCache (single level)
This commit is contained in:
zefie
2023-10-08 15:48:46 -04:00
parent 3a2e874887
commit 8aa32055f5
5 changed files with 89 additions and 11 deletions

View File

@@ -375,7 +375,7 @@ async function processPath(socket, service_vault_file_path, request_headers = ne
if (pc_services) { if (pc_services) {
var pc_service_name = getServiceByVaultDir(service_name) var pc_service_name = getServiceByVaultDir(service_name)
if (minisrv_config.services[pc_service_name].service_vaults) { if (minisrv_config.services[pc_service_name].service_vaults) {
vaults_to_scan = minisrv_config.services[pc_service_name].service_vaults; vaults_to_scan = vaults_to_scan.concat(minisrv_config.services[pc_service_name].service_vaults);
} }
} else { } else {
updateFromVM.push([`ssid_sessions['${socket.ssid}']`, "session_data"]); // user-specific session data from unprivileged scripts updateFromVM.push([`ssid_sessions['${socket.ssid}']`, "session_data"]); // user-specific session data from unprivileged scripts
@@ -844,9 +844,9 @@ minisrv-no-mail-count: true`;
} }
var urlToPath = wtvshared.fixPathSlashes(service_name + path.sep + shortURL.split(':/')[1]); var urlToPath = wtvshared.fixPathSlashes(service_name + path.sep + shortURL.split(':/')[1]);
var shared_romcache = null; var shared_romcache = null;
if (shortURL.indexOf(":/ROMCache/") != -1 && minisrv_config.config.enable_shared_romcache) { if ((shortURL.indexOf(":/ROMCache/") != -1 || shortURL.indexOf("://ROMCache/") != -1) && minisrv_config.config.enable_shared_romcache) {
shared_romcache = wtvshared.fixPathSlashes(minisrv_config.config.SharedROMCache + path.sep + shortURL.split(':/')[1]); shared_romcache = wtvshared.fixPathSlashes(minisrv_config.config.SharedROMCache + path.sep + shortURL.split(':/')[1]);
} }
if (minisrv_config.config.debug_flags.show_headers) console.log(" * Incoming headers on socket ID", socket.id, (await wtvshared.decodePostData(wtvshared.filterRequestLog(wtvshared.filterSSID(request_headers))))); if (minisrv_config.config.debug_flags.show_headers) console.log(" * Incoming headers on socket ID", socket.id, (await wtvshared.decodePostData(wtvshared.filterRequestLog(wtvshared.filterSSID(request_headers)))));
socket_sessions[socket.id].request_headers = request_headers; socket_sessions[socket.id].request_headers = request_headers;
processPath(socket, urlToPath, request_headers, service_name, shared_romcache, pc_services); processPath(socket, urlToPath, request_headers, service_name, shared_romcache, pc_services);
@@ -859,6 +859,10 @@ minisrv-no-mail-count: true`;
processPath(socket, urlToPath, request_headers, service_name, shared_romcache, pc_services); processPath(socket, urlToPath, request_headers, service_name, shared_romcache, pc_services);
} else if (pc_services) { } else if (pc_services) {
// if a directory, request index // if a directory, request index
if (shortURL.indexOf("/ROMCache/") == 0 && minisrv_config.config.enable_shared_romcache) {
shared_romcache = wtvshared.fixPathSlashes(minisrv_config.config.SharedROMCache + path.sep + shortURL.split('/')[1] + '/' + shortURL.split('/')[2]);
console.log(shared_romcache);
}
if (shortURL.substring(shortURL.length - 1) == "/") shortURL += "index"; if (shortURL.substring(shortURL.length - 1) == "/") shortURL += "index";
var urlToPath = wtvshared.fixPathSlashes(service_name + path.sep + shortURL); var urlToPath = wtvshared.fixPathSlashes(service_name + path.sep + shortURL);
processPath(socket, urlToPath, request_headers, service_name, shared_romcache, pc_services); processPath(socket, urlToPath, request_headers, service_name, shared_romcache, pc_services);
@@ -1914,7 +1918,10 @@ function reloadConfig() {
minisrv_config = wtvshared.readMiniSrvConfig(true, false, true); // snatches minisrv_config minisrv_config = wtvshared.readMiniSrvConfig(true, false, true); // snatches minisrv_config
minisrv_config.version = temp.version minisrv_config.version = temp.version
if (temp.git_commit) minisrv_config.config.git_commit = temp.git_commit; if (temp.git_commit) minisrv_config.config.git_commit = temp.git_commit;
if (minisrv_config.config.service_logo.indexOf(':') == -1) minisrv_config.config.service_logo = "wtv-star:/ROMCache/" + minisrv_config.config.service_logo; if (minisrv_config.config.service_logo.indexOf(':') == -1) {
minisrv_config.config.service_logo_pc = "/ROMCache/" + minisrv_config.config.service_logo;
minisrv_config.config.service_logo = "wtv-star:/ROMCache/" + minisrv_config.config.service_logo;
}
if (minisrv_config.config.service_splash_logo.indexOf(':') == -1) minisrv_config.config.service_splash_logo = "wtv-star:/ROMCache/" + minisrv_config.config.service_splash_logo; if (minisrv_config.config.service_splash_logo.indexOf(':') == -1) minisrv_config.config.service_splash_logo = "wtv-star:/ROMCache/" + minisrv_config.config.service_splash_logo;
Object.keys(minisrv_config.services).forEach((k) => { Object.keys(minisrv_config.services).forEach((k) => {
configureService(k, minisrv_config.services[k]) configureService(k, minisrv_config.services[k])
@@ -2014,7 +2021,10 @@ else console.log(" * Full SSIDs will be shown in console logs");
if (minisrv_config.config.filter_passwords_in_logs) console.log(" * Will attempt to filter passwords in browser queries") if (minisrv_config.config.filter_passwords_in_logs) console.log(" * Will attempt to filter passwords in browser queries")
else console.log(" * Passwords in browser queries will not be filtered") else console.log(" * Passwords in browser queries will not be filtered")
if (minisrv_config.config.service_logo.indexOf(':') == -1) minisrv_config.config.service_logo = "wtv-star:/ROMCache/" + minisrv_config.config.service_logo; if (minisrv_config.config.service_logo.indexOf(':') == -1) {
minisrv_config.config.service_logo_pc = "/ROMCache/" + minisrv_config.config.service_logo;
minisrv_config.config.service_logo = "wtv-star:/ROMCache/" + minisrv_config.config.service_logo;
}
if (minisrv_config.config.service_splash_logo.indexOf(':') == -1) minisrv_config.config.service_splash_logo = "wtv-star:/ROMCache/" + minisrv_config.config.service_splash_logo; if (minisrv_config.config.service_splash_logo.indexOf(':') == -1) minisrv_config.config.service_splash_logo = "wtv-star:/ROMCache/" + minisrv_config.config.service_splash_logo;
minisrv_config.version = require('./package.json').version; minisrv_config.version = require('./package.json').version;

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -0,0 +1,68 @@
var minisrv_service_file = true;
var site = "";
if (minisrv_config.services['wtv-author'].public_domain) {
site = minisrv_config.services['wtv-author'].public_domain;
} else {
if (minisrv_config.services['wtv-author'].publish_mode == "service") {
var target_service = minisrv_config.services[minisrv_config.services['wtv-author'].publish_dest];
if (target_service) {
site = target_service.host + ":" + target_service.port;
}
} else {
site = minisrv_config.services['wtv-author'].host + ":" + minisrv_config.services['wtv-author'].port;
}
}
headers = `200 OK
Content-Type: text/html`
data = `<html><head>
<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">
<title>WebTV community home pages</title>
<style type="text/css"></style></head>
<body background="/blue_tile_128b.gif" bgcolor="1e4261" text="#dedede" link="#ccccff" data-new-gr-c-s-check-loaded="14.1114.0" data-gr-ext-installed="">
<table border="0" cellpadding="4" cellspacing="0" width="95%">
<tbody><tr>
<td width="100" rowspan="2">
<a href="/"><img src="${minisrv_config.config.service_logo_pc}" border="0" width="87" height="67"></a></td>
<td><font color="#dedede" size="5"><b>WebTV community home pages</b></font></td>
</tr>
<tr>
<td>
<hr>
</td>
</tr>
<tr>
<td width="100"></td>
<td bgcolor="#000033"><font color="#dedede" size="3">Here you'll find pages created by members of the ${minisrv_config.config.service_name} community using ${minisrv_config.config.service_name}'s Page Builder.</font></td>
</tr>
<tr height="7">
<td width="100" height="7"></td>
<td height="7" bgcolor="#000033"></td>
</tr>
<tr>
<td width="100"></td>
<td bgcolor="#000033"><font color="#dedede" size="3">If you know the name of a ${minisrv_config.config.service_name} user who has a home page, you can find that user's home page at an address of this form:</font> <blockquote>
<p><font color="#dedede" size="3">http://${site}/</font><font color="darkOrange" size="3">username</font></p></blockquote>
</td>
</tr>
<tr>
<td width="100"></td>
<td bgcolor="#000033"><font color="#dedede" size="3">For example, if the username is </font><font color="darkOrange" size="3">ltolstoy</font><font color="#dedede" size="3">, then the address is:</font> <blockquote>
<p><font color="#dedede" size="3">http://${site}/</font><font color="darkOrange" size="3">ltolstoy</font></p></blockquote>
</td>
</tr>
<tr>
<td width="100"></td>
<td></td>
</tr>
</tbody></table>
</body></html>
`

View File

@@ -561,7 +561,7 @@ block += `
<td width="30%" valign="middle"> <td width="30%" valign="middle">
<center> <center>
<font size="-2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><i> <font size="-2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><i>
<a href="http://community.webtv.zone">Powered by WebTV</a> <a href="http://${this.getPublishDomain()}">Powered by ${minisrv_config.config.service_name}</a>
</i></font></center> </i></font></center>
</td> </td>
<td width="30%" valign="middle" align="right"> <td width="30%" valign="middle" align="right">
@@ -605,7 +605,7 @@ html += `">previous page</a>
<td width="30%" valign="middle"> <td width="30%" valign="middle">
<center> <center>
<font size="-2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><i> <font size="-2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><i>
<a href="http://community.webtv.zone">Powered by WebTV</a> <a href="http://${this.getPublishDomain()}">Powered by ${minisrv_config.config.service_name}</a>
</i></font></center> </i></font></center>
</td> </td>
<td width="30%" valign="middle" align="right"> <td width="30%" valign="middle" align="right">
@@ -641,7 +641,7 @@ html += `">previous page</a>
<td width="30%" valign="middle"> <td width="30%" valign="middle">
<center> <center>
<font size="-2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><i> <font size="-2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><i>
<a href="http://community.webtv.zone">Powered by WebTV</a> <a href="http://${this.getPublishDomain()}">Powered by ${minisrv_config.config.service_name}</a>
</i></font></center> </i></font></center>
</td> </td>
<td width="30%" valign="middle" align="right"> <td width="30%" valign="middle" align="right">
@@ -673,7 +673,7 @@ html += `">next page</a>
<td width="30%" valign="middle"> <td width="30%" valign="middle">
<center> <center>
<font size="-2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><i> <font size="-2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><i>
<a href="http://community.webtv.zone">Powered by WebTV</a> <a href="http://${this.getPublishDomain()}">Powered by ${minisrv_config.config.service_name}</a>
</i></font></center> </i></font></center>
</td> </td>
<td width="30%" valign="middle" align="right"> <td width="30%" valign="middle" align="right">
@@ -1244,7 +1244,7 @@ vspace=0
<td width="30%" valign="middle"> <td width="30%" valign="middle">
<center> <center>
<font size="-2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><i> <font size="-2" face="Arial,Helvetica,Geneva,Swiss,SunSans-Regular"><i>
<a href="http://community.webtv.zone">Powered by WebTV</a> <a href="http://${this.getPublishDomain()}">Powered by ${minisrv_config.config.service_name}</a>
</i></font></center> </i></font></center>
</td> </td>
<td width="30%" valign="middle" align="right"> <td width="30%" valign="middle" align="right">

View File

@@ -313,7 +313,7 @@
"pc_services": true, // defines service as a PC service "pc_services": true, // defines service as a PC service
"hide_minisrv_version": true, // hide or show the minisrv version (eg like Apache version, can be hidden to hide known exploits for older version) "hide_minisrv_version": true, // hide or show the minisrv version (eg like Apache version, can be hidden to hide known exploits for older version)
"servicevault_dir": "http_pb", // The service vault dir for the PC Services for PageBuilder "servicevault_dir": "http_pb", // The service vault dir for the PC Services for PageBuilder
"service_vaults": ["PageBuilderVault"], // override service vaults for this service "service_vaults": ["PageBuilderVault"], // additional service vaults for this service
"drop_connection_on_wrong_port": true, // If true, resets connection if the PC browser connects to a port that is not PC Services enabled "drop_connection_on_wrong_port": true, // If true, resets connection if the PC browser connects to a port that is not PC Services enabled
"show_verbose_errors": false, // extra debugging "show_verbose_errors": false, // extra debugging
"allow_https": false, // for future use with LetsEncrypt "allow_https": false, // for future use with LetsEncrypt