Skip to content

Commit 2d74df7

Browse files
committed
fix: navigate webview to localhost server for HTTP origin
Keep frontendDist as ../out so assets are embedded in binary. Navigate webview to http://localhost:3080 in setup so origin is HTTP. Required for YouTube embeds (Error 153) and Spotify PKCE redirects.
1 parent ab07231 commit 2d74df7

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

src-tauri/src/lib.rs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,16 @@ pub fn run() {
177177
.ok(); // Don't panic if vibrancy fails
178178
}
179179

180+
// ── Navigate to localhost server ────────────────────
181+
// The localhost plugin serves embedded assets via HTTP on LOCALHOST_PORT.
182+
// We navigate the webview there so the origin is http://localhost:PORT
183+
// instead of tauri://localhost — required for YouTube embeds and Spotify PKCE.
184+
{
185+
let window = app.get_webview_window("main").unwrap();
186+
let url = format!("http://localhost:{}", LOCALHOST_PORT);
187+
let _ = window.navigate(url.parse().unwrap());
188+
}
189+
180190
Ok(())
181191
})
182192
.invoke_handler(tauri::generate_handler![

src-tauri/tauri.conf.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"version": "1.2.0",
55
"identifier": "ai.openknot.code-editor",
66
"build": {
7-
"frontendDist": "http://localhost:3080",
7+
"frontendDist": "../out",
88
"devUrl": "http://127.0.0.1:3080",
99
"beforeDevCommand": "pnpm frontend:dev",
1010
"beforeBuildCommand": "pnpm frontend:build"

0 commit comments

Comments
 (0)