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 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 httpAgent = new import_http_proxy_agent.HttpProxyAgent(cfg.proxyUrl);
1148
- const httpsAgent = new import_https_proxy_agent.HttpsProxyAgent(cfg.proxyUrl);
1149
- import_axios.default.defaults.httpAgent = httpAgent;
1150
- import_axios.default.defaults.httpsAgent = httpsAgent;
1151
- const res = await import_axios.default.get(url, { responseType: "arraybuffer" });
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
- const dataUrl = `data:image/png;base64,${base64}`;
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
@@ -4,7 +4,7 @@
4
4
  "contributors": [
5
5
  "StarFreedomX <starfreedomx@outlook.com>"
6
6
  ],
7
- "version": "0.19.10",
7
+ "version": "0.19.11",
8
8
  "main": "lib/index.js",
9
9
  "typings": "lib/index.d.ts",
10
10
  "files": [
package/readme.md CHANGED
@@ -122,3 +122,4 @@ StarFreedomX机器人的小功能,自用
122
122
  | `0.19.8` | base64适配linux目录 |
123
123
  | `0.19.9` | base64更改适配windows |
124
124
  | `0.19.10` | 减少不必要的控制台输出 |
125
+ | `0.19.11` | 修复无代理情况下无法查看原图的bug |