add optional anime notes

This commit is contained in:
stjet
2026-09-13 19:47:14 +00:00
parent 56edc6bdbc
commit d6ff5cd46a
3 changed files with 15 additions and 1 deletions

View File

@@ -1,5 +1,5 @@
import * as path from 'path';
import { readdirSync, existsSync } from 'fs';
import { readdirSync, readFileSync, existsSync } from 'fs';
import { Renderer } from './ryuji.js';
import { Builder } from './saki.js';
import _favourites_info from './favourites_info.json';
@@ -34,6 +34,7 @@ type MusicVars = ListingVars;
interface AnimeVars extends ListingVars {
higher_quality_available: boolean;
notes: string | boolean;
};
interface MangaVars extends ListingVars {
@@ -118,10 +119,15 @@ for (let i = 0; i < listings.length; i++) {
};
const serve_path = `/${listing.type}/${listing.name}/${chapter}`;
if (listing.type === "anime") {
let notes: string | boolean = false;
try {
notes = readFileSync(`notes/${listing.name}_${chapter}.txt`, "utf-8");
} catch (_) {}
anime_serve_paths.push(serve_path);
anime_vars.push({
...base,
higher_quality_available: existsSync(path.join(__dirname, `/static_assets/${listing.type}_assets/${listing.name}`, `${chapter}_higher_quality.mp4`)),
notes,
});
} else if (listing.type === "manga") {
manga_serve_paths.push(serve_path);

View File

@@ -0,0 +1,2 @@
Test note!
Wei wei wei wei wei wei

View File

@@ -45,6 +45,12 @@
</script>
[[ endif ]]
[[ component:nav ]]
[[ if:notes ]]
<div>
<h2>Notes</h2>
[[ notes ]]
</div>
[[ endif ]]
</div>
</div>
</body>