Package a self-contained macOS app and harden serving
- Add macos/build.mjs: stages a universal .app outside the checkout, bundles and checksums Node, installs production deps per architecture, compiles the launcher shim, signs ad-hoc or with a Developer ID, and writes a zip and dmg with an optional notarization path. - Serve precompressed brotli/gzip assets and split admin panels and the public pages out of the main bundle. - Support HTTP range requests, and fix upload and quota accounting, gallery download counts and unreadable-file handling. - Add server HTTP integration tests, a Gitea CI workflow, a catalog backup script and a crash screen for the UI.
This commit is contained in:
+11
-6
@@ -88,15 +88,20 @@ export function originalTarget(id, ext = 'bin') {
|
||||
return originalPath(id, ext);
|
||||
}
|
||||
|
||||
export function findOriginal(id) {
|
||||
export function findOriginals(id) {
|
||||
const safe = lookupId(id);
|
||||
if (!safe) return null;
|
||||
if (!safe) return [];
|
||||
const { originals } = dirs();
|
||||
const prefix = `${safe}.`;
|
||||
for (const name of listFiles(originals)) {
|
||||
if (name.startsWith(prefix)) return path.join(originals, name);
|
||||
}
|
||||
return null;
|
||||
return listFiles(originals)
|
||||
// An interrupted upload leaves `<id>.<ext>.part-xxxx` behind; it is not a
|
||||
// usable original, and returning it would serve a truncated image.
|
||||
.filter((name) => name.startsWith(prefix) && !name.includes('.part-'))
|
||||
.map((name) => path.join(originals, name));
|
||||
}
|
||||
|
||||
export function findOriginal(id) {
|
||||
return findOriginals(id)[0] ?? null;
|
||||
}
|
||||
|
||||
export async function writePreview(id, data, ext = 'jpg') {
|
||||
|
||||
Reference in New Issue
Block a user