Sailfish OS UnifiedPush Distributor
  • Rust 77.9%
  • QML 16%
  • Shell 3.4%
  • Java 2.3%
  • Dockerfile 0.4%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
projectmoon 84e5711f07
All checks were successful
Release Foghorn / version (push) Successful in 10s
Release Foghorn / apk (push) Successful in 2m38s
Test Foghorn on Master / native-tests (push) Successful in 6m15s
Test Foghorn on Master / tests (push) Successful in 0s
Release Foghorn / SFOS aarch64 (push) Successful in 15m39s
Release Foghorn / SFOS armv7hl (push) Successful in 16m48s
Release Foghorn / sfos (push) Successful in 0s
Release Foghorn / release (push) Successful in 1m8s
update lockfile
2026-10-23 21:42:44 +02:00
.forgejo/workflows CI 2026-10-20 22:23:52 +02:00
appsupport Run the App Support bridge as the container's owner instead of root 2026-10-23 19:15:36 +02:00
assets Fix icon shapes. 2026-10-11 12:26:12 +02:00
ci CI 2026-10-20 21:56:24 +02:00
docs i say boy, i say, that's a push notification, that is. 2026-10-07 20:16:57 +02:00
foghorn Version 0.8.0: Root no longer required. 2026-10-23 21:18:49 +02:00
foghorn-accounts Support Nextcloud unifiedpush. 2026-10-10 22:25:33 +02:00
foghorn-common Version 0.8.0: Root no longer required. 2026-10-23 21:18:49 +02:00
foghorn-test-connector Version 0.8.0: Root no longer required. 2026-10-23 21:18:49 +02:00
foghornd Version 0.8.0: Root no longer required. 2026-10-23 21:18:49 +02:00
leghorn fmt 2026-10-23 20:02:15 +02:00
leghorn-build deslop comments 2026-10-09 12:16:30 +02:00
leghorn-macros deslop comments 2026-10-09 12:16:30 +02:00
qml Run the App Support bridge as the container's owner instead of root 2026-10-23 19:15:36 +02:00
rpm Version 0.8.0: Root no longer required. 2026-10-23 21:18:49 +02:00
sfos CI 2026-10-20 21:56:24 +02:00
toot fmt 2026-10-23 20:02:15 +02:00
.gitignore toot toot 2026-08-21 11:00:07 +02:00
Cargo.lock update lockfile 2026-10-23 21:42:44 +02:00
Cargo.toml Version 0.8.0: Root no longer required. 2026-10-23 21:18:49 +02:00
README.md Run the App Support bridge as the container's owner instead of root 2026-10-23 19:15:36 +02:00
rustfmt.toml toot toot 2026-08-21 11:00:07 +02:00

Foghorn

Foghorn

A UnifiedPush distributor for Sailfish OS, using the Mozilla Push Service, an ntfy server or a Nextcloud instance with NextPush.

  • foghornd: systemd user service holding the push connection and the D-Bus interfaces.
  • foghorn: GUI, with service control, the list of registered apps and what each one has received.
  • foghorn-test-connector: optional subpackage for checking delivery.

Installing

The official distributon channel of Foghorn is at OpenRepos.

The latest and pre-release versions are available via Harpoon. Scan this code in Harpoon's scanner, or open the link on your phone.

Add to Harpoon

harpoon://add?url=https%3A%2F%2Fgit.agnos.is%2Fprojectmoon%2Ffoghorn&source=Forgejo

ntfy.sh

Out of the box Foghorn talks to Mozilla's push service. But you can switch it to a ntfy.sh instance in Settings. Foghorn can connect to the public https://ntfy.sh instance or your own server. Switching (or changing servers later) unregisters every app, so they'll have to re-register with Foghorn.

For a server that requires authentication, enter your username and password. To use an access token instead, leave the username blank and put the token in the password field.

App servers publish to ntfy anonymously. If your server has auth-default-access set to deny-all, allow anonymous writes to UnifiedPush topics:

ntfy access everyone 'up*' write-only

And if ntfy is behind nginx, make sure WebSocket upgrades get through, or Foghorn can't subscribe:

proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

Nextcloud

Foghorn can also push through a Nextcloud server you've added in Settings → Accounts. Pick Nextcloud as the push service in Foghorn's settings, choose the account and log in to Nextcloud in the browser. Sailfish asks once whether Foghorn may read your accounts.

The server needs the NextPush app (uppush) and Redis:

occ app:install uppush

Foghorn gets its own app password. If you log in with an app password instead of your normal one, make a new one just for Foghorn. Switching to another push service or uninstalling Foghorn revokes it.

If that app password is revoked, Foghorn's device is deleted in Nextcloud or the account is removed from Settings → Accounts, Foghorn unregisters every app. Pick a push service again and reopen your apps so they re-register.

NextPush pings every 50 seconds by default. To save battery, an admin can raise that to 600 seconds under UnifiedPush Provider in Nextcloud's administration settings.

If Nextcloud is behind a reverse proxy, turn off buffering and set a timeout longer than that. With nginx:

