update use lines

This commit is contained in:
minish 2025-12-05 01:32:50 -05:00
parent daa46f9872
commit 2932798884
Signed by: min
SSH Key Fingerprint: SHA256:mf+pUTmK92Y57BuCjlkBdd82LqztTfDCQIUp0fCKABc
4 changed files with 11 additions and 9 deletions

View File

@ -1,13 +1,13 @@
use std::sync::{Arc, atomic::Ordering};
use axum::extract::{Query, State};
use base64::{Engine, prelude::BASE64_URL_SAFE_NO_PAD};
use base64::{Engine as _, prelude::BASE64_URL_SAFE_NO_PAD};
use bytes::{Buf, BytesMut};
use hmac::Mac;
use http::StatusCode;
use serde::Deserialize;
use crate::engine::update_hmac;
use crate::engine::{Engine, update_hmac};
#[derive(Deserialize)]
pub struct DeleteRequest {
@ -17,7 +17,7 @@ pub struct DeleteRequest {
}
pub async fn delete(
State(engine): State<Arc<crate::engine::Engine>>,
State(engine): State<Arc<Engine>>,
Query(req): Query<DeleteRequest>,
) -> (StatusCode, &'static str) {
let Some(mut hmac) = engine.deletion_hmac.clone() else {

View File

@ -2,8 +2,10 @@ use std::sync::{Arc, atomic::Ordering};
use axum::extract::State;
use crate::engine::Engine;
/// Show index status page with amount of uploaded files
pub async fn index(State(engine): State<Arc<crate::engine::Engine>>) -> String {
pub async fn index(State(engine): State<Arc<Engine>>) -> String {
let count = engine.upl_count.load(Ordering::Relaxed);
let motd = engine.cfg.motd.clone();

View File

@ -8,7 +8,7 @@ use std::{
use axum::{
body::Body,
extract::{Query, State},
response::{IntoResponse, Response},
response::{IntoResponse as _, Response},
};
use axum_extra::TypedHeader;
use headers::ContentLength;
@ -17,7 +17,7 @@ use serde::Deserialize;
use serde_with::{DurationSeconds, serde_as};
use tracing::error;
use crate::engine::ProcessOutcome;
use crate::engine::{Engine, ProcessOutcome};
fn default_keep_exif() -> bool {
false
@ -40,7 +40,7 @@ pub struct NewRequest {
/// The request handler for the /new path.
/// This handles all new uploads.
pub async fn new(
State(engine): State<Arc<crate::engine::Engine>>,
State(engine): State<Arc<Engine>>,
Query(req): Query<NewRequest>,
TypedHeader(ContentLength(content_length)): TypedHeader<ContentLength>,
body: Body,

View File

@ -12,7 +12,7 @@ use http::{HeaderValue, StatusCode};
use tokio_util::io::ReaderStream;
use tracing::error;
use crate::engine::{GetOutcome, UploadData, UploadResponse};
use crate::engine::{Engine, GetOutcome, UploadData, UploadResponse};
/// Responses for a failed view operation
pub enum ViewError {
@ -88,7 +88,7 @@ impl IntoResponse for UploadResponse {
/// GET request handler for /p/* path.
/// All file views are handled here.
pub async fn view(
State(engine): State<Arc<crate::engine::Engine>>,
State(engine): State<Arc<Engine>>,
Path(original_path): Path<PathBuf>,
range: Option<TypedHeader<Range>>,
) -> Result<UploadResponse, ViewError> {