(fileBlob: Blob, filename: string)
| 870 | } |
| 871 | |
| 872 | async function uploadToFilebin(fileBlob: Blob, filename: string): Promise<string> { |
| 873 | if (Native) { |
| 874 | const result = await Native.uploadToFilebin(await fileBlob.arrayBuffer(), filename); |
| 875 | if (!result.success || !result.url) throw new Error(result.error || "No URL returned from upload"); |
| 876 | return result.url; |
| 877 | } |
| 878 | |
| 879 | const binId = makeRandomHex(6); |
| 880 | const uploadUrl = `https://filebin.net/${binId}/${encodeURIComponent(filename)}`; |
| 881 | const formData = new FormData(); |
| 882 | formData.append("file", fileBlob, filename); |
| 883 | |
| 884 | const response = await uploadRequestWithTimeout(uploadUrl, { |
| 885 | method: "POST", |
| 886 | body: formData |
| 887 | }); |
| 888 | |
| 889 | if (!response.ok) { |
| 890 | throw new Error(`Upload failed: ${response.status} ${await response.text()}`); |
| 891 | } |
| 892 | |
| 893 | return `https://filebin.net/${binId}/${encodeURIComponent(filename)}`; |
| 894 | } |
| 895 | |
| 896 | async function uploadToPixelVault(fileBlob: Blob, filename: string): Promise<string> { |
| 897 | const { pixelVaultKey } = settings.store as { pixelVaultKey?: string; }; |
no test coverage detected