aboutsummaryrefslogtreecommitdiff
path: root/base/src/federation.rs
diff options
context:
space:
mode:
Diffstat (limited to 'base/src/federation.rs')
-rw-r--r--base/src/federation.rs18
1 files changed, 11 insertions, 7 deletions
diff --git a/base/src/federation.rs b/base/src/federation.rs
index 9cd04ae..0041e26 100644
--- a/base/src/federation.rs
+++ b/base/src/federation.rs
@@ -3,10 +3,10 @@
which is licensed under the GNU Affero General Public License (version 3); see /COPYING.
Copyright (C) 2023 metamuffin <metamuffin.org>
*/
-use crate::CONF;
+use crate::SECRETS;
use anyhow::anyhow;
use jellyclient::{Instance, Session};
-use jellycommon::user::CreateSessionParams;
+use jellycommon::{config::FederationAccount, user::CreateSessionParams};
use std::{collections::HashMap, sync::Arc};
use tokio::sync::RwLock;
@@ -17,10 +17,12 @@ pub struct Federation {
impl Federation {
pub fn initialize() -> Self {
- let instances = CONF
- .remote_credentials
+ let instances = SECRETS
+ .federation
.iter()
- .map(|(k, (_, _, tls))| (k.to_owned(), Instance::new(k.to_owned(), *tls)))
+ .map(|(k, FederationAccount { tls, .. })| {
+ (k.to_owned(), Instance::new(k.to_owned(), *tls))
+ })
.collect::<HashMap<_, _>>();
Self {
@@ -40,8 +42,10 @@ impl Federation {
if let Some(s) = w.get(host) {
Ok(s.to_owned())
} else {
- let (username, password, _) = CONF
- .remote_credentials
+ let FederationAccount {
+ username, password, ..
+ } = SECRETS
+ .federation
.get(host)
.ok_or(anyhow!("no credentials of the remote server"))?;
let s = Arc::new(