Files
mrleo1nid 19924e1c5a
CI / frontend (push) Failing after 22s
CI / backend (push) Failing after 42s
feat: unlock in-game galleries per owned version
2026-10-27 15:45:22 +03:00

23 lines
1.0 KiB
Python

"""Gallery support for converted games; never changes scripts or story progress."""
from app.translation import file_json
def available(manifest: dict | None) -> bool:
if not manifest or "game.json" not in manifest.get("files", {}):
return False
game = file_json(manifest, "game.json")
if game.get("engine") not in (None, "renpy") or game.get("runtime"):
return False
screens = game.get("screens", {})
if game.get("build", {}).get("name") == "MIST" and "rewatchgirlselectscreen" in screens:
return True
def uses_gallery(value):
if isinstance(value, dict):
if value.get("k") == "call" and value.get("f", {}).get("k") == "name" and value["f"].get("id") in {"Gallery", "Replay"}:
return True
return any(uses_gallery(item) for item in value.values())
return isinstance(value, list) and any(uses_gallery(item) for item in value)
return uses_gallery(game.get("init", [])) or uses_gallery(screens) or uses_gallery(game.get("defaults", []))