Fennec SDK: split from the Fennec OS repository
All checks were successful
ci / test (push) Successful in 17m21s

The app-facing parts of Fennec OS move here, so apps build without the
OS sources:
- sf-app: the app contract (manifest, permissions, store rules, sandbox,
  launch), from sf-ipc; the OS depends on it by tag.
- sf-ui (+ gallery), sf-pack, templates/rust-app, docs.

Store apps may now register for DIAL: a [dial] section implies the new
`dial` permission, which the user approves like any other.

The templates no longer mention signing: store releases are unsigned.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Tamas Csikel
2026-10-25 17:31:51 +01:00
parent bcc7bc64c0
commit f00e8c6847
19 changed files with 7276 additions and 107 deletions

4
.gitattributes vendored Normal file
View File

@@ -0,0 +1,4 @@
* text=auto eol=lf
*.ttf binary
*.png binary
*.gpg binary

49
.gitea/workflows/ci.yml Normal file
View File

@@ -0,0 +1,49 @@
# Builds and tests the SDK on every push.
#
# Runner hygiene (shared host, little disk): runs in the runner image that is
# already on the host (no image pull), uses no `uses:` actions (no action
# cache), and deletes everything it made at the end.
name: ci
on:
push:
workflow_dispatch:
jobs:
test:
runs-on: build
container:
image: docker.gitea.com/runner-images:ubuntu-latest
env:
CARGO_HOME: /tmp/sf-sdk/cargo
RUSTUP_HOME: /tmp/sf-sdk/rustup
CARGO_TARGET_DIR: /tmp/sf-sdk/target
CARGO_INCREMENTAL: "0"
steps:
- name: Checkout
run: |
mkdir -p /tmp/sf-sdk
host="${GITHUB_SERVER_URL#https://}"
git clone --depth 1 --branch "${GITHUB_REF_NAME}" \
"https://oauth2:${{ secrets.GITHUB_TOKEN }}@${host}/${GITHUB_REPOSITORY}.git" /tmp/sf-sdk/src
- name: Toolchain
run: |
export DEBIAN_FRONTEND=noninteractive
apt-get update -qq
apt-get install -y -qq --no-install-recommends build-essential pkg-config \
libfontconfig1-dev libfreetype-dev libxkbcommon-dev >/dev/null
rm -rf /var/lib/apt/lists/*
curl -sSf https://sh.rustup.rs | sh -s -- -y -q --profile minimal --no-modify-path
- name: Test
run: |
export PATH="/tmp/sf-sdk/cargo/bin:$PATH"
cd /tmp/sf-sdk/src
cargo test --locked --workspace
- name: Clean up
if: always()
run: |
rm -rf /tmp/sf-sdk
df -h / | tail -1

5
.gitignore vendored Normal file
View File

@@ -0,0 +1,5 @@
/target
*.log
/templates/rust-app/target
/templates/rust-app/dist
/templates/rust-app/pkg

7029
Cargo.lock generated Normal file

File diff suppressed because it is too large Load Diff

29
Cargo.toml Normal file
View File

@@ -0,0 +1,29 @@
[workspace]
resolver = "3"
members = ["sf-app", "sf-ui", "sf-ui/gallery", "sf-pack"]
# A template to copy, with its own (empty) workspace.
exclude = ["templates/rust-app"]
[workspace.package]
version = "0.1.0"
edition = "2024"
license = "MIT"
repository = "https://gitea.bluefox.support/fennec/sdk"
[workspace.dependencies]
sf-app = { path = "sf-app" }
serde = { version = "1", features = ["derive"] }
serde_json = "1"
toml = "0.9"
anyhow = "1"
log = "0.4"
env_logger = "0.11"
[profile.release]
lto = "thin"
codegen-units = 1
strip = true
opt-level = 3
[profile.dev.package."*"]
opt-level = 2

50
README.md Normal file
View File

@@ -0,0 +1,50 @@
# Fennec SDK
Minden, ami egy Fennec OS app fejlesztéséhez kell. A Fennec OS forráskódja nem kell hozzá.
```
sf-app/ az app-szerződés: app.toml, engedélyek, store-szabályok, sandbox, indítás
(ugyanezt a kódot futtatja a TV: a launcher, az sf-core és az sf-update)
sf-ui/ UI-készlet Rust + Slint appokhoz: Liquid Glass, TV-komponensek, képek, videó
sf-ui/gallery/ minden sf-ui komponens egy képernyőn
sf-pack/ csomagoló: build, verify, és futtatás a TV sandboxában
templates/rust-app/ sablon egy store apphoz, release pipeline-okkal (Gitea, GitHub, GitLab)
docs/ store-app-guide.md (a teljes útmutató), sf-ui.md
```
## Használat
**Csomagoló:**
```sh
cargo install --locked --git https://gitea.bluefox.support/fennec/sdk --tag v0.1.0 sf-pack
```
**sf-ui egy appban** (`Cargo.toml`):
```toml
[dependencies]
sf-ui = { git = "https://gitea.bluefox.support/fennec/sdk", tag = "v0.1.0" }
```
**Útmutató:** [docs/store-app-guide.md](docs/store-app-guide.md), UI-hoz [docs/sf-ui.md](docs/sf-ui.md). Mindkettő önállóan is használható: másold be az app repójába, és egy fejlesztő vagy egy AI ebből meg tudja írni az appot.
**Galéria:** `cargo run -p sf-ui-gallery` (Linuxon `--features video` és `SF_UI_VIDEO=file:///…mkv`: videó az üveg alatt).
## Kiadás
Az SDK verziója a `Cargo.toml` `[workspace.package] version` mezője. Kiadás: emeld a verziót, commitold, és tegyél rá egy `v<verzió>` taget. Az appok és a Fennec OS is tagre hivatkoznak, így mindegyik maga dönti el, mikor lép újabbra.
Az `sf-app` az OS és az appok közti szerződés. Ha egy változás a TV viselkedését érinti (új engedély, új manifest-mező, más sandbox), akkor:
1. kiadsz egy új SDK-verziót;
2. a Fennec OS-ben frissíted rá a függőséget (`sf-ipc`, `sf-launcher`);
3. a TV-k a következő shell-frissítéssel kapják meg.
Az appok csak ezután használhatják az újdonságot.
**Helyi fejlesztés a Fennec OS mellett** (a `.cargo/config.toml` az OS checkoutban; ne commitold):
```toml
[patch."https://gitea.bluefox.support/fennec/sdk"]
sf-app = { path = "../fennec/sdk/sf-app" }
sf-ui = { path = "../fennec/sdk/sf-ui" }
```
## Licenc
- `sf-ui` és a galéria: GPL-3.0-only. A Slint GPL-licence alatt használjuk, mert a royalty-free licenc nem fedi le a TV-dobozt.
- A többi: MIT.

View File

@@ -3,8 +3,8 @@
Az **sf-ui** a Fennec OS UI-készlete Rust + [Slint](https://slint.dev) appokhoz. Ugyanazt a Liquid Glass-t adja, amit a launcher használ: valódi fénytörést, fagyasztott (frosted) üveget, élfényt, árnyékot és cseppszerűen összeolvadó paneleket. Mellé jönnek a TV-s komponensek (gomb, panel, menü, billentyűzet...), egy képbetöltő és egy hardveres videólejátszó.
Ez a fájl önállóan is használható. Másold be az app repójába a [store-app-guide.md](store-app-guide.md) mellé (például `AGENTS.md`-be fűzve), és egy fejlesztő vagy egy AI ebből meg tudja írni a felületet. Élő példák:
- `crates/sf-ui/gallery`: minden komponens egy képernyőn;
- `apps/netflex-tv`: egy teljes app.
- [`sf-ui/gallery`](../sf-ui/gallery) ebben az SDK-ban: minden komponens egy képernyőn;
- [`fennec/netflex`](https://gitea.bluefox.support/fennec/netflex): egy teljes app.
---
@@ -37,14 +37,13 @@ Az üveg *alatt* tehát csak háttér lehet: gradient, háttérkép (`Backdrop`)
```toml
[dependencies]
sf-ui = { path = "../../crates/sf-ui" } # a Fennec OS checkouton belül (apps/<app>)
# vagy: sf-ui = { git = "https://gitea.bluefox.support/bluefox/fox-in-the-box" }
sf-ui = { git = "https://gitea.bluefox.support/fennec/sdk", tag = "v0.1.0" }
slint = "1.18"
anyhow = "1"
# Videó csak Linuxon (a TV-n); Windowson/macOS-en a UI videó nélkül fejleszthető.
[target.'cfg(target_os = "linux")'.dependencies]
sf-ui = { path = "../../crates/sf-ui", features = ["video"] }
sf-ui = { git = "https://gitea.bluefox.support/fennec/sdk", tag = "v0.1.0", features = ["video"] }
[build-dependencies]
slint-build = "1.18"
@@ -57,11 +56,13 @@ Feature-ök:
| `images` | be | `sf_ui::images::Images`: HTTP(S) képek, háttérszálon dekódolva, gyorsítótárral |
| `video` | ki | `sf_ui::video::Player`: GStreamer lejátszó (Linux, GStreamer 1.22+ és a dev csomagok kellenek a buildhez: `libgstreamer1.0-dev libgstreamer-plugins-base1.0-dev`) |
**Hozzáférés:** az sf-ui most a privát `fox-in-the-box` repóban van. Ezért két út van:
- az app a Fennec OS checkout `apps/<app>/` mappájában él (saját git repóként; a Fennec OS a `.git`-et tartalmazó mappákat kihagyja az image-ből), és path-függőséggel hivatkozik rá;
- git-függőség, olyan buildkörnyezetben, amelynek van olvasási joga.
**Verzió:** az SDK release-ei tagek (`v0.1.0`). Mindig egy tagre hivatkozz, ne ágra, így a build megismételhető, és te döntöd el, mikor lépsz újabbra.
A release CI-nak mindkét esetben olvasási jog kell. Példa: `apps/netflex-tv/.gitea/workflows/release.yml`.
**Az sf-ui helyi fejlesztése** az app mellett: klónozd az SDK-t, és tedd az app repójában a `.cargo/config.toml` fájlba (ezt ne commitold):
```toml
[patch."https://gitea.bluefox.support/fennec/sdk"]
sf-ui = { path = "../sdk/sf-ui" }
```
### build.rs
@@ -419,8 +420,8 @@ Minden `Glass`-os ablakba be van építve:
SF_UI_SIZE=1920x1080 SF_UI_KEYS="down right enter" SF_UI_SNAPSHOT=detail.png cargo run
```
- **Galéria:** `cargo run -p sf-ui-gallery` (Linuxon `--features video` és `SF_UI_VIDEO=file:///…mkv`: videó a glass alatt).
- **Mock szerver:** érdemes adni egyet az apphoz, ami a szerveredet helyettesíti (a Netflexé: `apps/netflex-tv/tools/mock_server.py`).
- **Galéria:** az SDK-ban `cargo run -p sf-ui-gallery` (Linuxon `--features video` és `SF_UI_VIDEO=file:///…mkv`: videó a glass alatt).
- **Mock szerver:** érdemes adni egyet az apphoz, ami a szerveredet helyettesíti (a Netflexé: `tools/mock_server.py` a [`fennec/netflex`](https://gitea.bluefox.support/fennec/netflex) repóban).
---
@@ -433,7 +434,8 @@ SF_UI_SIZE=1920x1080 SF_UI_KEYS="down right enter" SF_UI_SNAPSHOT=detail.png car
- **Minden `glass` tömböt sorolj fel** a `Glass::install` callbackjében. Ami kimarad, az üveg nélkül jelenik meg.
- **Egy rejtett képernyő lapjainak `alpha`-ja legyen 0** (a képernyő átlátszóságával szorozva). A `visible: false` a Slint-tartalmat elrejti, a glass rectet nem.
- **`sf_ui::init()` a `App::new()` előtt**, különben nincs OpenGL, és nincs üveg (a napló jelzi).
- **`RefCell` újrabelépés:** ha képbetöltő vagy háttérfeladat callbackje gyorsítótárból azonnal visszahív, ne tartsd közben kölcsönözve az állapotot.
- **`RefCell` újrabelépés:** ha képbetöltő vagy háttérfeladat callbackje gyorsítótárból azonnal visszahív, ne tartsd közben kölcsönözve az állapotot. A `match state.borrow().screen { … }` a kölcsönzést az egész `match` végéig tartja: előbb másold ki az értéket.
- **Layouton kívüli `GlassButton`-nak adj `width: self.preferred-width;`-et**, különben kitölti a szülőjét, és az azonos csoportú gombok üvege egy nagy foltba olvad össze.
---

View File

@@ -1,8 +1,8 @@
# SmartFox store app: fejlesztői útmutató
# Fennec OS store app: fejlesztői útmutató
Ez a fájl önállóan is használható. Másold be az app repójába (pl. `SMARTFOX.md`, `AGENTS.md` vagy `CLAUDE.md` néven), és egy fejlesztő vagy egy AI ebből meg tudja írni, be tudja csomagolni és ki tudja adni az appot. A SmartFox forráskódja nem kell hozzá.
Ez a fájl önállóan is használható. Másold be az app repójába (pl. `FENNEC.md`, `AGENTS.md` vagy `CLAUDE.md` néven), és egy fejlesztő vagy egy AI ebből meg tudja írni, be tudja csomagolni és ki tudja adni az appot. A Fennec OS forráskódja nem kell hozzá, csak a [Fennec SDK](https://gitea.bluefox.support/fennec/sdk) (`sf-pack`, és ha kell, `sf-ui`).
A SmartFox egy Linuxos (Debian trixie) TV-rendszer. Az appok teljes képernyőn futnak, sandboxban, és távirányítóval kezelik őket. Egy **store app** egy nyilvános Git-repóban él (GitHub, Gitea/Forgejo, pl. Codeberg, vagy GitLab). A TV a repó **release-eiből** telepíti és frissíti.
A Fennec OS egy Linuxos (Debian trixie) TV-rendszer. Az appok teljes képernyőn futnak, sandboxban, és távirányítóval kezelik őket. Egy **store app** egy nyilvános Git-repóban él (GitHub, Gitea/Forgejo, pl. Codeberg, vagy GitLab). A TV a repó **release-eiből** telepíti és frissíti.
---
@@ -16,7 +16,7 @@ Ha ezek közül bármelyik sérül, a TV nem telepíti az appot.
4. A `kind` értéke `"exec"` (natív program) vagy `"web"` (weboldal a beépített Chromiumban).
5. `exec` app: az `exec[0]` relatív út a csomagon belül (pl. `bin/app`), és a fájl futtatható.
6. `web` app: az `url` `https://`-sel kezdődik.
8. Tilos: `kind = "builtin"`, `service = true`, `[dial]`, `[sandbox] enabled = false`.
8. Tilos: `kind = "builtin"`, `service = true`, `[sandbox] enabled = false`.
9. Csak Wayland van, X11 nincs. Az app ablaka mindig teljes képernyős.
10. Az app csak a saját `$HOME`-jába írhat tartósan. Hálózat, hang, GPU stb. csak akkor elérhető, ha a `[sandbox] permissions` listában szerepel.
11. A release két fájlt tartalmaz: `app.toml`, `<id>-<version>.tar.zst`. Ezeket az `sf-pack build` készíti el.
@@ -117,9 +117,12 @@ Telepítés előtt a TV megmutatja a felhasználónak a listát. Ha egy frissít
| `dbus-session` | munkamenet D-Bus, szűretlenül | **kockázatos**, kerüld |
| `dbus-system` | rendszer D-Bus, szűretlenül | **kockázatos**, kerüld |
| `devices` | az egész `/dev` | **kockázatos**, kerüld |
| `dial` | telefonról castolva is indulhat (DIAL) | nem kell felsorolni: a `[dial]` szakasz kéri |
A `web` appok mindig megkapják a `network`, `gpu` és `audio` engedélyt. Ezeket nem kell felsorolni.
**Castolás (DIAL):** egy `[dial]` szakasszal (`name = "YouTube"`) a telefon cast gombja is elindíthatja az appot. Egy DIAL név egyszerre egy apphoz tartozhat: ha egy gyári app is ugyanezt a nevet használja, az nyer.
---
## 4. Futási környezet (sandbox)
@@ -180,9 +183,9 @@ A TV rendszere Debian trixie, x86_64 (Intel N100 kategória, Intel GPU, Mesa: Op
## 5. Toolkitok
**Ajánlott: Rust + Slint + [sf-ui](sf-ui.md).** Az sf-ui a launcher Liquid Glass-a és TV-komponensei egy könyvtárban: üveglapok, gombok, menük, képernyő-billentyűzet, képbetöltő, hardveres videólejátszó. Ezzel az app pontosan úgy néz ki és úgy viselkedik, mint a rendszer. A teljes leírása a [sf-ui.md](sf-ui.md)-ben van; azt is másold az app repójába. Példák: `crates/sf-ui/gallery` és `apps/netflex-tv`.
**Ajánlott: Rust + Slint + [sf-ui](sf-ui.md).** Az sf-ui a launcher Liquid Glass-a és TV-komponensei egy könyvtárban: üveglapok, gombok, menük, képernyő-billentyűzet, képbetöltő, hardveres videólejátszó. Ezzel az app pontosan úgy néz ki és úgy viselkedik, mint a rendszer. A teljes leírása a [sf-ui.md](sf-ui.md)-ben van; azt is másold az app repójába. Példák: az SDK `sf-ui/gallery` mappája és a [`fennec/netflex`](https://gitea.bluefox.support/fennec/netflex) repó.
**Az app helye fejlesztés közben:** a Fennec OS checkout `apps/<app>/` mappája lehet, saját git repóként. A `.git`-et tartalmazó mappákat a Fennec OS image build, a csomagoló és a launcher kihagyja, a gyökér `.gitignore`-ba pedig vedd fel. Így az sf-ui path-függőség (`../../crates/sf-ui`) helyben működik.
**Az sf-ui függőség:** git-függőség az SDK egy tagjére (`sf-ui = { git = "https://gitea.bluefox.support/fennec/sdk", tag = "v0.1.0" }`). Az app bárhol élhet, a Fennec OS forráskódja nem kell hozzá.
Ha nem kell a rendszer kinézete, bármi jó, ami natívan beszél Waylanddel.
@@ -224,7 +227,7 @@ slint::slint! {
in-out property <int> selected: 0;
in-out property <int> clicks: 0;
callback quit();
property <[string]> items: ["Hello", "SmartFox", "Rust"];
property <[string]> items: ["Hello", "Fennec", "Rust"];
// Design for 1080p, scale to the real height (4K TVs give 2160).
property <float> k: self.height / 1080px;
background: #0b0d12;
@@ -277,7 +280,7 @@ Ha a toolkit nem állítja be magától: az adatfájlokat a `std::env::var("HOME
Telepítés (Linuxon, Rust kell hozzá):
```sh
cargo install --locked --git https://gitea.bluefox.support/bluefox/fox-in-the-box sf-pack
cargo install --locked --git https://gitea.bluefox.support/fennec/sdk sf-pack
```
| Parancs | Mit csinál |
@@ -334,7 +337,7 @@ jobs:
runs-on: ubuntu-latest
container: debian:trixie
env:
SF_PACK_GIT: https://gitea.bluefox.support/bluefox/fox-in-the-box
SF_PACK_GIT: https://gitea.bluefox.support/fennec/sdk
steps:
- uses: actions/checkout@v4
- name: Toolchain
@@ -353,7 +356,7 @@ jobs:
GH_TOKEN: ${{ github.token }}
run: |
git config --global --add safe.directory "$PWD"
gh release create "$GITHUB_REF_NAME" dist/* --title "$GITHUB_REF_NAME" --notes "SmartFox store release"
gh release create "$GITHUB_REF_NAME" dist/* --title "$GITHUB_REF_NAME" --notes "Fennec OS store release"
```
### Gitea / Forgejo (Codeberg): `.gitea/workflows/release.yml`
@@ -369,7 +372,7 @@ jobs:
container:
image: debian:trixie
env:
SF_PACK_GIT: https://gitea.bluefox.support/bluefox/fox-in-the-box
SF_PACK_GIT: https://gitea.bluefox.support/fennec/sdk
steps:
- name: Checkout
run: |
@@ -406,7 +409,7 @@ release:
rules:
- if: $CI_COMMIT_TAG =~ /^v/
variables:
SF_PACK_GIT: https://gitea.bluefox.support/bluefox/fox-in-the-box
SF_PACK_GIT: https://gitea.bluefox.support/fennec/sdk
script:
- apt-get update -qq
- apt-get install -y -qq --no-install-recommends build-essential pkg-config curl ca-certificates git jq libfontconfig1-dev libfreetype-dev libxkbcommon-dev >/dev/null
@@ -469,7 +472,7 @@ icon = "icon.png"
accent = "#3d7bff"
[web]
user_agent_suffix = "SMART-TV SmartFox"
user_agent_suffix = "SMART-TV FennecOS"
```
`package.sh` web apphoz:

13
sf-app/Cargo.toml Normal file
View File

@@ -0,0 +1,13 @@
[package]
name = "sf-app"
description = "The Fennec OS app contract: app.toml manifests, permissions, the sandbox and how the TV starts an app"
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
[dependencies]
serde.workspace = true
toml.workspace = true
anyhow.workspace = true
log.workspace = true

14
sf-app/src/lib.rs Normal file
View File

@@ -0,0 +1,14 @@
//! The Fennec OS app contract, shared by the OS (launcher, sf-core,
//! sf-update) and the developer tools (sf-pack):
//! - `manifest`: what an app is (`app.toml`), its permissions, the store rules;
//! - `launch` and `sandbox`: how the TV starts it, and what it can reach;
//! - `paths`, `settings`: where its data lives, `${settings.<key>}` values.
pub mod launch;
pub mod manifest;
pub mod paths;
pub mod sandbox;
pub mod settings;
pub use manifest::{AppKind, AppManifest, Origin, Permission, load_apps};
pub use settings::Settings;

View File

@@ -55,10 +55,13 @@ pub enum Permission {
DbusSystem,
/// Every device in /dev.
Devices,
/// Phones may start the app by casting to the TV (DIAL, e.g. the YouTube
/// app's cast button). Implied by a `[dial]` section.
Dial,
}
impl Permission {
pub const ALL: [Permission; 7] = [
pub const ALL: [Permission; 8] = [
Permission::Network,
Permission::Gpu,
Permission::Audio,
@@ -66,6 +69,7 @@ impl Permission {
Permission::DbusSession,
Permission::DbusSystem,
Permission::Devices,
Permission::Dial,
];
/// Name used in app.toml and store.toml.
@@ -78,6 +82,7 @@ impl Permission {
Permission::DbusSession => "dbus-session",
Permission::DbusSystem => "dbus-system",
Permission::Devices => "devices",
Permission::Dial => "dial",
}
}
@@ -95,6 +100,7 @@ impl Permission {
Permission::DbusSession => "Munkamenet D-Bus",
Permission::DbusSystem => "Rendszer D-Bus",
Permission::Devices => "Minden eszköz (/dev)",
Permission::Dial => "Castolás telefonról (DIAL)",
}
}
@@ -233,12 +239,15 @@ impl AppManifest {
}
/// What the app may reach from its sandbox. Web apps always get what a
/// browser needs.
/// browser needs; a `[dial]` section asks for `dial`.
pub fn permissions(&self) -> Vec<Permission> {
let mut p = self.sandbox.permissions.clone();
if self.kind == AppKind::Web {
p.extend([Permission::Network, Permission::Gpu, Permission::Audio]);
}
if self.dial.is_some() {
p.push(Permission::Dial);
}
p.sort();
p.dedup();
p
@@ -269,7 +278,9 @@ impl AppManifest {
anyhow::ensure!(is_store_id(&self.id), "store app id {:?} must be a reverse domain name (io.github.user.app)", self.id);
anyhow::ensure!(self.kind != AppKind::Builtin, "store apps can't be built-in");
anyhow::ensure!(!self.service, "store apps can't be background services");
anyhow::ensure!(self.dial.is_none(), "store apps can't register for DIAL");
if let Some(d) = &self.dial {
anyhow::ensure!(!d.name.trim().is_empty() && d.name.len() <= 64, "dial.name must be 1-64 characters");
}
anyhow::ensure!(self.sandbox.enabled != Some(false), "store apps can't turn off the sandbox");
match self.kind {
AppKind::Exec => anyhow::ensure!(!self.resolved_exec(Path::new("/app")).is_empty(), "exec is missing"),
@@ -451,6 +462,20 @@ mod tests {
bad.id = "youtube".into();
assert!(bad.check_store_rules().is_err());
// DIAL: allowed for store apps, and it shows up as a permission.
let cast: AppManifest = toml::from_str(
"id = 'io.github.fox.tube'
name = 'Tube'
kind = 'web'
url = 'https://example.com/tv'
[dial]
name = 'YouTube'
",
)
.unwrap();
cast.check_store_rules().unwrap();
assert!(cast.permissions().contains(&Permission::Dial));
let web: AppManifest = toml::from_str("id = 'a'\nname = 'A'\nkind = 'web'\nurl = 'https://x'\n").unwrap();
assert_eq!(web.permissions(), [Permission::Network, Permission::Gpu, Permission::Audio]);
let path: AppManifest = toml::from_str("id = 'a'\nname = 'A'\nkind = 'exec'\nexec = ['uxplay', '-n']\n").unwrap();

View File

@@ -1,34 +1,12 @@
//! Where the Fennec OS sockets and files live.
//! Where an app's files live on the TV (and on a developer machine).
use std::path::{Path, PathBuf};
use std::path::PathBuf;
/// `$XDG_RUNTIME_DIR`, or the temp dir.
pub fn runtime_dir() -> PathBuf {
std::env::var_os("XDG_RUNTIME_DIR").map(PathBuf::from).unwrap_or_else(std::env::temp_dir)
}
fn from_env(var: &str, default: &str) -> PathBuf {
match std::env::var_os(var) {
Some(p) => p.into(),
None => runtime_dir().join(default),
}
}
/// Launcher command socket (`home`, `remote <state>`, `power`, `wake`).
pub fn launcher_socket() -> PathBuf {
from_env("SMARTFOX_SOCKET", "smartfox.sock")
}
/// sf-core: app lifecycle (JSON lines, see `message`).
pub fn core_socket() -> PathBuf {
from_env("SMARTFOX_CORE_SOCKET", "smartfox-core.sock")
}
/// sf-compositor control socket (`focus launcher`, `focus <app-id>`).
pub fn wm_socket() -> PathBuf {
from_env("SMARTFOX_WM_SOCKET", "smartfox-wm.sock")
}
/// The settings file: `$SMARTFOX_SETTINGS`, else `<config>/smartfox/settings.toml`.
pub fn settings_file() -> PathBuf {
if let Ok(p) = std::env::var("SMARTFOX_SETTINGS") {
@@ -52,27 +30,3 @@ pub fn app_data_dir(id: &str) -> PathBuf {
.unwrap_or_else(|| PathBuf::from("."));
base.join("smartfox").join("apps").join(id)
}
/// Installed store apps (`/var/lib/sf-pkg/store/apps/<id>`), written by sf-update.
pub const STORE_APPS: &str = "/var/lib/sf-pkg/store/apps";
/// Looks for an `apps` folder next to the binary or above the cwd (dev
/// checkout), else the installed one.
pub fn apps_dir() -> PathBuf {
let mut starts = vec![];
if let Ok(cwd) = std::env::current_dir() {
starts.push(cwd);
}
if let Ok(exe) = std::env::current_exe() {
starts.extend(exe.parent().map(Path::to_path_buf));
}
for start in starts {
for dir in start.ancestors() {
let candidate = dir.join("apps");
if candidate.join("netflex").is_dir() {
return candidate;
}
}
}
PathBuf::from("/usr/share/smartfox/apps")
}

View File

@@ -1,12 +1,13 @@
[package]
name = "sf-pack"
description = "Fennec OS store app packaging (docs/store.md)"
description = "Fennec OS store app packaging (docs/store-app-guide.md)"
version.workspace = true
edition.workspace = true
license.workspace = true
repository.workspace = true
[dependencies]
sf-ipc.workspace = true
sf-app.workspace = true
anyhow.workspace = true
serde.workspace = true
toml.workspace = true

View File

@@ -12,7 +12,7 @@ use std::io::Read;
use std::path::{Path, PathBuf};
use anyhow::{Context, Result, bail};
use sf_ipc::AppManifest;
use sf_app::AppManifest;
fn main() {
let args: Vec<String> = std::env::args().skip(1).collect();
@@ -206,12 +206,12 @@ mod tests {
fn run_app(dir: &Path) -> Result<()> {
let mut app = read_manifest(dir)?;
app.check_store_rules().context("app.toml")?;
app.origin = sf_ipc::Origin::Store;
let settings = sf_ipc::Settings::default();
app.origin = sf_app::Origin::Store;
let settings = sf_app::Settings::default();
let data = std::env::temp_dir().join("sf-pack-run");
let opts = sf_ipc::launch::LaunchOptions { data_dir: &data, fullscreen: false, bounds: None, query: None };
let mut cmd = sf_ipc::launch::command(&app, &settings, &opts)?;
eprintln!("data folder ($HOME inside): {}", sf_ipc::paths::app_data_dir(&app.id).display());
let opts = sf_app::launch::LaunchOptions { data_dir: &data, fullscreen: false, bounds: None, query: None };
let mut cmd = sf_app::launch::command(&app, &settings, &opts)?;
eprintln!("data folder ($HOME inside): {}", sf_app::paths::app_data_dir(&app.id).display());
if std::env::var_os("SF_PACK_SHOW").is_some() {
eprintln!("{} {}", cmd.get_program().to_string_lossy(), cmd.get_args().map(|a| a.to_string_lossy()).collect::<Vec<_>>().join(" "));
}

View File

@@ -1,8 +1,9 @@
[package]
name = "sf-ui"
description = "SmartFox TV UI kit: Liquid Glass for Slint apps, TV components, artwork loading, video playback"
description = "Fennec OS TV UI kit: Liquid Glass for Slint apps, TV components, artwork loading, video playback"
version.workspace = true
edition.workspace = true
repository.workspace = true
# Slint is used under GPL-3.0 (its royalty-free license does not cover embedded
# devices like a TV box), so apps built on sf-ui are GPL-3.0 too.
license = "GPL-3.0-only"

View File

@@ -1,6 +1,5 @@
# Gitea / Forgejo (Codeberg): on a tag (v1.2.3), build, sign and publish a
# release with the three store assets. Secret: SF_SIGNING_KEY (base64 of
# key.pem on one line). The job token creates the release.
# Gitea / Forgejo (Codeberg): on a tag (v1.2.3), build and publish a release
# with the two store assets. The job token creates the release.
name: release
on:
push:
@@ -11,7 +10,7 @@ jobs:
container:
image: debian:trixie
env:
SF_PACK_GIT: https://gitea.bluefox.support/bluefox/fox-in-the-box
SF_PACK_GIT: https://gitea.bluefox.support/fennec/sdk
steps:
- name: Checkout
run: |
@@ -20,9 +19,7 @@ jobs:
libfontconfig1-dev libfreetype-dev libxkbcommon-dev >/dev/null
git clone --depth 1 --branch "$GITHUB_REF_NAME" \
"${GITHUB_SERVER_URL%%://*}://oauth2:${{ secrets.GITHUB_TOKEN }}@${GITHUB_SERVER_URL#*://}/${GITHUB_REPOSITORY}.git" src
- name: Build and sign
env:
SF_SIGNING_KEY: ${{ secrets.SF_SIGNING_KEY }}
- name: Build
run: |
curl -sSf https://sh.rustup.rs | sh -s -- -y -q --profile minimal
export PATH="$HOME/.cargo/bin:$PATH"

View File

@@ -1,6 +1,5 @@
# GitHub: on a tag (v1.2.3), build in Debian trixie, sign, and publish a
# release with the three store assets. Secret: SF_SIGNING_KEY (base64 of
# key.pem on one line: `base64 -w0 key.pem`).
# GitHub: on a tag (v1.2.3), build in Debian trixie and publish a release
# with the two store assets.
name: release
on:
push:
@@ -12,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
container: debian:trixie
env:
SF_PACK_GIT: https://gitea.bluefox.support/bluefox/fox-in-the-box
SF_PACK_GIT: https://gitea.bluefox.support/fennec/sdk
steps:
- uses: actions/checkout@v4
- name: Toolchain
@@ -24,9 +23,7 @@ jobs:
echo "$HOME/.cargo/bin" >> "$GITHUB_PATH"
- name: sf-pack
run: cargo install -q --locked --git "$SF_PACK_GIT" sf-pack
- name: Build and sign
env:
SF_SIGNING_KEY: ${{ secrets.SF_SIGNING_KEY }}
- name: Build
run: ./package.sh
- name: Release
env:

View File

@@ -1,13 +1,12 @@
# GitLab: on a tag (v1.2.3), build, sign, put the three store assets into the
# GitLab: on a tag (v1.2.3), build, put the two store assets into the
# project's generic package registry and make a release that links them.
# CI/CD variable: SF_SIGNING_KEY (base64 of key.pem on one line, masked).
# The project must be public, so TVs can download without a login.
release:
image: debian:trixie
rules:
- if: $CI_COMMIT_TAG =~ /^v/
variables:
SF_PACK_GIT: https://gitea.bluefox.support/bluefox/fox-in-the-box
SF_PACK_GIT: https://gitea.bluefox.support/fennec/sdk
script:
- apt-get update -qq
- apt-get install -y -qq --no-install-recommends build-essential pkg-config curl ca-certificates git jq libfontconfig1-dev libfreetype-dev libxkbcommon-dev >/dev/null

View File

@@ -1,4 +1,4 @@
# Fennec OS store app manifest (docs/store.md in the Fennec OS repo).
# Fennec OS store app manifest (docs/store-app-guide.md in the Fennec SDK).
# The id is a reverse domain name you control: io.github.<user>.<app>,
# io.gitlab.<user>.<app>, org.codeberg.<user>.<app>, or your own domain.
id = "io.github.example.hello"
@@ -18,12 +18,9 @@ exec = ["bin/hello-fennec"]
accent = "#FF9A5C"
palette = ["#ffb27a", "#8a3d12", "#120805"]
# Your signing key's public half: `sf-pack keygen` prints it. Every release
# must be signed with the same key, or TVs won't update.
[sandbox]
# What the app may use besides its own files and the screen. The TV shows
# this list before installing; an update that asks for more waits for the
# user to approve it. network, gpu, audio, gamepad, dbus-session,
# dbus-system, devices.
# dbus-system, devices. A [dial] section (cast from a phone) adds dial.
permissions = ["gpu"]