mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-04 14:41:14 +00:00
Introduced backend API endpoints for managing plugin configuration data, including listing, reading, saving, and deleting plugin data files. Added a new PluginData API module and registered related routes. Updated the frontend plugin manager controller to support these new API methods and corresponding TypeScript interfaces. Also fixed minor typos in documentation prompts.
34 lines
1.3 KiB
TypeScript
34 lines
1.3 KiB
TypeScript
import { OneBotAction } from '@/napcat-onebot/action/OneBotAction';
|
|
import { ActionName } from '@/napcat-onebot/action/router';
|
|
import { Static, Type } from '@sinclair/typebox';
|
|
|
|
export const GetFlashFileUrlPayloadSchema = Type.Object({
|
|
fileset_id: Type.String({ description: '文件集 ID' }),
|
|
file_name: Type.Optional(Type.String({ description: '文件名' })),
|
|
file_index: Type.Optional(Type.Number({ description: '文件索引' })),
|
|
});
|
|
|
|
export type GetFlashFileUrlPayload = Static<typeof GetFlashFileUrlPayloadSchema>;
|
|
|
|
export class GetFlashFileUrl extends OneBotAction<GetFlashFileUrlPayload, any> {
|
|
override actionName = ActionName.GetFlashFileUrl;
|
|
override payloadSchema = GetFlashFileUrlPayloadSchema;
|
|
override returnSchema = Type.Any({ description: '文件下载链接' });
|
|
override actionSummary = '获取闪传文件链接';
|
|
override actionTags = ['文件扩展'];
|
|
override payloadExample = {
|
|
fileset_id: 'set_123'
|
|
};
|
|
override returnExample = {
|
|
url: 'http://example.com/flash.jpg'
|
|
};
|
|
|
|
async _handle (payload: GetFlashFileUrlPayload) {
|
|
// 文件的索引依旧从0开始
|
|
return await this.core.apis.FlashApi.getFileTransUrl(payload.fileset_id, {
|
|
fileName: payload.file_name,
|
|
fileIndex: payload.file_index,
|
|
});
|
|
}
|
|
}
|