koishi-plugin-checkgal 1.3.1 → 1.3.3
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/api.js +3 -3
- package/package.json +1 -1
package/lib/api.js
CHANGED
|
@@ -45,7 +45,7 @@ class TouchGalAPI {
|
|
|
45
45
|
constructor(ctx) {
|
|
46
46
|
this.http = ctx.http;
|
|
47
47
|
this.logger = ctx.logger('checkgal-api');
|
|
48
|
-
this.tempDir = path.join(ctx.app.baseDir, 'temp');
|
|
48
|
+
this.tempDir = path.join(ctx.app.baseDir, 'data', 'temp', 'checkgal');
|
|
49
49
|
ctx.on('ready', async () => {
|
|
50
50
|
await fs_1.promises.mkdir(this.tempDir, { recursive: true });
|
|
51
51
|
});
|
|
@@ -116,8 +116,8 @@ class TouchGalAPI {
|
|
|
116
116
|
const fileName = `${hash}.jpg`;
|
|
117
117
|
const filePath = path.join(this.tempDir, fileName);
|
|
118
118
|
await fs_1.promises.writeFile(filePath, imageBuffer);
|
|
119
|
-
//
|
|
120
|
-
return `
|
|
119
|
+
// 返回绝对文件路径的 file:// URL
|
|
120
|
+
return `file://${filePath}`;
|
|
121
121
|
}
|
|
122
122
|
catch (error) {
|
|
123
123
|
this.logger.error(`Failed to download or convert image from ${url}:`, error);
|