Project gallery, webhook fixes, remove cache, re-enable donation URLs (#222)

This commit is contained in:
Geometrically
2021-07-19 11:30:39 -07:00
committed by GitHub
parent 981bf1d56f
commit 9ee92fb9e9
15 changed files with 961 additions and 689 deletions

27
src/util/ext.rs Normal file
View File

@@ -0,0 +1,27 @@
pub fn get_image_content_type(extension: &str) -> Option<&'static str> {
let content_type = match &*extension {
"bmp" => "image/bmp",
"gif" => "image/gif",
"jpeg" | "jpg" | "jpe" => "image/jpeg",
"png" => "image/png",
"svg" | "svgz" => "image/svg+xml",
"webp" => "image/webp",
"rgb" => "image/x-rgb",
"mp4" => "video/mp4",
_ => "",
};
if !content_type.is_empty() {
Some(content_type)
} else {
None
}
}
pub fn project_file_type(ext: &str) -> Option<&str> {
match ext {
"jar" => Some("application/java-archive"),
"zip" => Some("application/zip"),
_ => None,
}
}

View File

@@ -1,3 +1,4 @@
pub mod auth;
pub mod ext;
pub mod validate;
pub mod webhook;