refactor(pages): decompose index.ts into specialized renderers and utils

This commit is contained in:
daydreamer-json
2026-03-08 01:44:25 +09:00
parent 74c7c7b803
commit 5e2c00dcb8
10 changed files with 712 additions and 662 deletions

View File

@@ -0,0 +1,16 @@
import type { MirrorFileEntry } from '../types.js';
export function generateDownloadLinks(url: string, mirrorFileDb: MirrorFileEntry[]) {
const cleanUrl = new URL(url);
cleanUrl.search = '';
const mirrorEntry = mirrorFileDb.find((g) => g.orig.includes(cleanUrl.toString()));
const links: string[] = [];
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>`);
}
return links.join(' / ');
}