goon/scripts/_patch_manifest.py
https://github.com/goon-foss/goon 7979d5fa61 session work: bug-report fixes + WIP cleanup
User-facing bugs resolved (per bug_reports table 2026-05-25):
- 40cd28aa (short-scene filter): mobile api.ts default min_duration_sec=60
  hides 6519 sub-60s scenes across all list endpoints (Performer/Site/Tag/
  Browse). Caller may override with explicit 0.
- 5e89ef7e (porndoe needs cookies/play click): INJECTED_JS in PlayerScreen
  now auto-clicks player-poster overlay (player-poster-play, big-play-button,
  vjs-big-play-button, jw-icon-display, btn-big-play, mejs__overlay-button,
  play-button, btn-play, videoPlayButton). Triggered same interval as
  consent-dismiss + ad-iframe removal.
- b1b5e1a2 (Mixdrop czarny ekran): re-enable mixdrop direct stream via VPS
  curl_cffi proxy (was: skip → WebView fallback → blank screen). Backend
  pipeline (mixdrop.py extract + stream_proxy._curl_cffi_stream with JA3 +
  auto-refetch on token expire) was already complete; just removed the skip
  in app/api/playback.py.

Plus ongoing WIP (paradisehill multi-part extraction, stream_proxy refetch
logic, gesture race fix for long-press 2x speed, anti-adblock INJECTED_JS
defenses, scripts for freshporno backfill, new sources API).
2026-05-25 22:02:52 +02:00

54 lines
1.4 KiB
Python

"""One-shot: napraw manifest.json dla istniejącego OTA update'u.
Bugs:
1. Windows publish wpisywał `assets\<hash>` (os.sep) do URL'i.
2. URL hosta ustawiony na 'goon-app.crawlbot.pl:8443' który nie ma DNS —
mobile nie pobierze assetów. Właściwy host: api.goon-foss.org (port 443).
Normalizujemy `\` → `/` i podmieniamy hosta na CORRECT_HOST.
"""
import json
import sys
CORRECT_HOST_PREFIX = "https://api.goon-foss.org/expo-updates/asset"
WRONG_HOST_PREFIXES = [
"https://goon-app.crawlbot.pl:8443/expo-updates/asset",
]
def fix_url(u: str) -> tuple[str, bool]:
new = u.replace("\\", "/")
for wrong in WRONG_HOST_PREFIXES:
if new.startswith(wrong):
new = new.replace(wrong, CORRECT_HOST_PREFIX, 1)
break
return new, new != u
def main() -> int:
if len(sys.argv) != 2:
print("usage: _patch_manifest.py <manifest.json path>")
return 1
path = sys.argv[1]
m = json.load(open(path))
fixed = 0
for a in m.get("assets", []):
new, ch = fix_url(a["url"])
if ch:
a["url"] = new
fixed += 1
la = m.get("launchAsset", {})
if "url" in la:
new, ch = fix_url(la["url"])
if ch:
la["url"] = new
fixed += 1
with open(path, "w") as f:
json.dump(m, f, indent=2)
print(f"patched {fixed} URLs in {path}")
return 0
if __name__ == "__main__":
sys.exit(main())