more meta logic creation updates

This commit is contained in:
zefie
2022-10-14 11:43:43 -04:00
parent e82328cab5
commit 097c908590

View File

@@ -191,7 +191,7 @@ class WTVNewsServer {
const g = this.getMetaFilename(group); const g = this.getMetaFilename(group);
if (g) { if (g) {
if (this.fs.existsSync(g)) return JSON.parse(this.fs.readFileSync(g)); if (this.fs.existsSync(g)) return JSON.parse(this.fs.readFileSync(g));
else return this.createMetaFile(group); else return false
} else return false; } else return false;
} }
@@ -304,6 +304,9 @@ class WTVNewsServer {
selectGroup(group, force_update = false, initial_update = false) { selectGroup(group, force_update = false, initial_update = false) {
var g = this.getGroupPath(group); var g = this.getGroupPath(group);
var meta = this.getMetadata(group);
if (!meta) force_update, initial_update = true;
if (initial_update) { if (initial_update) {
var out = { var out = {
total: 0, total: 0,
@@ -311,15 +314,14 @@ class WTVNewsServer {
max_index: 0, max_index: 0,
name: group name: group
} }
} else { } else var out = { ...meta }
var meta = this.getMetadata(group);
var out = { ...meta }
}
if (meta.min_index == 0) force_update = true; if (meta.min_index == 0) force_update = true;
if (this.featuredGroups) { if (this.featuredGroups) {
Object.keys(this.featuredGroups).forEach((k) => { Object.keys(this.featuredGroups).forEach((k) => {
if (group == this.featuredGroups[k].group) { if (group == this.featuredGroups[k].name) {
out.wildmat = 'y'; out.wildmat = 'y';
out.description = this.featuredGroups[k].description
return false; return false;
} }
}) })