add wtvchat://
(and unofficial irc://)
This commit is contained in:
@@ -183,37 +183,8 @@ if (!Object.prototype.getCaseInsensitiveKey) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function isConfiguredService(service) {
|
|
||||||
if (minisrv_config.services[service]) {
|
|
||||||
if (!minisrv_config.services[service].disabled) return true;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getServiceString(service, overrides = {}) {
|
function getServiceString(service, overrides = {}) {
|
||||||
// used externally by service scripts
|
return wtvshared.getServiceString(service, overrides);
|
||||||
if (service === "all") {
|
|
||||||
var out = "";
|
|
||||||
Object.keys(minisrv_config.services).sort().forEach(function (k) {
|
|
||||||
if (!isConfiguredService(k)) return true;
|
|
||||||
if (minisrv_config.services[k].pc_services) return true;
|
|
||||||
|
|
||||||
if (overrides.exceptions) {
|
|
||||||
Object.keys(overrides.exceptions).forEach(function (j) {
|
|
||||||
if (k != overrides.exceptions[j]) out += minisrv_config.services[k].toString(overrides) + "\n";
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
out += minisrv_config.services[k].toString(overrides) + "\n";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return out;
|
|
||||||
} else {
|
|
||||||
if (!minisrv_config.services[service]) {
|
|
||||||
throw ("SERVICE ERROR: Attempted to provision unconfigured service: " + service)
|
|
||||||
} else {
|
|
||||||
return minisrv_config.services[service].toString(overrides);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -239,7 +210,7 @@ var runScriptInVM = function (script_data, user_contextObj = {}, privileged = fa
|
|||||||
// try to make the debug name
|
// try to make the debug name
|
||||||
var debug_name = (filename) ? filename.split(path.sep) : null;
|
var debug_name = (filename) ? filename.split(path.sep) : null;
|
||||||
if (debug_name) {
|
if (debug_name) {
|
||||||
if (isConfiguredService(debug_name[debug_name.length - 2]))
|
if (wtvshared.isConfiguredService(debug_name[debug_name.length - 2]))
|
||||||
// service:/filename
|
// service:/filename
|
||||||
debug_name = debug_name[debug_name.length - 2] + ":/" + debug_name[debug_name.length - 1];
|
debug_name = debug_name[debug_name.length - 2] + ":/" + debug_name[debug_name.length - 1];
|
||||||
else
|
else
|
||||||
@@ -812,8 +783,8 @@ minisrv-no-mail-count: true`;
|
|||||||
if (original_service_name == service_name) console.log(" * " + ((ssl) ? "SSL " : "") + "PC request on service " + service_name + " for " + request_headers.request_url, 'on', socket.id);
|
if (original_service_name == service_name) console.log(" * " + ((ssl) ? "SSL " : "") + "PC request on service " + service_name + " for " + request_headers.request_url, 'on', socket.id);
|
||||||
else console.log(" * " + ((ssl) ? "SSL " : "") + "PC request on service " + original_service_name + " (Service Vault " + service_name + ") for " + request_headers.request_url, 'on', socket.id);
|
else console.log(" * " + ((ssl) ? "SSL " : "") + "PC request on service " + original_service_name + " (Service Vault " + service_name + ") for " + request_headers.request_url, 'on', socket.id);
|
||||||
}
|
}
|
||||||
// Check URL for :/, but not :// (to differentiate wtv urls)
|
|
||||||
if (shortURL.indexOf(':/') >= 0 && shortURL.indexOf('://') == -1) {
|
if (shortURL.indexOf(':/') >= 0) {
|
||||||
var ssid = socket.ssid;
|
var ssid = socket.ssid;
|
||||||
if (ssid == null) {
|
if (ssid == null) {
|
||||||
// prevent possible injection attacks via malformed SSID and filesystem SessionStore
|
// prevent possible injection attacks via malformed SSID and filesystem SessionStore
|
||||||
|
|||||||
21
zefie_wtvp_minisrv/includes/ServiceVault/wtvchat/catchall.js
Normal file
21
zefie_wtvp_minisrv/includes/ServiceVault/wtvchat/catchall.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
var minisrv_service_file = true;
|
||||||
|
|
||||||
|
var urldata = request_headers.request_url.split(":");
|
||||||
|
delete urldata[0];
|
||||||
|
|
||||||
|
urldata = urldata.join(":").substring(1);
|
||||||
|
console.log(urldata);
|
||||||
|
while (urldata.substring(0, 1) == "/") urldata = urldata.substring(1);
|
||||||
|
|
||||||
|
var server = urldata.split('/')[0];
|
||||||
|
var port = 6667;
|
||||||
|
|
||||||
|
if (server.indexOf(":") > 0) {
|
||||||
|
port = server.split(":")[1];
|
||||||
|
server = server.split(":")[0];
|
||||||
|
}
|
||||||
|
channel = urldata.split('/')[1]
|
||||||
|
|
||||||
|
var dest_url = "wtv-chat:/MakeChatPage?host=" + server + "&port=" + port + "&channel=" + channel;
|
||||||
|
headers = `300 Moved
|
||||||
|
Location: ${dest_url}`
|
||||||
@@ -855,6 +855,40 @@ class WTVShared {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isConfiguredService(service) {
|
||||||
|
if (this.minisrv_config.services[service]) {
|
||||||
|
if (!this.minisrv_config.services[service].disabled) return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
getServiceString(service, overrides = {}) {
|
||||||
|
// used externally by service scripts
|
||||||
|
if (service === "all") {
|
||||||
|
var self = this;
|
||||||
|
var out = "";
|
||||||
|
Object.keys(this.minisrv_config.services).sort().forEach(function (k) {
|
||||||
|
if (!self.isConfiguredService(k)) return true;
|
||||||
|
if (self.minisrv_config.services[k].pc_services) return true;
|
||||||
|
|
||||||
|
if (overrides.exceptions) {
|
||||||
|
Object.keys(overrides.exceptions).forEach(function (j) {
|
||||||
|
if (k != overrides.exceptions[j]) out += self.minisrv_config.services[k].toString(overrides) + "\n";
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
out += self.minisrv_config.services[k].toString(overrides) + "\n";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
return out;
|
||||||
|
} else {
|
||||||
|
if (!this.minisrv_config.services[service]) {
|
||||||
|
throw ("SERVICE ERROR: Attempted to provision unconfigured service: " + service)
|
||||||
|
} else {
|
||||||
|
return this.minisrv_config.services[service].toString(overrides);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
doErrorPage(code, data = null, details = null, pc_mode = false, wtv_reset = false) {
|
doErrorPage(code, data = null, details = null, pc_mode = false, wtv_reset = false) {
|
||||||
var headers = null;
|
var headers = null;
|
||||||
var minisrv_config = this.minisrv_config;
|
var minisrv_config = this.minisrv_config;
|
||||||
|
|||||||
@@ -209,6 +209,17 @@
|
|||||||
"port": 1630,
|
"port": 1630,
|
||||||
"connections": 3
|
"connections": 3
|
||||||
},
|
},
|
||||||
|
"wtvchat": {
|
||||||
|
"port": 1630,
|
||||||
|
"nobind": true,
|
||||||
|
"flags": "0x00000004"
|
||||||
|
},
|
||||||
|
"irc": {
|
||||||
|
"port": 1630,
|
||||||
|
"nobind": true,
|
||||||
|
"flags": "0x00000004",
|
||||||
|
"servicevault_dir": "wtvchat"
|
||||||
|
},
|
||||||
"wtv-disk": {
|
"wtv-disk": {
|
||||||
// wtv-disk (used for DiskMaps)
|
// wtv-disk (used for DiskMaps)
|
||||||
"port": 1635,
|
"port": 1635,
|
||||||
|
|||||||
@@ -196,6 +196,9 @@
|
|||||||
<Content Include="includes\ServiceVault\http_pc\favicon.ico" />
|
<Content Include="includes\ServiceVault\http_pc\favicon.ico" />
|
||||||
<Content Include="includes\ServiceVault\http_pc\index.js" />
|
<Content Include="includes\ServiceVault\http_pc\index.js" />
|
||||||
<Content Include="includes\ServiceVault\http_pc\viewergen\index.js" />
|
<Content Include="includes\ServiceVault\http_pc\viewergen\index.js" />
|
||||||
|
<Content Include="includes\ServiceVault\wtvchat\catchall.js">
|
||||||
|
<SubType>Code</SubType>
|
||||||
|
</Content>
|
||||||
<Content Include="includes\ServiceVault\news\catchall.js">
|
<Content Include="includes\ServiceVault\news\catchall.js">
|
||||||
<SubType>Code</SubType>
|
<SubType>Code</SubType>
|
||||||
</Content>
|
</Content>
|
||||||
@@ -2340,6 +2343,7 @@
|
|||||||
<Folder Include="includes\ServiceVault\" />
|
<Folder Include="includes\ServiceVault\" />
|
||||||
<Folder Include="includes\ServiceVault\http_pc\" />
|
<Folder Include="includes\ServiceVault\http_pc\" />
|
||||||
<Folder Include="includes\ServiceVault\http_pc\viewergen\" />
|
<Folder Include="includes\ServiceVault\http_pc\viewergen\" />
|
||||||
|
<Folder Include="includes\ServiceVault\wtvchat\" />
|
||||||
<Folder Include="includes\ServiceVault\news\" />
|
<Folder Include="includes\ServiceVault\news\" />
|
||||||
<Folder Include="includes\ServiceVault\SharedROMCache\" />
|
<Folder Include="includes\ServiceVault\SharedROMCache\" />
|
||||||
<Folder Include="includes\ServiceVault\SharedROMCache\help\" />
|
<Folder Include="includes\ServiceVault\SharedROMCache\help\" />
|
||||||
|
|||||||
Reference in New Issue
Block a user