mirror of
https://github.com/community-scripts/ProxmoxVE-Local.git
synced 2026-07-31 09:28:40 -04:00
* fix: PB 503 retry, IPv6 validation, download concurrency - Add withPbRetry() with exponential backoff for PocketBase queries that return 503/429 under concurrent tRPC request load (#527) - Accept IPv6 addresses in gateway and DNS resolver fields (#524) - Batch loadMultipleScripts in groups of 5 with Promise.allSettled and inter-batch delay to avoid GitHub rate limits (#523) Closes #527, Closes #524, Closes #523 * perf: increase staleTime, disable refetchOnWindowFocus, use httpBatchLink - staleTime 30s → 5min: script metadata rarely changes, avoids constant re-fetches on every navigation - refetchOnWindowFocus: false: prevents all queries from re-firing when switching tabs or clicking back into the window - httpBatchLink instead of httpBatchStreamLink: responses arrive as single JSON payload instead of streamed chunks, reducing overhead for the typical small tRPC payloads * fix: address TypeScript linting issues and improve error handling across multiple files * fix: resolve TypeScript linting issues by updating error handling and filtering logic --------- Co-authored-by: ProxmoxVE Developer <dev@localhost>
35 lines
1.2 KiB
TypeScript
35 lines
1.2 KiB
TypeScript
/**
|
|
* Build-time script: fetch all logos from PocketBase and cache them to public/logos/.
|
|
* Called as part of `npm run build` so the app starts with logos pre-cached.
|
|
*/
|
|
|
|
import { getPb } from '../src/server/services/pbService';
|
|
import { cacheLogos } from '../src/server/services/logoCacheService';
|
|
|
|
async function main() {
|
|
console.log('[cache-logos] Fetching script list from PocketBase...');
|
|
const pb = getPb();
|
|
const records = await pb.collection('script_scripts').getFullList({
|
|
fields: 'slug,logo',
|
|
batch: 500,
|
|
});
|
|
|
|
const entries = records
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-return
|
|
.filter((r) => r.logo)
|
|
.map((r) => ({ slug: r.slug, url: r.logo }));
|
|
|
|
console.log(`[cache-logos] Caching ${entries.length} logos...`);
|
|
// eslint-disable-next-line @typescript-eslint/no-unsafe-argument
|
|
const result = await cacheLogos(entries);
|
|
console.log(
|
|
`[cache-logos] Done: ${result.downloaded} downloaded, ${result.skipped} already cached, ${result.errors} errors`,
|
|
);
|
|
}
|
|
|
|
main().catch((err) => {
|
|
console.error('[cache-logos] Failed:', err);
|
|
// Non-fatal — build should continue even if logo caching fails
|
|
process.exit(0);
|
|
});
|