diff --git a/src/simple.rs b/src/simple.rs index 3b5adeb..1dd8f66 100644 --- a/src/simple.rs +++ b/src/simple.rs @@ -21,7 +21,7 @@ use askama_actix::TemplateToResponse; use chrono::{Duration, Utc}; use futures::{future::ready, StreamExt, TryStreamExt}; use futures_util::Stream; -use mime_guess::mime::{self, APPLICATION_OCTET_STREAM, IMAGE}; +use mime_guess::mime::{self, APPLICATION_OCTET_STREAM, IMAGE, VIDEO}; use rand::distributions::{Alphanumeric, DistString}; use serde::Deserialize; use syntect::{html::ClassedHTMLGenerator, parsing::SyntaxSet, util::LinesWithEndings}; @@ -203,6 +203,24 @@ async fn get_ext( } .to_response() } + Some(mime) if mime.type_() == VIDEO => { + #[derive(Template)] + #[template(path = "video.html")] + struct Video { + file_name: FileName, + delete_at: Option, + owner: bool, + copy: Option, + } + + Video { + file_name, + delete_at, + owner, + copy: None, + } + .to_response() + } _ if file.len() < 50_000 => { if let Ok(file) = String::from_utf8(file.to_vec().await.map_err(ErrorInternalServerError)?) diff --git a/templates/video.html b/templates/video.html new file mode 100644 index 0000000..363cf8b --- /dev/null +++ b/templates/video.html @@ -0,0 +1,5 @@ +{% extends "get.html" %} + +{% block file %} +