From 9bee739a454df6e3d2f7639b139faac0fe8b62be Mon Sep 17 00:00:00 2001 From: trisua Date: Sat, 26 Apr 2025 22:28:08 -0400 Subject: [PATCH] add: allow external proxy to proxy videos --- crates/app/src/public/js/me.js | 10 ++-------- crates/app/src/routes/api/v1/util.rs | 6 +++++- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/crates/app/src/public/js/me.js b/crates/app/src/public/js/me.js index 361f826..a6f0f74 100644 --- a/crates/app/src/public/js/me.js +++ b/crates/app/src/public/js/me.js @@ -420,11 +420,7 @@ params.append("code_challenge_method", "S256"); params.append("code_challenge", challenge); - window.open( - `https://accounts.spotify.com/authorize?${params.toString()}`, - ); - - window.location.reload(); + window.location.href = `https://accounts.spotify.com/authorize?${params.toString()}`; }); }); @@ -621,9 +617,7 @@ `${window.location.origin}/auth/connections_link/LastFm`, ); - window.open(`https://last.fm/api/auth?${params.toString()}`); - - window.location.reload(); + window.location.href = `https://last.fm/api/auth?${params.toString()}`; }); }); diff --git a/crates/app/src/routes/api/v1/util.rs b/crates/app/src/routes/api/v1/util.rs index 3975207..8e1539c 100644 --- a/crates/app/src/routes/api/v1/util.rs +++ b/crates/app/src/routes/api/v1/util.rs @@ -73,7 +73,11 @@ pub async fn proxy_request( if let Some(ct) = stream.headers().get("Content-Type") { let ct = ct.to_str().unwrap(); let bad_ct = ["text/html", "text/plain"]; - if (!ct.starts_with("image/") && !ct.starts_with("font/")) | bad_ct.contains(&ct) { + if (!ct.starts_with("image/") + && !ct.starts_with("font/") + && !ct.starts_with("video/")) + | bad_ct.contains(&ct) + { // if we got html, return default banner (likely an error page) return ( [("Content-Type", "image/svg+xml")],