aboutsummaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/src/config.rs27
-rw-r--r--server/src/main.rs7
-rw-r--r--server/src/routes/ui/account/session/mod.rs5
-rw-r--r--server/src/routes/ui/account/session/token.rs5
4 files changed, 14 insertions, 30 deletions
diff --git a/server/src/config.rs b/server/src/config.rs
deleted file mode 100644
index 05c56bc..0000000
--- a/server/src/config.rs
+++ /dev/null
@@ -1,27 +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) 2023 metamuffin <metamuffin.org>
-*/
-use serde::{Deserialize, Serialize};
-use std::{collections::HashMap, fs::File, path::PathBuf};
-
-#[derive(Debug, Deserialize, Serialize, Default)]
-pub struct GlobalConfig {
- pub brand: String,
- pub slogan: String,
-
- pub asset_path: PathBuf,
- pub database_path: PathBuf,
- pub library_path: PathBuf,
-
- pub admin_username: String,
- pub admin_password: String,
- pub cookie_key: String,
- pub login_expire: i64,
- pub remote_credentials: HashMap<String, (String, String, bool)>,
-}
-
-pub fn load_global_config() -> GlobalConfig {
- serde_json::from_reader(File::open("data/config.json").unwrap()).unwrap()
-}
diff --git a/server/src/main.rs b/server/src/main.rs
index eba9532..341f72b 100644
--- a/server/src/main.rs
+++ b/server/src/main.rs
@@ -5,19 +5,20 @@
*/
#![feature(lazy_cell)]
-use config::{load_global_config, GlobalConfig};
+use std::fs::File;
use database::Database;
+use jellycommon::config::GlobalConfig;
use jellyremuxer::RemuxerContext;
use once_cell::sync::Lazy;
use rocket::launch;
use routes::build_rocket;
-pub mod config;
pub mod database;
pub mod import;
pub mod routes;
-pub static CONF: Lazy<GlobalConfig> = Lazy::new(load_global_config);
+pub static CONF: Lazy<GlobalConfig> =
+ Lazy::new(|| serde_json::from_reader(File::open("data/config.json").unwrap()).unwrap());
#[launch]
fn rocket() -> _ {
diff --git a/server/src/routes/ui/account/session/mod.rs b/server/src/routes/ui/account/session/mod.rs
index 1546ee7..2a7908f 100644
--- a/server/src/routes/ui/account/session/mod.rs
+++ b/server/src/routes/ui/account/session/mod.rs
@@ -1,3 +1,8 @@
+/*
+ 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) 2023 metamuffin <metamuffin.org>
+*/
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
diff --git a/server/src/routes/ui/account/session/token.rs b/server/src/routes/ui/account/session/token.rs
index f82b475..c8913d3 100644
--- a/server/src/routes/ui/account/session/token.rs
+++ b/server/src/routes/ui/account/session/token.rs
@@ -1,3 +1,8 @@
+/*
+ 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) 2023 metamuffin <metamuffin.org>
+*/
use super::SessionData;
use aes_gcm_siv::{
aead::{generic_array::GenericArray, Aead},