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

@@ -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

View File

@@ -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) => {

View File

@@ -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": [