progress for multi-server usenet
This commit is contained in:
@@ -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;
|
||||
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) {
|
||||
const WTVNewsServer = require(classPath + "/WTVNewsServer.js");
|
||||
let local_nntp_using_auth = false;
|
||||
|
||||
@@ -22,7 +22,7 @@ if (service_config.local_nntp_port && wtvnewsserver) {
|
||||
|
||||
async function throwError(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]);
|
||||
}
|
||||
|
||||
@@ -48,11 +48,12 @@ async function WebTVListGroup(group) {
|
||||
}
|
||||
wtvnews.listGroup(group, page, limit_per_page).then((response) => {
|
||||
if (response.code === 211) {
|
||||
const NGCount = response.group.number;
|
||||
let NGCount = response.group.number;
|
||||
const NGArticles = response.group.articleNumbers;
|
||||
page_start = (limit_per_page * page) + 1;
|
||||
page_end = (page + 1) * limit_per_page;
|
||||
wtvnews.getHeaderObj(NGArticles).then((messages) => {
|
||||
NGCount = NGArticles.length;
|
||||
messages = wtvnews.sortByResponse(messages);
|
||||
wtvnews.quitUsenet();
|
||||
headers = `200 OK
|
||||
@@ -193,7 +194,7 @@ Group: ${request_headers.query.group}
|
||||
<td height=33 width=256 valign=bottom>
|
||||
<font size=4>
|
||||
`
|
||||
if (NGCount === 0) {
|
||||
if (NGCount === 0 || isNaN(NGCount)) {
|
||||
data += `This group has no postings`;
|
||||
} else {
|
||||
data += NGCount + " posting";
|
||||
@@ -304,11 +305,11 @@ ${(message.headers.FROM.indexOf(' ') > 0) ? message.headers.FROM.split(' ')[0] :
|
||||
}
|
||||
}).catch((e) => {
|
||||
// listGroup error
|
||||
throwError(e)
|
||||
});;
|
||||
throwError("No such group");
|
||||
});
|
||||
}).catch((e) => {
|
||||
// selectGroup error
|
||||
throwError(e)
|
||||
throwError("No such group")
|
||||
});
|
||||
}).catch((e) => {
|
||||
// connect error
|
||||
|
||||
@@ -359,6 +359,7 @@ class WTVNews {
|
||||
if (article === "getCaseInsensitiveKey" || isNaN(article)) continue;
|
||||
promises.push(new Promise((resolve, reject) => {
|
||||
this.getHeader(NGArticles[article]).then((data) => {
|
||||
console.log(data)
|
||||
if (data.article) messages.push(data.article)
|
||||
resolve();
|
||||
}).catch((e) => {
|
||||
|
||||
@@ -136,6 +136,7 @@
|
||||
"wtv-news": {
|
||||
// Usenet
|
||||
"port": 1605,
|
||||
"local_nntp_enabled": true,
|
||||
"local_nntp_port": 5730, // Port for internal NNTP
|
||||
"local_nntp_requires_auth": true, // Needs to be enabled for posting
|
||||
"modules": [
|
||||
|
||||
Reference in New Issue
Block a user