Skip to content

Improve account management and Windows behavior; add hardening and a language setting - #49

Merged
karem505 merged 24 commits into
karem505:masterfrom
matheuscardosoj:development
Oct 23, 2026
Merged

karem505 merged 24 commits into
karem505:masterfrom
matheuscardosoj:development

Conversation

@matheuscardosoj

@matheuscardosoj matheuscardosoj commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Follow-up account/session and Windows usability work from the development branch, now with a hardening pass and an interface-language setting.

Accounts and Windows usability (earlier commits on this branch)

  • Keep the selected account in the main window when a detached account window is closed; return the live WebView without recreating its session. Explicit "Reintegrar à janela" still activates the selected account.
  • Integrated account/settings UI, account switching and window lifecycle, including empty/logged-out account states.
  • Windows notification, lock, startup visibility, UI recovery and NSIS installer work.

Hardening (new)

  • Settings, accounts and app-lock JSON are written atomically (temp file + rename) with a .bak; an unreadable app-lock.json with no backup now keeps the lock on instead of silently disabling it, and an unreadable accounts.json is preserved as .corrupt. A UTF-8 BOM is accepted.
  • Unlock: exponential delay after 3 wrong passwords, Argon2 runs off the UI thread, new passwords need 6+ characters, and the reset needs an explicit confirmation from the lock window.
  • "Open" on a finished download uses an allowlist of safe types; anything else is revealed in its folder.
  • WebView permission requests are granted only to https://web.whatsapp.com; CSP for the local pages; bounded diagnostic log.
  • Poison-tolerant mutex helper instead of lock().unwrap() (release builds use panic = "abort"); lock_now flips the state atomically.
  • CI: cargo fmt --check, clippy -D warnings, actions pinned by SHA, plus the notification and language test suites. install.ps1 verifies the release asset's SHA-256.

Language (new)

  • Settings > Aparência > Idioma: Português (Brasil) or English, applied immediately and stored as language in settings.json. The default stays pt-BR in this branch; please say if you would rather default to English upstream.
  • Covers the settings, lock and shell pages, tray and native menus, notifications, error messages, window titles, and the account switcher/download toasts injected into WhatsApp. Source strings are Portuguese with an English table (src-tauri/src/i18n.rs, settings-ui/i18n.js); a string without an entry is shown as written. Tests fail when a new UI string has no English entry.

Validation

  • cargo test --locked: 142 passed. cargo clippy --locked --all-targets -- -D warnings and cargo fmt --check: clean.
  • Node suites: bridge, hotkey, dialog, language (settings-ui/i18n.test.mjs) and notifications (4 passed).
  • Tested against a real debug build with an isolated app identifier: wrong-password delay, reset refusal without confirmation, corrupt app-lock.json (stays locked), recovery from .bak, and corrupt accounts.json (kept as .corrupt).
  • Windows NSIS installer 0.6.9 builds (tauri build --bundles nsis); the language switch was checked by hand in the installed 0.6.9-local.11 build.

Review notes

  • Windows only has been exercised. The Linux/WebKitGTK permission-origin check (window.rs) was written without a Linux build here, so the Linux CI job is its first compile; macOS is unvalidated.
  • The diff against master includes the branch's earlier account and Windows work; please review that scope before merging.
  • The installer is a local artifact and is not attached.

matheuscardosoj and others added 20 commits September 5, 2026 12:06
…ation-acl

# Conflicts:
#	settings-ui/index.html
#	settings-ui/style.css
#	src-tauri/capabilities/lock.json
#	src-tauri/capabilities/main-remote.json
#	src-tauri/capabilities/settings.json
#	src-tauri/resources/bridge.js
#	src-tauri/src/commands.rs
#	src-tauri/src/settings.rs
Add jsonfile.rs: write to a temp file, keep the last valid copy as .bak,
rename into place, and recover from .bak when the main file is unreadable.
settings, accounts and app-lock now use it instead of std::fs::write, and
no longer panic on serialization errors.

- accounts.json unreadable: keep a .corrupt copy before falling back
- app-lock.json unreadable with no backup: keep the lock on instead of
  silently disabling it
- factory reset also removes .bak/.corrupt/.tmp files
- remove_account repoints ActiveAccount; delete_profile retries while
  WebView2 releases files

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
- unlock_password: exponential delay after 3 wrong guesses, Argon2 off the
  UI thread; password minimum 6; reset requires explicit confirmation
- downloads: open only an allowlist of file types, others reveal in folder
- webview permissions granted to https://web.whatsapp.com only
- CSP for the local UI; bounded dlog
- poison-tolerant mutex helper; atomic lock_now test-and-set
- JSON files tolerate a UTF-8 BOM
- CI: fmt + clippy, actions pinned by SHA; install.ps1 verifies SHA-256
- a11y: focus-visible on lock screen, aria-labelledby on dialogs

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Portuguese (Brazil) stays the default. Settings > Aparência > Idioma switches
the language immediately and persists it in settings.json (`language`).

- i18n.rs: Portuguese source strings with an English table (tr/trf); a test
  fails when a translatable literal has no English entry
- settings-ui/i18n.js: translates text nodes and aria/title/placeholder
  attributes for the settings, lock and shell pages, live on change
- bridge.js / integration.js: account switcher and download toasts follow the
  language set by Rust (window.__WR_LANG)
- tray, native menu, notifications, errors and window titles are translated;
  the language change re-applies them without a restart
- lock screen shows the localized "too many attempts" wait
- CI runs the language and notification test suites

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@matheuscardosoj matheuscardosoj changed the title Improve integrated account management and Windows behavior Improve account management and Windows behavior; add hardening and a language setting Oct 22, 2026
@matheuscardosoj
matheuscardosoj marked this pull request as ready for review October 22, 2026 23:09
Copilot AI balanced review requested due to automatic review settings October 22, 2026 23:09

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

matheuscardosoj and others added 4 commits October 22, 2026 20:16
Resolved against the integrated Windows account sessions and the language
setting:
- menu-bar-only settings row is Portuguese/English like the rest of the page
  and keeps upstream's macOS-only wiring (menubar_only, SettingsView)
- macOS menu-bar logic lives in the non-Windows show/toggle paths
- background throttling policy added to the shared account webview builder
- early settings load in setup() feeds the language and menu-bar mode

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
The language commit left i18n.rs, i18n.js and i18n.test.mjs untracked, so CI
could not find `mod i18n`. Also fix errors that only show on macOS/Linux
(CI had never compiled this branch there):

- aumid: import Manager only on Windows
- integration: detach/attach return directly per platform (no unreachable code)
- notify: show_for_account does not warn about `label` off Windows
- menubar: ensure_window works with open_account_window returning ()

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@karem505
karem505 merged commit f1a7f41 into karem505:master Oct 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants