mirror of
https://github.com/daydreamer-json/ak-endfield-api-archive.git
synced 2026-03-26 09:12:27 +01:00
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:
@@ -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>`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user