@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/cli.js
CHANGED
|
@@ -4792,18 +4792,18 @@ async function uploadDataUriToHost(dataUri) {
|
|
|
4792
4792
|
const buffer = Buffer.from(b64Data, "base64");
|
|
4793
4793
|
const blob = new Blob([buffer], { type: mimeType });
|
|
4794
4794
|
const form = new FormData();
|
|
4795
|
-
form.append("
|
|
4796
|
-
|
|
4795
|
+
form.append("reqtype", "fileupload");
|
|
4796
|
+
form.append("fileToUpload", blob, `image.${ext}`);
|
|
4797
|
+
const resp = await fetch("https://catbox.moe/user/api.php", {
|
|
4797
4798
|
method: "POST",
|
|
4798
4799
|
body: form
|
|
4799
4800
|
});
|
|
4800
|
-
if (!resp.ok) throw new Error(`
|
|
4801
|
-
const result = await resp.
|
|
4802
|
-
if (
|
|
4803
|
-
return
|
|
4801
|
+
if (!resp.ok) throw new Error(`catbox.moe upload failed: HTTP ${resp.status}`);
|
|
4802
|
+
const result = await resp.text();
|
|
4803
|
+
if (result.startsWith("https://")) {
|
|
4804
|
+
return result.trim();
|
|
4804
4805
|
}
|
|
4805
|
-
|
|
4806
|
-
throw new Error(`telegra.ph upload failed: ${errMsg}`);
|
|
4806
|
+
throw new Error(`catbox.moe upload failed: ${result}`);
|
|
4807
4807
|
}
|
|
4808
4808
|
async function startProxy(options) {
|
|
4809
4809
|
const apiBase = options.apiBase ?? BLOCKRUN_API;
|