Version 0.2.0, small tweaks to UI

This commit is contained in:
G2-Games 2025-01-13 22:51:42 -06:00
parent 3e2e49bb79
commit dbb76a4062
5 changed files with 41 additions and 34 deletions

View file

@ -1,6 +1,6 @@
[package] [package]
name = "confetti_box" name = "confetti_box"
version = "0.1.3" version = "0.2.0"
repository = "https://github.com/Dangoware/confetti-box" repository = "https://github.com/Dangoware/confetti-box"
license = "AGPL-3.0-or-later" license = "AGPL-3.0-or-later"
authors.workspace = true authors.workspace = true
@ -10,19 +10,18 @@ edition = "2021"
workspace = true workspace = true
[dependencies] [dependencies]
blake3 = { version = "1.5.4", features = ["mmap", "rayon", "serde"] } blake3 = { version = "1.5", features = ["mmap", "rayon", "serde"] }
chrono = { version = "0.4.38", features = ["serde"] } chrono = { version = "0.4", features = ["serde"] }
ciborium = "0.2.2" ciborium = "0.2"
file-format = { version = "0.26", features = ["reader"] } file-format = { version = "0.26", features = ["reader"] }
log = "0.4" log = "0.4"
lz4_flex = "0.11.3"
maud = { version = "0.26", features = ["rocket"] } maud = { version = "0.26", features = ["rocket"] }
rand = "0.8.5" rand = "0.8"
rocket = { version = "0.5", features = ["json"] } rocket = { version = "0.5", features = ["json"] }
rocket_ws = "0.1.1" rocket_ws = "0.1"
serde = { version = "1.0.213", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }
serde_with = { version = "3.11.0", features = ["chrono_0_4"] } serde_with = { version = "3.11", features = ["chrono_0_4"] }
toml = "0.8.19" toml = "0.8"
unidecode = "0.3.0" unidecode = "0.3"
urlencoding = "2.1.3" urlencoding = "2.1"
uuid = { version = "1.11.0", features = ["serde", "v4"] } uuid = { version = "1.11", features = ["serde", "v4"] }

View file

@ -2,7 +2,7 @@ use std::{
collections::{hash_map::Values, HashMap, HashSet}, collections::{hash_map::Values, HashMap, HashSet},
ffi::OsStr, ffi::OsStr,
fs::{self, File}, fs::{self, File},
io, io::{self, Write},
path::{Path, PathBuf}, path::{Path, PathBuf},
sync::{Arc, RwLock}, sync::{Arc, RwLock},
}; };
@ -48,10 +48,9 @@ impl Mochibase {
/// Open the database from a path /// Open the database from a path
pub fn open<P: AsRef<Path>>(path: &P) -> Result<Self, io::Error> { pub fn open<P: AsRef<Path>>(path: &P) -> Result<Self, io::Error> {
let file = File::open(path)?; let mut file = File::open(path)?;
let mut lz4_file = lz4_flex::frame::FrameDecoder::new(file);
from_reader(&mut lz4_file) from_reader(&mut file)
.map_err(|e| io::Error::other(format!("failed to open database: {e}"))) .map_err(|e| io::Error::other(format!("failed to open database: {e}")))
} }
@ -67,11 +66,10 @@ impl Mochibase {
/// Save the database to its file /// Save the database to its file
pub fn save(&self) -> Result<(), io::Error> { pub fn save(&self) -> Result<(), io::Error> {
// Create a file and write the LZ4 compressed stream into it // Create a file and write the LZ4 compressed stream into it
let file = File::create(self.path.with_extension("bkp"))?; let mut file = File::create(self.path.with_extension("bkp"))?;
let mut lz4_file = lz4_flex::frame::FrameEncoder::new(file); into_writer(self, &mut file)
into_writer(self, &mut lz4_file)
.map_err(|e| io::Error::other(format!("failed to save database: {e}")))?; .map_err(|e| io::Error::other(format!("failed to save database: {e}")))?;
lz4_file.try_finish()?; file.flush()?;
fs::rename(self.path.with_extension("bkp"), &self.path).unwrap(); fs::rename(self.path.with_extension("bkp"), &self.path).unwrap();

View file

@ -19,12 +19,15 @@ pub fn head(page_title: &str) -> Markup {
pub fn footer() -> Markup { pub fn footer() -> Markup {
html! { html! {
footer { footer {
div {
p {a href="/" {"Home"}} p {a href="/" {"Home"}}
p {a href="/about" {"About"}} p {a href="/about" {"About"}}
p {a href="/api" {"API"}} p {a href="/api" {"API"}}
p {a href="https://github.com/Dangoware/confetti-box" {"Source"}} p {a href="https://github.com/Dangoware/confetti-box" {"Source"}}
p {a href="https://github.com/Dangoware/" {"Dangoware"}} p {a href="https://github.com/Dangoware/" {"Dangoware"}}
} }
p.version { "Running Confetti-Box v" (env!("CARGO_PKG_VERSION")) }
}
} }
} }

View file

@ -24,6 +24,7 @@ center {
} }
footer { footer {
div {
display: flex; display: flex;
width: fit-content; width: fit-content;
@ -35,6 +36,12 @@ footer {
p:last-child { p:last-child {
border-right: none; border-right: none;
} }
}
p.version {
margin-top: 0;
opacity: 45%;
}
} }
hr { hr {

View file

@ -206,7 +206,7 @@ async function uploadFileWebsocket(file, duration, maxSize) {
new_uri = "ws:"; new_uri = "ws:";
} }
new_uri += "//" + loc.host; new_uri += "//" + loc.host;
new_uri += loc.pathname + "/upload/websocket?name=" + file.name +"&size=" + file.size + "&duration=" + parseInt(duration); new_uri += "/upload/websocket?name=" + file.name +"&size=" + file.size + "&duration=" + parseInt(duration);
const socket = new WebSocket(new_uri); const socket = new WebSocket(new_uri);
const chunkSize = 10_000_000; const chunkSize = 10_000_000;