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

View file

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

View file

@ -19,12 +19,15 @@ pub fn head(page_title: &str) -> Markup {
pub fn footer() -> Markup {
html! {
footer {
div {
p {a href="/" {"Home"}}
p {a href="/about" {"About"}}
p {a href="/api" {"API"}}
p {a href="https://github.com/Dangoware/confetti-box" {"Source"}}
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 {
div {
display: flex;
width: fit-content;
@ -37,6 +38,12 @@ footer {
}
}
p.version {
margin-top: 0;
opacity: 45%;
}
}
hr {
background-color: gray;
width: 100%;

View file

@ -206,7 +206,7 @@ async function uploadFileWebsocket(file, duration, maxSize) {
new_uri = "ws:";
}
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 chunkSize = 10_000_000;