diff --git a/bun.lockb b/bun.lockb index a8ca6e2..09a103c 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/components.json b/components.json index 15f2b02..0b14023 100644 --- a/components.json +++ b/components.json @@ -12,6 +12,10 @@ }, "aliases": { "components": "@/components", - "utils": "@/lib/utils" - } + "utils": "@/lib/utils", + "ui": "@/components/ui", + "lib": "@/lib", + "hooks": "@/hooks" + }, + "iconLibrary": "lucide" } \ No newline at end of file diff --git a/components/UploadComponent.tsx b/components/UploadComponent.tsx index 58f6212..2ba2cf6 100644 --- a/components/UploadComponent.tsx +++ b/components/UploadComponent.tsx @@ -17,6 +17,14 @@ import { } from "@/components/ui/drawer" import { Spinner } from "@/components/spinner" import { signEvent } from "@/utils/utils" +import { + Select, + SelectContent, + SelectItem, + SelectTrigger, + SelectValue, +} from "@/components/ui/select" + async function calculateBlurhash(file: File): Promise { return new Promise((resolve, reject) => { @@ -51,6 +59,7 @@ const UploadComponent: React.FC = () => { const [uploadedNoteId, setUploadedNoteId] = useState("") const [retryCount, setRetryCount] = useState(0) const [shouldFetch, setShouldFetch] = useState(false) + const [serverChoice, setServerChoice] = useState("nostr.download") const { events, isLoading: isNoteLoading } = useNostrEvents({ filter: shouldFetch @@ -106,6 +115,10 @@ const UploadComponent: React.FC = () => { } } + const handleServerChange = (value: string) => { + setServerChoice(value) + } + async function onSubmit(event: FormEvent) { event.preventDefault() setIsLoading(true) @@ -174,8 +187,9 @@ const UploadComponent: React.FC = () => { // authEventSigned as base64 encoded string let authString = Buffer.from(JSON.stringify(authEventSigned)).toString('base64') - // Actually upload the file - await fetch("https://nostr.download/upload", { + const blossomServer = "https://" + serverChoice + + await fetch(blossomServer + "/upload", { method: "PUT", body: file, headers: { authorization: "Nostr " + authString }, @@ -220,7 +234,7 @@ const UploadComponent: React.FC = () => { // NIP-89 // ["client","lumina","31990:ff363e4afc398b7dd8ceb0b2e73e96fe9621ababc22ab150ffbb1aa0f34df8b2:1731850618505"] noteTags.push(["client", "lumina", "31990:" + "ff363e4afc398b7dd8ceb0b2e73e96fe9621ababc22ab150ffbb1aa0f34df8b2" + ":" + createdAt]) - + // Create the actual note const noteEvent: NostrEvent = { kind: 20, @@ -279,6 +293,22 @@ const UploadComponent: React.FC = () => {
+
+ {/* */} + Upload to + +
{previewUrl && Preview} {isLoading ? (