Add QR codes, link expiry, password protection, previews, audit trail and bulk operations
This commit is contained in:
1 parent
157aa81252
commit
bcbcc90d98
88 files changed
+5354
-815
No files matched your search
@@ -1,4 +1,4 @@
|
||||
use sha2::{Sha256, Digest};
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
// General SHA-256 hash helper
|
||||
pub fn sha256_hash(data: &str) -> String {
|
||||
|
||||
+4
-4
@@ -1,11 +1,11 @@
|
||||
pub mod time;
|
||||
pub mod system;
|
||||
pub mod hashing;
|
||||
pub mod network;
|
||||
pub mod random;
|
||||
pub mod system;
|
||||
pub mod time;
|
||||
|
||||
pub use time::format_duration;
|
||||
pub use system::{get_memory_usage, get_db_file_info};
|
||||
pub use hashing::sha256_hash;
|
||||
pub use network::get_client_ip;
|
||||
pub use random::generate_token;
|
||||
pub use system::{get_db_file_info, get_memory_usage};
|
||||
pub use time::format_duration;
|
||||
@@ -1,12 +1,12 @@
|
||||
use axum::{extract::ConnectInfo, http::HeaderMap};
|
||||
use std::net::SocketAddr;
|
||||
use axum::{
|
||||
extract::ConnectInfo,
|
||||
http::HeaderMap,
|
||||
};
|
||||
|
||||
// Extract client IP address from proxy headers or connection info
|
||||
pub fn get_client_ip(headers: &HeaderMap, connect_info: Option<ConnectInfo<SocketAddr>>) -> String {
|
||||
if let Some(ip) = headers.get("cf-connecting-ip").and_then(|h| h.to_str().ok()) {
|
||||
if let Some(ip) = headers
|
||||
.get("cf-connecting-ip")
|
||||
.and_then(|h| h.to_str().ok())
|
||||
{
|
||||
return ip.to_string();
|
||||
}
|
||||
if let Some(ip) = headers.get("x-real-ip").and_then(|h| h.to_str().ok()) {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
use rand::{RngCore, thread_rng};
|
||||
use rand::{thread_rng, RngCore};
|
||||
|
||||
// Generate a secure random token (hex-encoded)
|
||||
pub fn generate_token(bytes_len: usize) -> String {
|
||||
|
||||
+6
-1
@@ -30,7 +30,12 @@ pub fn get_db_file_info(data_dir: &Path) -> String {
|
||||
if path.exists() {
|
||||
if let Ok(metadata) = std::fs::metadata(&path) {
|
||||
let size = metadata.len();
|
||||
stats.push_str(&format!("{}: {} bytes ({:.2} MB)\n", name, size, size as f64 / 1_048_576.0));
|
||||
stats.push_str(&format!(
|
||||
"{}: {} bytes ({:.2} MB)\n",
|
||||
name,
|
||||
size,
|
||||
size as f64 / 1_048_576.0
|
||||
));
|
||||
}
|
||||
} else {
|
||||
stats.push_str(&format!("{}: File not created yet\n", name));
|
||||
|
||||
Reference in new issue
Block a user