feat: Linux support — platform abstraction, systemd autostart, Secret Service keyring, CI matrix#1
Open
daviirodrig wants to merge 2 commits into
Open
feat: Linux support — platform abstraction, systemd autostart, Secret Service keyring, CI matrix#1daviirodrig wants to merge 2 commits into
daviirodrig wants to merge 2 commits into
Conversation
…ential store
Adds a platform abstraction layer so macOS and Linux each get correct
labels, paths, and behavior without scattering cfg blocks everywhere.
- platform/: mod.rs with pure TargetOs/PlatformLabels (testable without
a real OS), macos.rs wrapping the existing LaunchAgent logic, linux.rs
implementing systemd --user install/restart/remove
- daemon.rs: DaemonStatus gains plataforma, autostart_nome, service_path,
instalacao_manual; delegates fully to platform module (no more cfg in daemon)
- Cargo.toml: target-specific keyring (apple-native / sync-secret-service)
and libc (macOS only); eliminates unused-import warnings on Linux
- secrets.rs: error messages and BackupCredentialStatus.store_nome use the
platform label ("Keychain" / "Secret Service")
- domain.rs: ApiCapabilities gains data_root + data_root_label; filled by
storage.bootstrap() with the real filesystem path (~-expanded)
- UI: SettingsView, Shell, BackupView all drive text from API data instead
of hardcoded macOS strings; App.tsx forwards data_root_label
- 4 platform unit tests covering label correctness per OS
…CI matrix Scripts: - instalar-autostart.sh / remover-autostart.sh become bash dispatchers (Darwin → macos, Linux → linux, else error); old zsh logic moved to *-macos.sh variants intact - instalar-autostart-linux.sh: writes ~/.config/systemd/user/projectus.service, runs systemctl --user enable --now; hints about loginctl enable-linger - remover-autostart-linux.sh: systemctl disable --now + rm + daemon-reload - instalar.sh: early exit on Linux with a useful message pointing to build:linux - build-linux.sh: pnpm build + cargo release + tauri deb,appimage - check-tauri-linux-deps.sh: pkg-config probe for webkit2gtk-4.1 / gtk+-3.0 / openssl; prints Arch and Debian/Ubuntu install commands on failure; macOS no-op package.json: adds build:linux, instalar:macos, desktop:check scripts CI (.github/workflows/ci.yml): - web job on ubuntu-latest: typecheck, test, build - rust-linux on ubuntu-latest: libdbus-1-dev, cargo test + release build - rust-macos on macos-latest: cargo test + release build
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Overview
Makes the server and desktop build/run properly on Linux without touching the polished macOS flow. macOS behavior is identical to before.
What changed
Backend — platform abstraction (
crates/server/src/platform/)Replaced scattered
#[cfg(target_os = "macos")]blocks with a proper platform module:platform/mod.rs— pureTargetOsenum +PlatformLabelsstruct +platform_labels(os)function (fully testable without a host OS). Exposesautostart_info / install / restartthat delegate to the right platform impl.platform/macos.rs— existing LaunchAgent logic, now isolated behind#[cfg(target_os = "macos")] mod macos. No Linux compiler warnings.platform/linux.rs— systemd user service: install writes~/.config/systemd/user/projectus.service, runssystemctl --user enable --now; restart delegates tosystemctl --user restart; status checksis-active --quiet. Suggestsloginctl enable-lingerbut never calls it automatically. No sudo.daemon.rsDaemonStatusgains:plataforma"macOS"/"Linux"/"sistema atual"autostart_nome"LaunchAgent"/"systemd user service"service_pathplist; absolute path to the service fileinstalacao_manualstatus(),install(),restart()now fully delegate — no cfg in daemon.rs.Cargo deps
Eliminates unused-import warnings on Linux. Linux uses DBus Secret Service (GNOME Keyring / KWallet).
domain.rs+storage.rsBackupCredentialStatusgainsstore_nome("Keychain"/"Secret Service")ApiCapabilitiesgainsdata_root(absolute path) anddata_root_label(~-expanded path), filled bystorage.bootstrap()UI
All hardcoded macOS strings replaced by API data:
"Salva no Keychain do macOS""Salva no {credentialStore}""fixar credenciais no Keychain""fixar credenciais no {credentialStore}""autostart instalado no macOS""autostart instalado via {daemon.autostart_nome}""execute ./scripts/instalar-autostart.sh""use o botão instalar ou {daemon.instalacao_manual}"~/Documents/PROJECTUS(hardcoded)capacidades.data_root_label(real path, ~-expanded)Scripts
instalar-autostart.sh*-macos.shor*-linux.shremover-autostart.sh*-macos.shor*-linux.shinstalar-autostart-macos.shremover-autostart-macos.shinstalar-autostart-linux.shremover-autostart-linux.shinstalar.shbuild-linux.shcheck-tauri-linux-deps.shCI (
.github/workflows/ci.yml)Three jobs on every push/PR to main:
libdbus-1-dev,cargo test --workspace, release buildcargo test --workspace, release buildTests
4 new unit tests in
platform/mod.rs:daemon_status_on_linux_reports_systemd_user_servicedaemon_status_on_macos_reports_launch_agentcredential_store_label_matches_platformmanual_install_message_mentions_correct_scriptAll tests pass (
cargo test --workspace: 16 passed,pnpm test --run: 16 passed).Linux quick start (server only)
Autostart:
Secret Service (R2 credentials): requires GNOME Keyring or KWallet running. Headless environments get a clear error, no panic.