Skip to content

Commit b0daa1d

Browse files
committed
✨ feat: v4.0 release prep — Flathub + Nix packaging, bulk actions, default browser, translations
Ships the Rust/GTK4 rewrite as the new stable line and extends the project beyond Arch with first-class Flathub and Nix packaging. ## Packaging - Reorganize: pkgbuild/ → packaging/arch/; add packaging/flatpak/. - Flatpak manifest targeting org.gnome.Platform//48 + rust-stable//24.08; includes generate-cargo-sources.sh helper for offline Flathub builds. - AppStream metainfo at biglinux-webapps/usr/share/metainfo/ (validated via appstreamcli). - Nix flake.nix with package, devShell, and apps.default outputs. - PKGBUILD depends extended with xdg-utils + desktop-file-utils; optdepends for dconf (GNOME app-folders) and flatpak (Flatpak browser detection). - Installs metainfo.xml under /usr/share/metainfo/. ## Features - Restore search button placement on the header-bar left (matches prior UI). - Bulk "Remove WebApps" dialog with multi-select + master toggle + async worker + success/failure toast (window/actions/remove_multiple.rs). - Double confirmation for "Remove All" (Cancel/Continue → Cancel/Remove), matching the Python stable UX so upgraders keep the safety net. - System default browser auto-selected on new-webapp creation: detect_default_browser walks desktop_pattern + desktop_aliases + flatpak_app_id with longest-match wins; falls back to xdg-mime when xdg-settings is unconfigured. Adds aliases for google-chrome, microsoft-edge, vivaldi, brave-browser-{beta,nightly} so common desktop filenames resolve. - Larger row action icons (pixel_size 16/18 → 22/24) for better visual balance against the button size. ## Icon pipeline - resolve_icon_path now walks a size fallback chain [64, 48, 128, 32, 256, 512, 24, 22, 16] plus progressive suffix stripping (google-chrome-stable → google-chrome → google), returning absolute paths so SVG can render crisp via Pixbuf::from_file_at_size. ## Translations - Move locale/*.po → po/*.po (xtr-driven flow via scripts/update-translations.sh + msgmerge). - pt-BR + pt translated 100% (0 untranslated, 0 fuzzy) including all new strings from this release. - PKGBUILD + Flatpak manifest + Nix flake all compile .po → .mo at build time and install to /usr/share/locale/<lang>/LC_MESSAGES/ with pt-BR normalized to pt_BR. ## Dependencies - Bump scraper 0.22 → 0.26 (drops unmaintained fxhash + unsound rand 0.8.5 transitive warnings; cargo audit now clean). ## Docs / conventions - AGENTS.md documents repo conventions, subsystem gotchas, validation gate, and packaging channels for future AI agents. - Remove narrative/history comments across the tree; no references to past rewrites or planning docs. - .gitignore excludes .codex, .claude/, .serena/. ## Validation - ./scripts/validate-customizations.sh exit=0: - cargo fmt --check - cargo clippy --workspace --all-targets --all-features -- -D warnings - cargo test --workspace (126 tests, 3 consecutive green runs) - shellcheck + shfmt -d + bash -n on PKGBUILD and systemd helper - appstreamcli validate on metainfo.xml - YAML parse on Flatpak manifest
1 parent f0f3e90 commit b0daa1d

275 files changed

Lines changed: 32368 additions & 14149 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
name: Build Package
2+
3+
on:
4+
workflow_dispatch:
5+
6+
push:
7+
branches: [ "*" ]
8+
9+
jobs:
10+
build:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v4
14+
# - name: Send Hooks BigLinux Build Package
15+
# shell: bash
16+
# run: |
17+
# if [ -z "$(grep biglinux-package-template pkgbuild/PKGBUILD)" ];then
18+
# curl -X POST -H "Accept: application/json" -H "Authorization: token ${{ secrets.WEBHOOK_TOKEN }}" --data '{"event_type": "${{ github.repository }}", "client_payload": { "branch": "${{ github.ref_name }}", "url": "https://github.com/${{ github.repository }}"}}' https://api.github.com/repos/BigLinux-Package-Build/build-package/dispatches
19+
# curl -X POST -H "Accept: application/json" -H "Authorization: token ${{ secrets.WEBHOOK_TOKEN }}" --data '{"event_type": "${{ github.repository }}", "client_payload": { "branch": "${{ github.ref_name }}", "url": "https://github.com/${{ github.repository }}"}}' https://api.github.com/repos/BigLinux-Package-Build/build-package-ARM/dispatches
20+
# fi
21+
# curl -X POST "https://nebulaapi.nimbusnetwork.dev/webhook" \
22+
# -H "Authorization: token ${{ secrets.WEBHOOK_TOKEN }}" \
23+
# -H "Content-Type: application/json" \
24+
# -d '{
25+
# "event_type": "${{ github.repository }}",
26+
# "branch": "${{ github.ref_name }}",
27+
# "url": "https://github.com/${{ github.repository }}"
28+
# }'
29+
30+
# - name: Invoke deployment hook
31+
# uses: johannes-huther/webhook.sh@v1
32+
# env:
33+
# webhook_url: https://nebulaapi.nimbusnetwork.dev/webhook
34+
# webhook_secret: ${{ secrets.WEBHOOK_TOKEN }}
35+
# data: '{ "event_type": "${{ github.repository }}", "branch": "${{ github.ref_name }}", "url": "https://github.com/${{ github.repository }}"}'
36+
#xpto28
37+
38+
39+
40+
41+
42+
43+

