(
_: IpcMainInvokeEvent,
fileBuffer: ArrayBuffer,
filename: string
)
| 142 | } |
| 143 | |
| 144 | export async function uploadTo0x0( |
| 145 | _: IpcMainInvokeEvent, |
| 146 | fileBuffer: ArrayBuffer, |
| 147 | filename: string |
| 148 | ): Promise<NativeUploadResult> { |
| 149 | try { |
| 150 | const response = await multipartFetch("https://0x0.st", {}, "file", fileBuffer, filename); |
| 151 | |
| 152 | if (!response.ok) { |
| 153 | const errorText = await response.text(); |
| 154 | return { success: false, error: `Upload failed: ${response.status} ${errorText}` }; |
| 155 | } |
| 156 | |
| 157 | const text = (await response.text()).trim(); |
| 158 | if (!text) { |
| 159 | return { success: false, error: "No URL returned from upload" }; |
| 160 | } |
| 161 | |
| 162 | return { success: true, url: text }; |
| 163 | } catch (e) { |
| 164 | return { success: false, error: e instanceof Error ? e.message : "Unknown error" }; |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | export async function uploadToS3( |
| 169 | _: IpcMainInvokeEvent, |
nothing calls this directly
no test coverage detected