From 200db4e9dca32de6f01cc88ed88971a817b08aff Mon Sep 17 00:00:00 2001 From: metamuffin Date: Sat, 28 Oct 2023 21:59:10 +0200 Subject: recursive federation!! --- common/src/config.rs | 1 + server/src/import.rs | 4 ++-- server/src/routes/ui/mod.rs | 2 +- tool/src/main.rs | 4 ++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/common/src/config.rs b/common/src/config.rs index 399e96a..3ccf0e8 100644 --- a/common/src/config.rs +++ b/common/src/config.rs @@ -11,6 +11,7 @@ use std::{collections::HashMap, path::PathBuf}; #[rustfmt::skip] #[derive(Debug, Deserialize, Serialize, Default)] pub struct GlobalConfig { + pub hostname: String, pub brand: String, pub slogan: String, #[serde(default = "default::asset_path")] pub asset_path: PathBuf, diff --git a/server/src/import.rs b/server/src/import.rs index 4019958..8736d05 100644 --- a/server/src/import.rs +++ b/server/src/import.rs @@ -159,8 +159,8 @@ async fn import_remote( .await .context("fetching remote node")?; - if node.federated.is_some() { - return Ok(vec![]); // node is federated, lets not import it + if node.federated.as_ref() == Some(&CONF.hostname) { + return Ok(vec![]); // node is federated from us, lets not import it } let poster = cache_federation_asset(session.to_owned(), opts.id.clone(), "poster").await?; diff --git a/server/src/routes/ui/mod.rs b/server/src/routes/ui/mod.rs index 07098c8..af8cf10 100644 --- a/server/src/routes/ui/mod.rs +++ b/server/src/routes/ui/mod.rs @@ -30,8 +30,8 @@ pub mod home; pub mod layout; pub mod node; pub mod player; -pub mod style; pub mod sort; +pub mod style; pub struct HtmlTemplate<'a>(pub markup::DynRender<'a>); diff --git a/tool/src/main.rs b/tool/src/main.rs index 8a67f30..8135d20 100644 --- a/tool/src/main.rs +++ b/tool/src/main.rs @@ -33,6 +33,8 @@ enum Action { base_path: PathBuf, #[arg(short, long)] brand: String, + #[arg(short, long)] + hostname: String, }, /// Imports a movie, video or series given media and metadata sources New { @@ -90,6 +92,7 @@ fn main() -> anyhow::Result<()> { Action::Init { base_path: path, brand, + hostname, } => { info!("creating new instance..."); std::fs::create_dir_all(path.join("library"))?; @@ -101,6 +104,7 @@ fn main() -> anyhow::Result<()> { File::create_new(path.join("config.yaml"))?, &GlobalConfig { brand: brand.clone(), + hostname, slogan: "Creative slogan here".to_string(), asset_path: path.join("assets"), cache_path: path.join("cache"), -- cgit v1.2.3-70-g09d2