| 692 | } |
| 693 | |
| 694 | async function uploadTo0x0(fileBlob: Blob, filename: string): Promise<string> { |
| 695 | if (!Native) { |
| 696 | throw new Error("0x0.st uploads are only supported on the desktop client"); |
| 697 | } |
| 698 | |
| 699 | const arrayBuffer = await fileBlob.arrayBuffer(); |
| 700 | const result = await Native.uploadTo0x0(arrayBuffer, filename); |
| 701 | |
| 702 | if (!result.success) { |
| 703 | throw new Error(result.error || "Upload failed"); |
| 704 | } |
| 705 | |
| 706 | if (!result.url) { |
| 707 | throw new Error("No URL returned from upload"); |
| 708 | } |
| 709 | |
| 710 | return result.url; |
| 711 | } |
| 712 | |
| 713 | async function uploadToLitterbox(fileBlob: Blob, filename: string): Promise<string> { |
| 714 | const expiry = settings.store.litterboxExpiry || "24h"; |