@blockrun/clawrouter 0.11.3 → 0.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +8 -8
- package/dist/cli.js.map +1 -1
- package/dist/index.js +8 -8
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -4942,18 +4942,18 @@ async function uploadDataUriToHost(dataUri) {
|
|
|
4942
4942
|
const buffer = Buffer.from(b64Data, "base64");
|
|
4943
4943
|
const blob = new Blob([buffer], { type: mimeType });
|
|
4944
4944
|
const form = new FormData();
|
|
4945
|
-
form.append("
|
|
4946
|
-
|
|
4945
|
+
form.append("reqtype", "fileupload");
|
|
4946
|
+
form.append("fileToUpload", blob, `image.${ext}`);
|
|
4947
|
+
const resp = await fetch("https://catbox.moe/user/api.php", {
|
|
4947
4948
|
method: "POST",
|
|
4948
4949
|
body: form
|
|
4949
4950
|
});
|
|
4950
|
-
if (!resp.ok) throw new Error(`
|
|
4951
|
-
const result = await resp.
|
|
4952
|
-
if (
|
|
4953
|
-
return
|
|
4951
|
+
if (!resp.ok) throw new Error(`catbox.moe upload failed: HTTP ${resp.status}`);
|
|
4952
|
+
const result = await resp.text();
|
|
4953
|
+
if (result.startsWith("https://")) {
|
|
4954
|
+
return result.trim();
|
|
4954
4955
|
}
|
|
4955
|
-
|
|
4956
|
-
throw new Error(`telegra.ph upload failed: ${errMsg}`);
|
|
4956
|
+
throw new Error(`catbox.moe upload failed: ${result}`);
|
|
4957
4957
|
}
|
|
4958
4958
|
async function startProxy(options) {
|
|
4959
4959
|
const apiBase = options.apiBase ?? BLOCKRUN_API;
|