feat: Add origStatus to MirrorFileEntry and implement status check for original files

- Added origStatus property to MirrorFileEntry interface to track the availability of original files.
- Updated generateDownloadLinks function to conditionally display the original link based on origStatus.
- Implemented checkMirrorFileDbStatus function to verify the accessibility of original files and update their status in the mirrorFileDb.
- Called checkMirrorFileDbStatus in main command handler to ensure the status is checked during execution.
This commit is contained in:
daydreamer-json
2026-03-05 00:33:58 +09:00
parent 50d76b7646
commit 79f327ce76
3 changed files with 425 additions and 196 deletions

View File

@@ -22,6 +22,7 @@ const FILE_SIZE_OPTS = {
interface MirrorFileEntry {
orig: string;
mirror: string;
origStatus: boolean;
}
interface StoredData<T> {
@@ -681,7 +682,9 @@ function generateDownloadLinks(url: string) {
const mirrorEntry = mirrorFileDb.find((g) => g.orig.includes(cleanUrl.toString()));
const links: string[] = [];
links.push(`<a href="${url}" target="_blank">Orig</a>`);
if (!mirrorEntry || mirrorEntry.origStatus === true) {
links.push(`<a href="${url}" target="_blank">Orig</a>`);
}
if (mirrorEntry) {
links.push(`<a href="${mirrorEntry.mirror}" target="_blank">Mirror</a>`);
}