diff options
author | metamuffin <metamuffin@disroot.org> | 2025-04-30 11:46:28 +0200 |
---|---|---|
committer | metamuffin <metamuffin@disroot.org> | 2025-04-30 11:46:28 +0200 |
commit | 35ae80f183904466667af73c7921b4ade399569a (patch) | |
tree | 3a7eec95debbd9ba292436ff989742b8a9b1dff4 /server | |
parent | d6a039a10ac3c81d410beb9b648d29524ca1e278 (diff) | |
download | jellything-35ae80f183904466667af73c7921b4ade399569a.tar jellything-35ae80f183904466667af73c7921b4ade399569a.tar.bz2 jellything-35ae80f183904466667af73c7921b4ade399569a.tar.zst |
split base into asset_token and db
Diffstat (limited to 'server')
-rw-r--r-- | server/Cargo.toml | 1 | ||||
-rw-r--r-- | server/src/api.rs | 5 | ||||
-rw-r--r-- | server/src/compat/jellyfin/mod.rs | 3 | ||||
-rw-r--r-- | server/src/compat/youtube.rs | 3 | ||||
-rw-r--r-- | server/src/config.rs | 4 | ||||
-rw-r--r-- | server/src/helper/session.rs | 6 | ||||
-rw-r--r-- | server/src/logic/stream.rs | 6 | ||||
-rw-r--r-- | server/src/logic/userdata.rs | 3 | ||||
-rw-r--r-- | server/src/main.rs | 3 | ||||
-rw-r--r-- | server/src/routes.rs | 2 | ||||
-rw-r--r-- | server/src/ui/account/mod.rs | 2 | ||||
-rw-r--r-- | server/src/ui/account/settings.rs | 11 | ||||
-rw-r--r-- | server/src/ui/admin/mod.rs | 7 | ||||
-rw-r--r-- | server/src/ui/admin/user.rs | 4 | ||||
-rw-r--r-- | server/src/ui/assets.rs | 4 | ||||
-rw-r--r-- | server/src/ui/home.rs | 3 | ||||
-rw-r--r-- | server/src/ui/items.rs | 4 | ||||
-rw-r--r-- | server/src/ui/node.rs | 4 | ||||
-rw-r--r-- | server/src/ui/player.rs | 4 | ||||
-rw-r--r-- | server/src/ui/search.rs | 3 | ||||
-rw-r--r-- | server/src/ui/stats.rs | 4 |
21 files changed, 38 insertions, 48 deletions
diff --git a/server/Cargo.toml b/server/Cargo.toml index be8abdb..0bc1960 100644 --- a/server/Cargo.toml +++ b/server/Cargo.toml @@ -5,7 +5,6 @@ edition = "2021" [dependencies] jellycommon = { path = "../common" } -jellybase = { path = "../base" } jellystream = { path = "../stream" } jellytranscoder = { path = "../transcoder" } jellyimport = { path = "../import" } diff --git a/server/src/api.rs b/server/src/api.rs index fb5ee88..5ec3c5c 100644 --- a/server/src/api.rs +++ b/server/src/api.rs @@ -4,12 +4,13 @@ Copyright (C) 2025 metamuffin <metamuffin.org> */ use super::ui::error::MyResult; -use crate::{database::Database, helper::A}; -use jellybase::assetfed::AssetInner; +use crate::helper::A; use jellycommon::{user::CreateSessionParams, NodeID, Visibility}; +use jellyimport::asset_token::AssetInner; use jellylogic::{ login::login_logic, session::{AdminSession, Session}, + Database, }; use rocket::{ get, diff --git a/server/src/compat/jellyfin/mod.rs b/server/src/compat/jellyfin/mod.rs index 1c602ca..e8a74d7 100644 --- a/server/src/compat/jellyfin/mod.rs +++ b/server/src/compat/jellyfin/mod.rs @@ -7,7 +7,6 @@ pub mod models; use crate::{helper::A, ui::error::MyResult}; use anyhow::{anyhow, Context}; -use jellybase::database::Database; use jellycommon::{ api::{FilterProperty, NodeFilterSort, SortOrder, SortProperty}, routes::{u_asset, u_node_slug_backdrop, u_node_slug_poster}, @@ -17,7 +16,7 @@ use jellycommon::{ }; use jellylogic::{ filter_sort::filter_and_sort_nodes, login::login_logic, node::DatabaseNodeUserDataExt, - session::Session, + session::Session, Database, }; use jellyui::{get_brand, get_slogan, node_page::aspect_class}; use models::*; diff --git a/server/src/compat/youtube.rs b/server/src/compat/youtube.rs index 67a34fc..0a69d14 100644 --- a/server/src/compat/youtube.rs +++ b/server/src/compat/youtube.rs @@ -5,9 +5,8 @@ */ use crate::{helper::A, ui::error::MyResult}; use anyhow::anyhow; -use jellybase::database::Database; use jellycommon::routes::{u_node_slug, u_node_slug_player}; -use jellylogic::session::Session; +use jellylogic::{session::Session, Database}; use rocket::{get, response::Redirect, State}; #[get("/watch?<v>")] diff --git a/server/src/config.rs b/server/src/config.rs index 68148dd..202948a 100644 --- a/server/src/config.rs +++ b/server/src/config.rs @@ -16,7 +16,7 @@ struct Config { stream: jellystream::Config, cache: jellycache::Config, server: crate::Config, - base: jellybase::Config, + base: jellyimport::asset_token::Config, logic: jellylogic::Config, import: jellyimport::Config, } @@ -36,7 +36,7 @@ pub async fn load_config() -> Result<()> { *jellytranscoder::CONF_PRELOAD.lock().unwrap() = Some(config.transcoder); *jellycache::CONF_PRELOAD.lock().unwrap() = Some(config.cache); *jellylogic::CONF_PRELOAD.lock().unwrap() = Some(config.logic); - *jellybase::CONF_PRELOAD.lock().unwrap() = Some(config.base); + *jellyimport::asset_token::CONF_PRELOAD.lock().unwrap() = Some(config.base); *jellyimport::CONF_PRELOAD.lock().unwrap() = Some(config.import); *crate::CONF_PRELOAD.lock().unwrap() = Some(config.server); *jellyui::CONF_PRELOAD.lock().unwrap() = Some(config.ui); diff --git a/server/src/helper/session.rs b/server/src/helper/session.rs index b77f9fa..7e23152 100644 --- a/server/src/helper/session.rs +++ b/server/src/helper/session.rs @@ -5,8 +5,10 @@ */ use crate::ui::error::MyError; use anyhow::anyhow; -use jellybase::database::Database; -use jellylogic::session::{validate, AdminSession, Session}; +use jellylogic::{ + session::{validate, AdminSession, Session}, + Database, +}; use log::warn; use rocket::{ async_trait, diff --git a/server/src/logic/stream.rs b/server/src/logic/stream.rs index 89589c7..c21edaa 100644 --- a/server/src/logic/stream.rs +++ b/server/src/logic/stream.rs @@ -3,11 +3,11 @@ which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2025 metamuffin <metamuffin.org> */ -use crate::{database::Database, helper::A, ui::error::MyError}; +use crate::{helper::A, ui::error::MyError}; use anyhow::{anyhow, Result}; -use jellybase::assetfed::AssetInner; use jellycommon::{stream::StreamSpec, TrackSource}; -use jellylogic::session::Session; +use jellyimport::asset_token::AssetInner; +use jellylogic::{session::Session, Database}; use jellystream::SMediaInfo; use log::{info, warn}; use rocket::{ diff --git a/server/src/logic/userdata.rs b/server/src/logic/userdata.rs index 25d3893..ac3cb83 100644 --- a/server/src/logic/userdata.rs +++ b/server/src/logic/userdata.rs @@ -4,13 +4,12 @@ Copyright (C) 2025 metamuffin <metamuffin.org> */ use crate::{helper::A, ui::error::MyResult}; -use jellybase::database::Database; use jellycommon::{ routes::u_node_id, user::{NodeUserData, WatchedState}, NodeID, }; -use jellylogic::session::Session; +use jellylogic::{session::Session, Database}; use rocket::{ form::Form, get, post, response::Redirect, serde::json::Json, FromForm, FromFormField, State, UriDisplayQuery, diff --git a/server/src/main.rs b/server/src/main.rs index ea75208..0e237f9 100644 --- a/server/src/main.rs +++ b/server/src/main.rs @@ -9,7 +9,7 @@ use anyhow::Context; use config::load_config; -use database::Database; +use jellylogic::Database; use jellylogic::{admin::log::enable_logging, login::create_admin_account}; use log::{error, info, warn}; use routes::build_rocket; @@ -17,7 +17,6 @@ use serde::{Deserialize, Serialize}; use std::sync::Mutex; use std::{path::PathBuf, process::exit, sync::LazyLock}; -pub use jellybase::database; pub mod api; pub mod compat; pub mod config; diff --git a/server/src/routes.rs b/server/src/routes.rs index da3a389..cc68067 100644 --- a/server/src/routes.rs +++ b/server/src/routes.rs @@ -3,7 +3,6 @@ which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2025 metamuffin <metamuffin.org> */ -use crate::database::Database; use crate::logic::playersync::{r_playersync, PlayersyncChannels}; use crate::ui::account::{r_account_login, r_account_logout, r_account_register}; use crate::ui::{ @@ -62,6 +61,7 @@ use crate::{ }, }; use base64::Engine; +use jellylogic::Database; use log::warn; use rand::random; use rocket::{ diff --git a/server/src/ui/account/mod.rs b/server/src/ui/account/mod.rs index a9c28ea..f3cd450 100644 --- a/server/src/ui/account/mod.rs +++ b/server/src/ui/account/mod.rs @@ -7,7 +7,6 @@ pub mod settings; use super::error::MyError; use crate::{ - database::Database, helper::A, locale::AcceptLanguage, ui::{error::MyResult, home::rocket_uri_macro_r_home}, @@ -18,6 +17,7 @@ use jellyimport::is_importing; use jellylogic::{ login::{hash_password, login_logic}, session::Session, + Database, }; use jellyui::{ account::{AccountLogin, AccountLogout, AccountRegister, AccountRegisterSuccess}, diff --git a/server/src/ui/account/settings.rs b/server/src/ui/account/settings.rs index 5355321..93f442c 100644 --- a/server/src/ui/account/settings.rs +++ b/server/src/ui/account/settings.rs @@ -4,11 +4,10 @@ Copyright (C) 2025 metamuffin <metamuffin.org> */ use super::{format_form_error, hash_password}; -use crate::{database::Database, helper::A, locale::AcceptLanguage, ui::error::MyResult}; -use jellybase::permission::PermissionSetExt; -use jellycommon::user::{PlayerKind, Theme, UserPermission}; +use crate::{helper::A, locale::AcceptLanguage, ui::error::MyResult}; +use jellycommon::user::{PlayerKind, Theme}; use jellyimport::is_importing; -use jellylogic::session::Session; +use jellylogic::{session::Session, Database}; use jellyui::{ account::settings::SettingsPage, locale::{tr, Language}, @@ -74,10 +73,6 @@ pub fn r_account_settings_post( ) -> MyResult<RawHtml<String>> { let AcceptLanguage(lang) = lang; let A(session) = session; - session - .user - .permissions - .assert(&UserPermission::ManageSelf)?; let form = match &form.value { Some(v) => v, diff --git a/server/src/ui/admin/mod.rs b/server/src/ui/admin/mod.rs index 62c5940..9bf85b5 100644 --- a/server/src/ui/admin/mod.rs +++ b/server/src/ui/admin/mod.rs @@ -10,12 +10,11 @@ use super::{ assets::{resolve_asset, AVIF_QUALITY, AVIF_SPEED}, error::MyResult, }; -use crate::{database::Database, helper::A, locale::AcceptLanguage}; +use crate::{helper::A, locale::AcceptLanguage}; use anyhow::{anyhow, Context}; -use jellybase::assetfed::AssetInner; use jellycommon::routes::u_admin_dashboard; -use jellyimport::{import_wrap, is_importing, IMPORT_ERRORS}; -use jellylogic::session::AdminSession; +use jellyimport::{asset_token::AssetInner, import_wrap, is_importing, IMPORT_ERRORS}; +use jellylogic::{session::AdminSession, Database}; use jellyui::{ admin::AdminDashboardPage, render_page, diff --git a/server/src/ui/admin/user.rs b/server/src/ui/admin/user.rs index fb646ab..eedf66c 100644 --- a/server/src/ui/admin/user.rs +++ b/server/src/ui/admin/user.rs @@ -3,11 +3,11 @@ which is licensed under the GNU Affero General Public License (version 3); see /COPYING. Copyright (C) 2025 metamuffin <metamuffin.org> */ -use crate::{database::Database, helper::A, locale::AcceptLanguage, ui::error::MyResult}; +use crate::{helper::A, locale::AcceptLanguage, ui::error::MyResult}; use anyhow::{anyhow, Context}; use jellycommon::user::UserPermission; use jellyimport::is_importing; -use jellylogic::{admin::user::admin_users, session::AdminSession}; +use jellylogic::{admin::user::admin_users, session::AdminSession, Database}; use jellyui::{ admin::user::{AdminUserPage, AdminUsersPage}, render_page, diff --git a/server/src/ui/assets.rs b/server/src/ui/assets.rs index 596661a..4e09417 100644 --- a/server/src/ui/assets.rs +++ b/server/src/ui/assets.rs @@ -6,9 +6,9 @@ use super::error::MyResult; use crate::{helper::{cache::CacheControlFile, A}, CONF}; use anyhow::{anyhow, bail, Context}; -use jellybase::{assetfed::AssetInner, database::Database}; use jellycommon::{LocalTrack, NodeID, PeopleGroup, SourceTrackKind, TrackSource}; -use jellylogic::session::Session; +use jellyimport::asset_token::AssetInner; +use jellylogic::{session::Session, Database}; use log::info; use rocket::{get, http::ContentType, response::Redirect, State}; use std::path::PathBuf; diff --git a/server/src/ui/home.rs b/server/src/ui/home.rs index 9c9c1ca..d323b11 100644 --- a/server/src/ui/home.rs +++ b/server/src/ui/home.rs @@ -6,10 +6,9 @@ use super::error::MyResult; use crate::{api::AcceptJson, helper::A, locale::AcceptLanguage}; -use jellybase::database::Database; use jellycommon::api::ApiHomeResponse; use jellyimport::is_importing; -use jellylogic::session::Session; +use jellylogic::{session::Session, Database}; use jellyui::{ home::HomePage, render_page, diff --git a/server/src/ui/items.rs b/server/src/ui/items.rs index e5aa050..31902f8 100644 --- a/server/src/ui/items.rs +++ b/server/src/ui/items.rs @@ -4,10 +4,10 @@ Copyright (C) 2025 metamuffin <metamuffin.org> */ use super::error::MyError; -use crate::{api::AcceptJson, database::Database, helper::A, locale::AcceptLanguage}; +use crate::{api::AcceptJson, helper::A, locale::AcceptLanguage}; use jellycommon::api::{ApiItemsResponse, NodeFilterSort}; use jellyimport::is_importing; -use jellylogic::{items::all_items, session::Session}; +use jellylogic::{items::all_items, session::Session, Database}; use jellyui::{ items::ItemsPage, render_page, diff --git a/server/src/ui/node.rs b/server/src/ui/node.rs index 1441cfc..eced16a 100644 --- a/server/src/ui/node.rs +++ b/server/src/ui/node.rs @@ -4,13 +4,13 @@ Copyright (C) 2025 metamuffin <metamuffin.org> */ use super::error::MyResult; -use crate::{api::AcceptJson, database::Database, helper::A, locale::AcceptLanguage}; +use crate::{api::AcceptJson, helper::A, locale::AcceptLanguage}; use jellycommon::{ api::{ApiNodeResponse, NodeFilterSort}, NodeID, }; use jellyimport::is_importing; -use jellylogic::{node::get_node, session::Session}; +use jellylogic::{node::get_node, session::Session, Database}; use jellyui::{ node_page::NodePage, render_page, diff --git a/server/src/ui/player.rs b/server/src/ui/player.rs index 300e9d2..614bf4a 100644 --- a/server/src/ui/player.rs +++ b/server/src/ui/player.rs @@ -4,7 +4,7 @@ Copyright (C) 2025 metamuffin <metamuffin.org> */ use super::error::MyResult; -use crate::{database::Database, helper::A, locale::AcceptLanguage, CONF}; +use crate::{helper::A, locale::AcceptLanguage, CONF}; use jellycommon::{ api::NodeFilterSort, stream::{StreamContainer, StreamSpec}, @@ -12,7 +12,7 @@ use jellycommon::{ NodeID, }; use jellyimport::is_importing; -use jellylogic::{node::get_node, session::Session}; +use jellylogic::{node::get_node, session::Session, Database}; use jellyui::{ node_page::NodePage, render_page, diff --git a/server/src/ui/search.rs b/server/src/ui/search.rs index 1c2ea70..92fcfce 100644 --- a/server/src/ui/search.rs +++ b/server/src/ui/search.rs @@ -6,10 +6,9 @@ use super::error::MyResult; use crate::{api::AcceptJson, helper::A, locale::AcceptLanguage}; use anyhow::anyhow; -use jellybase::database::Database; use jellycommon::api::ApiSearchResponse; use jellyimport::is_importing; -use jellylogic::{search::search, session::Session}; +use jellylogic::{search::search, session::Session, Database}; use jellyui::{ render_page, scaffold::{RenderInfo, SessionInfo}, diff --git a/server/src/ui/stats.rs b/server/src/ui/stats.rs index b6a74e5..d991fa0 100644 --- a/server/src/ui/stats.rs +++ b/server/src/ui/stats.rs @@ -4,10 +4,10 @@ Copyright (C) 2025 metamuffin <metamuffin.org> */ use super::error::MyError; -use crate::{api::AcceptJson, database::Database, helper::A, locale::AcceptLanguage}; +use crate::{api::AcceptJson, helper::A, locale::AcceptLanguage}; use jellycommon::api::ApiStatsResponse; use jellyimport::is_importing; -use jellylogic::{session::Session, stats::stats}; +use jellylogic::{session::Session, stats::stats, Database}; use jellyui::{ render_page, scaffold::{RenderInfo, SessionInfo}, |