diff --git a/.gitignore b/.gitignore index 5fc8aa2..99c2546 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,6 @@ deepseek.txt passcode.txt config.toml .idea -target \ No newline at end of file +target +local_file_storage/ +target_pkg/ \ No newline at end of file diff --git a/Cargo.lock b/Cargo.lock index 8aecc9c..6b52077 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -62,6 +62,7 @@ dependencies = [ "matchit", "memchr", "mime", + "multer", "percent-encoding", "pin-project-lite", "rustversion", @@ -173,9 +174,9 @@ checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" [[package]] name = "cc" -version = "1.2.56" +version = "1.2.57" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" +checksum = "7a0dd1ca384932ff3641c8718a02769f1698e7563dc6974ffd03346116310423" dependencies = [ "find-msvc-tools", "shlex", @@ -366,6 +367,15 @@ dependencies = [ "percent-encoding", ] +[[package]] +name = "frontend" +version = "0.1.0" +dependencies = [ + "js-sys", + "wasm-bindgen", + "web-sys", +] + [[package]] name = "futures-channel" version = "0.3.32" @@ -759,9 +769,9 @@ dependencies = [ [[package]] name = "ipnet" -version = "2.11.0" +version = "2.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" +checksum = "d98f6fed1fde3f8c21bc40a1abb88dd75e67924f9cffc3ef95607bad8017f8e2" [[package]] name = "iri-string" @@ -775,9 +785,9 @@ dependencies = [ [[package]] name = "itoa" -version = "1.0.17" +version = "1.0.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" +checksum = "8f42a60cbdf9a97f5d2305f08a87dc4e09308d1276d28c869c684d7777685682" [[package]] name = "js-sys" @@ -797,9 +807,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.181" +version = "0.2.183" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "459427e2af2b9c839b132acb702a1c654d95e10f8c326bfc2ad11310e458b1c5" +checksum = "b5b646652bf6661599e1da8901b3b9522896f01e736bad5f723fe7a3a27f899d" [[package]] name = "libm" @@ -944,9 +954,9 @@ dependencies = [ [[package]] name = "once_cell" -version = "1.21.3" +version = "1.21.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" [[package]] name = "parking_lot" @@ -1182,9 +1192,9 @@ dependencies = [ [[package]] name = "quinn-proto" -version = "0.11.13" +version = "0.11.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" +checksum = "434b42fec591c96ef50e21e886936e66d3cc3f737104fdb9b737c40ffb94c098" dependencies = [ "bytes", "getrandom 0.3.4", @@ -1217,9 +1227,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.44" +version = "1.0.45" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" +checksum = "41f2619966050689382d2b44f664f4bc593e129785a36d6ee376ddf37259b924" dependencies = [ "proc-macro2", ] @@ -1379,22 +1389,6 @@ dependencies = [ "windows-sys 0.52.0", ] -[[package]] -name = "rust_tripping" -version = "0.1.2" -dependencies = [ - "axum", - "axum-extra", - "rand 0.8.5", - "reqwest", - "serde", - "tera", - "tokio", - "tokio-postgres", - "toml", - "tower-http 0.5.2", -] - [[package]] name = "rustc-hash" version = "2.1.1" @@ -1427,9 +1421,9 @@ dependencies = [ [[package]] name = "rustls-webpki" -version = "0.103.9" +version = "0.103.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53" +checksum = "df33b2b81ac578cabaf06b89b0631153a3f416b0a886e8a7a1707fb51abbd1ef" dependencies = [ "ring", "rustls-pki-types", @@ -1585,12 +1579,12 @@ checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" [[package]] name = "socket2" -version = "0.6.2" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0" +checksum = "3a766e1110788c36f4fa1c2b71b387a7815aa65f88ce0229841826633d93723e" dependencies = [ "libc", - "windows-sys 0.60.2", + "windows-sys 0.61.2", ] [[package]] @@ -1624,9 +1618,9 @@ checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" [[package]] name = "syn" -version = "2.0.114" +version = "2.0.117" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +checksum = "e665b8803e7b1d2a727f4023456bbbbe74da67099c585258af0ad9c5013b9b99" dependencies = [ "proc-macro2", "quote", @@ -1738,9 +1732,9 @@ dependencies = [ [[package]] name = "tinyvec" -version = "1.10.0" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +checksum = "3e61e67053d25a4e82c844e8424039d9745781b3fc4f32b8d55ed50f5f667ef3" dependencies = [ "tinyvec_macros", ] @@ -1753,9 +1747,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.49.0" +version = "1.50.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" +checksum = "27ad5e34374e03cfffefc301becb44e9dc3c17584f414349ebe29ed26661822d" dependencies = [ "bytes", "libc", @@ -1768,9 +1762,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.6.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +checksum = "5c55a2eff8b69ce66c84f85e1da1c233edc36ceb85a2058d11b0d6a3c7e7569c" dependencies = [ "proc-macro2", "quote", @@ -1990,9 +1984,9 @@ checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" [[package]] name = "unicode-ident" -version = "1.0.23" +version = "1.0.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "537dd038a89878be9b64dd4bd1b260315c1bb94f4d784956b81e27a088d9a09e" +checksum = "e6e4313cd5fcd3dad5cafa179702e2b244f760991f45397d14d4ebf38247da75" [[package]] name = "unicode-normalization" @@ -2185,6 +2179,23 @@ dependencies = [ "rustls-pki-types", ] +[[package]] +name = "website" +version = "0.1.2" +dependencies = [ + "axum", + "axum-extra", + "rand 0.8.5", + "reqwest", + "serde", + "tera", + "tokio", + "tokio-postgres", + "tokio-util", + "toml", + "tower-http 0.5.2", +] + [[package]] name = "whoami" version = "2.1.1" @@ -2468,18 +2479,18 @@ dependencies = [ [[package]] name = "zerocopy" -version = "0.8.39" +version = "0.8.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a" +checksum = "efbb2a062be311f2ba113ce66f697a4dc589f85e78a4aea276200804cea0ed87" dependencies = [ "zerocopy-derive", ] [[package]] name = "zerocopy-derive" -version = "0.8.39" +version = "0.8.47" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" +checksum = "0e8bc7269b54418e7aeeef514aa68f8690b8c0489a06b0136e5f57c4c5ccab89" dependencies = [ "proc-macro2", "quote", diff --git a/Cargo.toml b/Cargo.toml index 43bff31..148ab96 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,16 +1,6 @@ -[package] -name = "rust_tripping" -version = "0.1.2" -edition = "2021" - -[dependencies] -rand = "0.8" -axum = "0.7" -tokio = { version = "1", features = ["rt-multi-thread", "macros"] } -tower-http = { version = "0.5", features = ["fs"] } -tera = "1.19.1" -reqwest = { version = "0.12", features = ["json", "rustls-tls"], default-features = false } -serde = { version = "1", features = ["derive"] } -axum-extra = { version = "0.9", features = ["cookie"] } -tokio-postgres = "0.7" -toml = "0.8" +[workspace] +name="rust_tripping" +members = [ + "frontend", + "website", +] \ No newline at end of file diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..fe6ba78 --- /dev/null +++ b/Makefile @@ -0,0 +1,7 @@ +find_rust = $(shell find $(1) -type f -name '*.rs' ) + +target/debug/frontend.wasm: $(call find_rust,frontend) frontend/Cargo.toml + cargo build -p frontend --target wasm32-unknown-unknown + +target_pkg/frontend_bg.wasm: target/debug/frontend.wasm + wasm-bindgen --target web --out-dir target_pkg target/wasm32-unknown-unknown/debug/frontend.wasm diff --git a/config.example.toml b/config.example.toml index 97e46ff..7cb2433 100644 --- a/config.example.toml +++ b/config.example.toml @@ -1,3 +1,4 @@ postgres_host="/run/postgresql" pg_database="DATABASE_NAME" -postgres_user="postgres" \ No newline at end of file +postgres_user="postgres" +file_storage="file_storage" diff --git a/frontend/Cargo.toml b/frontend/Cargo.toml new file mode 100644 index 0000000..9b27a86 --- /dev/null +++ b/frontend/Cargo.toml @@ -0,0 +1,26 @@ +[package] +name = "frontend" +version = "0.1.0" +edition = "2021" + +[lib] +crate-type = ["cdylib"] + +[dependencies] +wasm-bindgen = "0.2" +js-sys = "0.3" + +[dependencies.web-sys] +version = "0.3" +features = [ + "Window", + "Document", + "Event", + "EventTarget", + "KeyboardEvent", + "MouseEvent", + "WheelEvent", + "HtmlCanvasElement", + "CanvasRenderingContext2d", + "Performance", +] diff --git a/frontend/pages/board.html b/frontend/pages/board.html new file mode 100644 index 0000000..802ce06 --- /dev/null +++ b/frontend/pages/board.html @@ -0,0 +1,34 @@ + + + + + wasm_test + + + + + + + + + diff --git a/frontend/pages/index.html b/frontend/pages/index.html new file mode 100644 index 0000000..9cc57c2 --- /dev/null +++ b/frontend/pages/index.html @@ -0,0 +1,65 @@ + + + + + + Control Center + + + +
+
+ +
+ Signed in + {{ logged_in_cur_user }} +
+
+ +
+
+

Dark Material Console

+

Fast uploads, calm interface.

+

+ Keep your files close, your workflow focused, and your storage under control. +

+ +
+ +
+
+

Recent activity

+

+ Track new files, size totals, and secure download links in one place. +

+ Review uploads +
+
+

Storage health

+

+ Monitor usage and keep the 10 GiB limit comfortably in sight. +

+ View usage +
+
+

Quick actions

+

+ Jump straight into file uploads or check your latest shared links. +

+ Start upload +
+
+
+
+ + diff --git a/src/pages/login.html b/frontend/pages/login.html similarity index 100% rename from src/pages/login.html rename to frontend/pages/login.html diff --git a/frontend/pages/upload.html b/frontend/pages/upload.html new file mode 100644 index 0000000..726e5d0 --- /dev/null +++ b/frontend/pages/upload.html @@ -0,0 +1,29 @@ + + + + + + Upload file + + + +

Upload file

+

Maximum total storage: 10 GiB

+ + {% if error %} +

{{ error }}

+ {% endif %} + + {% if success_id %} +

+ Uploaded {{ success_filename }} ({{ success_size }} bytes). + Download +

+ {% endif %} + +
+ + +
+ + diff --git a/src/pages/welcome.html b/frontend/pages/welcome.html similarity index 100% rename from src/pages/welcome.html rename to frontend/pages/welcome.html diff --git a/frontend/src/lib.rs b/frontend/src/lib.rs new file mode 100644 index 0000000..98e836b --- /dev/null +++ b/frontend/src/lib.rs @@ -0,0 +1,271 @@ +use std::cell::RefCell; +use std::rc::Rc; +use wasm_bindgen::closure::Closure; +use wasm_bindgen::prelude::*; +use wasm_bindgen::JsCast; +use web_sys::{ + window, CanvasRenderingContext2d, Document, HtmlCanvasElement, KeyboardEvent, WheelEvent, +}; + +#[derive(Default, Clone, Copy)] +struct InputState { + w: bool, + a: bool, + s: bool, + d: bool, +} + +struct Camera { + x: f64, + y: f64, + ppm: f64, +} + +struct SceneState { + camera: Camera, + speed_pps: f64, + triangles: Vec<(&'static str, [(f64, f64); 3])>, + need_camera_setup: bool, +} + +impl SceneState { + fn new() -> Self { + Self { + camera: Camera { + x: 0.0, + y: 0.0, + ppm: 10.0, + }, + speed_pps: 900.0, + triangles: vec![ + ("#ff6b6b", [(0.0, 0.0), (3.0, 0.0), (1.5, 2.5)]), + ("#4dabf7", [(-4.0, -2.0), (-1.0, -3.5), (-2.5, 0.5)]), + ("#ffd43b", [(2.0, -4.0), (5.0, -4.0), (4.0, -1.0)]), + ], + need_camera_setup: true, + } + } + + fn setup_camera_if_needed(&mut self, width: f64, height: f64) { + if !self.need_camera_setup { + return; + } + + if width <= 0.0 || height <= 0.0 || self.camera.ppm <= 0.0 { + return; + } + + self.camera.x = -width / (2.0 * self.camera.ppm); + self.camera.y = -height / (2.0 * self.camera.ppm); + self.need_camera_setup = false; + } +} + +fn update_key(state: &mut InputState, code: &str, is_down: bool) -> bool { + match code { + "KeyW" => { + state.w = is_down; + true + } + "KeyA" => { + state.a = is_down; + true + } + "KeyS" => { + state.s = is_down; + true + } + "KeyD" => { + state.d = is_down; + true + } + _ => false, + } +} + +#[wasm_bindgen] +pub fn init_index() -> Result<(), JsValue> { + let document: Document = window().unwrap().document().unwrap(); + let canvas: HtmlCanvasElement = document + .get_element_by_id("canvas") + .ok_or_else(|| JsValue::from_str("Missing #canvas element"))? + .dyn_into()?; + + let context: CanvasRenderingContext2d = canvas + .get_context("2d")? + .ok_or_else(|| JsValue::from_str("Missing 2d context"))? + .dyn_into()?; + + let window = window().unwrap(); + let canvas = canvas.clone(); + let context = context.clone(); + + let input = Rc::new(RefCell::new(InputState::default())); + let scene = Rc::new(RefCell::new(SceneState::new())); + let last_time = Rc::new(RefCell::new( + window + .performance() + .ok_or_else(|| JsValue::from_str("Missing performance"))? + .now(), + )); + + let input_down = input.clone(); + let keydown = Closure::::wrap(Box::new(move |event: KeyboardEvent| { + let code = event.code(); + let mut state = input_down.borrow_mut(); + if update_key(&mut state, &code, true) { + event.prevent_default(); + } + })); + window.add_event_listener_with_callback("keydown", keydown.as_ref().unchecked_ref())?; + keydown.forget(); + + let input_up = input.clone(); + let keyup = Closure::::wrap(Box::new(move |event: KeyboardEvent| { + let code = event.code(); + let mut state = input_up.borrow_mut(); + if update_key(&mut state, &code, false) { + event.prevent_default(); + } + })); + window.add_event_listener_with_callback("keyup", keyup.as_ref().unchecked_ref())?; + keyup.forget(); + + let scene_zoom = scene.clone(); + let canvas_zoom = canvas.clone(); + let wheel = Closure::::wrap(Box::new(move |event: WheelEvent| { + event.prevent_default(); + + let pointer_x = event.offset_x() as f64; + let pointer_y = event.offset_y() as f64; + + let mut scene = scene_zoom.borrow_mut(); + let old_ppm = scene.camera.ppm; + let zoom_factor = (-event.delta_y() * 0.001).exp(); + let mut new_ppm = old_ppm * zoom_factor; + let min_ppm = 2.0; + let max_ppm = 200.0; + + if new_ppm < min_ppm { + new_ppm = min_ppm; + } + if new_ppm > max_ppm { + new_ppm = max_ppm; + } + + let world_x = scene.camera.x + pointer_x / old_ppm; + let world_y = scene.camera.y + pointer_y / old_ppm; + + scene.camera.ppm = new_ppm; + scene.camera.x = world_x - pointer_x / new_ppm; + scene.camera.y = world_y - pointer_y / new_ppm; + })); + canvas_zoom.add_event_listener_with_callback("wheel", wheel.as_ref().unchecked_ref())?; + wheel.forget(); + + let draw = Rc::new(RefCell::new(None::>)); + let draw_handle = draw.clone(); + let window_handle = window.clone(); + let input_handle = input.clone(); + let scene_handle = scene.clone(); + let last_time_handle = last_time.clone(); + + *draw_handle.borrow_mut() = Some(Closure::wrap(Box::new(move || { + let now = window_handle + .performance() + .map(|perf| perf.now()) + .unwrap_or(0.0); + let mut last = last_time_handle.borrow_mut(); + let mut dt = (now - *last) / 1000.0; + *last = now; + + if dt.is_nan() || dt.is_infinite() { + dt = 0.0; + } + if dt > 0.05 { + dt = 0.05; + } + + let width = window_handle + .inner_width() + .ok() + .and_then(|v| v.as_f64()) + .unwrap_or(0.0); + let height = window_handle + .inner_height() + .ok() + .and_then(|v| v.as_f64()) + .unwrap_or(0.0); + + canvas.set_width(width as u32); + canvas.set_height(height as u32); + + let input = input_handle.borrow(); + let mut scene = scene_handle.borrow_mut(); + scene.setup_camera_if_needed(width, height); + let step = (scene.speed_pps / scene.camera.ppm) * dt; + + if input.w { + scene.camera.y -= step; + } + if input.s { + scene.camera.y += step; + } + if input.a { + scene.camera.x -= step; + } + if input.d { + scene.camera.x += step; + } + + context.set_fill_style(&JsValue::from_str("#0b0f17")); + context.fill_rect(0.0, 0.0, width, height); + context.set_line_width(1.0); + context.set_stroke_style(&JsValue::from_str("#111827")); + + for (color, points) in scene.triangles.iter() { + let to_screen = |(x, y): (f64, f64)| -> (f64, f64) { + let sx = + (x - scene.camera.x) * scene.camera.ppm; + let sy = + (y - scene.camera.y) * scene.camera.ppm; + (sx, sy) + }; + + let (x0, y0) = to_screen(points[0]); + let (x1, y1) = to_screen(points[1]); + let (x2, y2) = to_screen(points[2]); + + context.begin_path(); + context.move_to(x0, y0); + context.line_to(x1, y1); + context.line_to(x2, y2); + context.close_path(); + + context.set_fill_style(&JsValue::from_str(color)); + context.fill(); + context.stroke(); + } + + let _ = window_handle.request_animation_frame( + draw.borrow().as_ref().unwrap().as_ref().unchecked_ref(), + ); + }) as Box)); + + window.request_animation_frame( + draw_handle + .borrow() + .as_ref() + .unwrap() + .as_ref() + .unchecked_ref(), + )?; + + Ok(()) +} + +#[wasm_bindgen] +pub fn init_tables() -> Result<(), JsValue> { + + Ok(()) +} diff --git a/frontend/static/css/site.css b/frontend/static/css/site.css new file mode 100644 index 0000000..6594287 --- /dev/null +++ b/frontend/static/css/site.css @@ -0,0 +1,377 @@ +html, +body { + height: 100%; + width: 100%; + margin: 0; + padding: 0; + overflow: hidden; +} + +body { + display: flex; + align-items: center; + justify-content: center; + font-family: "Georgia", "Times New Roman", serif; + color: #f7f4ef; + background: url("/static/images/skeleton.webp") top center / cover no-repeat; +} + +.login-card, +.welcome-card { + background: rgba(10, 10, 10, 0.65); + border: 1px solid rgba(255, 255, 255, 0.15); + border-radius: 16px; + padding: 28px 32px; + width: min(360px, 90vw); + box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35); + backdrop-filter: blur(2px); +} + +.login-card h1, +.welcome-card h1 { + margin: 0 0 16px; + font-size: 28px; + letter-spacing: 0.5px; +} + +.field { + display: block; + margin-bottom: 16px; +} + +.label { + display: block; + margin-bottom: 6px; + font-size: 14px; + text-transform: uppercase; + letter-spacing: 1px; + color: #e6e0d7; +} + +input[type="password"] { + width: 100%; + border-radius: 8px; + border: 1px solid rgba(255, 255, 255, 0.2); + padding: 10px 12px; + background: rgba(255, 255, 255, 0.08); + color: #fff; + font-size: 16px; + box-sizing: border-box; +} + +button { + width: 100%; + border: none; + border-radius: 8px; + padding: 12px; + font-size: 16px; + font-weight: 600; + letter-spacing: 0.5px; + background: #f0c986; + color: #1c1200; + cursor: pointer; +} + +button:hover { + background: #f3d6a4; +} + +.error { + margin: 0 0 12px; + color: #ff6b6b; + font-weight: 600; +} + +.mild-warning { + margin: 0 0 12px; + color: white; + font-weight: 200; +} + +.index-html, +.index-body { + height: 100%; + width: 100%; + overflow: auto; +} + +.index-body { + margin: 0; + display: block; + min-height: 100%; + color: #f5f5f5; + font-family: "Fira Sans", "Space Grotesk", "Montserrat", sans-serif; + background: + radial-gradient(circle at 20% 20%, rgba(66, 90, 120, 0.35), transparent 55%), + radial-gradient(circle at 80% 0%, rgba(120, 70, 130, 0.25), transparent 50%), + linear-gradient(145deg, #0b0f15 0%, #0f141c 45%, #151a22 100%); +} + +.index-shell { + min-height: 100%; + padding: 28px 32px 56px; + box-sizing: border-box; + display: flex; + flex-direction: column; + gap: 48px; +} + +.top-panel { + display: flex; + align-items: center; + justify-content: space-between; + gap: 24px; + padding: 18px 28px; + background: rgba(17, 21, 29, 0.92); + border: 1px solid rgba(255, 255, 255, 0.08); + border-radius: 18px; + box-shadow: + 0 16px 40px rgba(0, 0, 0, 0.45), + inset 0 1px 0 rgba(255, 255, 255, 0.04); + backdrop-filter: blur(8px); + animation: index-rise 0.55s ease-out both; +} + +.top-panel__left { + display: flex; + align-items: center; + gap: 28px; + flex-wrap: wrap; +} + +.top-panel__brand { + font-family: "Space Grotesk", "Fira Sans", sans-serif; + font-size: 20px; + font-weight: 700; + letter-spacing: 0.6px; + color: #ffffff; + text-decoration: none; +} + +.top-panel__nav { + display: flex; + gap: 14px; + flex-wrap: wrap; +} + +.top-panel__link { + color: #f5f5f5; + text-decoration: none; + font-size: 14px; + letter-spacing: 0.6px; + text-transform: uppercase; + padding: 8px 14px; + border-radius: 999px; + background: rgba(255, 255, 255, 0.06); + border: 1px solid transparent; + transition: border-color 0.2s ease, background 0.2s ease, transform 0.2s ease; +} + +.top-panel__link:hover { + background: rgba(255, 255, 255, 0.12); + border-color: rgba(255, 255, 255, 0.18); + transform: translateY(-1px); +} + +.top-panel__right { + display: flex; + align-items: center; + gap: 12px; + padding: 6px 12px; + border-radius: 999px; + background: rgba(255, 255, 255, 0.05); + border: 1px solid rgba(255, 255, 255, 0.08); +} + +.top-panel__user-label { + font-size: 12px; + letter-spacing: 0.6px; + text-transform: uppercase; + color: rgba(255, 255, 255, 0.7); +} + +.top-panel__user-name { + font-size: 14px; + font-weight: 600; + letter-spacing: 0.4px; + color: #ffffff; + padding: 6px 12px; + border-radius: 999px; + background: rgba(77, 118, 255, 0.28); + border: 1px solid rgba(110, 146, 255, 0.4); +} + +.index-main { + display: flex; + flex-direction: column; + gap: 40px; + max-width: 1100px; + width: 100%; + margin: 0 auto; + animation: index-fade 0.6s ease-out both; + animation-delay: 0.1s; +} + +.index-hero { + display: flex; + flex-direction: column; + gap: 16px; + padding: 24px 28px; + background: rgba(20, 24, 32, 0.75); + border-radius: 22px; + border: 1px solid rgba(255, 255, 255, 0.08); + box-shadow: 0 18px 36px rgba(0, 0, 0, 0.35); +} + +.index-hero__eyebrow { + margin: 0; + font-size: 13px; + letter-spacing: 1.6px; + text-transform: uppercase; + color: rgba(255, 255, 255, 0.7); +} + +.index-hero__title { + margin: 0; + font-size: clamp(32px, 4vw, 44px); + font-weight: 700; + letter-spacing: 0.3px; +} + +.index-hero__subtitle { + margin: 0; + font-size: 16px; + max-width: 680px; + color: rgba(255, 255, 255, 0.78); +} + +.index-hero__actions { + display: flex; + flex-wrap: wrap; + gap: 16px; + margin-top: 6px; +} + +.index-hero__button { + text-decoration: none; + color: #0b0f15; + background: linear-gradient(135deg, #f0d27a 0%, #f8b46f 100%); + padding: 12px 22px; + border-radius: 999px; + font-weight: 600; + letter-spacing: 0.3px; + box-shadow: 0 10px 20px rgba(0, 0, 0, 0.3); + transition: transform 0.2s ease, box-shadow 0.2s ease; +} + +.index-hero__button:hover { + transform: translateY(-2px); + box-shadow: 0 14px 24px rgba(0, 0, 0, 0.38); +} + +.index-hero__ghost { + text-decoration: none; + color: #f5f5f5; + padding: 12px 20px; + border-radius: 999px; + border: 1px solid rgba(255, 255, 255, 0.2); + background: rgba(255, 255, 255, 0.06); + letter-spacing: 0.3px; + transition: border-color 0.2s ease, background 0.2s ease; +} + +.index-hero__ghost:hover { + background: rgba(255, 255, 255, 0.12); + border-color: rgba(255, 255, 255, 0.3); +} + +.index-grid { + display: grid; + gap: 18px; + grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); +} + +.index-card { + padding: 20px 22px; + background: rgba(18, 22, 30, 0.78); + border-radius: 18px; + border: 1px solid rgba(255, 255, 255, 0.08); + box-shadow: 0 14px 28px rgba(0, 0, 0, 0.3); + display: flex; + flex-direction: column; + gap: 12px; + animation: index-fade 0.6s ease-out both; +} + +.index-card__title { + margin: 0; + font-size: 18px; + font-weight: 600; +} + +.index-card__text { + margin: 0; + font-size: 14px; + line-height: 1.6; + color: rgba(255, 255, 255, 0.75); +} + +.index-card__link { + color: #ffffff; + text-decoration: none; + font-size: 14px; + letter-spacing: 0.3px; + padding: 8px 12px; + border-radius: 999px; + background: rgba(255, 255, 255, 0.08); + border: 1px solid rgba(255, 255, 255, 0.12); + width: fit-content; + transition: background 0.2s ease, border-color 0.2s ease; +} + +.index-card__link:hover { + background: rgba(255, 255, 255, 0.14); + border-color: rgba(255, 255, 255, 0.2); +} + +@keyframes index-rise { + from { + opacity: 0; + transform: translateY(-16px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +@keyframes index-fade { + from { + opacity: 0; + transform: translateY(12px); + } + to { + opacity: 1; + transform: translateY(0); + } +} + +@media (max-width: 720px) { + .index-shell { + padding: 20px 18px 36px; + } + + .top-panel { + align-items: flex-start; + flex-direction: column; + } + + .top-panel__right { + width: 100%; + justify-content: space-between; + } + + .index-hero { + padding: 20px; + } +} diff --git a/src/static/images/skeleton.webp b/frontend/static/images/skeleton.webp similarity index 100% rename from src/static/images/skeleton.webp rename to frontend/static/images/skeleton.webp diff --git a/src/static/images/wool.jpg b/frontend/static/images/wool.jpg similarity index 100% rename from src/static/images/wool.jpg rename to frontend/static/images/wool.jpg diff --git a/src/pages/index.html b/src/pages/index.html deleted file mode 100644 index ee82143..0000000 --- a/src/pages/index.html +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - Main page - - - -

Main page

- - diff --git a/src/static/css/site.css b/src/static/css/site.css deleted file mode 100644 index db1efe7..0000000 --- a/src/static/css/site.css +++ /dev/null @@ -1,89 +0,0 @@ -html, -body { - height: 100%; - width: 100%; - margin: 0; - padding: 0; - overflow: hidden; -} - -body { - display: flex; - align-items: center; - justify-content: center; - font-family: "Georgia", "Times New Roman", serif; - color: #f7f4ef; - background: url("/static/images/wool.jpg") top center / cover no-repeat; -} - -.login-card, -.welcome-card { - background: rgba(10, 10, 10, 0.65); - border: 1px solid rgba(255, 255, 255, 0.15); - border-radius: 16px; - padding: 28px 32px; - width: min(360px, 90vw); - box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35); - backdrop-filter: blur(2px); -} - -.login-card h1, -.welcome-card h1 { - margin: 0 0 16px; - font-size: 28px; - letter-spacing: 0.5px; -} - -.field { - display: block; - margin-bottom: 16px; -} - -.label { - display: block; - margin-bottom: 6px; - font-size: 14px; - text-transform: uppercase; - letter-spacing: 1px; - color: #e6e0d7; -} - -input[type="password"] { - width: 100%; - border-radius: 8px; - border: 1px solid rgba(255, 255, 255, 0.2); - padding: 10px 12px; - background: rgba(255, 255, 255, 0.08); - color: #fff; - font-size: 16px; - box-sizing: border-box; -} - -button { - width: 100%; - border: none; - border-radius: 8px; - padding: 12px; - font-size: 16px; - font-weight: 600; - letter-spacing: 0.5px; - background: #f0c986; - color: #1c1200; - cursor: pointer; -} - -button:hover { - background: #f3d6a4; -} - -.error { - margin: 0 0 12px; - color: #ff6b6b; - font-weight: 600; -} - -.mild-warning { - margin: 0 0 12px; - color: white; - font-weight: 200; -} diff --git a/website/Cargo.lock b/website/Cargo.lock new file mode 100644 index 0000000..28295bc --- /dev/null +++ b/website/Cargo.lock @@ -0,0 +1,2555 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aho-corasick" +version = "1.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddd31a130427c27518df266943a5308ed92d4b226cc639f5a8f1002816174301" +dependencies = [ + "memchr", +] + +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + +[[package]] +name = "async-trait" +version = "0.1.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9035ad2d096bed7955a320ee7e2230574d28fd3c3a0f186cbea1ff3c7eed5dbb" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "autocfg" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08606f8c3cbf4ce6ec8e28fb0014a2c086708fe954eaa885384a6165172e7e8" + +[[package]] +name = "axum" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edca88bc138befd0323b20752846e6587272d3b03b0343c8ea28a6f819e6e71f" +dependencies = [ + "async-trait", + "axum-core", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "multer", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-extra" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c794b30c904f0a1c2fb7740f7df7f7972dfaa14ef6f57cb6178dc63e5dca2f04" +dependencies = [ + "axum", + "axum-core", + "bytes", + "cookie", + "fastrand", + "futures-util", + "http", + "http-body", + "http-body-util", + "mime", + "multer", + "pin-project-lite", + "serde", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bitflags" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "843867be96c8daad0d758b57df9392b6d8d271134fce549de6ce169ff98a92af" + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bstr" +version = "1.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63044e1ae8e69f3b5a92c736ca6269b8d12fa7efe39bf34ddb06d102cf0e2cab" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "bumpalo" +version = "3.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d20789868f4b01b2f2caec9f5c4e0213b41e3e5702a50157d699ae31ced2fcb" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e748733b7cbc798e1434b6ac524f0c1ff2ab456fe201501e6497c8417a4fc33" + +[[package]] +name = "cc" +version = "1.2.56" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aebf35691d1bfb0ac386a69bac2fde4dd276fb618cf8bf4f5318fe285e821bb2" +dependencies = [ + "find-msvc-tools", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9330f8b2ff13f34540b44e946ef35111825727b38d33286ef986142615121801" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "chrono" +version = "0.4.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c673075a2e0e5f4a1dde27ce9dee1ea4558c7ffe648f576438a20ca1d2acc4b0" +dependencies = [ + "iana-time-zone", + "num-traits", + "windows-link", +] + +[[package]] +name = "chrono-tz" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93698b29de5e97ad0ae26447b344c482a7284c737d9ddc5f9e52b74a336671bb" +dependencies = [ + "chrono", + "chrono-tz-build", + "phf 0.11.3", +] + +[[package]] +name = "chrono-tz-build" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c088aee841df9c3041febbb73934cfc39708749bf96dc827e3359cd39ef11b1" +dependencies = [ + "parse-zoneinfo", + "phf 0.11.3", + "phf_codegen", +] + +[[package]] +name = "cookie" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ddef33a339a91ea89fb53151bd0a4689cfce27055c291dfa69945475d22c747" +dependencies = [ + "percent-encoding", + "time", + "version_check", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "crossbeam-deque" +version = "0.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dd111b7b7f7d55b72c0a6ae361660ee5853c9af73f70c3c2ef6858b950e2e51" +dependencies = [ + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b82ac4a3c2ca9c3460964f020e1402edd5753411d7737aa39c3714ad1b5420e" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "deranged" +version = "0.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7cd812cc2bc1d69d4764bd80df88b4317eaef9e773c75226407d9bc0876b211c" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "deunicode" +version = "1.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abd57806937c9cc163efc8ea3910e00a62e2aeb0b8119f1793a978088f8f6b04" + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer", + "crypto-common", + "subtle", +] + +[[package]] +name = "displaydoc" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "equivalent" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877a4ace8713b0bcf2a4e7eec82529c029f1d0619886d18145fea96c3ffe5c0f" + +[[package]] +name = "fallible-iterator" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4443176a9f2c162692bd3d352d745ef9413eec5782a80d8fd6f8a1ac692a07f7" + +[[package]] +name = "fastrand" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" + +[[package]] +name = "find-msvc-tools" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5baebc0774151f905a1a2cc41989300b1e6fbb29aff0ceffa1064fdd3088d582" + +[[package]] +name = "form_urlencoded" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb4cb245038516f5f85277875cdaa4f7d2c9a0fa0468de06ed190163b1581fcf" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07bbe89c50d7a535e539b8c17bc0b49bdb77747034daa8087407d655f3f7cc1d" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e3450815272ef58cec6d564423f6e755e25379b217b0bc688e295ba24df6b1d" + +[[package]] +name = "futures-sink" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c39754e157331b013978ec91992bde1ac089843443c49cbc7f46150b0fad0893" + +[[package]] +name = "futures-task" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "037711b3d59c33004d3856fbdc83b99d4ff37a24768fa1be9ce3538a1cde4393" + +[[package]] +name = "futures-util" +version = "0.3.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "389ca41296e6190b48053de0321d02a77f32f8a5d2461dd38762c0593805c6d6" +dependencies = [ + "futures-core", + "futures-sink", + "futures-task", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "wasm-bindgen", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "r-efi", + "wasip2", + "wasm-bindgen", +] + +[[package]] +name = "globset" +version = "0.4.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "52dfc19153a48bde0cbd630453615c8151bce3a5adfac7a0aebfbf0a1e1f57e3" +dependencies = [ + "aho-corasick", + "bstr", + "log", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "globwalk" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf760ebf69878d9fd8f110c89703d90ce35095324d1f1edcb595c63945ee757" +dependencies = [ + "bitflags", + "ignore", + "walkdir", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest", +] + +[[package]] +name = "http" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3ba2a386d7f85a81f119ad7498ebe444d2e22c2af0b86b069416ace48b3311a" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b021d93e26becf5dc7e1b75b1bed1fd93124b374ceb73f43d4d4eafec896a64a" +dependencies = [ + "bytes", + "futures-core", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "http-range-header" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9171a2ea8a68358193d15dd5d70c1c10a2afc3e7e4c5bc92bc9f025cebd7359c" + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "humansize" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6cb51c9a029ddc91b07a787f1d86b53ccfa49b0e86688c946ebe8d3555685dd7" +dependencies = [ + "libm", +] + +[[package]] +name = "hyper" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ab2d4f250c3d7b1c9fcdff1cece94ea4e2dfbec68614f7b87cb205f24ca9d11" +dependencies = [ + "atomic-waker", + "bytes", + "futures-channel", + "futures-core", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "pin-utils", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3c93eb611681b207e1fe55d5a71ecf91572ec8a6705cdb6857f7d8d5242cf58" +dependencies = [ + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-util" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96547c2556ec9d12fb1578c4eaf448b04993e7fb79cbaad930a656880a6bdfa0" +dependencies = [ + "base64", + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "ipnet", + "libc", + "percent-encoding", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c6b649701667bbe825c3b7e6388cb521c23d88644678e83c0c4d0a621a34b43" +dependencies = [ + "displaydoc", + "potential_utf", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edba7861004dd3714265b4db54a3c390e880ab658fec5f7db895fae2046b5bb6" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5f6c8828b67bf8908d82127b2054ea1b4427ff0230ee9141c54251934ab1b599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7aedcccd01fc5fe81e6b489c15b247b8b0690feb23304303a9e560f37efc560a" + +[[package]] +name = "icu_properties" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "020bfc02fe870ec3a66d93e677ccca0562506e5872c650f893269e08615d74ec" +dependencies = [ + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "616c294cf8d725c6afcd8f55abc17c56464ef6211f9ed59cccffe534129c77af" + +[[package]] +name = "icu_provider" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85962cf0ce02e1e0a629cc34e7ca3e373ce20dda4c4d7294bbd0bf1fdb59e614" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3acae9609540aa318d1bc588455225fb2085b9ed0c4f6bd0d9d5bcd86f1a0344" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "ignore" +version = "0.4.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3d782a365a015e0f5c04902246139249abf769125006fbe7649e2ee88169b4a" +dependencies = [ + "crossbeam-deque", + "globset", + "log", + "memchr", + "regex-automata", + "same-file", + "walkdir", + "winapi-util", +] + +[[package]] +name = "indexmap" +version = "2.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7714e70437a7dc3ac8eb7e6f8df75fd8eb422675fc7678aff7364301092b1017" +dependencies = [ + "equivalent", + "hashbrown", +] + +[[package]] +name = "ipnet" +version = "2.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "469fb0b9cefa57e3ef31275ee7cacb78f2fdca44e4765491884a2b119d4eb130" + +[[package]] +name = "iri-string" +version = "0.7.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c91338f0783edbd6195decb37bae672fd3b165faffb89bf7b9e6942f8b1a731a" +dependencies = [ + "memchr", + "serde", +] + +[[package]] +name = "itoa" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92ecc6618181def0457392ccd0ee51198e065e016d1d527a7ac1b6dc7c1f09d2" + +[[package]] +name = "js-sys" +version = "0.3.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b49715b7073f385ba4bc528e5747d02e66cb39c6146efb66b781f131f0fb399c" +dependencies = [ + "once_cell", + "wasm-bindgen", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" + +[[package]] +name = "libc" +version = "0.2.181" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "459427e2af2b9c839b132acb702a1c654d95e10f8c326bfc2ad11310e458b1c5" + +[[package]] +name = "libm" +version = "0.2.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6d2cec3eae94f9f509c767b45932f1ada8350c4bdb85af2fcab4a3c14807981" + +[[package]] +name = "libredox" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1744e39d1d6a9948f4f388969627434e31128196de472883b39f148769bfe30a" +dependencies = [ + "libc", +] + +[[package]] +name = "litemap" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6373607a59f0be73a39b6fe456b8192fcc3585f602af20751600e974dd455e77" + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e5032e24019045c762d3c0f28f5b6b8bbf38563a65908389bf7978758920897" + +[[package]] +name = "lru-slab" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "112b39cec0b298b6c1999fee3e31427f74f676e4cb9879ed1a121b43661a4154" + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "md-5" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d89e7ee0cfbedfc4da3340218492196241d89eefb6dab27de5df917a6d2e78cf" +dependencies = [ + "cfg-if", + "digest", +] + +[[package]] +name = "memchr" +version = "2.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8ca58f447f06ed17d5fc4043ce1b10dd205e060fb3ce5b979b8ed8e59ff3f79" + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "mime_guess" +version = "2.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" +dependencies = [ + "mime", + "unicase", +] + +[[package]] +name = "mio" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a69bcab0ad47271a0234d9422b131806bf3968021e5dc9328caf2d4cd58557fc" +dependencies = [ + "libc", + "wasi 0.11.1+wasi-snapshot-preview1", + "windows-sys 0.61.2", +] + +[[package]] +name = "multer" +version = "3.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83e87776546dc87511aa5ee218730c92b666d7264ab6ed41f9d215af9cd5224b" +dependencies = [ + "bytes", + "encoding_rs", + "futures-util", + "http", + "httparse", + "memchr", + "mime", + "spin", + "version_check", +] + +[[package]] +name = "num-conv" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf97ec579c3c42f953ef76dbf8d55ac91fb219dde70e49aa4a6b7d74e9919050" + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags", +] + +[[package]] +name = "objc2-system-configuration" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7216bd11cbda54ccabcab84d523dc93b858ec75ecfb3a7d89513fa22464da396" +dependencies = [ + "objc2-core-foundation", +] + +[[package]] +name = "once_cell" +version = "1.21.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42f5e15c9953c5e4ccceeb2e7382a716482c34515315f7b03532b8b4e8393d2d" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "parse-zoneinfo" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f2a05b18d44e2957b88f96ba460715e295bc1d7510468a2f3d3b44535d26c24" +dependencies = [ + "regex", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "pest" +version = "2.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e0848c601009d37dfa3430c4666e147e49cdcf1b92ecd3e63657d8a5f19da662" +dependencies = [ + "memchr", + "ucd-trie", +] + +[[package]] +name = "pest_derive" +version = "2.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11f486f1ea21e6c10ed15d5a7c77165d0ee443402f0780849d1768e7d9d6fe77" +dependencies = [ + "pest", + "pest_generator", +] + +[[package]] +name = "pest_generator" +version = "2.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8040c4647b13b210a963c1ed407c1ff4fdfa01c31d6d2a098218702e6664f94f" +dependencies = [ + "pest", + "pest_meta", + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "pest_meta" +version = "2.8.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "89815c69d36021a140146f26659a81d6c2afa33d216d736dd4be5381a7362220" +dependencies = [ + "pest", + "sha2", +] + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_shared 0.11.3", +] + +[[package]] +name = "phf" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1562dc717473dbaa4c1f85a36410e03c047b2e7df7f45ee938fbef64ae7fadf" +dependencies = [ + "phf_shared 0.13.1", + "serde", +] + +[[package]] +name = "phf_codegen" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aef8048c789fa5e851558d709946d6d79a8ff88c0440c587967f8e94bfb1216a" +dependencies = [ + "phf_generator", + "phf_shared 0.11.3", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared 0.11.3", + "rand 0.8.5", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + +[[package]] +name = "phf_shared" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e57fef6bc5981e38c2ce2d63bfa546861309f875b8a75f092d1d54ae2d64f266" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a89322df9ebe1c1578d689c92318e070967d1042b512afbe49518723f4e6d5cd" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "postgres-protocol" +version = "0.6.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ee9dd5fe15055d2b6806f4736aa0c9637217074e224bbec46d4041b91bb9491" +dependencies = [ + "base64", + "byteorder", + "bytes", + "fallible-iterator", + "hmac", + "md-5", + "memchr", + "rand 0.9.2", + "sha2", + "stringprep", +] + +[[package]] +name = "postgres-types" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54b858f82211e84682fecd373f68e1ceae642d8d751a1ebd13f33de6257b3e20" +dependencies = [ + "bytes", + "fallible-iterator", + "postgres-protocol", +] + +[[package]] +name = "potential_utf" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b73949432f5e2a09657003c25bca5e19a0e9c84f8058ca374f49e0ebe605af77" +dependencies = [ + "zerovec", +] + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.106" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fd00f0bb2e90d81d1044c2b32617f68fcb9fa3bb7640c23e9c748e53fb30934" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quinn" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9e20a958963c291dc322d98411f541009df2ced7b5a4f2bd52337638cfccf20" +dependencies = [ + "bytes", + "cfg_aliases", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash", + "rustls", + "socket2", + "thiserror", + "tokio", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-proto" +version = "0.11.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1906b49b0c3bc04b5fe5d86a77925ae6524a19b816ae38ce1e426255f1d8a31" +dependencies = [ + "bytes", + "getrandom 0.3.4", + "lru-slab", + "rand 0.9.2", + "ring", + "rustc-hash", + "rustls", + "rustls-pki-types", + "slab", + "thiserror", + "tinyvec", + "tracing", + "web-time", +] + +[[package]] +name = "quinn-udp" +version = "0.5.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "addec6a0dcad8a8d96a771f815f0eaf55f9d1805756410b39f5fa81332574cbd" +dependencies = [ + "cfg_aliases", + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.60.2", +] + +[[package]] +name = "quote" +version = "1.0.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b2ebcf727b7760c461f091f9f0f539b77b8e87f2fd88131e7f1b433b3cece4" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha 0.3.1", + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6db2770f06117d490610c7488547d543617b21bfa07796d7a12f6f1bd53850d1" +dependencies = [ + "rand_chacha 0.9.0", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom 0.2.17", +] + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "regex" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e10754a14b9137dd7b1e3e5b0493cc9171fdd105e0ab477f51b72e7f3ac0e276" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e1dd4122fc1595e8162618945476892eefca7b88c52820e74af6262213cae8f" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc897dd8d9e8bd1ed8cdad82b5966c3e0ecae09fb1907d58efaa013543185d0a" + +[[package]] +name = "reqwest" +version = "0.12.28" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eddd3ca559203180a307f12d114c268abf583f59b03cb906fd0b3ff8646c1147" +dependencies = [ + "base64", + "bytes", + "futures-core", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-util", + "js-sys", + "log", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper", + "tokio", + "tokio-rustls", + "tower", + "tower-http 0.6.8", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", + "webpki-roots", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rust_tripping" +version = "0.1.2" +dependencies = [ + "axum", + "axum-extra", + "rand 0.8.5", + "reqwest", + "serde", + "tera", + "tokio", + "tokio-postgres", + "tokio-util", + "toml", + "tower-http 0.5.2", +] + +[[package]] +name = "rustc-hash" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "357703d41365b4b27c590e3ed91eabb1b663f07c4c084095e60cbed4362dff0d" + +[[package]] +name = "rustls" +version = "0.23.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "758025cb5fccfd3bc2fd74708fd4682be41d99e5dff73c377c0646c6012c73a4" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be040f8b0a225e40375822a563fa9524378b9d63112f53e19ffff34df5d33fdd" +dependencies = [ + "web-time", + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7df23109aa6c1567d1c575b9952556388da57401e4ace1d15f79eedad0d8f53" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b39cdef0fa800fc44525c84ccb54a029961a8215f9619753635a9c0d2538d46d" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "same-file" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" +dependencies = [ + "winapi-util", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "serde" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a8e94ea7f378bd32cbbd37198a4a91436180c5bb472411e48b5ec2e2124ae9e" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41d385c7d4ca58e59fc732af25c3983b67ac852c1a25000afe1175de458b67ad" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.228" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d540f220d3187173da220f885ab66608367b6574e925011a9353e4badda91d79" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "serde_json" +version = "1.0.149" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "83fc039473c5595ace860d8c4fafa220ff474b3fc6bfdb4293327f1a37e94d86" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "10a9ff822e371bb5403e391ecd83e182e0e77ba7f6fe0160b795797109d1b457" +dependencies = [ + "itoa", + "serde", + "serde_core", +] + +[[package]] +name = "serde_spanned" +version = "0.6.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf41e0cfaf7226dca15e8197172c295a782857fcb97fad1808a166870dee75a3" +dependencies = [ + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha2" +version = "0.10.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7507d819769d01a365ab707794a4084392c824f54a7a6a7862f8c3d0892b283" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "siphasher" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b2aa850e253778c88a04c3d7323b043aeda9d3e30d5971937c1855769763678e" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "slug" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "882a80f72ee45de3cc9a5afeb2da0331d58df69e4e7d8eeb5d3c7784ae67e724" +dependencies = [ + "deunicode", + "wasm-bindgen", +] + +[[package]] +name = "smallvec" +version = "1.15.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67b1b7a3b5fe4f1376887184045fcf45c69e92af734b7aaddc05fb777b6fbd03" + +[[package]] +name = "socket2" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86f4aa3ad99f2088c990dfa82d367e19cb29268ed67c574d10d0a4bfe71f07e0" +dependencies = [ + "libc", + "windows-sys 0.60.2", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "stringprep" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", + "unicode-properties", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4d107df263a3013ef9b1879b0df87d706ff80f65a86ea879bd9c31f9b307c2a" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "sync_wrapper" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0bf256ce5efdfa370213c1dabab5935a12e49f2c58d15e9eac2870d3b4f27263" +dependencies = [ + "futures-core", +] + +[[package]] +name = "synstructure" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "728a70f3dbaf5bab7f0c4b1ac8d7ae5ea60a4b5549c8a5914361c99147a709d2" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tera" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8004bca281f2d32df3bacd59bc67b312cb4c70cea46cbd79dbe8ac5ed206722" +dependencies = [ + "chrono", + "chrono-tz", + "globwalk", + "humansize", + "lazy_static", + "percent-encoding", + "pest", + "pest_derive", + "rand 0.8.5", + "regex", + "serde", + "serde_json", + "slug", + "unicode-segmentation", +] + +[[package]] +name = "thiserror" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4288b5bcbc7920c07a1149a35cf9590a2aa808e0bc1eafaade0b80947865fbc4" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc4ee7f67670e9b64d05fa4253e753e016c6c95ff35b89b7941d6b856dec1d5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "time" +version = "0.3.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "743bd48c283afc0388f9b8827b976905fb217ad9e647fae3a379a9283c4def2c" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde_core", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7694e1cfe791f8d31026952abf09c69ca6f6fa4e1a1229e18988f06a04a12dca" + +[[package]] +name = "time-macros" +version = "0.2.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e70e4c5a0e0a8a4823ad65dfe1a6930e4f4d756dcd9dd7939022b5e8c501215" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tinystr" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42d3e9c45c09de15d06dd8acf5f4e0e399e85927b7f00711024eb7ae10fa4869" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa5fdc3bce6191a1dbc8c02d5c8bffcf557bafa17c124c5264a458f1b0613fa" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.49.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72a2903cd7736441aac9df9d7688bd0ce48edccaadf181c3b90be801e81d3d86" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af407857209536a95c8e56f8231ef2c2e2aff839b22e07a1ffcbc617e9db9fa5" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "tokio-postgres" +version = "0.7.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dcea47c8f71744367793f16c2db1f11cb859d28f436bdb4ca9193eb1f787ee42" +dependencies = [ + "async-trait", + "byteorder", + "bytes", + "fallible-iterator", + "futures-channel", + "futures-util", + "log", + "parking_lot", + "percent-encoding", + "phf 0.13.1", + "pin-project-lite", + "postgres-protocol", + "postgres-types", + "rand 0.9.2", + "socket2", + "tokio", + "tokio-util", + "whoami", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ae9cec805b01e8fc3fd2fe289f89149a9b66dd16786abd8b19cfa7b48cb0098" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc1beb996b9d83529a9e75c17a1686767d148d70663143c7854d8b4a09ced362" +dependencies = [ + "serde", + "serde_spanned", + "toml_datetime", + "toml_edit", +] + +[[package]] +name = "toml_datetime" +version = "0.6.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cddaf88f4fbc13c51aebbf5f8eceb5c7c5a9da2ac40a13519eb5b0a0e8f11c" +dependencies = [ + "serde", +] + +[[package]] +name = "toml_edit" +version = "0.22.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41fe8c660ae4257887cf66394862d21dbca4a6ddd26f04a3560410406a2f819a" +dependencies = [ + "indexmap", + "serde", + "serde_spanned", + "toml_datetime", + "toml_write", + "winnow", +] + +[[package]] +name = "toml_write" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d99f8c9a7727884afe522e9bd5edbfc91a3312b36a77b5fb8926e4c31a41801" + +[[package]] +name = "tower" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebe5ef63511595f1344e2d5cfa636d973292adc0eec1f0ad45fae9f0851ab1d4" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9cd434a998747dd2c4276bc96ee2e0c7a2eadf3cae88e52be55a05fa9053f5" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "http-range-header", + "httpdate", + "mime", + "mime_guess", + "percent-encoding", + "pin-project-lite", + "tokio", + "tokio-util", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-http" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4e6559d53cc268e5031cd8429d05415bc4cb4aefc4aa5d6cc35fbf5b924a1f8" +dependencies = [ + "bitflags", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-core", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typenum" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "562d481066bde0658276a35467c4af00bdc6ee726305698a55b86e61d7ad82bb" + +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "unicase" +version = "2.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc4bc3a9f746d862c45cb89d705aa10f187bb96c76001afab07a0d35ce60142" + +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-ident" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "537dd038a89878be9b64dd4bd1b260315c1bb94f4d784956b81e27a088d9a09e" + +[[package]] +name = "unicode-normalization" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fd4f6878c9cb28d874b009da9e8d183b5abc80117c40bbd187a1fde336be6e8" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-properties" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7df058c713841ad818f1dc5d3fd88063241cc61f49f5fbea4b951e8cf5a8d71d" + +[[package]] +name = "unicode-segmentation" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6ccf251212114b54433ec949fd6a7841275f9ada20dddd2f29e9ceea4501493" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff67a8a4397373c3ef660812acab3268222035010ab8680ec4215f38ba3d0eed" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "walkdir" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29790946404f91d9c5d06f9874efddea1dc06c5efe94541a7d6863108e3a5e4b" +dependencies = [ + "same-file", + "winapi-util", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasi" +version = "0.14.7+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "883478de20367e224c0090af9cf5f9fa85bed63a95c1abf3afc5c083ebc06e8c" +dependencies = [ + "wasip2", +] + +[[package]] +name = "wasip2" +version = "1.0.2+wasi-0.2.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9517f9239f02c069db75e65f174b3da828fe5f5b945c4dd26bd25d89c03ebcf5" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasite" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "66fe902b4a6b8028a753d5424909b764ccf79b7a209eac9bf97e59cda9f71a42" +dependencies = [ + "wasi 0.14.7+wasi-0.2.4", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6532f9a5c1ece3798cb1c2cfdba640b9b3ba884f5db45973a6f442510a87d38e" +dependencies = [ + "cfg-if", + "once_cell", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.64" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9c5522b3a28661442748e09d40924dfb9ca614b21c00d3fd135720e48b67db8" +dependencies = [ + "cfg-if", + "futures-util", + "js-sys", + "once_cell", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "18a2d50fcf105fb33bb15f00e7a77b772945a2ee45dcf454961fd843e74c18e6" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03ce4caeaac547cdf713d280eda22a730824dd11e6b8c3ca9e42247b25c631e3" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.114" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75a326b8c223ee17883a4251907455a2431acc2791c98c26279376490c378c16" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "854ba17bb104abfb26ba36da9729addc7ce7f06f5c0f90f3c391f8461cca21f9" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "web-time" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a6580f308b1fad9207618087a65c04e7a10bc77e02c8e84e9b00dd4b12fa0bb" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "1.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22cfaf3c063993ff62e73cb4311efde4db1efb31ab78a3e5c457939ad5cc0bed" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "whoami" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6a5b12f9df4f978d2cfdb1bd3bac52433f44393342d7ee9c25f5a1c14c0f45d" +dependencies = [ + "libc", + "libredox", + "objc2-system-configuration", + "wasite", + "web-sys", +] + +[[package]] +name = "winapi-util" +version = "0.1.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2a7b1c03c876122aa43f3020e6c3c3ee5c05081c9a00739faf7503aeba10d22" +dependencies = [ + "windows-sys 0.61.2", +] + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2f500e4d28234f72040990ec9d39e3a6b950f9f22d3dba18416c35882612bcb" +dependencies = [ + "windows-targets 0.53.5", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm 0.52.6", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.53.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4945f9f551b88e0d65f3db0bc25c33b8acea4d9e41163edf90dcd0b19f9069f3" +dependencies = [ + "windows-link", + "windows_aarch64_gnullvm 0.53.1", + "windows_aarch64_msvc 0.53.1", + "windows_i686_gnu 0.53.1", + "windows_i686_gnullvm 0.53.1", + "windows_i686_msvc 0.53.1", + "windows_x86_64_gnu 0.53.1", + "windows_x86_64_gnullvm 0.53.1", + "windows_x86_64_msvc 0.53.1", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9d8416fa8b42f5c947f8482c43e7d89e73a173cead56d044f6a56104a6d1b53" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9d782e804c2f632e395708e99a94275910eb9100b2114651e04744e9b125006" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "960e6da069d81e09becb0ca57a65220ddff016ff2d6af6a223cf372a506593a3" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa7359d10048f68ab8b09fa71c3daccfb0e9b559aed648a8f95469c27057180c" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_i686_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e7ac75179f18232fe9c285163565a57ef8d3c89254a30685b57d83a38d326c2" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c3842cdd74a865a8066ab39c8a7a473c0778a3f29370b5fd6b4b9aa7df4a499" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ffa179e2d07eee8ad8f57493436566c7cc30ac536a3379fdf008f47f6bb7ae1" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d6bbff5f0aada427a1e5a6da5f1f98158182f26556f345ac9e04d36d0ebed650" + +[[package]] +name = "winnow" +version = "0.7.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df79d97927682d2fd8adb29682d1140b343be4ac0f08fd68b7765d9c059d3945" +dependencies = [ + "memchr", +] + +[[package]] +name = "wit-bindgen" +version = "0.51.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7249219f66ced02969388cf2bb044a09756a083d0fab1e566056b04d9fbcaa5" + +[[package]] +name = "writeable" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9edde0db4769d2dc68579893f2306b26c6ecfbe0ef499b013d731b7b9247e0b9" + +[[package]] +name = "yoke" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72d6e5c6afb84d73944e5cedb052c4680d5657337201555f9f2a16b7406d4954" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b659052874eb698efe5b9e8cf382204678a0086ebf46982b79d6ca3182927e5d" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db6d35d663eadb6c932438e763b262fe1a70987f9ae936e60158176d710cae4a" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.39" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4122cd3169e94605190e77839c9a40d40ed048d305bfdc146e7df40ab0f3e517" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b97154e67e32c85465826e8bcc1c59429aaaf107c1e4a9e53c8d8ccd5eff88d0" + +[[package]] +name = "zerotrie" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a59c17a5562d507e4b54960e8569ebee33bee890c70aa3fe7b97e85a9fd7851" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c28719294829477f525be0186d13efa9a3c602f7ec202ca9e353d310fb9a002" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eadce39539ca5cb3985590102671f2567e659fca9666581ad3411d59207951f3" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + +[[package]] +name = "zmij" +version = "1.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8848ee67ecc8aedbaf3e4122217aff892639231befc6a1b58d29fff4c2cabaa" diff --git a/website/Cargo.toml b/website/Cargo.toml new file mode 100644 index 0000000..4c5f0c6 --- /dev/null +++ b/website/Cargo.toml @@ -0,0 +1,17 @@ +[package] +name = "website" +version = "0.1.2" +edition = "2021" + +[dependencies] +rand = "0.8" +axum = { version = "0.7", features = ["multipart"] } +tokio = { version = "1", features = ["rt-multi-thread", "macros", "fs", "io-util"] } +tower-http = { version = "0.5", features = ["fs"] } +tera = "1.19.1" +reqwest = { version = "0.12", features = ["json", "rustls-tls"], default-features = false } +serde = { version = "1", features = ["derive"] } +axum-extra = { version = "0.9", features = ["cookie"] } +tokio-postgres = "0.7" +toml = "0.8" +tokio-util = { version = "0.7", features = ["io"] } diff --git a/src/bin/init_db.rs b/website/src/bin/init_db.rs similarity index 79% rename from src/bin/init_db.rs rename to website/src/bin/init_db.rs index 945c03a..4bd94f8 100644 --- a/src/bin/init_db.rs +++ b/website/src/bin/init_db.rs @@ -1,4 +1,4 @@ -use rust_tripping::init_db; +use website::init_db; #[tokio::main] async fn main() -> Result<(), Box> { diff --git a/src/bin/run_server.rs b/website/src/bin/run_server.rs similarity index 78% rename from src/bin/run_server.rs rename to website/src/bin/run_server.rs index 3f7778b..105807e 100644 --- a/src/bin/run_server.rs +++ b/website/src/bin/run_server.rs @@ -1,4 +1,4 @@ -use rust_tripping::run_server; +use website::run_server; #[tokio::main] async fn main() -> Result<(), Box> { diff --git a/src/config.rs b/website/src/config.rs similarity index 81% rename from src/config.rs rename to website/src/config.rs index c68db29..aa02f04 100644 --- a/src/config.rs +++ b/website/src/config.rs @@ -8,6 +8,7 @@ pub struct GeneralServiceConfig { pub postgres_host: String, pub pg_database: String, pub postgres_user: String, + pub file_storage: String, } pub type ConfigResult = Result>; @@ -32,6 +33,14 @@ pub fn load_config(path: impl AsRef) -> ConfigResult .into()); } + if config.file_storage.trim().is_empty() { + return Err(std::io::Error::new( + std::io::ErrorKind::InvalidData, + "config file_storage is empty", + ) + .into()); + } + Ok(config) } diff --git a/src/db.rs b/website/src/db.rs similarity index 64% rename from src/db.rs rename to website/src/db.rs index 13b9193..c26038a 100644 --- a/src/db.rs +++ b/website/src/db.rs @@ -1,8 +1,7 @@ use tokio_postgres::{Client, NoTls}; -const PERSON_SCHEMA_NAME: &str = "public"; - use crate::config::GeneralServiceConfig; +use crate::web_file_uploads::render_upload_page; pub type DbResult = Result>; @@ -25,14 +24,23 @@ pub async fn connect_db(config: &GeneralServiceConfig) -> DbResult { pub async fn init_database(config: &GeneralServiceConfig) -> DbResult<()> { let client = connect_db(config).await?; - let create_sql = format!( - "CREATE TABLE IF NOT EXISTS \"{}\".person (\ + let create_sql = + "CREATE TABLE IF NOT EXISTS person (\ id SERIAL PRIMARY KEY,\ name TEXT NOT NULL,\ passcode TEXT NOT NULL\ - )", - PERSON_SCHEMA_NAME - ); - client.execute(create_sql.as_str(), &[]).await?; + )"; + client.execute(create_sql, &[]).await?; + + let create_files_sql = + "CREATE TABLE IF NOT EXISTS stored_file (\ + id SERIAL PRIMARY KEY,\ + filename TEXT NOT NULL,\ + size BIGINT NOT NULL\ + )"; + client.execute(create_files_sql, &[]).await?; + + tokio::fs::create_dir_all(&config.file_storage).await?; + Ok(()) } diff --git a/src/invoking_llms/deepseek.rs b/website/src/invoking_llms/deepseek.rs similarity index 100% rename from src/invoking_llms/deepseek.rs rename to website/src/invoking_llms/deepseek.rs diff --git a/src/invoking_llms/mod.rs b/website/src/invoking_llms/mod.rs similarity index 100% rename from src/invoking_llms/mod.rs rename to website/src/invoking_llms/mod.rs diff --git a/src/lib.rs b/website/src/lib.rs similarity index 70% rename from src/lib.rs rename to website/src/lib.rs index 47b6d09..46fa750 100644 --- a/src/lib.rs +++ b/website/src/lib.rs @@ -2,9 +2,11 @@ mod samplers; mod invoking_llms; mod db; mod config; +mod web_file_uploads; +mod web_app_state; use axum::{ - extract::{Form, Query, State}, + extract::{DefaultBodyLimit, Form, Query, State}, response::{Html, IntoResponse, Redirect, Response}, routing::{get, post}, Router, @@ -16,34 +18,20 @@ use std::net::SocketAddr; use std::pin::Pin; use std::sync::OnceLock; use tera::{Tera}; -use tower_http::services::ServeDir; +use tower_http::services::{ServeDir, ServeFile}; use samplers::random_junk::random_string; -pub use config::{ConfigResult, GeneralServiceConfig, load_config, load_config_default}; -pub use db::{DbResult, connect_db, init_database}; +use config::{ConfigResult, GeneralServiceConfig, load_config, load_config_default}; +use db::{DbResult, connect_db, init_database}; +use web_file_uploads::{get_file, upload_get, upload_post}; +use web_app_state::{AppState, AppStateInner, AuthenticatedUserId}; -pub struct AppStateInner { - pub config: GeneralServiceConfig, - pub db: tokio_postgres::Client, -} -pub type AppState = std::sync::Arc; - -pub async fn init_app_state() -> DbResult { +pub async fn init_app_state() -> Result> { let config = load_config_default()?; let db = connect_db(&config).await?; - Ok(std::sync::Arc::new(AppStateInner { config, db })) -} - -static TEMPLATES: OnceLock = OnceLock::new(); - -fn templates() -> &'static Tera { - TEMPLATES.get_or_init(|| Tera::new("src/pages/**/*.html").expect("load templates")) -} - -struct AuthenticatedUserId { - id: i32, - name: String, + let tera = Tera::new("frontend/pages/**/*.html")?; + Ok(std::sync::Arc::new(AppStateInner { config, db, tera })) } enum PasscodeAuthenticationResult{ @@ -59,14 +47,14 @@ enum WebsiteAuthenticationResult { async fn website_authentication_with_passcode( state: &AppStateInner, passcode: &str) -> PasscodeAuthenticationResult { let row = state.db.query_opt( - "SELECT id, name FROM public.person WHERE passcode = $1 LIMIT 1", + "SELECT id, name FROM person WHERE passcode = $1 LIMIT 1", &[&passcode], ).await; match row { Ok(Some(row)) => PasscodeAuthenticationResult::Ok(AuthenticatedUserId { - id: row.get(0), - name: row.get(1), + id: row.get::<_, i32>(0), + name: row.get::<_, String>(1), }), Ok(None) => PasscodeAuthenticationResult::WrongPassword, Err(err) => { @@ -91,15 +79,13 @@ async fn website_authentication_with_cookie( } -fn axum_handler_with_auth( +fn axum_handler_with_auth( handler: H, state: AppState, ) -> impl Fn(CookieJar, T) -> std::pin::Pin + Send>> + Clone + Send + 'static where - H: for<'a> Fn(T, &'a AppStateInner, AuthenticatedUserId) -> std::pin::Pin + Send + 'a>> - + Clone - + Send - + 'static, + H: (Fn(T, AppState, AuthenticatedUserId) -> Fut) + Send + Clone + 'static, + Fut: Future + Send + 'static, Res: IntoResponse + 'static, T: Send + 'static, { @@ -110,7 +96,7 @@ where let res = website_authentication_with_cookie(state.as_ref(), &jar).await; match res { WebsiteAuthenticationResult::SomeCookie(PasscodeAuthenticationResult::Ok(user)) => { - handler(args, state.as_ref(), user).await.into_response() + handler(args, state, user).await.into_response() } WebsiteAuthenticationResult::NoCookie => { Redirect::to("/login").into_response() @@ -167,9 +153,7 @@ async fn login_get( ctx.insert("logged_in_cur_user", &cur_user.name); } - let body = templates() - .render("login.html", &ctx) - .expect("render index"); + let body = state.tera.render("login.html", &ctx).expect("render index"); (jar, Html(body)) } @@ -205,41 +189,59 @@ async fn login_post( } } -fn index( + +async fn index( _: (), - _state: &AppStateInner, - _user: AuthenticatedUserId, -) -> std::pin::Pin> + Send + '_>> { - Box::pin(async move { - let body = templates() - .render("index.html", &tera::Context::new()) - .expect("render index"); - Html(body) - }) + state: AppState, + user: AuthenticatedUserId, +) -> impl IntoResponse { + let mut ctx = tera::Context::new(); + ctx.insert("logged_in_cur_user", &user.name); + let body = state.tera + .render("index.html", &ctx) + .expect("render index"); + Html(body) } -fn welcome( +async fn welcome( _: (), - _state: &AppStateInner, + _state: AppState, _user: AuthenticatedUserId, -) -> std::pin::Pin> + Send + '_>> { - Box::pin(async move { - let body = templates() - .render("welcome.html", &tera::Context::new()) - .expect("render welcome"); - Html(body) - }) +) -> impl IntoResponse { + let body = _state.tera + .render("welcome.html", &tera::Context::new()) + .expect("render welcome"); + Html(body) } +async fn board( + _: (), + _state: AppState, + _user: AuthenticatedUserId, +) -> impl IntoResponse { + let body = _state.tera + .render("board.html", &tera::Context::new()) + .expect("render welcome"); + Html(body) +} + + pub async fn run_server() -> Result<(), Box> { let state = init_app_state().await.expect("lol"); let app = Router::new() .route("/login", get(login_get)) .route("/login", post(login_post)) - .route("/welcome", get(axum_handler_with_auth(welcome, state.clone()))) - .route("/", get(axum_handler_with_auth(index, state.clone()))) - .nest_service("/static", ServeDir::new("src/static")) + .route("/upload", get(axum_handler_with_auth(upload_get, state.clone()))) + .route("/upload", post(axum_handler_with_auth(upload_post, state.clone()))) + .route("/get/:id", get(axum_handler_with_auth(get_file, state.clone()))) + .route("/welcome", get(axum_handler_with_auth(welcome, state.clone())), ) + .route("/board", get(axum_handler_with_auth(board, state.clone())), ) + .route("/", get(axum_handler_with_auth(index, state.clone())), ) + .nest_service("/static", ServeDir::new("frontend/static")) + .nest_service("/pkg/frontend.js", ServeFile::new("target_pkg/frontend.js")) + .nest_service("/pkg/frontend_bg.wasm", ServeFile::new("target_pkg/frontend_bg.wasm")) + .layer(DefaultBodyLimit::disable()) .with_state(state); let addr: SocketAddr = "127.0.0.1:3000".parse().expect("valid socket addr"); diff --git a/src/samplers/mod.rs b/website/src/samplers/mod.rs similarity index 100% rename from src/samplers/mod.rs rename to website/src/samplers/mod.rs diff --git a/src/samplers/random_junk.rs b/website/src/samplers/random_junk.rs similarity index 100% rename from src/samplers/random_junk.rs rename to website/src/samplers/random_junk.rs diff --git a/website/src/web_app_state.rs b/website/src/web_app_state.rs new file mode 100644 index 0000000..95c077e --- /dev/null +++ b/website/src/web_app_state.rs @@ -0,0 +1,15 @@ +use tera::Tera; +use crate::GeneralServiceConfig; + +pub struct AppStateInner { + pub config: GeneralServiceConfig, + pub db: tokio_postgres::Client, + pub tera: Tera, +} + +pub type AppState = std::sync::Arc; + +pub struct AuthenticatedUserId { + pub id: i32, + pub name: String, +} diff --git a/website/src/web_file_uploads.rs b/website/src/web_file_uploads.rs new file mode 100644 index 0000000..ed246c2 --- /dev/null +++ b/website/src/web_file_uploads.rs @@ -0,0 +1,260 @@ +use axum::{ + body::Body, + extract::{Multipart, Path, State}, + http::{header, HeaderValue, StatusCode}, + response::{Html, IntoResponse, Response}, +}; +use std::path::PathBuf; +use tokio::io::AsyncWriteExt; +use tokio_util::io::ReaderStream; + +pub const MAX_TOTAL_STORAGE_BYTES: i64 = 10 * 1024 * 1024 * 1024; +pub const MAX_FILE_SIZE_BYTES: i64 = 10 * 1024 * 1024 * 1024; + +use crate::web_app_state::{AppState, AppStateInner, AuthenticatedUserId}; + +pub struct UploadSuccess { + pub(crate) id: i32, + pub(crate) filename: String, + pub(crate) size: u64, +} + +pub fn render_upload_page(state: &AppStateInner, error: Option, success: Option) -> Html { + let mut ctx = tera::Context::new(); + if let Some(error) = error { + ctx.insert("error", &error); + } + if let Some(success) = success { + ctx.insert("success_id", &success.id); + ctx.insert("success_filename", &success.filename); + ctx.insert("success_size", &success.size); + } + let body = state.tera + .render("upload.html", &ctx) + .expect("render upload"); + Html(body) +} + +pub async fn upload_get( + _: (), + _state: AppState, + _user: AuthenticatedUserId,) -> Html { + render_upload_page(&_state, None, None) +} + +pub async fn upload_post( + (headers, mut multipart): (axum::http::HeaderMap, Multipart), + _state: AppState, + _user: AuthenticatedUserId, +) -> Html { + let content_length: u64 = match headers + .get(header::CONTENT_LENGTH) + .and_then(|value| value.to_str().ok()) + .and_then(|value| value.parse::().ok()) + { + Some(value) => value, + _ => return render_upload_page(&_state, + Some("Missing or invalid Content-Length".to_string()), + None, + ) + }; + + if (content_length > MAX_FILE_SIZE_BYTES as u64){ + return render_upload_page(&_state, Some("File size is too big".to_string()), None); + } + + let old_total_size: i64 = match _state .db.query_one( + "SELECT COALESCE(SUM(size), 0)::BIGINT FROM public.stored_file", + &[], + ).await { + Ok(row) => row.get::<_, i64>(0), + Err(err) => { + eprintln!("Database error: {err}"); + return render_upload_page(&_state, Some("Server error".to_string()), None, ); + } + }; + + assert!(0 <= old_total_size); + assert!(old_total_size <= MAX_TOTAL_STORAGE_BYTES); + + let total_with_new: u64 = old_total_size as u64 + content_length; + + if total_with_new > MAX_TOTAL_STORAGE_BYTES as u64 { + return render_upload_page(&_state, + Some("Storage limit exceeded (10 GiB)".to_string()), None, + ); + } + + let mut field = loop { + match multipart.next_field().await { + Ok(Some(field)) => { + if field.name() == Some("file") { + break field; + } + } + Ok(None) => {} + Err(err) => + return render_upload_page(&_state, + Some(format!("Upload error: {err}")), None, + ) + } + }; + + let filename = field + .file_name() + .map(|name| name.to_string()) + .unwrap_or_else(|| "upload".to_string()); + + let row = match _state.db.query_one( + "INSERT INTO public.stored_file (filename, size) VALUES ($1, 0) RETURNING id", + &[&filename], + ).await + { + Ok(row) => row, + Err(err) => { + return render_upload_page(&_state, + Some(format!("Database error: {err}")), + None, + ); + } + }; + let id: i32 = row.get::<_, i32>(0); + + let path = PathBuf::from(&_state.config.file_storage).join(id.to_string()); + let mut file = match tokio::fs::File::create(&path).await { + Ok(file) => file, + Err(err) => { + let _ = _state.db.execute( + "DELETE FROM public.stored_file WHERE id = $1", &[&id] + ).await; + eprintln!("Cannot create file: {err}"); + return render_upload_page(&_state, + Some("Filesystem error".to_string()), None, + ); + } + }; + + if let Err(err) = file.set_len(content_length).await { + let _ = tokio::fs::remove_file(&path).await; + let _ = _state.db.execute( + "DELETE FROM public.stored_file WHERE id = $1", &[&id] + ).await; + eprintln!("Cannot preallocate file: {err}"); + return render_upload_page(&_state, + Some("Filesystem error".to_string()), None, + ); + } + + let mut written: u64 = 0; + loop { + match field.chunk().await { + Ok(Some(chunk)) => { + let chunk_len = chunk.len() as u64; + if written + chunk_len > content_length { + let _ = tokio::fs::remove_file(&path).await; + let _ = _state.db.execute( + "DELETE FROM public.stored_file WHERE id = $1", &[&id] + ).await; + return render_upload_page(&_state, + Some("Your browser is bad".to_string()), None, + ); + } + written += chunk_len; + { + let percent = 100. * (written as f32) / (content_length as f32); + println!("DEBUG: uploaded {percent}, cur chunk is {chunk_len}") + } + if let Err(err) = file.write_all(&chunk).await { + let _ = tokio::fs::remove_file(&path).await; + let _ = _state.db.execute( + "DELETE FROM public.stored_file WHERE id = $1", &[&id] + ).await; + eprintln!("Can't write chunk to file: {err}"); + return render_upload_page(&_state, + Some("Filesystem error".to_string()), None, + ); + } + } + Ok(None) => break, + Err(err) => { + let _ = tokio::fs::remove_file(&path).await; + let _ = _state.db.execute( + "DELETE FROM public.stored_file WHERE id = $1", &[&id] + ).await; + return render_upload_page(&_state, + Some(format!("Upload error: {err}")), None, + ); + } + } + } + + if let Err(err) = _state.db.execute( + "UPDATE public.stored_file SET size = $1 WHERE id = $2", + &[&(written as i64), &id], + ).await { + let _ = tokio::fs::remove_file(&path).await; + let _ = _state.db.execute( + "DELETE FROM public.stored_file WHERE id = $1", &[&id] + ).await; + + return render_upload_page(&_state, + Some("Server error".to_string()), None, + ); + } + + render_upload_page(&_state, + None, Some(UploadSuccess { + id, filename, size: written, }) + ) +} + +pub async fn get_file( + Path(id): Path, + state: AppState, + _user: AuthenticatedUserId, +) -> Response { + let row = match state + .db + .query_opt( + "SELECT filename, size FROM public.stored_file WHERE id = $1", + &[&id], + ) + .await + { + Ok(Some(row)) => row, + Ok(None) => return StatusCode::NOT_FOUND.into_response(), + Err(err) => { + eprintln!("file lookup error: {err}"); + return StatusCode::INTERNAL_SERVER_ERROR.into_response(); + } + }; + + let filename: String = row.get(0); + let size: i64 = row.get(1); + + let path = PathBuf::from(&state.config.file_storage).join(id.to_string()); + let file = match tokio::fs::File::open(&path).await { + Ok(file) => file, + Err(err) => { + eprintln!("file open error for {path:?}: {err}"); + return StatusCode::NOT_FOUND.into_response(); + } + }; + + let stream = ReaderStream::new(file); + let body = Body::from_stream(stream); + let mut response = Response::new(body); + if let Ok(value) = HeaderValue::from_str(&size.to_string()) { + response.headers_mut().insert(header::CONTENT_LENGTH, value); + } + response + .headers_mut() + .insert(header::CONTENT_TYPE, HeaderValue::from_static("application/octet-stream")); + response.headers_mut().insert( + header::CONTENT_DISPOSITION, + HeaderValue::from_str(&format!("attachment; filename=\"{}\"", filename)).unwrap_or_else( + |_| HeaderValue::from_static("attachment"), + ), + ); + response +}