From a95c46e23f4d3ac6096909a7eb966c25287a0363 Mon Sep 17 00:00:00 2001 From: Joshua Cold Date: Mon, 23 Nov 2026 14:50:45 -0700 Subject: [PATCH] feat(editor): ship the editor's license notices The editor page bundles CodeMirror and its vim mode, which are MIT licensed. Their notices are now served at riptide://licenses/, so every build carries them, and release packages install them as THIRD-PARTY-LICENSES.txt next to LICENSE. Co-Authored-By: Claude Opus 5.5 --- crates/rt-cef/src/edit.rs | 2 ++ crates/rt-cef/src/scheme.rs | 1 + crates/rt-e2e/tests/internal_pages.rs | 5 +++++ docs/book/src/dev/contributing.md | 2 +- docs/book/src/guide/editor.md | 1 + docs/book/src/guide/terminal.md | 2 +- packaging/aur/riptide-browser-bin/PKGBUILD | 1 + packaging/aur/riptide-browser/PKGBUILD | 1 + packaging/nix/source.nix | 1 + packaging/obs/debian.copyright | 3 ++- packaging/obs/riptide.spec | 3 ++- scripts/package-linux.sh | 7 +++++-- scripts/package-macos-windows.sh | 1 + 13 files changed, 24 insertions(+), 6 deletions(-) diff --git a/crates/rt-cef/src/edit.rs b/crates/rt-cef/src/edit.rs index a1cf881b..3f593f5e 100644 --- a/crates/rt-cef/src/edit.rs +++ b/crates/rt-cef/src/edit.rs @@ -17,6 +17,8 @@ use crate::shell; const TEMPLATE: &str = include_str!("../ui/editor.html"); const BUNDLE: &str = include_str!("../ui/editor.bundle.js"); +/// The bundle's license notices, served at `riptide://licenses/`. +pub const LICENSES: &str = include_str!("../ui/editor.bundle.LICENSES.txt"); /// The page around its data: built once, since the bundle is large. static PARTS: LazyLock<(String, String)> = LazyLock::new(|| { diff --git a/crates/rt-cef/src/scheme.rs b/crates/rt-cef/src/scheme.rs index 6e48a3b4..7d9f3e13 100644 --- a/crates/rt-cef/src/scheme.rs +++ b/crates/rt-cef/src/scheme.rs @@ -66,6 +66,7 @@ fn page(host: &str, path: &str, private: bool) -> Option<(Arc<[u8]>, &'static st ("settings", "/") => Some((themed(crate::settings_page::page()), html)), ("process", "/") => Some((crate::spawn::output_page(), html)), ("edit", path) => Some((themed(crate::edit::page(path)), html)), + ("licenses", "/") => Some((Arc::from(crate::edit::LICENSES.as_bytes()), "text/plain")), _ => None, } } diff --git a/crates/rt-e2e/tests/internal_pages.rs b/crates/rt-e2e/tests/internal_pages.rs index 01dff051..2175800a 100644 --- a/crates/rt-e2e/tests/internal_pages.rs +++ b/crates/rt-e2e/tests/internal_pages.rs @@ -24,6 +24,11 @@ fn changelog_history_and_downloads_pages_open() { b.run(command); b.wait_until(&format!(":{command} opens"), |s| s.tab().title == title); } + b.run("open riptide://licenses/"); + b.wait_eval( + "String(document.body.innerText.includes('@replit/codemirror-vim'))", + "true", + ); } #[test] diff --git a/docs/book/src/dev/contributing.md b/docs/book/src/dev/contributing.md index 721c9281..e45519d6 100644 --- a/docs/book/src/dev/contributing.md +++ b/docs/book/src/dev/contributing.md @@ -8,5 +8,5 @@ Commits follow [Conventional Commits](https://www.conventionalcommits.org), whic - `./task check` runs everything CI does: the [linters](testing.md#linters), unit tests, the e2e tests and the smoke test. - Generated files must be current: `UPDATE_LUA_TYPES=1 cargo test -p rt-config` rewrites `docs/lua/rt.meta.lua`, `docs/settings.md` and the generated reference pages after you add or change a command, setting or default binding. -- The editor page's bundle, `crates/rt-cef/ui/editor.bundle.js`, and its license notices are built from `crates/rt-cef/editor/` by `scripts/update-editor-bundle.sh`. Run it after changing `editor/main.js` or its packages (`--latest` updates them), and commit the result. +- The editor page's bundle, `crates/rt-cef/ui/editor.bundle.js`, and its license notices are built from `crates/rt-cef/editor/` by `scripts/update-editor-bundle.sh`. Run it after changing `editor/main.js` or its packages (`--latest` updates them), and commit the result. The notices, `ui/editor.bundle.LICENSES.txt`, are served at `riptide://licenses/` and shipped in every package as `THIRD-PARTY-LICENSES.txt`. - User-visible changes need documentation in the same change; see [Writing documentation](docs.md). diff --git a/docs/book/src/guide/editor.md b/docs/book/src/guide/editor.md index de701169..366cdbaf 100644 --- a/docs/book/src/guide/editor.md +++ b/docs/book/src/guide/editor.md @@ -35,4 +35,5 @@ The header shows the path, a dot when there are unwritten changes, and the resul - Files must be UTF-8 text and at most 8 MB. - Windows line endings (`\r\n`) are kept as they are. - Syntax highlighting covers Rust, JavaScript and TypeScript, Python, Go, C and C++, Java, HTML, CSS, JSON, YAML, TOML, Markdown, SQL, XML, Lua, shell scripts, Dockerfiles and INI-style config files. Anything else is plain text. +- The editor is built on [CodeMirror](https://codemirror.net/) and its vim mode. Their licenses are at `riptide://licenses/`, and in `THIRD-PARTY-LICENSES.txt` next to the `riptide` binary in release packages. - `:open-editor` and `:config-edit` are separate: they still open `editor.command`, your own editor program, in its own window. diff --git a/docs/book/src/guide/terminal.md b/docs/book/src/guide/terminal.md index 0c053822..7c4d4f81 100644 --- a/docs/book/src/guide/terminal.md +++ b/docs/book/src/guide/terminal.md @@ -18,4 +18,4 @@ The browser listens on a Unix socket in `$XDG_RUNTIME_DIR/riptide/` (or the data The tab bar, status bar and overlay are HTML pages served from the browser itself at `riptide://ui/…`. Web pages can't link to, frame or redirect to `riptide://` addresses, and only riptide's own pages get the `rt.send()` channel to Rust. The browser accepts only the messages each page is allowed to send. -Pages you can open: `riptide://help/` (`:help`), `riptide://history/` (`:history`), `riptide://downloads/` (`:downloads`), `riptide://settings/` (`:settings`), `riptide://changelog/` (`:changelog`) and `riptide://edit/` ([`:edit`](editor.md)). The first start after an update opens the changelog in a background tab when the version's minor or major number changed; `changelog_after_upgrade` (`major`, `minor`, `patch` or `never`) sets how big a step that takes. +Pages you can open: `riptide://help/` (`:help`), `riptide://history/` (`:history`), `riptide://downloads/` (`:downloads`), `riptide://settings/` (`:settings`), `riptide://changelog/` (`:changelog`), `riptide://edit/` ([`:edit`](editor.md)) and `riptide://licenses/`. The first start after an update opens the changelog in a background tab when the version's minor or major number changed; `changelog_after_upgrade` (`major`, `minor`, `patch` or `never`) sets how big a step that takes. diff --git a/packaging/aur/riptide-browser-bin/PKGBUILD b/packaging/aur/riptide-browser-bin/PKGBUILD index e52f075a..44e0fd43 100644 --- a/packaging/aur/riptide-browser-bin/PKGBUILD +++ b/packaging/aur/riptide-browser-bin/PKGBUILD @@ -29,4 +29,5 @@ package() { install -Dm644 riptide.svg "$pkgdir/usr/share/icons/hicolor/scalable/apps/riptide.svg" install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" install -Dm644 LICENSE-EXCEPTION "$pkgdir/usr/share/licenses/$pkgname/LICENSE-EXCEPTION" + install -Dm644 THIRD-PARTY-LICENSES.txt "$pkgdir/usr/share/licenses/$pkgname/THIRD-PARTY-LICENSES.txt" } diff --git a/packaging/aur/riptide-browser/PKGBUILD b/packaging/aur/riptide-browser/PKGBUILD index 92bd41e5..fa4febd1 100644 --- a/packaging/aur/riptide-browser/PKGBUILD +++ b/packaging/aur/riptide-browser/PKGBUILD @@ -61,4 +61,5 @@ package() { install -Dm644 riptide.svg "$pkgdir/usr/share/icons/hicolor/scalable/apps/riptide.svg" install -Dm644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE" install -Dm644 LICENSE-EXCEPTION "$pkgdir/usr/share/licenses/$pkgname/LICENSE-EXCEPTION" + install -Dm644 THIRD-PARTY-LICENSES.txt "$pkgdir/usr/share/licenses/$pkgname/THIRD-PARTY-LICENSES.txt" } diff --git a/packaging/nix/source.nix b/packaging/nix/source.nix index 170b1b11..4b3a2da5 100644 --- a/packaging/nix/source.nix +++ b/packaging/nix/source.nix @@ -129,6 +129,7 @@ rustPlatform.buildRustPackage { cp -rL "$release/$f" $out/lib/riptide/ done chmod -R u+w $out/lib/riptide + install -Dm644 crates/rt-cef/ui/editor.bundle.LICENSES.txt $out/lib/riptide/THIRD-PARTY-LICENSES.txt # The Nix store can't hold a setuid sandbox helper, so there is none; the # sandbox uses user namespaces instead, which NixOS allows by default. makeWrapper $out/lib/riptide/riptide $out/bin/riptide \ diff --git a/packaging/obs/debian.copyright b/packaging/obs/debian.copyright index 9811841a..b9f7fd4a 100644 --- a/packaging/obs/debian.copyright +++ b/packaging/obs/debian.copyright @@ -8,4 +8,5 @@ License: GPL-3.0-or-later On Debian systems, the full text is in /usr/share/common-licenses/GPL-3. With an additional permission under section 7 for loading a content decryption module such as Widevine: /opt/riptide/LICENSE-EXCEPTION. - Chromium's and CEF's licenses are in /opt/riptide/CREDITS.html. + Chromium's and CEF's licenses are in /opt/riptide/CREDITS.html, and those + of the editor page's JavaScript in /opt/riptide/THIRD-PARTY-LICENSES.txt. diff --git a/packaging/obs/riptide.spec b/packaging/obs/riptide.spec index ebd551ea..b86bdea8 100644 --- a/packaging/obs/riptide.spec +++ b/packaging/obs/riptide.spec @@ -29,7 +29,8 @@ Framework (CEF) and controlled from Rust: modes, hints, a command line, and configuration in TOML or Lua. Its license has an additional permission for loading a content decryption module such as Widevine (/opt/riptide/LICENSE-EXCEPTION); Chromium's and CEF's licenses are in -/opt/riptide/CREDITS.html. +/opt/riptide/CREDITS.html, and those of the editor page's JavaScript in +/opt/riptide/THIRD-PARTY-LICENSES.txt. %prep %setup -q -T -c diff --git a/scripts/package-linux.sh b/scripts/package-linux.sh index 6f017fab..fbb72ba5 100755 --- a/scripts/package-linux.sh +++ b/scripts/package-linux.sh @@ -59,6 +59,7 @@ for f in "${files[@]}"; do done cp -a "$build/locales" "$stage/" cp LICENSE LICENSE-EXCEPTION README.md CHANGELOG.md packaging/riptide.desktop packaging/riptide.svg "$stage/" +cp crates/rt-cef/ui/editor.bundle.LICENSES.txt "$stage/THIRD-PARTY-LICENSES.txt" crash_config > "$stage/crash_reporter.cfg" # CEF ships libcef.so with debug info (1.4 GB); stripped it is ~260 MB. strip "$stage/riptide" "$stage/libcef.so" "$stage/libvk_swiftshader.so" @@ -131,7 +132,8 @@ License: GPL-3.0-or-later On Debian systems, the full text is in /usr/share/common-licenses/GPL-3. With an additional permission under section 7 for loading a content decryption module such as Widevine: /opt/riptide/LICENSE-EXCEPTION. - Chromium's and CEF's licenses are in /opt/riptide/CREDITS.html. + Chromium's and CEF's licenses are in /opt/riptide/CREDITS.html, and those + of the editor page's JavaScript in /opt/riptide/THIRD-PARTY-LICENSES.txt. EOF # Packaged files must not be group- or world-writable, whatever the umask. chmod -R go-w "$tree" @@ -224,7 +226,8 @@ Framework (CEF) and controlled from Rust: modes, hints, a command line, and configuration in TOML or Lua. Its license has an additional permission for loading a content decryption module such as Widevine (/opt/riptide/LICENSE-EXCEPTION); Chromium's and CEF's licenses are in -/opt/riptide/CREDITS.html. +/opt/riptide/CREDITS.html, and those of the editor page's JavaScript in +/opt/riptide/THIRD-PARTY-LICENSES.txt. %install cp -a "$tree/." %{buildroot}/ diff --git a/scripts/package-macos-windows.sh b/scripts/package-macos-windows.sh index cc265c73..a8828c1e 100755 --- a/scripts/package-macos-windows.sh +++ b/scripts/package-macos-windows.sh @@ -45,6 +45,7 @@ else cp -R "$cef/locales" "$stage/" fi cp LICENSE LICENSE-EXCEPTION README.md CHANGELOG.md "$stage/" +cp crates/rt-cef/ui/editor.bundle.LICENSES.txt "$stage/THIRD-PARTY-LICENSES.txt" if [[ $os-$arch != macos-aarch64 ]]; then cat >"$stage/EXPERIMENTAL.txt" <