From d71fed68b96b1e52ad9365d058060be85f58af0a Mon Sep 17 00:00:00 2001 From: astar76 Date: Wed, 2 Dec 2026 12:07:39 -0600 Subject: [PATCH 1/7] docs: Astar Hub moved to astar76sites.tail7c4f5e.ts.net Co-Authored-By: Claude Opus 5.5 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c774fb9..c19730b 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Linux only: WebKitGTK has no Windows or macOS build. ## Install -Downloads are on the [Releases page](https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre/releases). Check them +Downloads are on the [Releases page](https://astar76sites.tail7c4f5e.ts.net/git/astar76/Nacre/releases). Check them against `SHA256SUMS-`. - **Arch Linux:** `sudo pacman -U Nacre--arch-x86_64.pkg.tar.zst` (package `nacre-bin`; remove it with @@ -23,7 +23,7 @@ against `SHA256SUMS-`. To build from this checkout instead: `./install.sh` (package `nacre`). - **Debian, Ubuntu and other apt systems:** `sudo apt install ./Nacre--amd64.deb`. Needs WebKitGTK 6.0 and a glibc as new as the one named in the package (recent releases only). -- **Nix:** `nix profile install git+https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre` (flake), or +- **Nix:** `nix profile install git+https://astar76sites.tail7c4f5e.ts.net/git/astar76/Nacre` (flake), or `callPackage ./packaging/nix { }`. - **Any distribution:** unpack `Nacre--Linux-x86_64.tar.gz` and run `sh install.sh` (your home, `~/.local`, no root) or `sh install.sh --system` (`/usr/local`). `sh uninstall.sh` removes it; `--purge` also deletes your From d529088b6b613190afe7b5b16bb98051f74ccdb7 Mon Sep 17 00:00:00 2001 From: astar76 Date: Wed, 2 Dec 2026 12:15:11 -0600 Subject: [PATCH 2/7] docs: Astar Hub moved to astar76sites.parore-gila.ts.net Co-Authored-By: Claude Opus 5.5 --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c19730b..3e1936e 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Linux only: WebKitGTK has no Windows or macOS build. ## Install -Downloads are on the [Releases page](https://astar76sites.tail7c4f5e.ts.net/git/astar76/Nacre/releases). Check them +Downloads are on the [Releases page](https://astar76sites.parore-gila.ts.net/git/astar76/Nacre/releases). Check them against `SHA256SUMS-`. - **Arch Linux:** `sudo pacman -U Nacre--arch-x86_64.pkg.tar.zst` (package `nacre-bin`; remove it with @@ -23,7 +23,7 @@ against `SHA256SUMS-`. To build from this checkout instead: `./install.sh` (package `nacre`). - **Debian, Ubuntu and other apt systems:** `sudo apt install ./Nacre--amd64.deb`. Needs WebKitGTK 6.0 and a glibc as new as the one named in the package (recent releases only). -- **Nix:** `nix profile install git+https://astar76sites.tail7c4f5e.ts.net/git/astar76/Nacre` (flake), or +- **Nix:** `nix profile install git+https://astar76sites.parore-gila.ts.net/git/astar76/Nacre` (flake), or `callPackage ./packaging/nix { }`. - **Any distribution:** unpack `Nacre--Linux-x86_64.tar.gz` and run `sh install.sh` (your home, `~/.local`, no root) or `sh install.sh --system` (`/usr/local`). `sh uninstall.sh` removes it; `--purge` also deletes your From 44a83e87b5094caa203f21ec3b42ba342705b3e1 Mon Sep 17 00:00:00 2001 From: astar76 Date: Wed, 2 Dec 2026 16:26:01 -0600 Subject: [PATCH 3/7] Move Astar Hub links to astar76.com Co-Authored-By: Claude Opus 5.5 --- README.md | 4 ++-- docs/PROGRESS.md | 2 +- packaging/arch-bin/.SRCINFO | 4 ++-- packaging/arch-bin/PKGBUILD | 2 +- packaging/arch/PKGBUILD | 2 +- packaging/nix/default.nix | 4 ++-- src/store/settings.rs | 2 +- src/updates.rs | 2 +- tools/package.sh | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 3e1936e..ff8d77f 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Linux only: WebKitGTK has no Windows or macOS build. ## Install -Downloads are on the [Releases page](https://astar76sites.parore-gila.ts.net/git/astar76/Nacre/releases). Check them +Downloads are on the [Releases page](https://astar76.com/git/astar76/Nacre/releases). Check them against `SHA256SUMS-`. - **Arch Linux:** `sudo pacman -U Nacre--arch-x86_64.pkg.tar.zst` (package `nacre-bin`; remove it with @@ -23,7 +23,7 @@ against `SHA256SUMS-`. To build from this checkout instead: `./install.sh` (package `nacre`). - **Debian, Ubuntu and other apt systems:** `sudo apt install ./Nacre--amd64.deb`. Needs WebKitGTK 6.0 and a glibc as new as the one named in the package (recent releases only). -- **Nix:** `nix profile install git+https://astar76sites.parore-gila.ts.net/git/astar76/Nacre` (flake), or +- **Nix:** `nix profile install git+https://astar76.com/git/astar76/Nacre` (flake), or `callPackage ./packaging/nix { }`. - **Any distribution:** unpack `Nacre--Linux-x86_64.tar.gz` and run `sh install.sh` (your home, `~/.local`, no root) or `sh install.sh --system` (`/usr/local`). `sh uninstall.sh` removes it; `--purge` also deletes your diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md index 69dfa4a..d513e67 100644 --- a/docs/PROGRESS.md +++ b/docs/PROGRESS.md @@ -589,6 +589,6 @@ Later: S010 list: user checks the Discord icon with their own client (the Discor - Shortcut icons: a favicon cache by host (today only open tabs' favicons show). - Interface size above ~110 % on a narrow (772 px) window clips wide segmented rows at the right (R1-21 visible run). - A test run (fresh profile, internet) moves ~200 KB before the first page and looks up the update host - (archlinux.tail7c4f5e.ts.net); find out which background fetch it is, maybe skip it in smoke runs (S007). + (astar76.com); find out which background fetch it is, maybe skip it in smoke runs (S007). - Downloads at addresses that give no hint (no extension, no "download"-like path) aren't probed, so they aren't treated as downloads (what Servo then shows wasn't checked) (S007). diff --git a/packaging/arch-bin/.SRCINFO b/packaging/arch-bin/.SRCINFO index 90059f1..1247604 100644 --- a/packaging/arch-bin/.SRCINFO +++ b/packaging/arch-bin/.SRCINFO @@ -2,7 +2,7 @@ pkgbase = nacre-bin pkgdesc = A web browser built on WebKitGTK pkgver = 0.4.1 pkgrel = 1 - url = https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre + url = https://astar76.com/git/astar76/Nacre arch = x86_64 license = MPL-2.0 depends = glibc>=2.43 @@ -29,7 +29,7 @@ pkgbase = nacre-bin conflicts = nacre options = !strip options = !debug - source = Nacre-0.4.1-Linux-x86_64.tar.gz::https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre/releases/download/v0.4.1/Nacre-0.4.1-Linux-x86_64.tar.gz + source = Nacre-0.4.1-Linux-x86_64.tar.gz::https://astar76.com/git/astar76/Nacre/releases/download/v0.4.1/Nacre-0.4.1-Linux-x86_64.tar.gz sha256sums = 35902a2a539a53320814e9fd4ff670c118153fd8eaa6c788ef2dcf37bdcb2cff pkgname = nacre-bin diff --git a/packaging/arch-bin/PKGBUILD b/packaging/arch-bin/PKGBUILD index 744cbd1..7059359 100644 --- a/packaging/arch-bin/PKGBUILD +++ b/packaging/arch-bin/PKGBUILD @@ -6,7 +6,7 @@ pkgver=0.4.1 pkgrel=1 pkgdesc='A web browser built on WebKitGTK' arch=('x86_64') -url='https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre' +url='https://astar76.com/git/astar76/Nacre' license=('MPL-2.0') depends=('glibc>=2.43' 'gcc-libs' 'webkitgtk-6.0' 'gtk4' 'libsoup3' 'libepoxy' 'gstreamer' 'gst-plugins-base' 'gst-plugins-good' 'gst-plugins-bad' 'gst-libav' 'dbus' 'pam' 'hicolor-icon-theme' 'xdg-utils') optdepends=( diff --git a/packaging/arch/PKGBUILD b/packaging/arch/PKGBUILD index dd0fc14..b01b283 100644 --- a/packaging/arch/PKGBUILD +++ b/packaging/arch/PKGBUILD @@ -4,7 +4,7 @@ pkgver=0.4.0 pkgrel=1 pkgdesc="A web browser built on WebKitGTK" arch=(x86_64) -url="https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre" +url="https://astar76.com/git/astar76/Nacre" license=(MPL-2.0) depends=(webkitgtk-6.0 gtk4 gst-plugins-base gst-plugins-good gst-plugins-bad gst-libav dbus pam glibc libgcc libepoxy libsoup3 gstreamer hicolor-icon-theme xdg-utils) makedepends=(cargo git pkgconf) diff --git a/packaging/nix/default.nix b/packaging/nix/default.nix index 6fb4f28..477a2ce 100644 --- a/packaging/nix/default.nix +++ b/packaging/nix/default.nix @@ -6,7 +6,7 @@ stdenv.mkDerivation rec { pname = "nacre"; version = "0.4.1"; src = fetchurl { - url = "https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre/releases/download/v${version}/Nacre-${version}-Linux-x86_64.tar.gz"; + url = "https://astar76.com/git/astar76/Nacre/releases/download/v${version}/Nacre-${version}-Linux-x86_64.tar.gz"; hash = "sha256-NZAqKlOaUzIIFOn9T/ZwwRgVP9jqpseI7y3PN73LLP8="; }; nativeBuildInputs = [ autoPatchelfHook makeWrapper wrapGAppsHook4 ]; @@ -24,7 +24,7 @@ stdenv.mkDerivation rec { meta = { description = "A web browser built on WebKitGTK"; - homepage = "https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre"; + homepage = "https://astar76.com/git/astar76/Nacre"; license = lib.licenses.mpl20; platforms = [ "x86_64-linux" ]; mainProgram = "nacre"; diff --git a/src/store/settings.rs b/src/store/settings.rs index 2db7f01..97934ef 100644 --- a/src/store/settings.rs +++ b/src/store/settings.rs @@ -418,7 +418,7 @@ pub struct Update { impl Default for Update { fn default() -> Self { - Self { repo: "https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre".to_owned(), last_check: 0, auto_check: true, available: String::new() } + Self { repo: "https://astar76.com/git/astar76/Nacre".to_owned(), last_check: 0, auto_check: true, available: String::new() } } } diff --git a/src/updates.rs b/src/updates.rs index f3f8dee..86931f7 100644 --- a/src/updates.rs +++ b/src/updates.rs @@ -91,7 +91,7 @@ mod tests { #[test] fn api_urls() { - assert_eq!(api_url("https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre").as_deref(), Some("https://archlinux.tail7c4f5e.ts.net/git/api/v1/repos/astar76/Nacre/releases/latest")); + assert_eq!(api_url("https://astar76.com/git/astar76/Nacre").as_deref(), Some("https://astar76.com/git/api/v1/repos/astar76/Nacre/releases/latest")); assert_eq!(api_url("https://github.com/a/b.git").as_deref(), Some("https://api.github.com/repos/a/b/releases/latest")); assert!(parse_version("v0.10.0") > parse_version("0.9.9")); } diff --git a/tools/package.sh b/tools/package.sh index 43e5129..a884096 100755 --- a/tools/package.sh +++ b/tools/package.sh @@ -3,7 +3,7 @@ set -euo pipefail root=$(cd "$(dirname "$0")/.." && pwd) APP=nacre NAME=Nacre DESKTOP=dev.nacre.Nacre.desktop -URL=https://archlinux.tail7c4f5e.ts.net/git/astar76/Nacre +URL=https://astar76.com/git/astar76/Nacre ver=$(sed -n 's/^version = "\(.*\)"/\1/p' "$root/Cargo.toml" | head -n 1) BINS=(nacre) EXTRA_ELF=(libnacre_webext.so) LICENSE=MPL-2.0 NIX_LICENSE=mpl20 SUMMARY='A web browser built on WebKitGTK' @@ -130,7 +130,7 @@ cat > "$d/control/control" < +Maintainer: astar76 Installed-Size: $size Depends: libc6 (>= $glibc)${DEB_DEPENDS:+, $DEB_DEPENDS} ${DEB_RECOMMENDS:+Recommends: $DEB_RECOMMENDS From af09e4d3594c3e7f343e93a2f010f77bc1feda0e Mon Sep 17 00:00:00 2001 From: astar76 Date: Thu, 3 Dec 2026 10:06:15 -0600 Subject: [PATCH 4/7] Follow desktop colours live: watch scheme.json and kdeglobals, take Caelestia's mode Co-Authored-By: Claude Opus 5.5 --- docs/PROGRESS.md | 8 ++++++- src/app.rs | 17 ++++++++++++--- src/theme.rs | 54 +++++++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 74 insertions(+), 5 deletions(-) diff --git a/docs/PROGRESS.md b/docs/PROGRESS.md index d513e67..7d2cbaf 100644 --- a/docs/PROGRESS.md +++ b/docs/PROGRESS.md @@ -575,6 +575,12 @@ Later: S010 list: user checks the Discord icon with their own client (the Discor - Not done: named profiles, a master-password vault, the old reading list, settings and cookies of the old Nacre; the native file dialog; the user's real data (they press Import). - Later: the binary logs a CRITICAL about the build folder's tests/smoke/pages (compiled-in path) at start; `install.sh` has no lock against running twice and wipes `target/` even while a cargo build uses it. +## Desktop colours live (2026-12-03) +- Nacre follows Caelestia's `scheme.json` and KDE's `kdeglobals` live: the tick checks their mtimes (`theme::file_stamps`) about every second; on a change it re-reads the system accent and dark mode and restyles every window (no restart). +- "System" theme mode now takes Caelestia's `mode` (dark/light) first, then GTK, then GNOME (`theme::system_dark`). +- Verified: `cargo test` 103 + webext 1; hidden smoke on a throwaway home: scheme.json rewritten from purple/dark to green/light mid-run, the new tab page and chrome went green and light (before/after shots read). +- Not done: GNOME portal `accent-color` live watch. + ## Later - A link followed inside a frame still goes through the tab's navigation policy (WebKit's GTK API has no frame info; S050). - file:// media outside the XDG user folders doesn't play (WebKit sandbox, D-043). @@ -583,7 +589,7 @@ Later: S010 list: user checks the Discord icon with their own client (the Discor - Bookmark flyout stays open after switching tabs and shows the old page's bookmark (S006 keys.txt shot). - Wikipedia search widget ignores the selftest's Enter (plain forms submit); check with a real keyboard (S006). - YouTube's result list lays out at zero size; CSS mask-image icons paint as squares (Servo layout, S006). -- System accent: watch caelestia scheme.json / the portal `accent-color` and restyle live (R1-11). +- System accent: the GNOME portal `accent-color` isn't watched live (only Caelestia's scheme.json and kdeglobals). - Reader mode, split view, translate, real gamepad rumble (D-002: not planned for now). - AppImage / tar.gz release (D-001, D-054). - Shortcut icons: a favicon cache by host (today only open tabs' favicons show). diff --git a/src/app.rs b/src/app.rs index d5b4bbd..679d179 100644 --- a/src/app.rs +++ b/src/app.rs @@ -143,7 +143,7 @@ pub struct Shared { pub vpn_status: RefCell, pub speller: RefCell>, pub spell_status: RefCell, - pub system_accent: Option, + pub system_accent: Cell>, pub user_agent: RefCell, pub devtools: RefCell>, pub update: RefCell>, @@ -241,6 +241,8 @@ pub struct App { /// A quit or window close waiting for the pages' `beforeunload`. pub shutdown: Option, last_tick: Instant, + /// Modification times of the desktop's colour files (`theme::desktop_files`), to follow them live. + desktop_stamps: Vec>, last_save: Instant, last_slow: Instant, /// Sealed cookies (D-037), `None` when they are kept for the run only. @@ -313,7 +315,7 @@ impl App { vpn_status: RefCell::new(VpnStatus::Off), speller: RefCell::new(None), spell_status: RefCell::new(String::new()), - system_accent: theme::system_accent(), + system_accent: Cell::new(theme::system_accent()), user_agent: RefCell::new(String::new()), devtools: RefCell::new(None), update: RefCell::new(None), @@ -368,6 +370,7 @@ impl App { exiting: false, shutdown: None, last_tick: Instant::now(), + desktop_stamps: theme::file_stamps(&theme::desktop_files()), last_save: Instant::now(), last_slow: Instant::now() - Duration::from_secs(3600), cookies: None, @@ -1277,6 +1280,14 @@ impl App { if self.shared.toasts.borrow().len() != before { self.redraw_all(); } + // A new wallpaper, scheme or mode on the desktop (Caelestia's scheme.json, kdeglobals). + let stamps = theme::file_stamps(&theme::desktop_files()); + if stamps != self.desktop_stamps { + self.desktop_stamps = stamps; + self.shared.system_accent.set(theme::system_accent()); + *self.shared.system_dark.borrow_mut() = theme::system_dark(gtk_dark()); + self.restyle_all(); + } // Loading spinners and media position need regular redraws. let busy: Vec = self.windows.iter().filter(|(_, w)| w.tabs.iter().any(|t| t.loading() || t.audible())).map(|(id, _)| *id).collect(); for w in busy { @@ -1618,7 +1629,7 @@ impl App { let settings = self.shared.settings.borrow(); let dark = theme::is_dark(&settings, *self.shared.system_dark.borrow()); let site = win.tab().and_then(Tab::site_colour); - let palette = theme::Palette::new(theme::seed(&settings, site, self.shared.system_accent), dark, &settings.theme.variant, settings.theme.contrast); + let palette = theme::Palette::new(theme::seed(&settings, site, self.shared.system_accent.get()), dark, &settings.theme.variant, settings.theme.contrast); let ctx = win.ctx(); theme::apply(&ctx, &palette, &settings); // Always, so going back to 100 % takes effect too. diff --git a/src/theme.rs b/src/theme.rs index 7625de4..8f388a0 100644 --- a/src/theme.rs +++ b/src/theme.rs @@ -169,8 +169,36 @@ fn caelestia_primary(text: &str) -> Option { parse_hex(hex) } -/// Whether the system prefers dark ("System" mode): GTK's answer, else the GNOME setting. +/// The files the desktop's colours come from: Caelestia's scheme.json and KDE's kdeglobals. +pub fn desktop_files() -> Vec { + [dirs::state_dir().map(|d| d.join("caelestia/scheme.json")), dirs::config_dir().map(|d| d.join("kdeglobals"))].into_iter().flatten().collect() +} + +/// Modification times of `files` (None: missing); a different answer means the desktop's colours may have changed. +pub fn file_stamps(files: &[std::path::PathBuf]) -> Vec> { + files.iter().map(|f| std::fs::metadata(f).and_then(|m| m.modified()).ok()).collect() +} + +/// The light/dark mode of a Caelestia `scheme.json` (`{"mode": "dark", ...}`). +fn caelestia_dark(text: &str) -> Option { + let json: serde_json::Value = serde_json::from_str(text).ok()?; + match json.get("mode")?.as_str()? { + "dark" => Some(true), + "light" => Some(false), + _ => None, + } +} + +/// Whether the system prefers dark ("System" mode): Caelestia's scheme mode, else GTK's answer, else the GNOME +/// setting. pub fn system_dark(gtk_dark: Option) -> bool { + #[cfg(unix)] + if let Some(path) = dirs::state_dir().map(|d| d.join("caelestia/scheme.json")) + && let Ok(text) = std::fs::read_to_string(path) + && let Some(dark) = caelestia_dark(&text) + { + return dark; + } match gtk_dark { Some(dark) => dark, None => { @@ -714,6 +742,30 @@ mod tests { assert_eq!(caelestia_primary("not json"), None); } + #[test] + fn caelestia_scheme_mode() { + assert_eq!(caelestia_dark(r#"{"mode": "light", "colours": {}}"#), Some(false)); + assert_eq!(caelestia_dark(r#"{"mode": "dark"}"#), Some(true)); + assert_eq!(caelestia_dark(r#"{"colours": {}}"#), None); + } + + #[test] + fn desktop_file_changes_are_seen() { + let dir = std::env::temp_dir().join(format!("nacre-theme-test-{}", crate::util::random_hex(6))); + std::fs::create_dir_all(&dir).unwrap(); + let files = vec![dir.join("scheme.json"), dir.join("kdeglobals")]; + let missing = file_stamps(&files); + assert_eq!(missing, vec![None, None]); + std::fs::write(&files[0], "{}").unwrap(); + let written = file_stamps(&files); + assert_ne!(written, missing); + assert_eq!(file_stamps(&files), written); + let later = std::time::SystemTime::now() + std::time::Duration::from_secs(5); + std::fs::File::options().write(true).open(&files[0]).unwrap().set_modified(later).unwrap(); + assert_ne!(file_stamps(&files), written); + std::fs::remove_dir_all(&dir).unwrap(); + } + #[test] fn colours() { assert_eq!(parse_hex("#6750A4"), Some(Color32::from_rgb(0x67, 0x50, 0xA4))); From 297034eb0d8e9682b50a264f7bdc27615e0a7ad0 Mon Sep 17 00:00:00 2001 From: astar76 Date: Thu, 3 Dec 2026 10:35:45 -0600 Subject: [PATCH 5/7] Discord: only send icons Discord can show (no ICO/SVG), fall back to og:image discord.com only has /assets/favicon.ico, which Discord draws as "?". Co-Authored-By: Claude Opus 5.5 --- src/actions.rs | 8 +++++--- src/discord.rs | 41 +++++++++++++++++++++-------------------- src/tabs.rs | 3 +++ 3 files changed, 29 insertions(+), 23 deletions(-) diff --git a/src/actions.rs b/src/actions.rs index 7e84342..833583c 100644 --- a/src/actions.rs +++ b/src/actions.rs @@ -1672,7 +1672,8 @@ impl App { "ready" => {}, "meta" => { let color = crate::theme::parse_css_color(&s(&data, "theme_color")); - let icon = data.get("icons").and_then(|v| v.as_array()).and_then(|a| a.first()).map(|i| s(i, "href")).unwrap_or_default(); + let icons: Vec = data.get("icons").and_then(|v| v.as_array()).map(|a| a.iter().map(|i| s(i, "href")).collect()).unwrap_or_default(); + let icon = icons.first().cloned().unwrap_or_default(); let changed; { let tab = &mut self.windows.get_mut(&w).expect("found").tabs[i]; @@ -1680,6 +1681,7 @@ impl App { tab.theme_color = color; tab.site_name = s(&data, "site_name"); tab.page_image = s(&data, "image"); + tab.rpc_icon = icons.iter().find(|i| crate::discord::usable_image(i)).cloned().unwrap_or_default(); tab.manifest = s(&data, "manifest"); if !icon.is_empty() { tab.favicon_url = icon; @@ -2242,14 +2244,14 @@ impl App { } let mut state = state.clone(); state.position = state.position_at(*received); - activity = crate::discord::media_activity(&settings, &url, &tab.title, &tab.favicon_url, &state, tab.id, &mut self.presence_started); + activity = crate::discord::media_activity(&settings, &url, &tab.title, &[&tab.rpc_icon, &tab.page_image], &state, tab.id, &mut self.presence_started); } if activity.is_none() && let Some(win) = self.current_window().and_then(|w| self.windows.get(&w)) && let Some(tab) = win.tab() && tab.page.is_none() && let Ok(url) = Url::parse(&tab.url) - && let Some(act) = crate::discord::browse_activity(&settings, &url, &tab.title, &tab.site_name, &tab.page_image, &tab.favicon_url, tab.arrived_ms as i64) + && let Some(act) = crate::discord::browse_activity(&settings, &url, &tab.title, &tab.site_name, &tab.page_image, &tab.rpc_icon, tab.arrived_ms as i64) { activity = Some((act, settings.client_id.clone())); } diff --git a/src/discord.rs b/src/discord.rs index 1691799..3872f79 100644 --- a/src/discord.rs +++ b/src/discord.rs @@ -111,17 +111,17 @@ fn https_short(url: &str) -> bool { url.starts_with("https://") && url.len() <= 256 } -/// Image for the activity's large icon: the first of `images` Discord can fetch (short https URL), -/// else the page origin's /favicon.ico (data:/http:/long favicon URLs are unusable; no third-party -/// service, so no visited host leaks beyond Discord). Empty for pages without a host. -fn icon_url(images: &[&str], page: &Url) -> String { - if let Some(img) = images.iter().find(|i| https_short(i)) { - return (*img).to_owned(); - } - match page.host_str() { - Some(host) if matches!(page.scheme(), "http" | "https") => format!("https://{host}/favicon.ico"), - _ => String::new(), - } +/// An image Discord can show: a short https URL that isn't ICO or SVG (Discord draws those as "?"). +pub fn usable_image(url: &str) -> bool { + let path = url.split(['?', '#']).next().unwrap_or("").to_ascii_lowercase(); + https_short(url) && !path.ends_with(".ico") && !path.ends_with(".svg") +} + +/// Image for the activity's large icon: the first of `images` Discord can show, else none, so +/// Discord shows the application's own icon (no third-party favicon service, so no visited host +/// leaks beyond Discord). +fn icon_url(images: &[&str]) -> String { + images.iter().find(|i| usable_image(i)).map(|i| (*i).to_owned()).unwrap_or_default() } /// Options that Discord clients may refuse; the worker turns them off when it is told so. @@ -133,7 +133,7 @@ pub struct Quirks { /// Activity for a playing (or paused) media tab, plus the application ID to use. /// `started` keeps the progress bar steady between polls: (tab id, title, start ms). -pub fn media_activity(settings: &Rpc, tab_url: &Url, tab_title: &str, favicon: &str, state: &MediaState, tab_id: u64, started: &mut Option<(u64, String, i64)>) -> Option<(Value, String)> { +pub fn media_activity(settings: &Rpc, tab_url: &Url, tab_title: &str, images: &[&str], state: &MediaState, tab_id: u64, started: &mut Option<(u64, String, i64)>) -> Option<(Value, String)> { let (key, name, kind, button) = site_for(&util::host_of(tab_url), settings)?; if state.paused && !settings.show_paused { return None; @@ -149,8 +149,8 @@ pub fn media_activity(settings: &Rpc, tab_url: &Url, tab_title: &str, favicon: & art = format!("https://i.ytimg.com/vi/{vid}/hqdefault.jpg"); } } - if !https_short(&art) { - art = icon_url(&[favicon], tab_url); + if !usable_image(&art) { + art = icon_url(images); } let by = if creator != name { format!("by {creator}") } else { name.clone() }; let mut act = json!({ @@ -212,7 +212,7 @@ pub fn browse_activity(settings: &Rpc, url: &Url, title: &str, site_name: &str, "timestamps": {"start": since_ms}, "assets": {"large_text": clip(&host, 128)}, }); - let icon = icon_url(&[image, favicon], url); + let icon = icon_url(&[image, favicon]); if !icon.is_empty() { act["assets"]["large_image"] = json!(icon); } @@ -490,11 +490,12 @@ mod tests { #[test] fn icon_prefers_fetchable_image_then_falls_back() { - let page = Url::parse("https://example.org/a").unwrap(); - assert_eq!(icon_url(&["https://x.test/a.png", "https://y.test/f.png"], &page), "https://x.test/a.png"); - assert_eq!(icon_url(&["data:image/png;base64,AAAA", "https://y.test/f.png"], &page), "https://y.test/f.png"); + assert_eq!(icon_url(&["https://x.test/a.png", "https://y.test/f.png"]), "https://x.test/a.png"); + assert_eq!(icon_url(&["data:image/png;base64,AAAA", "https://y.test/f.png"]), "https://y.test/f.png"); let long = format!("https://x.test/{}", "a".repeat(300)); - assert_eq!(icon_url(&["", "http://y.test/f.ico", &long], &page), "https://example.org/favicon.ico"); - assert_eq!(icon_url(&[""], &Url::parse("about:blank").unwrap()), ""); + assert_eq!(icon_url(&["", "http://y.test/f.png", &long]), ""); + // Discord draws ICO and SVG as "?" (discord.com only has /assets/favicon.ico). + assert_eq!(icon_url(&["https://discord.com/assets/favicon.ico", "https://x.test/f.SVG?v=2"]), ""); + assert_eq!(icon_url(&["https://x.test/f.ico?v=1", "https://x.test/og.png?w=1"]), "https://x.test/og.png?w=1"); } } diff --git a/src/tabs.rs b/src/tabs.rs index 34133b9..745255b 100644 --- a/src/tabs.rs +++ b/src/tabs.rs @@ -247,6 +247,8 @@ pub struct Tab { pub favicon_colour: Option, pub site_name: String, pub page_image: String, + /// Largest page icon Discord can show (not ICO/SVG), for Rich Presence. + pub rpc_icon: String, pub manifest: String, /// When the user arrived on this page (Discord "browsing" timer), ms. pub arrived_ms: u64, @@ -308,6 +310,7 @@ impl Tab { favicon_colour: None, site_name: String::new(), page_image: String::new(), + rpc_icon: String::new(), manifest: String::new(), arrived_ms: crate::util::now_ms(), context: None, From 82a5adf7c7de6505a0ca9dc1b00587baacb6bf11 Mon Sep 17 00:00:00 2001 From: astar76 Date: Thu, 3 Dec 2026 10:35:59 -0600 Subject: [PATCH 6/7] 0.4.2: release notes, version bump Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 2 +- Cargo.lock | 4 ++-- Cargo.toml | 2 +- docs/releases/0.4.2.md | 9 +++++++++ webext/Cargo.toml | 2 +- 5 files changed, 14 insertions(+), 5 deletions(-) create mode 100644 docs/releases/0.4.2.md diff --git a/CLAUDE.md b/CLAUDE.md index d524846..81517d1 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -37,7 +37,7 @@ Never modify: `~/Documents/Apps/Nacre` (the original Python Nacre, reference onl ## 2. Facts - **Engine**: WebKitGTK 6.0 (`webkit6` crate, `=0.6.1`) in a GTK 4 window; egui draws the chrome in a transparent `Gtk.GLArea` over the web views (D-033, D-035). WebKit tuning data and the engine test: `docs/engine/engine-comparison.md`, `docs/engine/tune/`. The Servo removal inventory (history): `docs/engine/servo-removal.md`. Pages' network work happens in the web process extension `webext/`. -- Cargo package `nacre` 0.4.1, edition 2024, Rust ≥ 1.88. No Servo, vendored crates or patched engine any more; builds take minutes (~2–4 min release), not hours. +- Cargo package `nacre` 0.4.2, edition 2024, Rust ≥ 1.88. No Servo, vendored crates or patched engine any more; builds take minutes (~2–4 min release), not hours. - Status: builds, `cargo test` green, hidden smokes pass; features still to re-verify on WebKit are marked in `docs/FEATURES.md`. - User rules: function first; plain egui UI until everything works; the Material You redesign comes afterwards (see `docs/UI-BRIEF.md`); nothing from the original is dropped silently (engine limits are shown as unavailable, see DESIGN.md "Engine limits"); never connect to Tor or proxies in tests. - Known gaps and things to check at the first build: `docs/REVIEW.md`. Feature list with file and review state: `docs/FEATURES.md`. diff --git a/Cargo.lock b/Cargo.lock index 2036dab..95e447e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1899,7 +1899,7 @@ dependencies = [ [[package]] name = "nacre" -version = "0.4.1" +version = "0.4.2" dependencies = [ "adblock", "arboard", @@ -1935,7 +1935,7 @@ dependencies = [ [[package]] name = "nacre-webext" -version = "0.4.1" +version = "0.4.2" dependencies = [ "glib-sys", "gobject-sys", diff --git a/Cargo.toml b/Cargo.toml index 4894b33..70655a3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nacre" -version = "0.4.1" +version = "0.4.2" edition = "2024" rust-version = "1.88" description = "Nacre, a web browser built on WebKitGTK" diff --git a/docs/releases/0.4.2.md b/docs/releases/0.4.2.md new file mode 100644 index 0000000..a1f50c8 --- /dev/null +++ b/docs/releases/0.4.2.md @@ -0,0 +1,9 @@ +# Nacre 0.4.2 + +- **Follows desktop colours live:** with Caelestia (or KDE colours), Nacre changes colour as soon as the wallpaper or + scheme changes, light or dark included. No restart. +- **Discord Rich Presence icons:** sites whose only icon is an `.ico` or `.svg` (discord.com, for example) no longer + show a "?"; Nacre sends a PNG/JPEG icon or the page's preview image instead. +- Astar Hub links (update check, packages) moved to astar76.com. + +Linux x86_64 only (WebKitGTK has no Windows build). diff --git a/webext/Cargo.toml b/webext/Cargo.toml index 73573a3..b393c93 100644 --- a/webext/Cargo.toml +++ b/webext/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "nacre-webext" -version = "0.4.1" +version = "0.4.2" edition = "2024" rust-version = "1.88" description = "Nacre's WebKit web process extension: request headers, ad blocker stand-ins, blocked counts (D-036)" From 5c6d16ed1a31356817caf34df0d93a03ede7384e Mon Sep 17 00:00:00 2001 From: astar76 Date: Thu, 3 Dec 2026 10:41:26 -0600 Subject: [PATCH 7/7] 0.4.2: packaging (arch-bin PKGBUILD, Nix) Co-Authored-By: Claude Opus 5.5 --- packaging/arch-bin/.SRCINFO | 6 +++--- packaging/arch-bin/PKGBUILD | 4 ++-- packaging/nix/default.nix | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/packaging/arch-bin/.SRCINFO b/packaging/arch-bin/.SRCINFO index 1247604..8d53b6f 100644 --- a/packaging/arch-bin/.SRCINFO +++ b/packaging/arch-bin/.SRCINFO @@ -1,6 +1,6 @@ pkgbase = nacre-bin pkgdesc = A web browser built on WebKitGTK - pkgver = 0.4.1 + pkgver = 0.4.2 pkgrel = 1 url = https://astar76.com/git/astar76/Nacre arch = x86_64 @@ -29,7 +29,7 @@ pkgbase = nacre-bin conflicts = nacre options = !strip options = !debug - source = Nacre-0.4.1-Linux-x86_64.tar.gz::https://astar76.com/git/astar76/Nacre/releases/download/v0.4.1/Nacre-0.4.1-Linux-x86_64.tar.gz - sha256sums = 35902a2a539a53320814e9fd4ff670c118153fd8eaa6c788ef2dcf37bdcb2cff + source = Nacre-0.4.2-Linux-x86_64.tar.gz::https://astar76.com/git/astar76/Nacre/releases/download/v0.4.2/Nacre-0.4.2-Linux-x86_64.tar.gz + sha256sums = c4865f30221bddd62fbb812781cdfe5974c615bebaf73b215e64e3a6867ab97a pkgname = nacre-bin diff --git a/packaging/arch-bin/PKGBUILD b/packaging/arch-bin/PKGBUILD index 7059359..b8dd6aa 100644 --- a/packaging/arch-bin/PKGBUILD +++ b/packaging/arch-bin/PKGBUILD @@ -2,7 +2,7 @@ # Built by tools/package.sh from the release tar.gz (TARBALL=file://… for an offline build); it keeps pkgver, # sha256sums and the glibc floor current. pkgname=nacre-bin -pkgver=0.4.1 +pkgver=0.4.2 pkgrel=1 pkgdesc='A web browser built on WebKitGTK' arch=('x86_64') @@ -20,7 +20,7 @@ provides=('nacre') conflicts=('nacre') options=('!strip' '!debug') source=("Nacre-$pkgver-Linux-x86_64.tar.gz::${TARBALL:-$url/releases/download/v$pkgver/Nacre-$pkgver-Linux-x86_64.tar.gz}") -sha256sums=('35902a2a539a53320814e9fd4ff670c118153fd8eaa6c788ef2dcf37bdcb2cff') +sha256sums=('c4865f30221bddd62fbb812781cdfe5974c615bebaf73b215e64e3a6867ab97a') package() { cd "$srcdir/nacre-$pkgver" diff --git a/packaging/nix/default.nix b/packaging/nix/default.nix index 477a2ce..15d3fec 100644 --- a/packaging/nix/default.nix +++ b/packaging/nix/default.nix @@ -4,10 +4,10 @@ stdenv.mkDerivation rec { pname = "nacre"; - version = "0.4.1"; + version = "0.4.2"; src = fetchurl { url = "https://astar76.com/git/astar76/Nacre/releases/download/v${version}/Nacre-${version}-Linux-x86_64.tar.gz"; - hash = "sha256-NZAqKlOaUzIIFOn9T/ZwwRgVP9jqpseI7y3PN73LLP8="; + hash = "sha256-xIZfMCIb3dYvu4Engc3+WXTGFb669zshXmTjpoZ6uXo="; }; nativeBuildInputs = [ autoPatchelfHook makeWrapper wrapGAppsHook4 ]; buildInputs = [ webkitgtk_6_0 gtk4 libsoup_3 libepoxy pam dbus glib-networking gst_all_1.gstreamer gst_all_1.gst-plugins-base gst_all_1.gst-plugins-good gst_all_1.gst-plugins-bad gst_all_1.gst-libav stdenv.cc.cc.lib ];