koishi-plugin-checkgal 1.5.3 → 1.6.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.d.ts +1 -0
- package/lib/api.js +8 -7
- package/lib/index.d.ts +1 -0
- package/lib/index.js +2 -1
- package/package.json +15 -6
package/lib/api.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { Config } from './config';
|
|
|
4
4
|
export declare class TouchGalAPI {
|
|
5
5
|
private http;
|
|
6
6
|
private logger;
|
|
7
|
+
private ctx;
|
|
7
8
|
constructor(ctx: Context);
|
|
8
9
|
searchGame(keyword: string, config: Config): Promise<GameInfo[]>;
|
|
9
10
|
getDownloads(patchId: number): Promise<DownloadResource[]>;
|
package/lib/api.js
CHANGED
|
@@ -1,12 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.TouchGalAPI = void 0;
|
|
7
|
-
const sharp_1 = __importDefault(require("sharp"));
|
|
8
4
|
class TouchGalAPI {
|
|
9
5
|
constructor(ctx) {
|
|
6
|
+
this.ctx = ctx;
|
|
10
7
|
this.http = ctx.http;
|
|
11
8
|
this.logger = ctx.logger('checkgal-api');
|
|
12
9
|
}
|
|
@@ -69,9 +66,13 @@ class TouchGalAPI {
|
|
|
69
66
|
const response = await this.http.get(url, {
|
|
70
67
|
responseType: 'arraybuffer',
|
|
71
68
|
});
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
69
|
+
const imageBuffer = Buffer.from(response);
|
|
70
|
+
// 使用 ffmpeg 将图片转换为 jpeg
|
|
71
|
+
const jpegBuffer = await this.ctx.ffmpeg.builder()
|
|
72
|
+
.input(imageBuffer)
|
|
73
|
+
.outputOption('-f', 'mjpeg')
|
|
74
|
+
.run('buffer');
|
|
75
|
+
return jpegBuffer;
|
|
75
76
|
}
|
|
76
77
|
catch (error) {
|
|
77
78
|
this.logger.error(`Failed to download or convert image from ${url}:`, error);
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Config = exports.name = void 0;
|
|
3
|
+
exports.Config = exports.inject = exports.name = void 0;
|
|
4
4
|
exports.apply = apply;
|
|
5
5
|
const config_1 = require("./config");
|
|
6
6
|
Object.defineProperty(exports, "Config", { enumerable: true, get: function () { return config_1.Config; } });
|
|
@@ -8,6 +8,7 @@ const api_1 = require("./api");
|
|
|
8
8
|
const cache_1 = require("./cache");
|
|
9
9
|
const commands_1 = require("./commands");
|
|
10
10
|
exports.name = 'checkgal';
|
|
11
|
+
exports.inject = ['ffmpeg'];
|
|
11
12
|
function apply(ctx, config) {
|
|
12
13
|
// 初始化服务
|
|
13
14
|
const api = new api_1.TouchGalAPI(ctx);
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "koishi-plugin-checkgal",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.6.3",
|
|
4
|
+
"scripts": {
|
|
5
|
+
"build": "tsc"
|
|
6
|
+
},
|
|
4
7
|
"description": "基于TouchGal API的Galgame信息查询与下载插件",
|
|
5
|
-
|
|
8
|
+
"contributors": [
|
|
6
9
|
"lumia.wang <fenglian19980510@gmail.com>"
|
|
7
10
|
],
|
|
8
11
|
"main": "lib/index.js",
|
|
@@ -27,15 +30,21 @@
|
|
|
27
30
|
"galgame"
|
|
28
31
|
],
|
|
29
32
|
"peerDependencies": {
|
|
30
|
-
"koishi": "^4.18.9"
|
|
33
|
+
"koishi": "^4.18.9",
|
|
34
|
+
"koishi-plugin-ffmpeg": ""
|
|
31
35
|
},
|
|
32
36
|
"koishi": {
|
|
33
37
|
"description": {
|
|
34
38
|
"zh": "基于TouchGal API的Galgame信息查询与下载插件"
|
|
39
|
+
},
|
|
40
|
+
"service": {
|
|
41
|
+
"required": [
|
|
42
|
+
"ffmpeg"
|
|
43
|
+
]
|
|
35
44
|
}
|
|
36
45
|
},
|
|
37
46
|
"devDependencies": {
|
|
38
|
-
"typescript": "^5.
|
|
39
|
-
"@types/
|
|
47
|
+
"typescript": "^5.4.0",
|
|
48
|
+
"@types/node": "^18.0.0"
|
|
40
49
|
}
|
|
41
|
-
}
|
|
50
|
+
}
|