[Add] Accepted Document Version

This commit is contained in:
Alex-Emmet 2026-02-03 22:46:54 +01:00
commit 0812d85e43
14 changed files with 231 additions and 72 deletions

View file

@ -22,7 +22,7 @@ use x448::{PublicKey, Secret};
static USERS: Lazy<Mutex<Vec<UserProfile>>> = Lazy::new(|| Mutex::new(Vec::new()));
static UNIQUE: Lazy<Mutex<bool>> = Lazy::new(|| Mutex::new(false));
// uuid::private_key
#[allow(dead_code)]
pub async fn load_from_tu(username: &str) -> Result<(), ()> {
let file_content = load_file("", &format!("{}.tu", username));
let segments = file_content.split("::").collect::<Vec<&str>>();
@ -181,6 +181,7 @@ pub async fn load_users() -> io::Result<()> {
Ok(())
}
#[allow(dead_code)]
pub fn set_unique(val: bool) {
*UNIQUE.lock().unwrap() = val;
}

View file

@ -1,7 +1,5 @@
use std::time::{SystemTime, UNIX_EPOCH};
use crate::gui::log_panel::log_message;
use crate::users::user_manager;
use crate::util::file_util::{has_file, load_file, used_dir_space};
use base64::{Engine as _, engine::general_purpose};
use json::{JsonValue, object};
@ -84,7 +82,7 @@ impl UserProfile {
let created_at = j["created_at"].as_i64()?;
let display_name = j["display_name"].as_str().map(|s| s.to_string());
let mut up = UserProfile {
let up = UserProfile {
user_id,
username,
display_name,
@ -110,6 +108,7 @@ impl UserProfile {
Some(up)
}
#[allow(dead_code)]
pub fn randomize_reset_token(&mut self) -> String {
let mut bytes = [0u8; 192];
OsRng.fill(bytes.as_mut());
@ -118,6 +117,7 @@ impl UserProfile {
new_token
}
#[allow(dead_code)]
pub fn get_display_name(&self) -> String {
self.display_name
.clone()