fix: cleanup only old uploads, restore fav state on tinder undo

- #11: cleanup_old_uploads() skips dirs younger than 24h (safe during --reload)
- #12: tinderHistory stores wasFav snapshot; undo restores exact pre-swipe favorite state

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-23 12:32:17 +00:00
parent a08777d759
commit ead0dd6a0f
2 changed files with 9 additions and 4 deletions
+2 -2
View File
@@ -1264,7 +1264,7 @@
const photo = tinderQueue[tinderIndex];
const card = el("tinder-card");
tinderHistory.push({ path: photo.path, decision: direction, index: tinderIndex });
tinderHistory.push({ path: photo.path, decision: direction, index: tinderIndex, wasFav: favoritePaths.has(photo.path) });
tinderDecisions[photo.path] = direction === "right" || direction === "fav";
if (direction === "fav") favoritePaths.add(photo.path);
@@ -1286,7 +1286,7 @@
if (tinderSwiping || tinderHistory.length === 0) return;
const last = tinderHistory.pop();
delete tinderDecisions[last.path];
favoritePaths.delete(last.path);
if (last.wasFav) favoritePaths.add(last.path); else favoritePaths.delete(last.path);
tinderIndex = last.index;
const backAnim = last.decision === "left" ? "back-from-left"
: last.decision === "fav" ? "back-from-top"