Free, open-source AI video generator for Mac. Run LTX-2.5 and MiniMax H3 (Hailuo) locally on Apple Silicon: text-to-video and image-to-video with sound, lip-sync, character LoRA training, songs from lyrics (YuE2) and image editing (Qwen-Image-Edit). One-click install via Pinokio. Offline: no cloud, no API key, no NVIDIA GPU.
Python ai-filmmakingai-videoai-video-generatorapple-siliconhailuoimage-to-videolip-synclocal-ailora-trainingltx-2ltx-2-5ltx-videomacosminimax-h3mlxmusic-generationoffline-aipinokiotext-to-videovideo-generation
release(v5.0.1): Pro activation on Pinokio, Faster Flex Turbo, iPhone Remote on the App Store
mrbizarro048698f98847
diff --git a/README.md b/README.mdindex e3820f0..6bf2b9d 100644--- a/README.md+++ b/README.md@@ -18,7 +18,7 @@ It runs **LTX-2.5** and **MiniMax H3 (Hailuo H3)** for text-to-video and image-tand it still installs with one click through Pinokio. It is built on Apple's MLX: no CUDA, no cloud GPU, no API key, no credits and no watermark.Your prompts, pictures and videos never leave your Mac.-**Current release: v5.0.0.** Made by Mr Bizarro.+**Current release: v5.0.1.** Made by Mr Bizarro.## Why Phosphenediff --git a/VERSION b/VERSIONindex 0062ac9..6b244dc 100644--- a/VERSION+++ b/VERSION@@ -1 +1 @@-5.0.0+5.0.1diff --git a/docs/CHANGELOG_5.0.1.md b/docs/CHANGELOG_5.0.1.mdnew file mode 100644index 0000000..3a57af6--- /dev/null+++ b/docs/CHANGELOG_5.0.1.md@@ -0,0 +1,13 @@+# Phosphene 5.0.1++**Pro now works on Pinokio.** Paste your licence key and the perks switch on. Everything that was free stays free.++## Pro (optional, paid)++- **Pinokio takes your Pro licence.** Open Pro in the header, paste your licence key, and Pro turns on for this Mac. No Mac app needed. If the Mac app is already on your Mac with Pro, Pinokio uses it automatically. One Mac per licence; Phosphene checks once a day while you are online and keeps working for two weeks without internet.+- **Faster Flex Turbo.** A faster way to render Hailuo H3 Flex, on as soon as your licence is.+- **iPhone Remote.** Start and watch renders from the free Phosphene Remote app ([App Store](https://apps.apple.com/app/id6827562294)), at home or away. Works with Pinokio and the Mac app.++## Free++- Nothing changes for Free. Without a licence Phosphene behaves exactly as 5.0.diff --git a/mlx_ltx_panel.py b/mlx_ltx_panel.pyindex a2ba749..94ef25c 100644--- a/mlx_ltx_panel.py+++ b/mlx_ltx_panel.py@@ -95,6 +95,13 @@ import agent_discovery# Remote Control (Pro): the Mac side of the iPhone app lives in the PRIVATE Pro tree and ships# inside the Pro pack as pro_remote.py. This studio only offers the left-menu page and the# routes behind it; with no pro_remote module next to it, Remote Control is "comes with Pro".+# Pinokio has no Pro pack: with its own licence the Studio takes the compiled Remote modules out+# of the signed pack (pro_parts.py) and puts their verified folder on sys.path first.+try:+ import pro_parts as _pro_parts+ _pro_parts.activate()+except Exception: # noqa: BLE001 - the free Studio runs without it+ _pro_parts = Nonetry:import pro_remoteexcept ImportError:@@ -9741,7 +9748,7 @@ H3_FLEX_TURBO_AUDIO_SHIFT = 3.0H3_FLEX_TURBO_DOWNLOAD_GB = 0.31H3_FLEX_TURBO_DISK_NEED_GB = 1.5H3_FLEX_TURBO_NAME = "H3 Flex Turbo"-H3_FLEX_TURBO_LABEL = "H3 Flex Turbo (preview, Pro) · 4 steps"+H3_FLEX_TURBO_LABEL = "H3 Flex Turbo (preview, Pro) · faster"H3_FLEX_TURBO_CREDIT = ("H3 Flex Turbo: Pika H3 Flex Turbo LoRA by akhaliq, fusing Pika H3 Flex ""(Pika Labs) with LightX2V's MiniMax-H3 Turbo distill, running natively ""on Apple Silicon (MLX) in Phosphene. Powered by MiniMax H3. "@@ -39848,7 +39855,7 @@ def run_h3_job_inner(job: dict) -> None:+ f". Expected under {flex_turbo_paths['dir']} - pick H3 Flex Turbo "f"again in the engine picker to download it.")steps = H3_FLEX_TURBO_STEPS- push(f"[h3] {H3_FLEX_TURBO_NAME}: four-step Pika H3 Flex (akhaliq's fused LoRA with "+ push(f"[h3] {H3_FLEX_TURBO_NAME}: the faster Pika H3 Flex (akhaliq's fused LoRA with "f"LightX2V's Turbo), running natively on Apple Silicon (MLX). Powered by MiniMax H3.")if flex and (tristep or turbo or v13 or not h3_cell_takes_flex(tier)or mode not in H3_FLEX_MODES):@@ -49955,6 +49962,19 @@ if __name__ == "__main__":raiseif pro_remote is not None:pro_remote.boot(sys.modules[__name__])+ # Pinokio has no Mac app to keep a Pro licence fresh: the Studio renews its own (pro_licence.py).+ # A no-op without a licence record; the Mac app's studio never runs it.+ if not _dist.is_mac_app():+ try:+ import pro_licence+ pro_licence.start_renewal()+ except Exception as exc: # noqa: BLE001 - never stop the panel for this+ print(f"[pro] licence renewal not started: {exc}", flush=True)+ if _pro_parts is not None:+ try:+ _pro_parts.start(sys.modules[__name__])+ except Exception as exc: # noqa: BLE001 - never stop the panel for this+ print(f"[remote] Pro parts check not started: {exc}", flush=True)# Only a process that loaded the candidate and bound its listener can# acknowledge it. Dependency failures survive boot, even without analytics.if _root_is_checkout():diff --git a/panel/routes_pro.py b/panel/routes_pro.pyindex d020b4e..b826769 100644--- a/panel/routes_pro.py+++ b/panel/routes_pro.py@@ -10,14 +10,58 @@ from __future__ import annotationsimport json-from panel.routes import get+from panel.routes import get, postP = None # the running mlx_ltx_panel module; assigned at wiring time@get("/pro/status")def get_pro_status(h, parsed) -> None:- h._json(P.pro_status())+ doc = P.pro_status()+ # Pinokio only: whether this Studio can take a licence key itself (the Mac app has its own door).+ doc["licence_here"] = not P._dist.is_mac_app()+ if doc["licence_here"]:+ import pro_licence+ doc["own_licence"] = pro_licence.load() is not None+ h._json(doc)+++def _licence_call(h, name: str, with_key: bool = False) -> None:+ if P._dist.is_mac_app():+ h._json({"ok": False, "message": "Use Phosphene \u2192 Pro in the Mac app to manage your licence."}, 404)+ return+ rb = h._read_form_body()+ if rb is None:+ return+ form = {k: (v[0] if v else "") for k, v in rb[1].items()}+ import pro_licence+ try:+ doc = getattr(pro_licence, name)(form.get("key", "")) if with_key else getattr(pro_licence, name)()+ except Exception as exc: # noqa: BLE001+ doc = {"ok": False, "message": "The licence check failed: %s" % type(exc).__name__}+ doc["pro_status"] = P.pro_status()+ h._json(doc)+++@post("/pro/activate")+def post_pro_activate(h, path, qs, ctype) -> None:+ _licence_call(h, "activate", with_key=True)+++@post("/pro/refresh")+def post_pro_refresh(h, path, qs, ctype) -> None:+ _licence_call(h, "validate")+++@post("/pro/deactivate")+def post_pro_deactivate(h, path, qs, ctype) -> None:+ _licence_call(h, "deactivate")+++@get("/pro/licence")+def get_pro_licence(h, parsed) -> None:+ import pro_licence+ h._json(pro_licence.status())@get("/pro/compare")diff --git a/pro_licence.py b/pro_licence.pynew file mode 100644index 0000000..b71832c--- /dev/null+++ b/pro_licence.py@@ -0,0 +1,357 @@+"""The Studio's own Phosphene Pro licence: for an install that has no Mac app (Pinokio).++The Mac app activates a licence key with the Phosphene licence server and keeps the signed+capability token the server answers with (see pro_token.py for what that token is). A Pinokio+install has no app, so it did that nowhere and Pro could not turn on. This module does the same+thing the app does, against the same server, with the same rules:++ POST https://phosphene.video/api/v1/licenses/activate license_key, instance_name+ POST https://phosphene.video/api/v1/licenses/validate license_key, instance_id, device_id, bundle_version+ POST https://phosphene.video/api/v1/licenses/deactivate license_key, instance_id++* One Mac per key: the server decides. The instance name ends with this Mac's device id (the same+ id as the app's), and the server gives the Mac's older slot back when the same Mac activates+ again. So a Mac that already has Pro through the Mac app is NOT activated a second time here+ (it would take the app's slot): the app's token file is read instead, see pro_token.py.+* The server answers every validate with a token (valid <= 14 days). It is written next to the+ record and read by pro_token.py, which verifies the signature and the device on every call.+ Nothing here grants Pro: a hand-written record or token file is checked like any other.+* Offline: a network error or a 5xx/429 is never an answer about the licence. The last token+ keeps working until its own expiry (the 14-day offline grace), then the Studio reads Free.+* Revoked / refunded / expired / deactivated elsewhere: an explicit answer, the token file is+ removed at once and the Studio reads Free.+* Renewal: at start and every 6 hours the Studio validates again when the last good check is+ older than a day or the token has under 7 days left.++The licence key is kept in state/pro_licence.json (0600, replaced atomically), like the app keeps+its record (the app uses the Keychain). It is never logged and never sent anywhere but the server.+"""+from __future__ import annotations++import json+import os+import re+import socket+import threading+import time+import urllib.error+import urllib.parse+import urllib.request+from pathlib import Path++import pro_token++PRODUCTION = "https://phosphene.video/api"+RENEW_BELOW = 7 * 86400 # renew a token with less than this left+REVALIDATE_EVERY = 24 * 3600 # and at least this often while online+TICK = 6 * 3600 # how often the background renewal looks+TIMEOUT = 15+RECORD_NAME = "pro_licence.json"++MESSAGES = {+ "unreachable": "Could not reach the licence server. Check your internet connection and try again.",+ "empty": "Paste your licence key first.",+ "via_app": "Phosphene Pro is already on through the Phosphene Mac app on this Mac, so there is nothing to activate here.",+ "no_device": "This Mac could not be identified, so a licence cannot be activated here.",+ "other_mac": "This licence was activated on another Mac. Deactivate it there, or use a key for this Mac.",+ "revoked": "This licence has been disabled. Contact support for help.",+ "expired": "This licence has expired. Renew it to keep Pro.",+ "grace_over": "The licence could not be checked for two weeks. Connect to the internet to renew it.",+}+++def _base() -> str:+ """The licence server: ours, or a loopback test server when one is named (never anything else)."""+ raw = (os.environ.get("PHOSPHENE_LICENSE_SERVER") or "").strip()+ if raw:+ u = urllib.parse.urlparse(raw)+ if u.scheme in ("http", "https") and u.hostname in ("127.0.0.1", "localhost", "::1"):+ return raw.rstrip("/")+ return PRODUCTION+++def state_dir() -> Path:+ raw = (os.environ.get("LTX_STATE_DIR") or "").strip()+ return Path(raw) if raw else Path(__file__).resolve().parent / "state"+++def record_path() -> Path:+ return state_dir() / RECORD_NAME+++def token_path() -> Path:+ return Path(pro_token.studio_token_path())+++def _write_private(path: Path, text: str) -> bool:+ """Replace `path` atomically with `text`, readable by this user only."""+ tmp = path.with_name(".%s.%d.tmp" % (path.name, os.getpid()))+ try:+ path.parent.mkdir(parents=True, exist_ok=True)+ fd = os.open(str(tmp), os.O_WRONLY | os.O_CREAT | os.O_TRUNC, 0o600)+ with os.fdopen(fd, "w", encoding="utf-8") as fh:+ fh.write(text)+ os.replace(tmp, path)+ return True+ except OSError:+ try:+ tmp.unlink()+ except OSError:+ pass+ return False+++def _remove(path: Path) -> None:+ try:+ path.unlink()+ except FileNotFoundError:+ pass+ except OSError:+ pass+++def load() -> dict | None:+ try:+ d = json.loads(record_path().read_text(encoding="utf-8"))+ except (OSError, ValueError):+ return None+ return d if isinstance(d, dict) and d.get("key") and d.get("instance_id") else None+++def _save(rec: dict) -> bool:+ return _write_private(record_path(), json.dumps(rec, sort_keys=True, indent=1))+++# ----------------------------------------------------------------------------- the server++class Offline(Exception):+ """No answer about the licence (network trouble, 5xx, 429, garbage): never downgrades anyone."""+++def _post(endpoint: str, form: dict, opener=None) -> dict:+ data = urllib.parse.urlencode(form).encode("ascii")+ req = urllib.request.Request(_base() + "/v1/licenses/" + endpoint, data=data, method="POST", headers={+ "Accept": "application/json", "Content-Type": "application/x-www-form-urlencoded", "User-Agent": "Phosphene-Studio"})+ try:+ with (opener or urllib.request.urlopen)(req, timeout=TIMEOUT) as r:+ body = r.read(1 << 20)+ code = getattr(r, "status", 200)+ except urllib.error.HTTPError as e:+ code, body = e.code, e.read(1 << 20)+ except (urllib.error.URLError, OSError, ValueError) as e:+ raise Offline(str(e)[:120]) from e+ if code >= 500 or code == 429:+ raise Offline("http %s" % code)+ try:+ d = json.loads(body.decode("utf-8"))+ except (ValueError, UnicodeDecodeError) as e:+ raise Offline("unreadable answer") from e+ if not isinstance(d, dict):+ raise Offline("unreadable answer")+ return d+++def current_bundle(opener=None) -> str | None:+ """The Pro pack version the server hands out now (the token is issued for a published one)."""+ req = urllib.request.Request(_base() + "/health", headers={"Accept": "application/json", "User-Agent": "Phosphene-Studio"})+ try:+ with (opener or urllib.request.urlopen)(req, timeout=TIMEOUT) as r:+ rel = json.loads(r.read(1 << 16).decode("utf-8")).get("release")+ except (urllib.error.URLError, OSError, ValueError, AttributeError):+ return None+ rel = str(rel or "").strip()+ return rel if re.fullmatch(r"[A-Za-z0-9._+-]{1,64}", rel) else None+++def _mac_name() -> str:+ try:+ name = socket.gethostname().split(".")[0]+ except OSError:+ name = ""+ return (re.sub(r"[^\w .-]", "", name) or "Mac")[:40]+++def instance_name(device: str) -> str:+ # the server reads the device id from the end of this string+ return "%s · Phosphene Studio · %s" % (_mac_name(), device)+++# ----------------------------------------------------------------------------- actions++def _app_token_valid() -> bool:+ """Is Pro already on this Mac through the Mac app's token (so a second activation would take+ the app's slot)?"""+ env = {"HOME": os.environ.get("HOME", ""), "PHOSPHENE_HOME": os.environ.get("PHOSPHENE_HOME", "")}+ for t in pro_token.app_tokens(env):+ v = pro_token.verify_signature(t)+ if v[0] and pro_token.check(t, int(time.time()), pro_token.device_id(), verified=v)[0]:+ return True+ return False+++def activate(key: str, opener=None, now=None) -> dict:+ """Activate `key` on this Mac and fetch the first token. {ok, message, ...status()}."""+ key = (key or "").strip()+ if not key or len(key) > 128:+ return {"ok": False, "message": MESSAGES["empty"], **status()}+ dev = pro_token.device_id()+ if not dev:+ return {"ok": False, "message": MESSAGES["no_device"], **status()}+ if _app_token_valid() and not load():+ return {"ok": False, "message": MESSAGES["via_app"], **status()}+ old = load()+ try:+ r = _post("activate", {"license_key": key, "instance_name": instance_name(dev)}, opener)+ except Offline:+ return {"ok": False, "message": MESSAGES["unreachable"], **status()}+ inst = r.get("instance") or {}+ if not (r.get("activated") is True and inst.get("id") and r.get("meta")):+ return {"ok": False, "message": _human(r.get("error")), **status()}+ t = int(now if now is not None else time.time())+ rec = {"key": key, "instance_id": str(inst["id"]), "device": dev, "status": "active", "last_validated": t,+ "variant": str((r.get("meta") or {}).get("variant_name") or ""),+ "expires_at": (r.get("license_key") or {}).get("expires_at"), "token_error": None}+ if not _save(rec):+ # not durable: give the slot back rather than lose it at the next start+ try:+ _post("deactivate", {"license_key": key, "instance_id": rec["instance_id"]}, opener)+ except Offline:+ pass+ return {"ok": False, "message": "The licence could not be saved on this Mac (is the disk full?).", **status()}+ if old and old.get("key") == key and old.get("instance_id") != rec["instance_id"]:+ pass # the server already gave the old slot of this Mac back+ out = validate(opener=opener, now=t)+ return {**out, "message": out.get("message") or "Pro is active on this Mac."}+++def _human(error) -> str:+ e = str(error or "").lower()+ if "limit" in e:+ return MESSAGES["other_mac"]+ if "disabled" in e:+ return MESSAGES["revoked"]+ if "expired" in e:+ return MESSAGES["expired"]+ if "not found" in e or "invalid" in e:+ return "That licence key was not recognised. Check it and try again."+ if "not for phosphene" in e:+ return "That key is not a Phosphene Pro key."+ return (str(error)[:160] if error else "The licence server refused this key.")+++def validate(opener=None, now=None) -> dict:+ """Ask the server again and store the fresh token. An explicit 'no' removes the token."""+ rec = load()+ if not rec:+ return {"ok": False, "message": None, **status()}+ dev = pro_token.device_id()+ if rec.get("device") != dev:+ return {"ok": False, "message": MESSAGES["other_mac"], **status()}+ t = int(now if now is not None else time.time())+ form = {"license_key": rec["key"], "instance_id": rec["instance_id"]}+ bundle = current_bundle(opener)+ if bundle and dev:+ form["device_id"] = dev+ form["bundle_version"] = bundle+ try:+ r = _post("validate", form, opener)+ except Offline:+ return {"ok": False, "message": MESSAGES["unreachable"], **status()}+ lk = r.get("license_key") or {}+ if r.get("valid") is True and r.get("meta") and lk:+ rec.update(status=str(lk.get("status") or "active"), expires_at=lk.get("expires_at"), last_validated=t,+ variant=str((r.get("meta") or {}).get("variant_name") or rec.get("variant") or ""))+ tok = r.get("pro_token")+ if tok:+ if _write_private(token_path(), str(tok).strip() + "\n"):+ rec["token_error"] = None+ else:+ rec["token_error"] = "store_unavailable"+ else:+ rec["token_error"] = str(r.get("pro_token_error") or "no_token")+ if rec["token_error"] in ("instance_bound_to_another_mac", "licence_expired"):+ _remove(token_path())+ _save(rec)+ return {"ok": True, "message": None, **status()}+ if r.get("valid") is None and not r.get("error") and not lk:+ return {"ok": False, "message": MESSAGES["unreachable"], **status()} # an empty answer is not a verdict+ # the server said no: refunded, disabled, expired, or this slot was given up elsewhere+ rec.update(status=str(lk.get("status") if lk.get("status") not in (None, "active") else "invalid"), token_error="refused")+ _remove(token_path())+ _save(rec)+ return {"ok": False, "message": _human(r.get("error")) if r.get("error") else MESSAGES["revoked"], **status()}+++def deactivate(opener=None) -> dict:+ """Give this Mac's place on the key back. The record goes only once the server confirmed it."""+ rec = load()+ if not rec:+ return {"ok": True, "message": None, **status()}+ try:+ r = _post("deactivate", {"license_key": rec["key"], "instance_id": rec["instance_id"]}, opener)+ except Offline:+ return {"ok": False, "message": "Could not reach the licence server, so this Mac was not deactivated. Try again online.", **status()}+ gone = r.get("deactivated") is True or "not found" in str(r.get("error") or "").lower()+ if not gone:+ return {"ok": False, "message": _human(r.get("error")), **status()}+ _remove(record_path())+ _remove(token_path())+ return {"ok": True, "message": "This Mac is deactivated. Pro is off here.", **status()}+++def status() -> dict:+ """What Settings > Pro shows. `via`: 'app' (the Mac app's token), 'studio' (this module's record), or None."""+ rec = load()+ st = pro_token.status()+ via = None+ if st.get("ok"):+ via = "studio" if (rec and pro_token.studio_token_valid()) else ("app" if _app_token_valid() else "studio")+ out = {"licensed": bool(rec), "via": via, "pro": bool(st.get("ok")), "reason": st.get("reason"),+ "expires_at": st.get("expires_at"), "variant": (rec or {}).get("variant") or None}+ if rec and not st.get("ok"):+ out["note"] = _note(rec, st)+ return out+++def _note(rec: dict, st: dict) -> str | None:+ if rec.get("status") not in ("active",):+ return MESSAGES["revoked"] if rec.get("status") == "disabled" else MESSAGES["expired"] if rec.get("status") == "expired" \+ else "This licence is no longer active. Contact support if this is a mistake."+ if st.get("reason") == "expired":+ return MESSAGES["grace_over"]+ return None+++# ----------------------------------------------------------------------------- renewal++def due(now: int | None = None) -> bool:+ rec = load()+ if not rec or rec.get("status") != "active":+ return False+ now = int(time.time()) if now is None else int(now)+ if now - int(rec.get("last_validated") or 0) >= REVALIDATE_EVERY:+ return True+ st = pro_token.status()+ return (not st.get("ok")) or (st.get("expires_at") or 0) - now < RENEW_BELOW+++_loop_started = threading.Event()+++def start_renewal(sleep=time.sleep) -> bool:+ """A daemon thread: renew at start and every 6 hours. Pinokio only, once per process."""+ if _loop_started.is_set():+ return False+ _loop_started.set()++ def run():+ while True:+ try:+ if due():+ validate()+ except Exception: # noqa: BLE001 - a renewal problem must never reach a render+ pass+ sleep(TICK)++ threading.Thread(target=run, name="pro-licence-renewal", daemon=True).start()+ return Truediff --git a/pro_parts.py b/pro_parts.pynew file mode 100644index 0000000..8711175--- /dev/null+++ b/pro_parts.py@@ -0,0 +1,346 @@+"""Pro parts for a Studio without the Mac app (Pinokio): Remote Control's Mac side.++The Mac app installs the whole signed Pro pack as its studio, so `import pro_remote` finds the+compiled module there. A Pinokio Studio is the public tree from GitHub and has no Pro pack. With+its own licence (Settings > Pro, pro_licence.py) it takes ONLY the Remote modules out of the same+signed pack, from the same server, with the same checks as the app's ProInstaller:++ 1. POST <server>/v1/pro/latest license_key, instance_id, device_id, app_version+ -> base64 manifest, Ed25519 signature, key id, a short-lived download URL+ 2. the manifest signature is checked against the release key compiled in here (pro-2026-10)+ 3. the download (header X-Phosphene-Licence) must have the manifest's exact size and sha256+ 4. only the allow-listed compiled modules are read out of it (regular files at the top of the+ tree, bounded size); nothing else of the pack is written anywhere+ 5. state/pro_parts/<version>/ + current.json (the signed manifest, each part's sha256)++At start, activate() puts that folder on sys.path only when every part still matches the sha256+recorded at install. The modules check Pro themselves on every request (a signed, unexpired+token for this Mac), so installed parts with a lapsed licence do nothing; a refund removes the+token, not the files. The server is ours or a loopback test server (PHOSPHENE_LICENSE_SERVER).+"""+from __future__ import annotations++import base64+import hashlib+import json+import os+import re+import shutil+import sys+import tarfile+import threading+import time+import urllib.error+import urllib.parse+import urllib.request+from pathlib import Path++import distribution as _dist++SO = ".cpython-311-darwin.so"+PARTS = ("pro_remote", "pro_remote_crypto", "pro_relay_grant")+TRUSTED = {"pro-2026-10": "K/27SibA0PprIa5SZ6W8ITdYs8LExFerEUeiJRMB2qg="} # the app's ProKeys+MAX_PART = 32 << 20+MAX_PACK = 1 << 30+CHECK_EVERY = 24 * 3600+TIMEOUT = 30+_lock = threading.Lock()+_state = {"busy": False, "error": None, "checked_at": None}+++def _server() -> str:+ try:+ import pro_licence+ return pro_licence._base()+ except Exception: # noqa: BLE001+ return "https://phosphene.video/api"+++def _trusted() -> dict:+ keys = dict(TRUSTED)+ # A loopback test server may sign with a test key; never the real server.+ dev = (os.environ.get("PHOSPHENE_PRO_TEST_KEY") or "").strip()+ host = urllib.parse.urlparse(_server()).hostname+ if dev and host in ("127.0.0.1", "localhost", "::1") and re.fullmatch(r"[A-Za-z0-9+/]{43}=", dev):+ keys["test"] = dev+ return keys+++def state_dir() -> Path:+ raw = (os.environ.get("LTX_STATE_DIR") or "").strip()+ return Path(raw) if raw else Path(__file__).resolve().parent / "state"+++def root() -> Path:+ return state_dir() / "pro_parts"+++def _sha(path: Path) -> str:+ h = hashlib.sha256()+ with open(path, "rb") as f:+ for b in iter(lambda: f.read(1 << 20), b""):+ h.update(b)+ return h.hexdigest()+++def _record() -> dict | None:+ try:+ d = json.loads((root() / "current.json").read_text(encoding="utf-8"))+ except (OSError, ValueError):+ return None+ if not (isinstance(d, dict) and isinstance(d.get("version"), str) and isinstance(d.get("files"), dict)):+ return None+ if not re.fullmatch(r"[A-Za-z0-9._+-]{1,96}", d["version"]):+ return None+ return d+++def installed() -> str | None:+ """The verified parts folder, or None."""+ rec = _record()+ if not rec:+ return None+ d = root() / rec["version"]+ want = {p + SO for p in PARTS}+ if set(rec["files"]) != want:+ return None+ for name, sha in rec["files"].items():+ p = d / name+ if p.is_symlink() or not p.is_file() or _sha(p) != sha:+ return None+ return str(d)+++def activate() -> str | None:+ """Called before `import pro_remote`. The Mac app's studio IS the Pro pack: nothing to do."""+ if _dist.is_mac_app():+ return None+ try:+ d = installed()+ except OSError:+ return None+ if d and d not in sys.path:+ sys.path.insert(0, d)+ return d+++def _licence() -> dict | None:+ try:+ import pro_licence+ rec = pro_licence.load()+ except Exception: # noqa: BLE001+ return None+ if not isinstance(rec, dict) or rec.get("status") not in (None, "active"):+ return None+ key, iid, dev = rec.get("key"), rec.get("instance_id"), rec.get("device")+ if not all(isinstance(v, str) and v for v in (key, iid, dev)):+ return None+ return {"key": key, "instance_id": iid, "device": dev}+++def _version() -> str:+ try:+ return (Path(__file__).resolve().parent / "VERSION").read_text().strip() or "0"+ except OSError:+ return "0"+++def _vt(v: str) -> tuple:+ return tuple(int(x) for x in re.findall(r"\d+", v.split("-")[0])[:3])+++def _b64(s: str) -> bytes:+ return base64.b64decode(s, validate=True)+++def _verify(offer: dict) -> tuple[dict, bytes]:+ import pro_token+ pk = _trusted().get(str(offer.get("key_id", "")))+ if not pk:+ raise ValueError("unknown_key")+ msg = _b64(str(offer.get("manifest", "")))+ if not pro_token.ed25519_verify(_b64(pk), msg, _b64(str(offer.get("signature", "")))):+ raise ValueError("bad_signature")+ m = json.loads(msg.decode("utf-8"))+ if not (isinstance(m, dict) and m.get("schema") == 1 and m.get("channel") == "pro" and m.get("component") == "panel"):+ raise ValueError("bad_manifest")+ if not re.fullmatch(r"[A-Za-z0-9._+-]{1,96}", str(m.get("version", ""))) \+ or not re.fullmatch(r"[A-Za-z0-9._+-]{1,160}", str(m.get("object", ""))) \+ or not re.fullmatch(r"[0-9a-f]{64}", str(m.get("sha256", ""))) \+ or not 0 < int(m.get("bytes", 0)) <= MAX_PACK or not 0 <= int(m.get("strip_components", -1)) <= 3:+ raise ValueError("bad_manifest")+ if _vt(str(m.get("min_app", "0"))) > _vt(_version()):+ raise ValueError("studio_too_old")+ return m, msg+++def _download(url: str, dest: Path, size: int, licence: str, opener) -> None:+ u = urllib.parse.urlparse(url)+ base = urllib.parse.urlparse(_server())+ if u.scheme != base.scheme or u.hostname != base.hostname:+ raise ValueError("bad_url") # the licence header only ever goes to our server+ req = urllib.request.Request(url, headers={"X-Phosphene-Licence": licence, "User-Agent": "Phosphene-Studio"})+ n = 0+ with (opener or urllib.request.urlopen)(req, timeout=TIMEOUT) as r, open(dest, "wb") as f:+ while True:+ b = r.read(1 << 20)+ if not b:+ break+ n += len(b)+ if n > size:+ raise ValueError("size")+ f.write(b)+ if n != size:+ raise ValueError("size")+++def _extract(pack: Path, strip: int, out: Path) -> dict:+ want = {p + SO for p in PARTS}+ got = {}+ with tarfile.open(pack, "r:gz") as t:+ for mem in t:+ parts = [x for x in mem.name.split("/") if x not in ("", ".")]+ if len(parts) != strip + 1 or parts[-1] not in want:+ continue+ if not mem.isreg() or mem.size > MAX_PART or parts[-1] in got:+ raise ValueError("bad_part")+ src = t.extractfile(mem)+ data = src.read(MAX_PART + 1)+ if len(data) != mem.size:+ raise ValueError("bad_part")+ fd = os.open(out / parts[-1], os.O_WRONLY | os.O_CREAT | os.O_EXCL | os.O_NOFOLLOW, 0o644)+ with os.fdopen(fd, "wb") as f:+ f.write(data)+ got[parts[-1]] = hashlib.sha256(data).hexdigest()+ if set(got) != want:+ raise ValueError("pack_without_remote")+ return got+++def fetch(opener=None) -> dict:+ """Install or update the parts. {ok, version | error}. Never raises."""+ if _dist.is_mac_app():+ return {"ok": False, "error": "mac_app"}+ lic = _licence()+ if not lic:+ return {"ok": False, "error": "no_licence"}+ with _lock:+ if _state["busy"]:+ return {"ok": False, "error": "busy"}+ _state["busy"] = True+ tmp = None+ try:+ form = urllib.parse.urlencode({"license_key": lic["key"], "instance_id": lic["instance_id"],+ "device_id": lic["device"], "app_version": _version()}).encode()+ req = urllib.request.Request(_server() + "/v1/pro/latest", data=form, method="POST", headers={+ "Content-Type": "application/x-www-form-urlencoded", "Accept": "application/json",+ "User-Agent": "Phosphene-Studio"})+ try:+ with (opener or urllib.request.urlopen)(req, timeout=TIMEOUT) as r:+ offer = json.loads(r.read(1 << 16).decode("utf-8"))+ except urllib.error.HTTPError as e:+ try:+ why = json.loads(e.read(1 << 12).decode("utf-8")).get("error") or "refused"+ except (ValueError, AttributeError):+ why = "refused"+ return _done({"ok": False, "error": str(why)[:60]})+ except (urllib.error.URLError, OSError, ValueError):+ return _done({"ok": False, "error": "unreachable"})+ m, msg = _verify(offer)+ rec = _record()+ if rec and rec["version"] == m["version"] and installed():+ return _done({"ok": True, "version": m["version"], "changed": False})+ root().mkdir(parents=True, exist_ok=True)+ tmp = root() / (".fetch-%d" % os.getpid())+ shutil.rmtree(tmp, ignore_errors=True)+ tmp.mkdir()+ pack = tmp / "pack.tar.gz"+ _download(str(offer.get("url", "")), pack, int(m["bytes"]), lic["key"], opener)+ if _sha(pack) != m["sha256"]:+ raise ValueError("hash")+ out = tmp / "parts"+ out.mkdir()+ files = _extract(pack, int(m["strip_components"]), out)+ dest = root() / m["version"]+ if dest.exists():+ shutil.rmtree(dest)+ os.replace(out, dest)+ doc = {"version": m["version"], "files": files, "key_id": offer["key_id"],+ "manifest": offer["manifest"], "signature": offer["signature"],+ "installed_at": int(time.time())}+ cur = root() / "current.json"+ part = root() / ".current.json.tmp"+ part.write_text(json.dumps(doc, indent=1, sort_keys=True), encoding="utf-8")+ old = _record()+ os.replace(part, cur)+ if old and old["version"] != m["version"]:+ shutil.rmtree(root() / old["version"], ignore_errors=True)+ return _done({"ok": True, "version": m["version"], "changed": True})+ except (ValueError, KeyError, TypeError, OSError, tarfile.TarError) as e:+ return _done({"ok": False, "error": (e.args[0] if isinstance(e, ValueError) and e.args else type(e).__name__)[:60]})+ finally:+ if tmp is not None:+ shutil.rmtree(tmp, ignore_errors=True)+ with _lock:+ _state["busy"] = False+++def _done(r: dict) -> dict:+ with _lock:+ _state["error"] = None if r.get("ok") else r.get("error")+ _state["checked_at"] = int(time.time())+ return r+++def status() -> dict:+ rec = _record()+ with _lock:+ return {"installed": rec["version"] if rec and installed() else None, "busy": _state["busy"],+ "error": _state["error"], "checked_at": _state["checked_at"]}+++def _bring_up(P) -> None:+ """Newly installed parts start without a Studio restart (routes look P.pro_remote up live)."""+ if getattr(P, "pro_remote", None) is not None:+ return+ if activate() is None:+ return+ try:+ import importlib+ mod = importlib.import_module("pro_remote")+ except Exception as exc: # noqa: BLE001+ print(f"[remote] Pro parts did not load: {type(exc).__name__}", flush=True)+ return+ P.pro_remote = mod+ mod.boot(P)+++IDLE_POLL = 30 # no licence yet: a licence pasted in Settings > Pro is noticed this fast+RETRY = 15 * 60 # the server refused or was unreachable (it allows a few offers a day)+++def _next_wait(r: dict | None) -> int:+ if r is None:+ return IDLE_POLL+ return CHECK_EVERY if r.get("ok") else RETRY+++def start(P, sleep=time.sleep, rounds=None) -> bool:+ """Background: fetch as soon as the Studio has a licence (at start, or within IDLE_POLL of+ activating one), then once a day; retry a failure after RETRY."""+ if _dist.is_mac_app():+ return False++ def loop():+ n = 0+ while rounds is None or n < rounds:+ n += 1+ r = fetch() if _licence() else None+ if r and r.get("ok"):+ _bring_up(P)+ sleep(_next_wait(r))+ if rounds is not None:+ loop()+ return True+ threading.Thread(target=loop, name="pro-parts", daemon=True).start()+ return Truediff --git a/pro_token.py b/pro_token.pyindex d5d40f5..eee8528 100644--- a/pro_token.py+++ b/pro_token.py@@ -240,8 +240,59 @@ def _read_token_file(path: str) -> str | None:return None+STUDIO_TOKEN_NAME = "pro_studio.token"+APP_TOKEN_NAMES = ("studio.token", "capability.token")+++def studio_token_path(environ=None) -> str:+ """Where the Studio's own licence (pro_licence.py) keeps the token it fetched."""+ env = os.environ if environ is None else environ+ raw = (env.get("LTX_STATE_DIR") or "").strip()+ base = raw if raw else os.path.join(os.path.dirname(os.path.abspath(__file__)), "state")+ return os.path.join(base, STUDIO_TOKEN_NAME)+++def studio_token_valid() -> bool:+ t = _read_token_file(studio_token_path())+ if not t:+ return False+ v = _verified(t)+ return bool(v[0] and check(t, int(time.time()), device_id(), verified=v)[0])+++def app_tokens(environ=None) -> list[str]:+ """The tokens the Phosphene Mac app keeps on this Mac (Pinokio reads them; the app passes its+ own). Off with PHOSPHENE_PRO_DISCOVER=0 (the tests)."""+ env = os.environ if environ is None else environ+ if (env.get("PHOSPHENE_PRO_DISCOVER") or "").strip() == "0":+ return []+ home = (env.get("PHOSPHENE_HOME") or "").strip()+ if not home:+ h = (env.get("HOME") or "").strip()+ if not h:+ return []+ home = os.path.join(h, "Library", "Application Support", "Phosphene")+ out = []+ for name in APP_TOKEN_NAMES:+ t = _read_token_file(os.path.join(home, "pro", name))+ if t and t not in out:+ out.append(t)+ return out+++def _discovered() -> list[str]:+ out = []+ t = _read_token_file(studio_token_path())+ if t:+ out.append(t)+ if (os.environ.get("PHOSPHENE_DISTRIBUTION") or "").strip().lower() != "mac-app":+ out += [a for a in app_tokens() if a not in out]+ return out++def candidates(environ=None) -> list[str]:- """The renewal file first (the app rewrites it on every renewal), then the launch token."""+ """The renewal file first (the app rewrites it on every renewal), then the launch token; on the+ real environment also the Studio's own licence token and, on Pinokio, the Mac app's."""env = os.environ if environ is None else environout = []path = (env.get("PHOSPHENE_PRO_TOKEN_FILE") or "").strip()@@ -252,6 +303,8 @@ def candidates(environ=None) -> list[str]:t = (env.get("PHOSPHENE_PRO_TOKEN") or "").strip()if t and t not in out:out.append(t)+ if environ is None:+ out += [d for d in _discovered() if d not in out]return outdiff --git a/webapp/docs/hailuo-h3.md b/webapp/docs/hailuo-h3.mdindex e811f42..7d20f69 100644--- a/webapp/docs/hailuo-h3.md+++ b/webapp/docs/hailuo-h3.md@@ -122,7 +122,7 @@ Powered by MiniMax H3. Pika H3 Flex by Pika Labs (Mellis, Inc.): the weights are## H3 Flex Turbo (faster draft, Pro) {#flex-turbo}-**H3 Flex Turbo** is H3 Flex in four steps instead of six: a faster draft, about 1.4× quicker than H3 Flex at the same size and a little softer. It is part of **Phosphene Pro**. For the final render, use H3 Flex or Best.+**H3 Flex Turbo** is a faster H3 Flex draft, about 1.4× quicker than H3 Flex at the same size and a little softer. It is part of **Phosphene Pro**. For the final render, use H3 Flex or Best.- **Pick it:** choose **H3 Flex Turbo** in the engine picker, right after H3 Flex. Without Pro, the click opens the Pro panel.- **Get it:** the same click downloads it (0.3 GB, from its author's Hugging Face page at a fixed version). You need Hailuo H3 installed; the H3 Flex adapter is not needed.diff --git a/webapp/index.html b/webapp/index.htmlindex 0cb86f6..708f96b 100644--- a/webapp/index.html+++ b/webapp/index.html@@ -354,7 +354,7 @@<button data-workflow="train" role="tab" aria-selected="false"><svg class="ph wf-icon" aria-hidden="true"><use href="#ph-user-plus"/></svg>Train Character</button><!-- Remote Control: drive this Mac from the iPhone app. The page is Studio UI; theworking parts are Pro-only and come from the Pro pack (see panel/routes_remote.py). -->- <button data-workflow="remote" role="tab" aria-selected="false"><svg class="ph wf-icon" aria-hidden="true"><use href="#ph-remote"/></svg>Remote Control<span class="new-badge">SOON</span></button>+ <button data-workflow="remote" role="tab" aria-selected="false"><svg class="ph wf-icon" aria-hidden="true"><use href="#ph-remote"/></svg>Remote Control<span class="new-badge">NEW</span></button></nav><div class="rail-foot"><!-- DOCS. The manual gets a door of its own beside the gear, with a WORD on@@ -395,9 +395,9 @@<div class="rm-pro" id="rmPro" hidden><div class="rm-pro-copy">- <span class="rm-pro-kicker">Phosphene Pro · coming soon</span>+ <span class="rm-pro-kicker">Phosphene Pro</span><strong>Remote Control comes with Phosphene Pro.</strong>- <p>The Phosphene Remote iPhone app is coming soon. Pro members can use it as soon as it is out.</p>+ <p>The Phosphene Remote iPhone app is free on the <a href="https://apps.apple.com/app/id6827562294" target="_blank" rel="noopener">App Store</a>. It works with your Mac once Pro is on.</p><p>Use your iPhone to start renders, follow their progress and save finished clips. Your Mac does the rendering.</p><ul class="rm-pro-list"><li>Write a prompt and pick settings on your phone</li>@@ -407,6 +407,7 @@<p class="rm-pro-note">Pro supports the open-source project.</p><div class="rm-pro-actions"><a class="rm-btn primary" href="https://phosphene.video/pricing/" target="_blank" rel="noopener">See Phosphene Pro</a>+ <a class="rm-btn" href="https://apps.apple.com/app/id6827562294" target="_blank" rel="noopener">Get the iPhone app</a><a class="rm-btn" href="https://phosphene.video/remote/" target="_blank" rel="noopener">How Remote Control works</a></div></div>@@ -426,7 +427,7 @@<section class="rm-card rm-pair" aria-labelledby="rmPairTitle"><h3 id="rmPairTitle">Pair your iPhone</h3><ol class="rm-steps">- <li><span class="rm-n">1</span><div><b>Get the iPhone app.</b> <em>Phosphene Remote</em> for iPhone is coming soon. Once it is out, pair it here.</div></li>+ <li><span class="rm-n">1</span><div><b>Get the iPhone app.</b> Install <a href="https://apps.apple.com/app/id6827562294" target="_blank" rel="noopener"><em>Phosphene Remote</em> from the App Store</a>.</div></li><li><span class="rm-n">2</span><div><b>Scan this code.</b> Open the app, tap <em>Pair with a Mac</em> and point it here. Same Wi-Fi is the easiest way.</div></li><li><span class="rm-n">3</span><div><b>Allow it on this Mac.</b> Check both screens show the same 6 digits, then press Allow.</div></li></ol>@@ -6833,7 +6834,7 @@ The last line"></textarea><div id="proModal" class="models-modal" style="display:none" role="dialog" aria-modal="true" aria-labelledby="lightsOnTitle" onclick="if(event.target===this)closeProModal()"><div class="models-card pro-card">- <div class="pro-toolbar"><span>Coming soon · not on sale yet</span><button type="button" class="ghost-btn" onclick="closeProModal()">Close</button></div>+ <div class="pro-toolbar"><span>Phosphene Pro</span><button type="button" class="ghost-btn" onclick="closeProModal()">Close</button></div><!-- LIGHTS_ON_HEADER_START --><section class="lights-on-header" aria-labelledby="lightsOnTitle"><div class="lights-on-wash" aria-hidden="true"></div>@@ -6864,20 +6865,33 @@ The last line"></textarea></section><!-- LIGHTS_ON_HEADER_END --><div class="pro-prices" aria-label="Pro pricing">- <section class="pro-price"><h3>Pro monthly</h3><p><strong>$15</strong> a month</p><span>Coming soon</span></section>- <section class="pro-price"><h3>Pro yearly</h3><p><strong>$120</strong> a year</p><span>Coming soon</span></section>- <section class="pro-price pro-founding"><h3>Founding (3 years)</h3><p><strong>$149</strong> one-time</p><span>Coming soon · first 200 seats. No renewal; access expires after 3 years (1,095 days). Existing Founding promises are preserved.</span></section>+ <section class="pro-price"><h3>Pro monthly</h3><p><strong>$15</strong> a month</p><span>Cancel any time.</span></section>+ <section class="pro-price"><h3>Pro yearly</h3><p><strong>$120</strong> a year</p><span>Two months free.</span></section>+ <section class="pro-price pro-founding"><h3>Founding (3 years)</h3><p><strong>$199</strong> one-time</p><span>First 200 seats. No renewal; access expires after 3 years (1,095 days). Existing Founding promises are preserved.</span></section></div><section class="pro-compare" id="proCompare" aria-label="Same clip, Free vs Pro"><header><p class="lights-on-eyebrow">SAME CLIP · FREE VS PRO</p><h3 id="proCompareTitle">Hailuo H3 · High · i2v · 5 s</h3><p class="pro-compare-sub" id="proCompareSub">Measured on an M4 Max · 64 GB, seed 4101: Free 14 min 56 s, Pro 10 min 02 s · 1.49×. Faces, motion, speech and sync reviewed equal.</p></header><div class="pro-compare-player"><video id="proCompareVideo" src="/assets/pro/compare_h3_5s.mp4" poster="/assets/pro/compare_h3_5s.jpg" controls muted loop playsinline preload="metadata"></video></div></section><div class="pro-benefits">- <p><strong>Faster renders</strong>On the measured M4 Max / 64 GiB: H3 High i2v 5–10 s 1.48×; LTX-2.5 High Q8 t2v/i2v 5 s 1.28–1.30×; the qualified image profile 1.54×. Exact supported settings only; other Macs are unmeasured.</p>- <p><strong>New model access</strong>New models, community improvements, sound cleanup and Face to keep remain Free.</p>+ <p><strong>Faster Flex Turbo</strong>A faster way to render Hailuo H3 Flex. Turns on as soon as your licence does.</p>+ <p><strong>iPhone Remote</strong>Start and watch renders from your iPhone, at home or away.</p><p><strong>Priority support and feature requests</strong>Pro questions and feature requests go to the front of the queue.</p></div>- <div class="pro-bottom"><a class="pro-waitlist" href="https://phosphene.video/pricing/" target="_blank" rel="noopener">Join the waitlist <span aria-hidden="true">↗</span></a><p>Hardship licences are available on request.<br><a href="mailto:[email protected]">Get in touch</a>.</p></div>+ <section class="pro-licence" id="proLicence" aria-label="Your Pro licence">+ <p class="lights-on-eyebrow">YOUR LICENCE</p>+ <p class="pro-licence-state" id="proLicenceState" role="status"></p>+ <form class="pro-licence-form" id="proLicenceForm" onsubmit="proLicenceActivate(event)">+ <input type="password" id="proLicenceKey" autocomplete="off" spellcheck="false" placeholder="Paste your licence key" aria-label="Licence key">+ <button type="submit" class="ghost-btn" id="proLicenceGo">Turn on Pro</button>+ </form>+ <div class="pro-licence-actions" id="proLicenceActions" hidden>+ <button type="button" class="ghost-btn" onclick="proLicenceRefresh()">Check again</button>+ <button type="button" class="ghost-btn" onclick="proLicenceDeactivate()">Deactivate this Mac</button>+ </div>+ <p class="pro-licence-note">One Mac per licence. Phosphene checks it once a day while you are online and keeps working for two weeks without internet.</p>+ </section>+ <div class="pro-bottom"><a class="pro-waitlist" href="https://phosphene.video/pricing/" target="_blank" rel="noopener">Get Pro <span aria-hidden="true">↗</span></a><p>Hardship licences are available on request.<br><a href="mailto:[email protected]">Get in touch</a>.</p></div></div></div>diff --git a/webapp/js/engines.js b/webapp/js/engines.jsindex 6f3b745..5987f98 100644--- a/webapp/js/engines.js+++ b/webapp/js/engines.js@@ -1726,11 +1726,11 @@ function h3FlexTurboPickerStatus() {}function _h3FlexTurboTooltip(st) {const credit = ' By akhaliq (Pika H3 Flex by Pika Labs + LightX2V Turbo), running on your Mac. Powered by MiniMax H3.';- if (!st.pro_active) return 'H3 Flex Turbo is part of Phosphene Pro: a faster draft of H3 Flex in four steps, about 1.4× faster and a little softer.' + credit;+ if (!st.pro_active) return 'H3 Flex Turbo is part of Phosphene Pro: a faster draft of H3 Flex, about 1.4× faster and a little softer.' + credit;if (!st.h3_ready) return 'H3 Flex Turbo needs Hailuo H3 first. Click to get it.' + credit;if (st.installing) return 'H3 Flex Turbo: downloading (' + st.progress + ').' + credit;if (!st.available) return 'H3 Flex Turbo: click to download it (' + st.download_gb + ' GB).' + credit;- return 'H3 Flex Turbo (faster draft): H3 Flex in four steps, about 1.4× faster and a little softer. Try ideas fast, then render the keeper on Flex or Best.' + credit;+ return 'H3 Flex Turbo (faster draft): a faster H3 Flex, about 1.4× faster and a little softer. Try ideas fast, then render the keeper on Flex or Best.' + credit;}function _h3FlexTurboNote(cell) {const ft = h3FlexTurboState();@@ -1740,7 +1740,7 @@ function _h3FlexTurboNote(cell) {if (!ft.supported) return 'H3 Flex Turbo needs a newer H3 runner.' + credit;if (ft.installing) { const d = ft.download || {}; return 'Downloading H3 Flex Turbo: ' + (d.mb || 0) + ' / ' + (d.total_mb || 295) + ' MB.'; }if (!ft.downloaded) return 'H3 Flex Turbo: pick it in the engine picker to download it (0.3 GB).' + credit;- if (h3FlexTurboOn(cell)) return 'H3 Flex Turbo: a faster draft (4 steps, about ' + _h3EtaPlain(cell && cell.flex_turbo_eta) + ' here), a little softer than H3 Flex. Try ideas fast, then render the keeper on Flex or Best. Fast motion can wobble.' + credit;+ if (h3FlexTurboOn(cell)) return 'H3 Flex Turbo: a faster draft (about ' + _h3EtaPlain(cell && cell.flex_turbo_eta) + ' here), a little softer than H3 Flex. Try ideas fast, then render the keeper on Flex or Best. Fast motion can wobble.' + credit;return 'H3 Flex Turbo renders Text and Image on 5-second windows; this shape uses Best.';}function _h3FlexTurboMenuRow(e, active, surfaceMode) {diff --git a/webapp/js/settings.js b/webapp/js/settings.jsindex 3508682..fbfe3b8 100644--- a/webapp/js/settings.js+++ b/webapp/js/settings.js@@ -1575,6 +1575,7 @@ function openProModal(opener = null) {if (modal.style.display !== 'none') return;proReturnFocus = opener || document.activeElement;modal.style.display = 'flex';+ proLicenceLoad();modal.querySelector('button').focus();}// The PRO mark: one GET /pro/status at boot. Free is the default state of the page; nothing nags.@@ -1587,10 +1588,45 @@ async function proStatusRefresh() {// The header "Pro" door is for Free in Pinokio only: a Pro member sees the PRO mark by the logo// instead, and the Mac app has its own Pro chip in the top bar.const btn = document.getElementById('proBtn');- if (btn) btn.hidden = active || isMacApp();+ // A member sees the door only to manage the licence this Studio holds (the modal hides the selling then).+ if (btn) { btn.hidden = isMacApp() || (active && !(st && st.own_licence)); btn.textContent = active ? 'Licence' : 'Pro'; }if (mark) { mark.hidden = !active; mark.textContent = ''; const d = document.createElement('span'); d.className = 'pro-mark-dash'; d.setAttribute('aria-hidden', 'true'); mark.append(d, active && st.label ? st.label.toUpperCase() : 'PRO'); }return st;}+// Settings > Pro on Pinokio: the Studio takes the licence key itself (pro_licence.py).+function proLicenceShow(doc) {+ const st = document.getElementById('proLicenceState'); if (!st) return;+ const lic = (doc && doc.licence) || doc || {};+ const pro = !!(doc && (doc.pro_status ? doc.pro_status.active : doc.active)) || !!lic.pro;+ const via = lic.via;+ let msg = (doc && doc.message) || lic.note || '';+ if (!msg) msg = pro ? (via === 'app' ? 'Pro is on through the Phosphene Mac app on this Mac.' : 'Pro is on for this Mac.') : 'Free. Paste the licence key from your purchase email to turn Pro on.';+ st.textContent = msg;+ st.dataset.on = pro ? '1' : '';+ const own = !!lic.licensed;+ document.getElementById('proLicenceForm').hidden = pro;+ document.getElementById('proLicenceActions').hidden = !own;+}+async function proLicenceLoad() {+ try { const r = await fetch('/pro/licence', { cache: 'no-store' }); if (r.ok) { const l = await r.json(); proLicenceShow({ licence: l }); } } catch (_) {}+}+async function proLicencePost(path, body) {+ const go = document.getElementById('proLicenceGo'); if (go) go.disabled = true;+ try {+ const r = await fetch(path, { method: 'POST', headers: { 'Content-Type': 'application/x-www-form-urlencoded' }, body: body || '' });+ const d = await r.json(); proLicenceShow(d);+ if (d.ok || d.licence_changed !== false) await proStatusRefresh();+ return d;+ } catch (_) { proLicenceShow({ message: 'Could not reach the Studio.' }); } finally { if (go) go.disabled = false; }+}+async function proLicenceActivate(ev) {+ ev.preventDefault();+ const inp = document.getElementById('proLicenceKey'); const key = inp.value.trim(); if (!key) return;+ const d = await proLicencePost('/pro/activate', 'key=' + encodeURIComponent(key));+ if (d && d.ok) inp.value = '';+}+const proLicenceRefresh = () => proLicencePost('/pro/refresh');+const proLicenceDeactivate = () => proLicencePost('/pro/deactivate');function closeProModal() {document.getElementById('proModal').style.display = 'none';if (proReturnFocus && proReturnFocus.isConnected) proReturnFocus.focus();@@ -1599,6 +1635,7 @@ function closeProModal() {Object.assign(globalThis, {downloadFirstVideo,openProModal, closeProModal, proStatusRefresh,+ proLicenceActivate, proLicenceRefresh, proLicenceDeactivate,pushSubscription, pushToggle, pushTest,appearanceGet, applyAppearance, setAppearance,renderNotifyState, toggleNotify, askNotifyPermission,diff --git a/webapp/style/panel.css b/webapp/style/panel.cssindex 3facb3a..366a6f7 100644--- a/webapp/style/panel.css+++ b/webapp/style/panel.css@@ -15156,3 +15156,18 @@ html[data-theme="light"] .star-card { box-shadow: 0 18px 44px rgba(20,26,46,.28)/* Images: a model with one version names it as plain text where the select was. */.studio-engine-row .studio-version-only { flex: 1 1 auto; min-width: 0; font-size: 13px; color: var(--text); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }++/* Settings > Pro on Pinokio: the licence box (5.0.1) */+.pro-licence { margin: 18px 0; padding: 14px 16px; border: 1px solid var(--line, #2a2a30); border-radius: 12px; display: grid; gap: 10px; }+.pro-licence-state { margin: 0; font-size: 14px; line-height: 1.5; color: var(--text, #f4f4f5); }+.pro-licence-state[data-on="1"] { color: #8be9a8; }+.pro-licence-form { display: flex; gap: 8px; }+.pro-licence-form[hidden], .pro-licence-actions[hidden] { display: none; }+.pro-licence-form input { flex: 1; min-width: 0; padding: 8px 10px; border-radius: 8px; border: 1px solid var(--line, #2a2a30); background: transparent; color: inherit; font-size: 14px; }+.pro-licence-actions { display: flex; gap: 8px; flex-wrap: wrap; }+.pro-licence-note { margin: 0; font-size: 13px; color: var(--muted, #b4b4bb); }+html[data-pro]:not([data-pro=""]) #proModal .lights-on-header,+html[data-pro]:not([data-pro=""]) #proModal .pro-prices,+html[data-pro]:not([data-pro=""]) #proModal .pro-compare,+html[data-pro]:not([data-pro=""]) #proModal .pro-benefits,+html[data-pro]:not([data-pro=""]) #proModal .pro-bottom { display: none; }