- BREAKING CHANGE from v0.9.35 and eariler: Move accounts into subfolder of SessionStore
 - viewergen and viewer updates from @GraspYonOx
 - new homepage theme inspired by @GraspYonOx
 - connect setup also mostly by @GraspYonOx
 - numerous bug fixes
 - nntp-server-zefie is now on npmjs
 - implement proper nodejs debugging
   - will start to phase out using console.log for actual debugging
   - existing "debug" (verbose) messages will stay as is
   - future code debugging will use debug() to debug WIP, therefore not showing to most users if it is accidently left in
This commit is contained in:
zefie
2022-10-16 18:58:30 -04:00
parent b89e0e932c
commit c2a3081afd
91 changed files with 1653 additions and 1694 deletions

View File

@@ -9,12 +9,14 @@ class WTVNews {
username = null;
password = null;
posting_allowed = true;
debug = null;
constructor(minisrv_config, service_name) {
this.minisrv_config = minisrv_config;
this.service_name = service_name;
const { WTVShared } = require("./WTVShared.js");
this.wtvshared = new WTVShared(minisrv_config);
this.debug = require('debug')('WTVNews');
}
initializeUsenet(host, port = 119, tls_options = null, username = null, password = null) {
@@ -393,17 +395,20 @@ class WTVNews {
var section = element.split("\n");
attachments[i] = {};
section.forEach((line) => {
this.debug('section_type', section_type, 'line', line);
var section_header_match = line.match(/^Content\-/i)
if (section_header_match) {
var section_match = line.match(/^Content\-Type\: (.+)\;/i)
if (section_match) {
this.debug('section_match', section_match)
section_type = section_match[1];
if (section_match[1].match("text/plain")) {
section_type = section_match[1].match("text/plain")[1];
message_type = section_type;
} else {
section_type = section_match[1];
attachments[i].content_type = section_match[1]
}
this.debug('section_type', section_type)
}
section_match = line.match(/^Content\-Disposition\: (.+)\;/i)
if (section_match) {
@@ -476,6 +481,9 @@ class WTVNews {
mainref = searchart.messageId;
message_relations[mainref].push({ "messageId": messageId, "index": k });
found = true;
} else {
// no relation, missing reference, add as root
message_id_roots.push({ "messageId": messageId, "index": k });
}
});
}
@@ -508,7 +516,7 @@ class WTVNews {
// sort relations by date
var article = messages[message_relations[message_id_roots[k].messageId][j].index];
var article_date = Date.parse(article.headers.DATE);
relations.push({ "article": article, "relation": message_id_roots[k].messageId, "date": article_date })
relations.push({ "article": article, "relation": message_id_roots[k].messageId || null, "date": article_date })
});
relations.sort((a, b) => { return (a.date - b.date) });
Object.keys(relations).forEach((j) => {