You've already forked AstralRinth
forked from xxxOFFxxx/AstralRinth
34 lines
1006 B
Rust
34 lines
1006 B
Rust
pub const MRPACK_MIME_TYPE: &str = "application/x-modrinth-modpack+zip";
|
|
|
|
pub fn get_image_content_type(extension: &str) -> Option<&'static str> {
|
|
match extension {
|
|
"bmp" => Some("image/bmp"),
|
|
"gif" => Some("image/gif"),
|
|
"jpeg" | "jpg" => Some("image/jpeg"),
|
|
"png" => Some("image/png"),
|
|
"webp" => Some("image/webp"),
|
|
_ => None,
|
|
}
|
|
}
|
|
|
|
pub fn get_image_ext(content_type: &str) -> Option<&'static str> {
|
|
match content_type {
|
|
"image/bmp" => Some("bmp"),
|
|
"image/gif" => Some("gif"),
|
|
"image/jpeg" => Some("jpg"),
|
|
"image/png" => Some("png"),
|
|
"image/webp" => Some("webp"),
|
|
_ => None,
|
|
}
|
|
}
|
|
|
|
pub fn project_file_type(ext: &str) -> Option<&str> {
|
|
match ext {
|
|
"jar" => Some("application/java-archive"),
|
|
"zip" | "litemod" => Some("application/zip"),
|
|
"mrpack" => Some(MRPACK_MIME_TYPE),
|
|
"asc" | "gpg" | "sig" => Some("application/pgp-signature"),
|
|
_ => None,
|
|
}
|
|
}
|