From 35ae80f183904466667af73c7921b4ade399569a Mon Sep 17 00:00:00 2001 From: metamuffin Date: Wed, 30 Apr 2025 11:46:28 +0200 Subject: split base into asset_token and db --- base/src/federation.rs | 64 -------------------------------------------------- 1 file changed, 64 deletions(-) delete mode 100644 base/src/federation.rs (limited to 'base/src/federation.rs') diff --git a/base/src/federation.rs b/base/src/federation.rs deleted file mode 100644 index b24d113..0000000 --- a/base/src/federation.rs +++ /dev/null @@ -1,64 +0,0 @@ -/* - This file is part of jellything (https://codeberg.org/metamuffin/jellything) - which is licensed under the GNU Affero General Public License (version 3); see /COPYING. - Copyright (C) 2025 metamuffin -*/ - -// use anyhow::anyhow; -// use jellyclient::{Instance, Session}; -// use jellycommon::{config::FederationAccount, user::CreateSessionParams}; -// use std::{collections::HashMap, sync::Arc}; -// use tokio::sync::RwLock; - -// pub struct Federation { -// instances: HashMap, -// sessions: RwLock>>, -// } - -// impl Federation { -// pub fn initialize() -> Self { -// let instances = SECRETS -// .federation -// .iter() -// .map(|(k, FederationAccount { tls, .. })| { -// (k.to_owned(), Instance::new(k.to_owned(), *tls)) -// }) -// .collect::>(); - -// Self { -// instances, -// sessions: Default::default(), -// } -// } - -// pub fn get_instance(&self, host: &String) -> anyhow::Result<&Instance> { -// self.instances.get(host).ok_or(anyhow!("unknown instance")) -// } - -// pub async fn get_session(&self, host: &String) -> anyhow::Result> { -// let mut w = self.sessions.write().await; -// if let Some(s) = w.get(host) { -// Ok(s.to_owned()) -// } else { -// let FederationAccount { -// username, password, .. -// } = SECRETS -// .federation -// .get(host) -// .ok_or(anyhow!("no credentials of the remote server"))?; -// let s = Arc::new( -// self.get_instance(host)? -// .to_owned() -// .login(CreateSessionParams { -// username: username.to_owned(), -// password: password.to_owned(), -// expire: None, -// drop_permissions: None, -// }) -// .await?, -// ); -// w.insert(host.to_owned(), s.clone()); -// Ok(s) -// } -// } -// } -- cgit v1.2.3-70-g09d2