fix: deliver JPEG (not huge PNG) to Picdrop, clean filenames, tmp cleanup

- Picdrop is a photo-proofing tool that expects handy JPGs; non-alpha
  results are now delivered as JPEG q92 (4:4:4) instead of 12-32 MB PNGs.
  Cutouts with alpha stay PNG. Fixes images not showing in POSTER LEA.
- buildResultFilename strips doubled dates/UUIDs/hex to avoid messy names.
- picdrop-ls gains action:cleanup_tmp; Admin 'Reste aufräumen' button
  removes leftover .tmp- files from the default gallery.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01XNQ8ghPfzAfsyVYd6HgFb6
This commit is contained in:
2026-07-24 08:07:16 +00:00
parent 32f06297a6
commit 70f3904d0e
4 changed files with 57 additions and 8 deletions
+12 -2
View File
@@ -93,11 +93,21 @@ export function slugify(s: string): string {
const GENERIC = new Set(['', 'foto', 'photo', 'bild', 'image', 'img', 'telegram', 'unbenannt', 'klarbild', 'screenshot', 'pxl', 'whatsapp']);
/** Motiv aus einem beliebigen (evtl. schon verarbeiteten) Namen herausschälen:
* Datumspräfixe, UUIDs und lange Hex-Ketten entfernen, damit keine Doppelungen entstehen. */
function cleanMotif(name: string | null): string {
let s = (name || '').replace(/\.[^.]+$/, '');
s = s.replace(/\b\d{4}-\d{2}-\d{2}\b/g, ' '); // Datum
s = s.replace(/[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/gi, ' '); // UUID
s = s.replace(/\b[0-9a-f]{16,}\b/gi, ' '); // lange Hex-Ketten
return slugify(s);
}
/** Logischer Dateiname: JJJJ-MM-TT_<motiv>_<format>.<ext>
* z. B. 2026-07-23_lea_the-frame.png */
export function buildResultFilename(originalName: string | null, formatToken: string, ext = 'png'): string {
const raw = slugify((originalName || '').replace(/\.[^.]+$/, ''));
const motif = GENERIC.has(raw) ? 'klarbild' : raw;
const raw = cleanMotif(originalName);
const motif = (!raw || GENERIC.has(raw)) ? 'klarbild' : raw;
const date = new Date().toISOString().slice(0, 10);
const fmt = slugify(formatToken) || 'original';
return `${date}_${motif}_${fmt}.${ext}`;