progress for multi-server usenet

This commit is contained in:
zefie
2025-08-14 15:28:14 -04:00
parent 7ae7bb97ef
commit e861591a8a
4 changed files with 10 additions and 7 deletions

View File

@@ -2452,7 +2452,7 @@ Object.keys(minisrv_config.services).forEach(function (k) {
const using_tls = (minisrv_config.services[k].pc_services && minisrv_config.services[k].https_cert && minisrv_config.services[k].use_https) ? true : false; const using_tls = (minisrv_config.services[k].pc_services && minisrv_config.services[k].https_cert && minisrv_config.services[k].use_https) ? true : false;
console.log(" * Configured Service:", k, "on Port", minisrv_config.services[k].port, "- Service Host:", minisrv_config.services[k].host + ((using_tls) ? " (TLS)" : ""), "- Mode:", (minisrv_config.services[k].pc_services) ? "HTTP" : "WTVP"); console.log(" * Configured Service:", k, "on Port", minisrv_config.services[k].port, "- Service Host:", minisrv_config.services[k].host + ((using_tls) ? " (TLS)" : ""), "- Mode:", (minisrv_config.services[k].pc_services) ? "HTTP" : "WTVP");
if (minisrv_config.services[k].local_nntp_port) { if (minisrv_config.services[k].local_nntp_enabled && minisrv_config.services[k].local_nntp_port) {
if (!wtvnewsserver) { if (!wtvnewsserver) {
const WTVNewsServer = require(classPath + "/WTVNewsServer.js"); const WTVNewsServer = require(classPath + "/WTVNewsServer.js");
let local_nntp_using_auth = false; let local_nntp_using_auth = false;

View File

@@ -22,7 +22,7 @@ if (service_config.local_nntp_port && wtvnewsserver) {
async function throwError(e) { async function throwError(e) {
console.log(e); console.log(e);
const errpage = wtvshared.doErrorPage(400, null, e.toString()); const errpage = wtvshared.doErrorPage(400 + " " + e.toString(), null, e.toString());
sendToClient(socket, errpage[0], errpage[1]); sendToClient(socket, errpage[0], errpage[1]);
} }
@@ -48,11 +48,12 @@ async function WebTVListGroup(group) {
} }
wtvnews.listGroup(group, page, limit_per_page).then((response) => { wtvnews.listGroup(group, page, limit_per_page).then((response) => {
if (response.code === 211) { if (response.code === 211) {
const NGCount = response.group.number; let NGCount = response.group.number;
const NGArticles = response.group.articleNumbers; const NGArticles = response.group.articleNumbers;
page_start = (limit_per_page * page) + 1; page_start = (limit_per_page * page) + 1;
page_end = (page + 1) * limit_per_page; page_end = (page + 1) * limit_per_page;
wtvnews.getHeaderObj(NGArticles).then((messages) => { wtvnews.getHeaderObj(NGArticles).then((messages) => {
NGCount = NGArticles.length;
messages = wtvnews.sortByResponse(messages); messages = wtvnews.sortByResponse(messages);
wtvnews.quitUsenet(); wtvnews.quitUsenet();
headers = `200 OK headers = `200 OK
@@ -193,7 +194,7 @@ Group: ${request_headers.query.group}
<td height=33 width=256 valign=bottom> <td height=33 width=256 valign=bottom>
<font size=4> <font size=4>
` `
if (NGCount === 0) { if (NGCount === 0 || isNaN(NGCount)) {
data += `This group has no postings`; data += `This group has no postings`;
} else { } else {
data += NGCount + " posting"; data += NGCount + " posting";
@@ -304,11 +305,11 @@ ${(message.headers.FROM.indexOf(' ') > 0) ? message.headers.FROM.split(' ')[0] :
} }
}).catch((e) => { }).catch((e) => {
// listGroup error // listGroup error
throwError(e) throwError("No such group");
});; });
}).catch((e) => { }).catch((e) => {
// selectGroup error // selectGroup error
throwError(e) throwError("No such group")
}); });
}).catch((e) => { }).catch((e) => {
// connect error // connect error

View File

@@ -359,6 +359,7 @@ class WTVNews {
if (article === "getCaseInsensitiveKey" || isNaN(article)) continue; if (article === "getCaseInsensitiveKey" || isNaN(article)) continue;
promises.push(new Promise((resolve, reject) => { promises.push(new Promise((resolve, reject) => {
this.getHeader(NGArticles[article]).then((data) => { this.getHeader(NGArticles[article]).then((data) => {
console.log(data)
if (data.article) messages.push(data.article) if (data.article) messages.push(data.article)
resolve(); resolve();
}).catch((e) => { }).catch((e) => {

View File

@@ -136,6 +136,7 @@
"wtv-news": { "wtv-news": {
// Usenet // Usenet
"port": 1605, "port": 1605,
"local_nntp_enabled": true,
"local_nntp_port": 5730, // Port for internal NNTP "local_nntp_port": 5730, // Port for internal NNTP
"local_nntp_requires_auth": true, // Needs to be enabled for posting "local_nntp_requires_auth": true, // Needs to be enabled for posting
"modules": [ "modules": [