updates to digiserver app server

This commit is contained in:
2026-09-10 21:03:16 +03:00
parent 046f5e5efd
commit 1c5186463a
129 changed files with 33014 additions and 17 deletions
+18
View File
@@ -837,6 +837,24 @@ def receive_edited_media():
with open(metadata_path, 'w') as f:
json.dump(metadata, f, indent=2)
# ── Preserve the original filename ──────────────────────────────
# `content.filename` is (re)pointed at the latest edit below so the
# player downloads the newest version. The pristine original must be
# remembered separately, otherwise the original is lost forever and
# the UI shows the edited image as the "original".
if not content.original_filename:
if not content.filename.startswith('edited_media/'):
# Normal case: current filename is still the pristine upload.
content.original_filename = content.filename
else:
# Re-process: content.filename already points at an edited
# file. Recover the pristine original from the first (v1) edit.
first_edit = PlayerEdit.query.filter_by(content_id=content.id)\
.order_by(PlayerEdit.version.asc(), PlayerEdit.created_at.asc())\
.first()
if first_edit and first_edit.original_name:
content.original_filename = first_edit.original_name
# ── Point Content.filename to the latest edit ────────────────────
# This tells the player to download the latest edited version.
old_filename = content.filename