Fennec SDK: split from the Fennec OS repository
All checks were successful
ci / test (push) Successful in 17m21s
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:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user