Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .changes/unreleased/Fixed-20261102-213555.701648.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
kind: Fixed
body: Release illustrations show localized captions and identify their English text.
time: 2026-11-02T21:35:55.701648+02:00
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Preserve the creator's original license bytes and checksum.
release-media/public/audio/music.LICENSE.txt -text whitespace=cr-at-eol
5 changes: 2 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ jobs:
node-version-file: 'site/.nvmrc'
cache: 'npm'
cache-dependency-path: site/package-lock.json
- run: make release-status release-test site-check site-test site-deploy-check
- run: make release-status release-test release-media-test site-check site-test site-deploy-check

ui:
name: UI (lint, test, build, end-to-end)
Expand Down Expand Up @@ -197,9 +197,8 @@ jobs:
path: |
Lilo/Generated/ChromeUIAssets.swift
Lilo/Generated/NativeStrings.swift
key: ui-${{ steps.ui-lock.outputs.hash }}-${{ hashFiles('lilo-ui/src/**', 'lilo-ui/index.html', 'lilo-ui/svelte.config.js', 'lilo-ui/tsconfig.json', 'lilo-ui/vite.config.ts', 'scripts/embed_chrome_ui.py', 'scripts/generate_native_strings.py') }}
key: ui-${{ steps.ui-lock.outputs.hash }}-${{ hashFiles('release-media/backlog.json', 'release-media/catalog.ts', 'release-media/assets/**/*.png', 'release-media/assets/**/*.mp4', '.changes/v*.md', 'lilo-ui/package.json', 'lilo-ui/releaseNotesPlugin.ts', 'lilo-ui/src/**', 'lilo-ui/index.html', 'lilo-ui/svelte.config.js', 'lilo-ui/tsconfig.json', 'lilo-ui/vite.config.ts', 'scripts/embed_chrome_ui.py', 'scripts/generate_native_strings.py') }}
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
if: steps.ui-cache.outputs.cache-hit != 'true'
with:
node-version-file: '.nvmrc'
cache: 'npm'
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ Vendor/

