add pnm:// server

This commit is contained in:
zefie
2026-04-21 08:23:40 -04:00
parent ca9a125435
commit a346fd7f69
4 changed files with 1427 additions and 9 deletions

View File

@@ -28,11 +28,13 @@ const WTVClientSessionData = require(classPath + "/WTVClientSessionData.js");
const WTVMime = require(classPath + "/WTVMime.js");
const WTVFlashrom = require(classPath + "/WTVFlashrom.js");
const WTVFTP = require(classPath + "/WTVFTP.js");
const WTVPNM = require(classPath + "/WTVPNM.js");
const vm = require('vm');
const debug = require('debug')('app');
const express = require('express');
let wtvnewsserver = null;
const protocolServers = [];
const minisrv_config = wtvshared.getMiniSrvConfig(); // snatches minisrv_config
const wtvmime = new WTVMime(minisrv_config);
@@ -2534,8 +2536,34 @@ process.on('uncaughtException', function (err) {
ports.sort();
pc_ports.sort();
Object.keys(minisrv_config.services).forEach((service_name) => {
if (typeof (minisrv_config.services[service_name]) === 'function') return;
const service = minisrv_config.services[service_name];
if (!service || service.disabled || !service.port) return;
if (service.protocol_handler === 'pnm') {
try {
const pnmServer = new WTVPNM(minisrv_config, service_name);
pnmServer.listen(service.port, minisrv_config.config.bind_ip);
protocolServers.push(pnmServer);
console.log(" * Configured Protocol Handler:", service.protocol_handler, "for", service_name, "on Port", service.port);
} catch (e) {
throw ("Could not bind PNM protocol handler to port " + service.port + " on " + minisrv_config.config.bind_ip + ": " + e.toString());
}
}
});
const protocolHandledPorts = new Set();
Object.keys(minisrv_config.services).forEach((service_name) => {
if (typeof (minisrv_config.services[service_name]) === 'function') return;
const service = minisrv_config.services[service_name];
if (!service || service.disabled || !service.port) return;
if (service.protocol_handler === 'pnm') {
protocolHandledPorts.add(parseInt(service.port));
}
});
// de-duplicate ports in case user configured multiple services on same port
const bind_ports = [...new Set(ports)]
const bind_ports = [...new Set(ports)].filter((port) => !protocolHandledPorts.has(parseInt(port)));
if (!minisrv_config.config.bind_ip) minisrv_config.config.bind_ip = "0.0.0.0";
bind_ports.every(function (v) {
try {

View File

@@ -17,7 +17,6 @@ Welcome to Download-O-Rama.
Download any of our fine file sets.<br>
Click the <b>!</b> to force download a specific file set.
</p><h2>Demos</h2>
<ul>
<table border=1 cellspacing=3 cellpadding=8>
<tr>
<td><a href="wtv-disk:/content/DownloadScreen.tmpl?diskmap=DealerDemo&amp;group=DealerDemo">Dealer Demo</a></td>
@@ -30,11 +29,10 @@ Click the <b>!</b> to force download a specific file set.
<td><a href="file://Disk/Demo-BPS/index.html">View Demo</a></td>
</tr>
</table>
</ul>
<h2>Firmware</h2>
<ul>
<i>These are always forced downloads</i>
<li><br><a href="wtv-disk:/content/DownloadScreen.tmpl?diskmap=ModemFirmwareDel&amp;group=ModemFirmware&force=true">
<ul>
<li><a href="wtv-disk:/content/DownloadScreen.tmpl?diskmap=ModemFirmwareDel&amp;group=ModemFirmware&force=true">
Delete Modem Firmware (Use 33.6k technology)
</a></li>
<li><a href="wtv-disk:/content/DownloadScreen.tmpl?diskmap=ModemFirmwareOld&amp;group=ModemFirmware&force=true">
@@ -70,12 +68,11 @@ V.90 Modem Firmware (Use common 56k technology)
<h2>Tools</h2>
</p>
<ul>
<i><b>WARNING: Use the following with caution</b></i>
<li><br>
<a href="wtv-disk:/get-group-data">View & Delete Groups</a>
</li></ul>
<ul>
<li><a href="wtv-disk:/get-group-data">View & Delete Groups</a></li>
</ul>
<h2>Home</h2>
<ul><li><a href="wtv-home:/home">Leave Download-O-Rama and Go Home</a></li>
</ul>

File diff suppressed because it is too large Load Diff

View File

@@ -393,6 +393,26 @@
"cert": "%ServiceDeps%/https/selfsigned_cert.pem",
"key": "%ServiceDeps%/https/selfsigned_key.pem"
}
},
"pnm": {
"port": 7070,
"flags": "0x00000001",
"allow_double_slash": true,
"protocol_handler": "pnm",
"send_keepalive": false,
"keepalive_zero_ack": true,
"hello_split_ms": 8,
"descriptor_on_first_pna": true,
"descriptor_after_hello_ms": 85,
"descriptor_fallback_ms": 85,
"descriptor_idle_fallback_ms": 85,
"tcp_start_delay_ms": 72,
"tcp_initial_burst": 1,
"tcp_interval_ms": 232,
"dynamic_session_token": true,
"adapt_codec_from_caps": false,
"auto_stream": true,
"debug": true
}
},
"favorites": {