diff options
| author | metamuffin <metamuffin@disroot.org> | 2026-02-20 01:23:38 +0100 |
|---|---|---|
| committer | metamuffin <metamuffin@disroot.org> | 2026-02-20 01:23:38 +0100 |
| commit | 5caf1f1db721d6dee2ddb5d0613e8c9914ccf879 (patch) | |
| tree | 7816c2a9e1a5222f8068ab2cf941df55743ba6d3 /common | |
| parent | 62984a7250c8998556e0258d67964e8e481b243c (diff) | |
| download | jellything-5caf1f1db721d6dee2ddb5d0613e8c9914ccf879.tar jellything-5caf1f1db721d6dee2ddb5d0613e8c9914ccf879.tar.bz2 jellything-5caf1f1db721d6dee2ddb5d0613e8c9914ccf879.tar.zst | |
admin log
Diffstat (limited to 'common')
| -rw-r--r-- | common/Cargo.toml | 2 | ||||
| -rw-r--r-- | common/src/api.rs | 4 | ||||
| -rw-r--r-- | common/src/internal.rs | 31 | ||||
| -rw-r--r-- | common/src/routes.rs | 3 |
4 files changed, 36 insertions, 4 deletions
diff --git a/common/Cargo.toml b/common/Cargo.toml index 4eae9f8..fabd3d2 100644 --- a/common/Cargo.toml +++ b/common/Cargo.toml @@ -6,3 +6,5 @@ edition = "2024" [dependencies] jellystream-types = { path = "../stream/types" } jellyobject = { path = "object", features = ["json"] } +serde_json = "1.0.149" +serde = { version = "1.0.228", features = ["derive"] } diff --git a/common/src/api.rs b/common/src/api.rs index 3c4e958..12d9243 100644 --- a/common/src/api.rs +++ b/common/src/api.rs @@ -26,11 +26,13 @@ fields! { VIEW_ADMIN_DASHBOARD: () = b"adda"; VIEW_ADMIN_IMPORT: Object = b"adim"; VIEW_ADMIN_INFO: Object = b"adin"; + VIEW_ADMIN_LOG: Object = b"adlo"; ADMIN_IMPORT_BUSY: () = b"busy"; ADMIN_IMPORT_ERROR: &str = b"erro"; // multi ADMIN_INFO_TITLE: &str = b"aiti"; ADMIN_INFO_TEXT: &str = b"aite"; + ADMIN_LOG_MESSAGE: &str = b"aite"; NKU_NODE: Object = b"node"; NKU_UDATA: Object = b"udat"; @@ -38,7 +40,7 @@ fields! { NODELIST_TITLE: &str = b"titl"; NODELIST_DISPLAYSTYLE: Tag = b"dsty"; - NODELIST_ITEM: Object = b"item"; + NODELIST_ITEM: Object = b"item"; // multi MESSAGE_KIND: &str = b"kind"; MESSAGE_TEXT: &str = b"text"; diff --git a/common/src/internal.rs b/common/src/internal.rs index 58a2dae..5aedfc7 100644 --- a/common/src/internal.rs +++ b/common/src/internal.rs @@ -4,9 +4,40 @@ Copyright (C) 2026 metamuffin <metamuffin.org> */ +use std::fmt::Display; + use jellyobject::fields; +use serde::{Deserialize, Serialize}; fields! { IM_PATH: &str = b"Ipth"; IM_MTIME: u64 = b"Imtm"; } + +#[derive(Serialize, Deserialize, Clone)] +pub struct LogLine { + pub time: String, + pub module: Option<&'static str>, + pub level: LogLevel, + pub message: String, +} + +#[derive(Serialize, Deserialize, Clone, Copy, PartialEq)] +pub enum LogLevel { + Trace, + Debug, + Info, + Warn, + Error, +} +impl Display for LogLevel { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.write_str(match self { + LogLevel::Trace => "trace", + LogLevel::Debug => "debug", + LogLevel::Info => "info", + LogLevel::Warn => "warn", + LogLevel::Error => "error", + }) + } +}
\ No newline at end of file diff --git a/common/src/routes.rs b/common/src/routes.rs index fcef144..82a6f45 100644 --- a/common/src/routes.rs +++ b/common/src/routes.rs @@ -73,9 +73,6 @@ pub fn u_admin_import_post(incremental: bool) -> String { pub fn u_admin_update_search() -> String { "/admin/update_search".to_string() } -pub fn u_account_register() -> String { - "/account/register".to_owned() -} pub fn u_account_login() -> String { "/account/login".to_owned() } |