# Node / Svelte
node_modules/
lilo-ui/public/release-media/*
!lilo-ui/public/release-media/.gitkeep
site/.wrangler/
site/.astro/
site/dist/
Expand Down
4 changes: 4 additions & 0 deletions Lilo.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@
720EEDBF9BC1B4E69E487858 /* TraditionalChineseLocalizationTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 5E6E4C686494304EB3C12561 /* TraditionalChineseLocalizationTests.swift */; };
733FF31D58F45F81D359C723 /* NativeMessaging.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0F387BD7442412B893689E36 /* NativeMessaging.swift */; };
7347B5EE09265AB1363C7C3C /* QRCodeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1957E0C36D17C64137430863 /* QRCodeTests.swift */; };
7363D33C1CF6FD94E68AE402 /* release-media in Resources */ = {isa = PBXBuildFile; fileRef = 2D0A9E30F6B3FBDFADF75B3C /* release-media */; };
7379D653347D408D4DA830D2 /* AppleScriptSupport.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1E2D3017282732FA173A586B /* AppleScriptSupport.swift */; };
743016EA91C1FE0D03CC9B20 /* WKFeatureFlags.swift in Sources */ = {isa = PBXBuildFile; fileRef = D6A559C549D5921A92A75791 /* WKFeatureFlags.swift */; };
743729CA39F3F4BF097F570B /* TabBridgeHandlerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 20DD2266C3DA5546A856F717 /* TabBridgeHandlerTests.swift */; };
Expand Down Expand Up @@ -876,6 +877,7 @@
2C5EAC944C4FA42F1A74E759 /* TerminalView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TerminalView.swift; sourceTree = "<group>"; };
2C5F024425A45722773238EE /* AgentFolders.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgentFolders.swift; sourceTree = "<group>"; };
2C7F940372202EA7DFB8229B /* AgentInput.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AgentInput.swift; sourceTree = "<group>"; };
2D0A9E30F6B3FBDFADF75B3C /* release-media */ = {isa = PBXFileReference; lastKnownFileType = folder; name = "release-media"; path = "lilo-ui/public/release-media"; sourceTree = SOURCE_ROOT; };
2D24BF900BE3A4131D4378A9 /* ProceduralCosmetics.js */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.javascript; path = ProceduralCosmetics.js; sourceTree = "<group>"; };
2D8452792228C102FF9E9860 /* ExtensionLifecycleTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ExtensionLifecycleTests.swift; sourceTree = "<group>"; };
2DFCC36C22B7A6970C465AF4 /* TerminalFrameBuilderTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TerminalFrameBuilderTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2637,6 +2639,7 @@
isa = PBXGroup;
children = (
2142A3F2FD9FF647C3069FF7 /* password-managers */,
2D0A9E30F6B3FBDFADF75B3C /* release-media */,
);
path = public;
sourceTree = "<group>";
Expand Down Expand Up @@ -2924,6 +2927,7 @@
EAE2D8439E5F00188A79A185 /* content-blocker-rules.json in Resources */,
3014BDAE6885561DD0059830 /* password-managers in Resources */,
80E69F9C86FA46A7EBB45114 /* public-suffix-list.dat in Resources */,
7363D33C1CF6FD94E68AE402 /* release-media in Resources */,
ECECE200138640A7DAAB9707 /* shell-integration in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
53 changes: 53 additions & 0 deletions Lilo/Bridge/ChromeUISchemeHandler.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,10 @@ final class ChromeUISchemeHandler: NSObject, WKURLSchemeHandler {
return
}
let path = Self.assetPath(for: url)
if path.hasPrefix("release-media/") {
serveReleaseMedia(path: path, task: urlSchemeTask, url: url)
return
}
if path.hasPrefix(Self.fileIconPrefix) {
let data = Self.fileIconPNG(path: path)
urlSchemeTask.didReceive(URLResponse(
Expand Down Expand Up @@ -106,6 +110,55 @@ final class ChromeUISchemeHandler: NSObject, WKURLSchemeHandler {

func webView(_ webView: WKWebView, stop urlSchemeTask: WKURLSchemeTask) {}

private func serveReleaseMedia(path: String, task: WKURLSchemeTask, url: URL) {
guard path.range(of: #"^release-media/[0-9]+\.[0-9]+\.[0-9]+/[a-z0-9-]+\.(png|mp4)$"#, options: .regularExpression) != nil else {
task.didFailWithError(URLError(.fileDoesNotExist)); return
}
let parts = path.split(separator: "/")
guard let file = Bundle.main.url(forResource: String(parts[2]), withExtension: nil, subdirectory: "release-media/\(parts[1])"),
let data = try? Data(contentsOf: file, options: .mappedIfSafe) else {
task.didFailWithError(URLError(.fileDoesNotExist)); return
}
// RFC 9110: a Range header that is not a single byte range is ignored, and the whole file served.
let requested = task.request.value(forHTTPHeaderField: "Range")
.flatMap { $0.range(of: #"^bytes=[0-9]*-[0-9]*$"#, options: .regularExpression) != nil ? $0 : nil }
let range = Self.mediaByteRange(requested, length: data.count)
var headers = ["Content-Type": path.hasSuffix(".mp4") ? "video/mp4" : "image/png", "Accept-Ranges": "bytes"]
let status: Int
if let range {
status = requested == nil ? 200 : 206
headers["Content-Length"] = String(range.count)
if requested != nil { headers["Content-Range"] = "bytes \(range.lowerBound)-\(range.upperBound - 1)/\(data.count)" }
} else {
status = 416
headers["Content-Length"] = "0"
headers["Content-Range"] = "bytes */\(data.count)"
}
guard let response = HTTPURLResponse(url: url, statusCode: status, httpVersion: "HTTP/1.1", headerFields: headers) else {
task.didFailWithError(URLError(.badServerResponse)); return
}
task.didReceive(response)
if let range { task.didReceive(data[range]) }
task.didFinish()
}