proxy_buffering off;
proxy_read_timeout 10m;

Android apps

Turn on Android apps in Foghorn's settings to give Android apps in App Support a UnifiedPush distributor. Foghorn then puts a small APK called Foghorn into Android, with no launcher entry or screens, which connects to foghornd on 127.0.0.1:47370. Android apps list Foghorn as a distributor and show up in the Foghorn app next to the native ones. Turning the setting off unregisters them and removes the APK again.

App Support only delivers broadcasts to Android apps that are running, so the APK keeps a foreground service up. foghornd starts it through apkd whenever it is not connected, and a service on the Sailfish side, running as the container's owner rather than root, installs and removes the APK. Turning the setting off while App Support is stopped leaves the APK until App Support next starts; the Foghorn app says so, and a notification follows once it is gone. Before each push the APK starts the receiving app through its RAISE_TO_FOREGROUND service, which apps on connector 3 have. Apps without one only get pushes while they are running.

Logs:

devel-su journalctl -f -u 'foghorn-appsupport@*'
devel-su appsupport-attach logcat -s Foghorn

Building

Needs Docker or Podman.

sfos/build.sh                # i486 and aarch64, into RPMS/
sfos/build.sh armv7hl        # 32-bit ARM devices
sfos/deploy.sh               # install onto a running emulator
ARCH=aarch64 sfos/deploy.sh  # ... or a device (armv7hl for 32-bit)

sfos/build.sh builds the App Support APK first, with appsupport/build.sh, in a Debian container holding Google's command-line Android tools. No Gradle or Android Studio is involved.

cargo test works on a normal Linux host. The Qt apps only build in the container. Leghorn's Matrix tests need --features matrix,insecure-test-http (they use a plain-http server on loopback).

cargo run -p toot sends a test push to a leghorn app on the emulator, or on a phone with -d <ssh destination>.

Versions

As in indra and livewire, the whole version lives in RPM's Version field, from git describe:

built from RPM
the v0.1.0 tag foghorn-0.1.0-1
3 commits past it foghorn-0.1.0.3.g1a2b3c4-1
uncommitted changes ... with .dirty appended
--stable foghorn-0.1.0-1, straight from rpm/foghorn.spec

With no tags reachable, or no .git at all, the spec's own Version takes over rather than a bare commit hash: RPM would compare those in hash order, so half the newer builds would look like downgrades. sfos/build.sh --print-version shows what the next build would stamp, and FOGHORN_VERSION overrides it.

Releasing is a tag plus a --stable build:

# bump Version in rpm/foghorn.spec and `version` in foghorn/Cargo.toml,
# foghornd, foghorn-common and foghorn-test-connector, so the package and the
# app's About page agree
git tag -a v0.2.0 -m "Foghorn 0.2.0"
sfos/build.sh --stable --prune

Forgejo CI

Pushes to master run native Rust tests. Tags named vX.Y.Z or vX.Y.Z-rcN validate the version, build aarch64 and armv7hl RPMs, and publish the four RPMs (Foghorn and its test connector for each architecture) to a Forgejo release. RC RPM versions use ~rcN, so the final version upgrades them.

Publish the CI images before enabling the workflows. Run this on a machine with ample Docker storage after logging in to git.agnos.is:

sh ci/build-images.sh

The images are stored at git.agnos.is/projectmoon/foghorn-ci. Rebuild them after changing their Dockerfiles. The workflows require runners with docker and docker-large labels. The SFOS images are large; the build deliberately does not upload or restore Rust target directories as Actions caches.

Once the images are in place, tag releases after bumping the spec and application crate versions with sfos/bump-version.sh.

Debugging

systemctl --user status foghornd
devel-su journalctl -f _SYSTEMD_USER_UNIT=foghornd.service
systemctl --user set-environment RUST_LOG=debug

Writing an app that uses Foghorn

See docs/connectors.md. Rust apps can use leghorn, which handles most of it.

Why it exists

No Rust UnifiedPush distributor library exists, and KDE's kunifiedpush is Qt 6, which will not build against Sailfish's Qt 5.6. Foghorn implements the UnifiedPush D-Bus specification directly, using kunifiedpush as a reference implementation; docs/kunifiedpush-spec.md transcribes its behavior. Code the specification mandates is marked Spec:.

AI disclaimer

An AI wrote most of this code, and this README.

It worked from the UnifiedPush D-Bus specification and from docs/kunifiedpush-spec.md, which it produced by reading KDE's kunifiedpush. It copied no kunifiedpush code into Foghorn.

A human review is underway, editing where needed. It is not finished.

License

Foghorn is AGPL-3.0-or-later, except Leghorn (leghorn and leghorn-macros) and foghorn-common, which are MPL-2.0.

kunifiedpush is LGPL-2.0-or-later (Copyright 2022 Volker Krause). Foghorn uses none of its code, so that license does not reach this project. The verbatim excerpts quoted in docs/kunifiedpush-spec.md remain under it.