.github/workflows/translate-and-build-package.yml

Lines changed: 0 additions & 74 deletions
This file was deleted.

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,11 @@
88
*.swo
99
*~
1010

11+
# AI coding assistants (local state markers / caches)
12+
.codex
13+
.claude/
14+
.serena/
15+
1116
# OS artifacts
1217
.DS_Store
1318
Thumbs.db

AGENTS.md

Lines changed: 255 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,255 @@
1+
# AGENT.md — BigLinux WebApps
2+
3+
Working notes for any AI coding agent operating on this repository.
4+
Read this before touching the tree. Humans can read it too.
5+
6+
---
7+
8+
## What this project is
9+
10+
Desktop app that turns websites into integrated `.desktop` launchers. Three
11+
binaries backed by a shared core:
12+
13+
| Binary | Crate | Role |
14+
| -------------------- | ----------------- | --------------------------------------------------- |
15+
| `big-webapps-gui` | `webapps-manager` | GTK4/libadwaita UI to CRUD webapps |
16+
| `big-webapps-exec` | `webapps-exec` | Launcher shim invoked by generated `.desktop` files |
17+
| `big-webapps-viewer` | `webapps-viewer` | Embedded WebKitGTK window (app-mode webapps) |
18+
|| `webapps-core` | Shared models, TOML configs, i18n plumbing |
19+
20+
The Python version in `/usr/share/biglinux/webapps/` is the legacy stable.
21+
This Rust rewrite replaces it.
22+
23+
---
24+
25+
## Ground rules
26+
27+
1. **Language**
28+
- Code, identifiers, commits, internal comments → English.
29+
- User-facing strings (gettext) → Brazilian Portuguese is the primary
30+
translation; source strings stay in English.
31+
- Conversation with the maintainer in this repo → Brazilian Portuguese.
32+
33+
2. **File sizes**
34+
- Target 200–300 lines. Justify going over 500.
35+
- Function bodies 4–20 logical lines. Longer = split.
36+
37+
3. **Naming**
38+
- No `data`, `helper`, `util`, `manager`, `process`. Prefer specific,
39+
grep-friendly names (`resolve_icon_path`, `rebuild_sections`).
40+
41+
4. **Types**
42+
- Explicit types on all public Rust APIs.
43+
- Domain primitives over raw strings where possible (see
44+
`webapps-core::models::{CategoryList, ProfileKind, WebAppUrl, BrowserId}`).
45+
46+
5. **Comments — default to zero**
47+
- Do NOT write "what" comments when the code already says it.
48+
- Do NOT write "added for X", "used to be Y", or references to PRs, issues,
49+
commits, past rewrites, or planning docs. The git log is the history.
50+
- DO write a one-line comment when the *why* is non-obvious (hidden
51+
invariant, workaround, surprising ordering).
52+
53+
6. **Scope discipline**
54+
- Bug fix = fix the bug. No drive-by refactor.
55+
- No new abstractions until there is a third concrete caller.
56+
- No feature flags / back-compat shims unless the maintainer asks.
57+
- No `*.md` planning documents unless explicitly requested.
58+
59+
7. **Safety**
60+
- Tool side-effects: deleting files, force-pushing, modifying shared state
61+
→ confirm with the maintainer first.
62+
- No `--no-verify`, no `--amend` on already-pushed commits, no hook skipping.
63+
64+
---
65+
66+
## Repository layout
67+
68+
```
69+
crates/ Rust workspace (no GTK in -core)
70+
webapps-core/ shared lib: models, browsers.toml loader, i18n, desktop writer
71+
webapps-manager/ GUI crate (binary big-webapps-gui, plus lib)
72+
webapps-exec/ launcher shim (binary big-webapps-exec)
73+
webapps-viewer/ WebKit window (binary big-webapps-viewer)
74+
75+
biglinux-webapps/ Data tree shipped by every packager
76+
usr/share/
77+
applications/ br.com.biglinux.webapps.desktop
78+
metainfo/ br.com.biglinux.webapps.metainfo.xml (AppStream)
79+
icons/hicolor/ big-webapps.svg + big-webapps-symbolic.svg
80+
biglinux-webapps/ browsers.toml
81+
biglinux/webapps/ bundled browser icons + viewer profile seed
82+
desktop-directories/ big-webapps.directory, google-apps.directory
83+
usr/lib/systemd/user/ biglinux-webapps.service
84+
usr/bin/ biglinux-webapps-systemd (session init helper)
85+
etc/xdg/menus/ KDE/GNOME menu integration
86+
87+
packaging/ One subfolder per distribution channel
88+
arch/ PKGBUILD + biglinux-webapps.install
89+
flatpak/ br.com.biglinux.webapps.yml + generate-cargo-sources.sh
90+
91+
flake.nix Nix flake: package, devShell, apps.default
92+
po/ Translation catalogs + biglinux-webapps.pot
93+
scripts/
94+
validate-customizations.sh one-shot local gate (see below)
95+
update-translations.sh regenerate .pot + msgmerge every .po
96+
```
97+
98+
---
99+
100+
## Packaging channels
101+
102+
### Arch (`packaging/arch/PKGBUILD`)
103+
- Auto-detects a local working tree via `BASH_SOURCE[0]`; falls back to
104+
`git+${url}.git` when building without one.
105+
- Version = `$(date +%y.%m.%d)-$(date +%H%M)`, surfaced to the app via the
106+
`BIGLINUX_WEBAPPS_VERSION` env var at build time.
107+
- Mirrors the source into `$srcdir/$pkgname` via rsync with `target/`,
108+
`.git/`, and `packaging/arch/{pkg,src}/` excluded — do not casually add
109+
new top-level dirs without extending the exclude list.
110+
111+
### Flatpak (`packaging/flatpak/br.com.biglinux.webapps.yml`)
112+
- Runtime: `org.gnome.Platform//48` (current Flathub-recommended branch;
113+
each GNOME branch supported for ~1 year — bump in lockstep with upstream)
114+
plus `org.freedesktop.Sdk.Extension.rust-stable//24.08` for the Rust
115+
toolchain. The extension branch must match the Freedesktop base of the
116+
GNOME runtime (verify with `flatpak info -m org.gnome.Sdk//<ver>`).
117+
- Local test: `flatpak-builder --user --install --force-clean build-dir
118+
packaging/flatpak/br.com.biglinux.webapps.yml`.
119+
- Flathub submission checklist:
120+
1. Swap the `type: dir` source for `type: git` pinned to the release tag.
121+
2. Run `packaging/flatpak/generate-cargo-sources.sh` to produce
122+
`cargo-sources.json`, then add it to the manifest `sources:` list.
123+
3. Drop `--share=network` from `build-options.build-args`, set
124+
`CARGO_NET_OFFLINE: 'true'` in the build env, and change the build
125+
commands to `cargo --offline fetch` + `cargo build --offline --release --locked`.
126+
- The app-id is `br.com.biglinux.webapps` and must stay that way — all
127+
`.desktop`, metainfo, icon, and D-Bus names key off it.
128+
129+
### Nix (`flake.nix`)
130+
- `nix build` produces the full package with binaries, desktop entry,
131+
metainfo, icons, browsers.toml, and compiled locales.
132+
- `nix run` launches `big-webapps-gui`.
133+
- `nix develop` drops into a shell with cargo + all native GTK/WebKit deps.
134+
- webkitgtk-6.0 is referenced as `pkgs.webkitgtk_6_0`; adjust if a newer
135+
nixpkgs pin renames the attribute.
136+
137+
---
138+
139+
## Validation gate
140+
141+
Before declaring any change complete, run:
142+
143+
```bash
144+
./scripts/validate-customizations.sh
145+
```
146+
147+
That wraps:
148+
149+
```
150+
cargo fmt --check
151+
cargo clippy --workspace --all-targets --all-features -- -D warnings
152+
cargo test --workspace
153+
shellcheck biglinux-webapps/usr/bin/biglinux-webapps-systemd packaging/arch/PKGBUILD
154+
shfmt -d biglinux-webapps/usr/bin/biglinux-webapps-systemd packaging/arch/PKGBUILD
155+
bash -n biglinux-webapps/usr/bin/biglinux-webapps-systemd packaging/arch/PKGBUILD
156+
```
157+
158+
Warnings are failures. If the script is missing a tool, install it; do not
159+
comment out the check.
160+
161+
UI changes require a manual sanity run:
162+
163+
```bash
164+
cargo run --release --bin big-webapps-gui
165+
```
166+
167+
If you cannot launch a GUI from your environment, say so explicitly in the
168+
summary instead of claiming UI success.
169+
170+
---
171+
172+
## Translations
173+
174+
1. Adding a new gettext string in code → run
175+
`./scripts/update-translations.sh` (needs `cargo install xtr`).
176+
That regenerates `po/biglinux-webapps.pot` and `msgmerge`s each
177+
`po/*.po`. Strings that match a close existing entry get flagged
178+
`#, fuzzy` — translators review those. Untranslated / fuzzy strings
179+
are **dropped** from the compiled `.mo`, so the UI falls back to
180+
English until a human updates them.
181+
2. pt-BR is the primary translation. Keep it fully translated at all
182+
times. Other languages can lag behind.
183+
3. The PKGBUILD, Flatpak manifest, and Nix flake all compile `.po → .mo`
184+
at build time and install to
185+
`/usr/share/locale/<lang>/LC_MESSAGES/biglinux-webapps.mo`. The `-`
186+
in `pt-BR` is normalized to `_` (POSIX) during install.
187+
188+
---
189+
190+
## Subsystems with gotchas
191+
192+
### Browser detection (`webapps-core::browsers` + `webapps-manager::service::browser`)
193+
- Source of truth is `browsers.toml`, not code.
194+
- Default-browser resolution uses `desktop_pattern` + `desktop_aliases` + the
195+
Flatpak `flatpak_app_id`. Longest match wins.
196+
- When `xdg-settings` fails, `xdg-mime query default x-scheme-handler/http`
197+
is the fallback.
198+
- `flatpak_id` is returned when the system default points to the Flatpak
199+
variant; the native `id` otherwise.
200+
201+
### Worker threads (`ui_async::run_with_result`)
202+
- Any filesystem/network call that can block longer than ~50 ms runs on a
203+
worker. The result callback executes back on the main loop.
204+
- Do not call GTK APIs from inside the worker closure. Only from the
205+
result callback.
206+
207+
### Icon resolution (`service::icons::resolve_icon_path`)
208+
- Returns either an absolute path (file found) or a plain icon name
209+
(theme lookup). The caller chooses `set_from_file` vs `set_icon_name`
210+
based on that distinction.
211+
- Walks a size fallback chain and progressive suffix stripping; keep both.
212+
213+
### CRUD atomicity (`service::crud`)
214+
- `create_webapp` / `update_webapp` / `delete_webapp` / `delete_all_webapps`
215+
each hold an advisory file lock and have rollback paths. Integration
216+
tests in `crates/webapps-manager/tests/crud_integration.rs` guard those
217+
contracts — do not break them casually.
218+
219+
### Geometry persistence (`geometry`)
220+
- Window and per-dialog sizes are persisted to JSON under the user cache
221+
dir. Binding helpers: `load_geometry`, `save_geometry`, `bind_adw_dialog`.
222+
223+
### Wayland icon swap (`webapps-exec::wayland`)
224+
- Chromium-family browsers don't let us set WM_CLASS. Workaround: swap
225+
the `.desktop` Icon= entry, launch, then restore. `DEFAULT_SWAP_SETTLE_MS`
226+
is tuned; override via `BIG_WEBAPPS_SWAP_SETTLE_MS` if a compositor needs
227+
more time.
228+
229+
---
230+
231+
## Release / versioning
232+
233+
- Cargo version lives in `Cargo.toml` (`[workspace.package]`). Keep it in
234+
step with the AppStream `<releases>` entries in
235+
`biglinux-webapps/usr/share/metainfo/br.com.biglinux.webapps.metainfo.xml`.
236+
- Arch PKGBUILD uses a date-based `pkgver`; bumping it is automatic.
237+
- Flatpak and Nix read the Cargo version (or git tag). Tag releases as
238+
`v<major>.<minor>.<patch>`.
239+
- `Cargo.lock` is committed. Do not regenerate it casually — commit
240+
intentional updates as their own change.
241+
242+
---
243+
244+
## Prompts to refuse
245+
246+
- "Rewrite everything in async" / large-scale refactors without a
247+
concrete failing case.
248+
- "Skip the hook / bypass the lint" — investigate the failure instead.
249+
- "Add a planning doc / architecture diagram" unless the maintainer
250+
explicitly asked.
251+
- Any change that ships code behind a feature flag purely because an
252+
agent was unsure.
253+
254+
When blocked by ambiguity, ask. Do not guess the maintainer's intent
255+
on wide-blast-radius operations.

0 commit comments

Comments
 (0)