Skip to content

armgit / Pake

Public Imported from GitHub
0

Turn any website into a lightweight desktop app with one command, on macOS, Windows and Linux.

fix: send a WebKit user agent by default on Linux

Tw93bc708adfb4af
diff --git a/src-tauri/pake.json b/src-tauri/pake.json
index 3d6d3eac..b1e872af 100644
--- a/src-tauri/pake.json
+++ b/src-tauri/pake.json
@@ -28,7 +28,7 @@
],
"user_agent": {
"macos": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Safari/605.1.15",
- "linux": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36",
+ "linux": "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/26.0 Safari/605.1.15",
"windows": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36"
},
"system_tray": {
diff --git a/tests/unit/default-user-agent.test.ts b/tests/unit/default-user-agent.test.ts
new file mode 100644
index 00000000..6ba285ec
--- /dev/null
+++ b/tests/unit/default-user-agent.test.ts
@@ -0,0 +1,25 @@
+import fs from 'node:fs';
+import path from 'node:path';
+import { describe, expect, it } from 'vitest';
+
+const { user_agent: userAgent } = JSON.parse(
+ fs.readFileSync(path.join(process.cwd(), 'src-tauri', 'pake.json'), 'utf8'),
+);
+
+describe('default user agents', () => {
+ // YouTube withholds caption tokens from a "Chrome" that runs on WebKit, so
+ // captions never load in Linux apps that claim Chrome (#1406).
+ it.each(['macos', 'linux'])(
+ '%s claims the WebKit engine it runs on',
+ (os) => {
+ expect(userAgent[os]).toMatch(
+ /AppleWebKit\/605\.1\.15 .*Safari\/605\.1\.15$/,
+ );
+ expect(userAgent[os]).not.toContain('Chrome/');
+ },
+ );
+
+ it('windows claims Chromium, matching WebView2', () => {
+ expect(userAgent.windows).toContain('Chrome/');
+ });
+});