diff --git a/README.md b/README.md index 9087a3e..bac587e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,8 @@ Image hosting service - [NIP-96 Support](https://github.com/nostr-protocol/nips/blob/master/96.md) - [Blossom Support](https://github.com/hzrd149/blossom/blob/master/buds/bud-01.md) - Image compression to WebP (FFMPEG, NIP-96) -- Blurhash calculation (NIP-96) +- Blurhash calculation (NIP-96 only) +- AI image labeling ([ViT224](https://huggingface.co/google/vit-base-patch16-224)) ## Planned - Torrent seed V2 diff --git a/src/routes/nip96.rs b/src/routes/nip96.rs index 6908764..bab800c 100644 --- a/src/routes/nip96.rs +++ b/src/routes/nip96.rs @@ -117,6 +117,7 @@ struct Nip96Form<'r> { caption: Option<&'r str>, media_type: Option<&'r str>, content_type: Option<&'r str>, + no_transform: Option, } pub fn nip96_routes() -> Vec { @@ -161,6 +162,9 @@ async fn upload( return Nip96Response::error("File too large"); } } + if form.size > settings.max_upload_bytes { + return Nip96Response::error("File too large"); + } let file = match form.file.open().await { Ok(f) => f, Err(e) => return Nip96Response::error(&format!("Could not open file: {}", e)), @@ -175,7 +179,7 @@ async fn upload( } } match fs - .put(file, mime_type, true) + .put(file, mime_type, !form.no_transform.unwrap_or(false)) .await { Ok(blob) => { diff --git a/ui/index.html b/ui/index.html index ced2280..d3bb8ec 100644 --- a/ui/index.html +++ b/ui/index.html @@ -7,45 +7,67 @@ html { background-color: black; color: white; + font-size: 15px; + font-weight: 400; + font-family: Arial, serif; + } + + .flex { + display: flex; + } + + .flex-col { + flex-direction: column; + } + + .gap-2 { + gap: 0.5rem; } @@ -53,19 +75,25 @@

Welcome to void_cat_rs

-
-

+

+
Upload a file using NIP-96 -

- +
+
You must have a nostr extension for this to work - -
-
+
- +
+ + +
+
+ +