diff --git a/index.html b/index.html
index f2823c4..d0546c8 100644
--- a/index.html
+++ b/index.html
@@ -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"
diff --git a/server.py b/server.py
index 339ecd9..5e833bb 100644
--- a/server.py
+++ b/server.py
@@ -31,13 +31,18 @@ load_dotenv()
def cleanup_old_uploads():
- """Löscht beim Start alle alten onlyframes-tmp-Ordner."""
+ """Löscht onlyframes-tmp-Ordner die älter als 24h sind."""
tmp = tempfile.gettempdir()
+ cutoff = time() - 24 * 3600
for name in os.listdir(tmp):
if name.startswith("onlyframes-") and name != "onlyframes-server.log":
path = os.path.join(tmp, name)
if os.path.isdir(path):
- shutil.rmtree(path, ignore_errors=True)
+ try:
+ if os.path.getmtime(path) < cutoff:
+ shutil.rmtree(path, ignore_errors=True)
+ except OSError:
+ pass
cleanup_old_uploads()