From 20b8fcc1c1df9d8f82c6186f2bb171edf891b9f2 Mon Sep 17 00:00:00 2001 From: stilobique Date: Sun, 8 Nov 2026 12:17:13 +0100 Subject: [PATCH] More setup about the deployment --- CLAUDE.md | 2 +- Core/Session.qml | 1 + manifest.json | 1 + readme.md | 4 +++- tools/package.py | 21 ++++++++++++++++----- 5 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 1819ad9..46a9d2b 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -20,7 +20,7 @@ There is no build system or test suite. - **Reproduce the box's loading mode**: the Player loads the app over HTTP, which behaves differently from local files (see constraints below). Check with `python3 -m http.server 8765 --directory .` then `QT_QPA_PLATFORM=offscreen qmlscene -I ../libfbxqml http://127.0.0.1:8765/Jellyfin.qml` — it must print no warnings. - The desktop has Qt 5.15 while the box targets QtQuick 2.5: code that runs locally can still use APIs too new for the box. -**FreeStore package**: `tools/package.py` → `dist/.tar.gz` (gitignored). Replicates the QtCreator plugin's "Make FreeStore Package": same file selection as `Jellyfin.fbxproject` (QML/JS/images/fonts/`qmldir`/`manifest.json`, excluding `tools/` and hidden dirs), manifest checks (identifier `\w+(\.\w+)+`, entry-point files present), `qmllint` on all sources, ustar tar with directory entries, gzipped. Upload is manual on the FreeFactory console (http://factory.free.fr), followed by Free's review. +**FreeStore package**: `tools/package.py` → `dist/.tar.gz` (gitignored). Replicates the QtCreator plugin's "Make FreeStore Package": same file selection as `Jellyfin.fbxproject` (QML/JS/images/fonts/`qmldir`/`manifest.json`, excluding `tools/` and hidden dirs), manifest checks (identifier `\w+(\.\w+)+`, `version` x.y.z equal to `Session.clientVersion`, entry-point files present), `qmllint` on all sources, ustar tar with directory entries, gzipped. Upload is manual on the FreeFactory console (http://factory.free.fr), followed by Free's review. **Deploying a test build to the Freebox**: `tools/deploy.py` (Python stdlib only; Player must be in developer mode). It discovers the Player via SSDP (`fbx:devel`) or takes `--box `, serves the repo over HTTP, calls JSON-RPC `debug_qml_app` on `http:///pub/devel`, and streams the app's stdout/stderr until it exits. `--server ` and `--user name[:password]` (both repeatable) serve a virtual `dev-config.json` next to the app; at startup `Session.loadDevConfig()` adds each listed server and stores users in `Session.devUsers`, which `UserSelectView` merges with public users (one-click sign-in when a password is given; never log passwords) (only when the app is loaded over HTTP; 404 otherwise, ignored) — the workaround for the lack of persistence in dev mode. Output is also written to `deploy.log` (repo root, gitignored, overwritten each run) — read it to diagnose on-box failures. The Player fetches files lazily from that HTTP server, so the script must keep running while the app is in use. This replicates the "Run" of the official QtCreator plugin, whose own setup is: diff --git a/Core/Session.qml b/Core/Session.qml index 8a66158..71fc681 100644 --- a/Core/Session.qml +++ b/Core/Session.qml @@ -10,6 +10,7 @@ QtObject { id: session readonly property string clientName: "Jellyfin Freebox" + // Doit rester égale à « version » dans manifest.json (vérifié par tools/package.py). readonly property string clientVersion: "0.1.0" readonly property string deviceName: "Freebox Player" diff --git a/manifest.json b/manifest.json index 4d59992..681119d 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,7 @@ { "name": "Jellyfin", "identifier": "com.stilobique.jellyfin", + "version": "0.1.0", "description": "Jellyfin for Freebox", "icon": "icon.png", "capabilities": { diff --git a/readme.md b/readme.md index 620b241..ab3877f 100644 --- a/readme.md +++ b/readme.md @@ -39,7 +39,9 @@ Le script sert les fichiers du projet au Player et affiche les logs de l'applica ## Publier sur le FreeStore ```bash -tools/package.py # crée dist/com.stilobique.jellyfin.tar.gz +tools/package.py # crée dist/com.stilobique.jellyfin-.tar.gz ``` +Pour une nouvelle version, modifier `version` dans `manifest.json` **et** `clientVersion` dans `Core/Session.qml` (le script refuse de créer le paquet si elles diffèrent). + Le script reproduit « Make FreeStore Package » du plugin QtCreator : il vérifie `manifest.json` et la syntaxe QML/JS (`qmllint`), puis crée l'archive à téléverser sur la console [FreeFactory](http://factory.free.fr) (compte développeur requis, validation par Free avant publication). diff --git a/tools/package.py b/tools/package.py index ff13e54..e51c435 100755 --- a/tools/package.py +++ b/tools/package.py @@ -5,7 +5,8 @@ Reproduit « Outils > Freebox SDK > Make FreeStore Package » du plugin QtCreato (github.com/fbx/freebox-qtcreator-plugin, src/freestorepackager.cc) : - fichiers inclus comme dans Jellyfin.fbxproject : QML, JS, images, polices, qmldir et manifest.json (tools/ est exclu : l'aperçu PC n'a rien à faire sur la box) ; - - vérifications : manifest.json (identifiant, points d'entrée existants), JSON valides, + - vérifications : manifest.json (identifiant, version identique à Session.clientVersion, + points d'entrée existants), JSON valides, syntaxe QML/JS (qmllint, s'il est installé) ; - archive tar (format ustar, avec les entrées de dossiers) compressée en gzip. @@ -70,6 +71,15 @@ def check_manifest(files): defaults += 1 if defaults > 1: raise ValueError("manifest.json : un seul point d'entrée peut avoir « default »: true") + version = manifest.get("version") + if not isinstance(version, str) or not re.fullmatch(r"\d+\.\d+\.\d+", version): + raise ValueError("manifest.json : « version » absente ou invalide (forme attendue : 1.2.3)") + # La version envoyée à Jellyfin (Session.clientVersion) doit rester la même. + session = open(os.path.join(PROJECT_DIR, "Core", "Session.qml"), encoding="utf-8").read() + client = re.search(r'clientVersion:\s*"([^"]*)"', session) + if not client or client.group(1) != version: + raise ValueError("version du manifest (%s) différente de Session.clientVersion (%s)" + % (version, client.group(1) if client else "introuvable")) icon = manifest.get("icon") if icon and icon not in files: raise ValueError("manifest.json : icône « %s » absente du paquet" % icon) @@ -118,7 +128,7 @@ def build_archive(files, output): def main(): parser = argparse.ArgumentParser(description=__doc__.splitlines()[0]) - parser.add_argument("--output", help="archive à créer (défaut : dist/.tar.gz)") + parser.add_argument("--output", help="archive à créer (défaut : dist/-.tar.gz)") args = parser.parse_args() files = collect_files() @@ -128,10 +138,11 @@ def main(): except (ValueError, json.JSONDecodeError) as error: sys.exit("Paquet non créé : %s" % error) - output = args.output or os.path.join(PROJECT_DIR, "dist", manifest["identifier"] + ".tar.gz") + output = args.output or os.path.join( + PROJECT_DIR, "dist", "%s-%s.tar.gz" % (manifest["identifier"], manifest["version"])) build_archive(files, output) - print("Paquet créé : %s (%d fichiers, %.1f Ko)" % ( - os.path.relpath(output, os.getcwd()), len(files), os.path.getsize(output) / 1024)) + print("Paquet créé : %s — version %s (%d fichiers, %.1f Ko)" % ( + os.path.relpath(output, os.getcwd()), manifest["version"], len(files), os.path.getsize(output) / 1024)) print("À téléverser sur la console FreeFactory (http://factory.free.fr).")