From 755f81e4c1b1b1a59f7cb0a38bbb7c08537a9bbd Mon Sep 17 00:00:00 2001 From: metamuffin Date: Tue, 4 Feb 2025 20:14:10 +0100 Subject: youtube embed --- server/src/routes/mod.rs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) (limited to 'server/src/routes/mod.rs') diff --git a/server/src/routes/mod.rs b/server/src/routes/mod.rs index a0c2de4..dae4909 100644 --- a/server/src/routes/mod.rs +++ b/server/src/routes/mod.rs @@ -23,7 +23,7 @@ use compat::{ r_jellyfin_users_id, r_jellyfin_users_items, r_jellyfin_users_items_item, r_jellyfin_users_public, r_jellyfin_users_views, r_jellyfin_video_stream, }, - youtube::{r_youtube_channel, r_youtube_watch}, + youtube::{r_youtube_channel, r_youtube_embed, r_youtube_watch}, }; use jellybase::{federation::Federation, CONF, SECRETS}; use log::warn; @@ -36,7 +36,9 @@ use rocket::{ get, http::Header, response::{self, Responder}, - routes, Build, Config, Request, Rocket, + routes, + shield::Shield, + Build, Config, Request, Rocket, }; use std::fs::File; use stream::r_stream; @@ -108,6 +110,14 @@ pub fn build_rocket(database: Database, federation: Federation) -> Rocket res.set_header(Header::new("server", "jellything")); Box::pin(async {}) })) + // TODO this would be useful but needs to handle not only the entry-point + // .attach(AdHoc::on_response("frame options", |req, resp| { + // if !req.uri().path().as_str().starts_with("/embed") { + // resp.set_raw_header("X-Frame-Options", "SAMEORIGIN"); + // } + // Box::pin(async {}) + // })) + .attach(Shield::new()) .register("/", catchers![r_catch]) .register("/api", catchers![r_api_catch]) .mount("/assets", FileServer::from(&CONF.asset_path)) @@ -197,6 +207,7 @@ pub fn build_rocket(database: Database, federation: Federation) -> Rocket r_jellyfin_users_views, r_jellyfin_video_stream, r_youtube_channel, + r_youtube_embed, r_youtube_watch, ], ) -- cgit v1.2.3-70-g09d2