koishi-plugin-starfx-bot 0.19.10 → 0.19.11
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/lib/index.js +9 -8
- package/package.json +1 -1
- package/readme.md +1 -0
package/lib/index.js
CHANGED
|
@@ -1144,15 +1144,16 @@ async function sendImages(session, cfg, imageUrls) {
|
|
|
1144
1144
|
}
|
|
1145
1145
|
__name(sendImages, "sendImages");
|
|
1146
1146
|
async function getXImageBase64(url, cfg) {
|
|
1147
|
-
const
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1147
|
+
const opts = {
|
|
1148
|
+
responseType: "arraybuffer"
|
|
1149
|
+
};
|
|
1150
|
+
if (cfg.proxyUrl) {
|
|
1151
|
+
opts.httpAgent = new import_http_proxy_agent.HttpProxyAgent(cfg.proxyUrl);
|
|
1152
|
+
opts.httpsAgent = new import_https_proxy_agent.HttpsProxyAgent(cfg.proxyUrl);
|
|
1153
|
+
}
|
|
1154
|
+
const res = await import_axios.default.get(url, opts);
|
|
1152
1155
|
const base64 = Buffer.from(res.data, "binary").toString("base64");
|
|
1153
|
-
|
|
1154
|
-
console.log("success");
|
|
1155
|
-
return dataUrl;
|
|
1156
|
+
return `data:image/png;base64,${base64}`;
|
|
1156
1157
|
}
|
|
1157
1158
|
__name(getXImageBase64, "getXImageBase64");
|
|
1158
1159
|
|
package/package.json
CHANGED
package/readme.md
CHANGED