/// WebKit asks for byte ranges to inspect and seek an MP4 without loading the whole film.
static func mediaByteRange(_ header: String?, length: Int) -> Range<Int>? {
guard length > 0 else { return nil }
guard let header else { return 0..<length }
guard header.hasPrefix("bytes=") else { return nil }
let parts = header.dropFirst(6).split(separator: "-", omittingEmptySubsequences: false)
guard parts.count == 2 else { return nil }
if parts[0].isEmpty {
guard let suffix = Int(parts[1]), suffix > 0 else { return nil }
return max(0, length - suffix)..<length
}
guard let start = Int(parts[0]), start >= 0, start < length else { return nil }
if parts[1].isEmpty { return start..<length }
guard let end = Int(parts[1]), end >= start else { return nil }
return start..<(min(end, length - 1) + 1)
}

/// The Finder icon for `file-icon/<extension>`, rendered once per extension.
private static func fileIconPNG(path: String) -> Data {
if let cached = dataByPath[path] { return cached }
Expand Down
10 changes: 10 additions & 0 deletions LiloTests/Bridge/ChromeUISchemeHandlerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,16 @@ import XCTest
@testable import Lilo

final class ChromeUISchemeHandlerTests: XCTestCase {
func testMediaRangesSupportMetadataReadsSeekingAndSuffixes() {
XCTAssertEqual(ChromeUISchemeHandler.mediaByteRange(nil, length: 100), 0..<100)
XCTAssertEqual(ChromeUISchemeHandler.mediaByteRange("bytes=0-1", length: 100), 0..<2)
XCTAssertEqual(ChromeUISchemeHandler.mediaByteRange("bytes=40-", length: 100), 40..<100)
XCTAssertEqual(ChromeUISchemeHandler.mediaByteRange("bytes=-20", length: 100), 80..<100)
XCTAssertEqual(ChromeUISchemeHandler.mediaByteRange("bytes=80-200", length: 100), 80..<100)
for header in ["bytes=100-", "bytes=30-20", "bytes=-0"] {
XCTAssertNil(ChromeUISchemeHandler.mediaByteRange(header, length: 100), header)
}
}
func testAssetPathMapsURLsToEmbeddedKeys() {
XCTAssertEqual(
ChromeUISchemeHandler.assetPath(for: URL(string: "lilo-chrome://ui/index.html")!),
Expand Down
13 changes: 12 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ XCODEGEN := $(CURDIR)/build/xcodegen-$(XCODEGEN_VERSION)/bin/xcodegen
# What validate's UI and bridge builds read, and the stamps they leave once built from them.
UI_SOURCES := $(shell find $(UI_DIR)/src) $(addprefix $(UI_DIR)/,index.html package-lock.json svelte.config.js tsconfig.json vite.config.ts) \
$(UI_DIR)/releaseNotesPlugin.ts $(wildcard .changes/v*.md) scripts/embed_chrome_ui.py scripts/generate_native_strings.py
UI_SOURCES += $(UI_DIR)/package.json release-media/catalog.ts release-media/backlog.json release-media/stage-native.mjs $(wildcard release-media/assets/*/*.png release-media/assets/*/*.mp4)
BRIDGE_SOURCES := $(shell find $(BRIDGE_DIR)/src $(BRIDGE_DIR)/scripts) $(addprefix $(BRIDGE_DIR)/,esbuild.mjs package-lock.json tsconfig.json)
UI_STAMP := build/.ui-build.stamp
BRIDGE_STAMP := build/.ext-bridge-build.stamp
Expand Down Expand Up @@ -87,6 +88,7 @@ TEST_WORKERS = $(shell sysctl -n hw.perflevel0.physicalcpu 2>/dev/null || sysctl
logs logs-stream site-dev site-dev-stop site-preview site-native-preview site-generate site-check site-fix site-test site-e2e site-release-capture site-capture-server site-capture-deps site-lock site-audit site-add-svelte site-playground-deps site-demo-icons site-deploy site-deploy-check emoji-data password-manager-icons \
hooks-install hooks-test lint-commit-message lint-commits \
changie change release-status release-version release-discord release-test
.PHONY: release-media-stage release-media-test

## List the targets
help:
Expand Down Expand Up @@ -217,10 +219,19 @@ release-test: $(CHANGIE)

## Build the embedded Svelte UI bundle and the Swift sources generated from lilo-ui
ui-build: $(UI_DEPS)
@$(MAKE) --no-print-directory release-media-stage
@npm --prefix $(UI_DIR) run build
@python3 scripts/embed_chrome_ui.py
@python3 scripts/generate_native_strings.py

## Stage only the installed release's binary media for the native bundle
release-media-stage:
@node release-media/stage-native.mjs

## Verify native release-media staging without external build tools
release-media-test:
@node --test release-media/*.test.mjs

# Built once when missing so a fresh clone compiles; ui-build, which validate's UI stamp runs on any
# UI source change, refreshes both.
$(CHROME_UI_ASSETS):
Expand Down Expand Up @@ -436,7 +447,7 @@ release-notarize: vt-build $(UI_STAMP) $(BRIDGE_STAMP) $(if $(WEBKIT_FORK_URL),w
# CI's release path: the UI is built or restored beforehand and the committed bridge bundles are checked
# against bridge-src on main, so neither needs npm here.
## Archive and export the release app from the UI already built (CI)
release-archive: vt-build $(CHROME_UI_ASSETS) $(NATIVE_STRINGS) $(if $(WEBKIT_FORK_URL),webkit-fork)
release-archive: release-media-stage vt-build $(CHROME_UI_ASSETS) $(NATIVE_STRINGS) $(if $(WEBKIT_FORK_URL),webkit-fork)
@scripts/build-app.sh release

# dmgbuild writes the window layout into .DS_Store itself, so no Finder or AppleScript is involved.
Expand Down
18 changes: 18 additions & 0 deletions lilo-ui/e2e/whatsNew.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { expect, test, type Page } from "@playwright/test";
import { bootChrome, type FakeHostWorld } from "./fakeHost";
import { initialWorld } from "./fixtures";
import type { ReleaseNotes } from "../src/components/whatsnew/releaseNotes";
import { mediaForRelease } from "../../release-media/catalog";

const release: ReleaseNotes = {
version: "0.6.0", date: "2026-01-15",
Expand Down Expand Up @@ -36,6 +37,23 @@ async function openWhatsNew(page: Page, automatic = false, version = "0.6.0") {
await page.evaluate(({ automatic, version }) => window.__lilo!.receive({ event: "openWhatsNew", automatic, version }), { automatic, version });
}

test("release media labels its English film in the app language", async ({ page }) => {
await bootReleaseChrome(page, initialWorld(), undefined, { ...release, media: mediaForRelease("0.8.0") });
await page.evaluate(() => window.__lilo!.receive({ event: "settingsLoaded", settings: { locale: "fr" } }));
await openWhatsNew(page);
const dialog = page.getByRole("dialog");
const caption = dialog.locator("figcaption");
await expect(caption).toBeVisible();
await expect(caption).toHaveAttribute("lang", "fr");
await expect(caption).toHaveText("Trouvez un onglet et changez celui que vous partagez. Illustration en anglais");
const video = dialog.locator("video");
await expect(video).toHaveAttribute("lang", "en");
await expect(video).toHaveAccessibleName("Trouvez un onglet et changez celui que vous partagez. Illustration en anglais");
await expect(video).toHaveAttribute("controls", "");
await expect(video).toHaveAttribute("preload", "none");
await expect(video).toHaveJSProperty("paused", true);
});

test("the sheet presents installed highlights, all changes and one acknowledgment", async ({ page }) => {
const resourceReads = await bootReleaseChrome(page);
await openWhatsNew(page, true);
Expand Down
Empty file.
8 changes: 7 additions & 1 deletion lilo-ui/releaseNotesPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,26 @@
import { readFileSync } from "node:fs";
import type { Plugin } from "vite";
import { mediaForRelease } from "../release-media/catalog";
import { SUPPORTED_LOCALES } from "./src/lib/i18n/translate";
import { localizeReleaseEditorial, parseReleaseNotes, releaseHighlightsForVersion } from "./src/components/whatsnew/releaseNotes";

function bundledRelease(): string {
const version = (JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")) as { version: string }).version;
const installed = (JSON.parse(readFileSync(new URL("./package.json", import.meta.url), "utf8")) as { version: string }).version;
const version = process.env.LILO_RELEASE_MEDIA_PREVIEW_VERSION || installed;
if (!/^\d+\.\d+\.\d+$/.test(version)) throw new Error("Invalid release preview version");
let markdown = "";
try { markdown = readFileSync(new URL(`../.changes/v${version}.md`, import.meta.url), "utf8"); } catch { /* Development builds may not have prepared notes. */ }
const release = parseReleaseNotes(markdown, version);
release.media = mediaForRelease(version);
const registry = JSON.parse(readFileSync(new URL("./src/components/whatsnew/releaseHighlights.json", import.meta.url), "utf8"));
const editorial = releaseHighlightsForVersion(registry, version);
release.editorial = {};
for (const { code: locale } of SUPPORTED_LOCALES) {
const catalog = JSON.parse(readFileSync(new URL(`./src/lib/i18n/locales/${locale}.json`, import.meta.url), "utf8"));
release.editorial[locale] = localizeReleaseEditorial(editorial, catalog);
}
// The sheet shows notes only for the version the app reports: a preview presents its release as the installed one.
release.version = installed;
return JSON.stringify(release);
}

Expand Down
44 changes: 44 additions & 0 deletions lilo-ui/src/components/whatsnew/ReleaseMedia.svelte
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<script lang="ts">
import { onMount } from "svelte";
import type { ReleaseMedia } from "../../../../release-media/catalog";
import { getLocale, t } from "../../lib/i18n/state.svelte";

let { media, label }: { media: ReleaseMedia; label: string } = $props();
const captionId = $props.id();
const locale = $derived(getLocale());
const caption = $derived(locale === "en" || locale === "fr" ? media.alt[locale] : label);
let video: HTMLVideoElement | undefined = $state();

onMount(() => {
if (!video) return;
const player = video;
const pauseWhenHidden = () => { if (document.hidden) player.pause(); };
const observer = new IntersectionObserver(([entry]) => { if (!entry.isIntersecting) player.pause(); });
observer.observe(player);
document.addEventListener("visibilitychange", pauseWhenHidden);
return () => { player.pause(); observer.disconnect(); document.removeEventListener("visibilitychange", pauseWhenHidden); };
});
</script>

<figure class="release-media" lang={getLocale()}>
{#if media.kind === "video"}
<video bind:this={video} controls playsinline preload="none" poster={media.poster} width={media.width} height={media.height} lang="en" aria-labelledby={captionId}>
<source src={media.video} type="video/mp4" />
<a href={media.video} lang={getLocale()}>{caption}</a>
</video>
{:else}
<img src={media.poster} width={media.width} height={media.height} alt={media.alt.en} lang="en" aria-labelledby={captionId} decoding="async" />
{/if}
<figcaption id={captionId} lang={getLocale()}>
<span>{caption}</span>
<span class="media-language">{t("whatsNew.mediaLanguage")}</span>
</figcaption>
</figure>

<style>
.release-media { margin: 0 0 var(--space-24); }
video, img { display: block; width: 100%; height: auto; aspect-ratio: 16 / 9; border-radius: var(--radius-lg); background: var(--bg-primary); }
video:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
figcaption { margin-top: var(--space-8); color: var(--text-secondary); font-size: var(--font-size-sm); line-height: 1.5; }
.media-language { display: block; margin-top: var(--space-4); font-size: var(--font-size-xs); }
</style>
Loading