[WIP] A (somewhat barebones) atproto app for creating custom sites without hosting!

upload: guess mime type from extension via mime_guess crate

i am absolving myself of all mime type issues with the upload function

ppl can pr OR manually edit mime types on pdsls OR just use normal file extensions

vielle.dev edc717c4 f5f3239a

verified
Changed files
+29 -1
upload
+23
upload/Cargo.lock
··· 67 dependencies = [ 68 "clap", 69 "ignore", 70 "regex", 71 ] 72 ··· 205 checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" 206 207 [[package]] 208 name = "once_cell_polyfill" 209 version = "1.70.1" 210 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 311 "quote", 312 "unicode-ident", 313 ] 314 315 [[package]] 316 name = "unicode-ident"
··· 67 dependencies = [ 68 "clap", 69 "ignore", 70 + "mime_guess", 71 "regex", 72 ] 73 ··· 206 checksum = "f52b00d39961fc5b2736ea853c9cc86238e165017a493d1d5c8eac6bdc4cc273" 207 208 [[package]] 209 + name = "mime" 210 + version = "0.3.17" 211 + source = "registry+https://github.com/rust-lang/crates.io-index" 212 + checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" 213 + 214 + [[package]] 215 + name = "mime_guess" 216 + version = "2.0.5" 217 + source = "registry+https://github.com/rust-lang/crates.io-index" 218 + checksum = "f7c44f8e672c00fe5308fa235f821cb4198414e1c77935c1ab6948d3fd78550e" 219 + dependencies = [ 220 + "mime", 221 + "unicase", 222 + ] 223 + 224 + [[package]] 225 name = "once_cell_polyfill" 226 version = "1.70.1" 227 source = "registry+https://github.com/rust-lang/crates.io-index" ··· 328 "quote", 329 "unicode-ident", 330 ] 331 + 332 + [[package]] 333 + name = "unicase" 334 + version = "2.8.1" 335 + source = "registry+https://github.com/rust-lang/crates.io-index" 336 + checksum = "75b844d17643ee918803943289730bec8aac480150456169e647ed0b576ba539" 337 338 [[package]] 339 name = "unicode-ident"
+1
upload/Cargo.toml
··· 7 clap = { version = "4.5.49", features = ["derive"] } 8 ignore = "0.4.23" 9 regex = "1.12.2"
··· 7 clap = { version = "4.5.49", features = ["derive"] } 8 ignore = "0.4.23" 9 regex = "1.12.2" 10 + mime_guess = "2.0.5"
+5 -1
upload/src/sitemap.rs
··· 79 let key = x.path().to_str()?; 80 let key = String::from(key); 81 82 Some(( 83 key, 84 SitemapNode { 85 - mime_type: String::from("application/octet-stream"), 86 blob: BlobRef::Local(x.path().to_owned()), 87 }, 88 ))
··· 79 let key = x.path().to_str()?; 80 let key = String::from(key); 81 82 + let mime = mime_guess::from_path(&key); 83 + let mime = mime.first()?; 84 + let mime = mime.essence_str(); 85 + 86 Some(( 87 key, 88 SitemapNode { 89 + mime_type: String::from(mime), 90 blob: BlobRef::Local(x.path().to_owned()), 91 }, 92 ))