* feat: pnpm new * Refactor build and release workflows, update dependencies Switch build scripts and workflows from npm to pnpm, update build and artifact paths, and simplify release workflow by removing version detection and changelog steps. Add new dependencies (silk-wasm, express, ws, node-pty-prebuilt-multiarch), update exports in package.json files, and add vite config for napcat-framework. Also, rename manifest.json for framework package and fix static asset copying in shell build config.
39 lines
1.2 KiB
TypeScript
39 lines
1.2 KiB
TypeScript
import { NapCatCore } from '@/napcat-core/index';
|
|
|
|
export interface NapCoreCompatBasicInfo {
|
|
readonly requireMinNTQQBuild: (buildVer: string) => boolean;
|
|
readonly uin: number;
|
|
readonly uid: string;
|
|
readonly uin2uid: (uin: number) => Promise<string>;
|
|
readonly uid2uin: (uid: string) => Promise<number>;
|
|
readonly sendSsoCmdReqByContend: (cmd: string, trace_id: string) => Promise<void>;
|
|
}
|
|
|
|
export class NapCoreContext {
|
|
private readonly core: NapCatCore;
|
|
|
|
constructor (core: NapCatCore) {
|
|
this.core = core;
|
|
}
|
|
|
|
get logger () {
|
|
return this.core.context.logger;
|
|
}
|
|
|
|
get basicInfo () {
|
|
return {
|
|
requireMinNTQQBuild: (buildVer: string) => this.core.context.basicInfoWrapper.requireMinNTQQBuild(buildVer),
|
|
uin: +this.core.selfInfo.uin,
|
|
uid: this.core.selfInfo.uid,
|
|
uin2uid: (uin: number) => this.core.apis.UserApi.getUidByUinV2(String(uin)).then(res => res ?? ''),
|
|
uid2uin: (uid: string) => this.core.apis.UserApi.getUinByUidV2(uid).then(res => +res),
|
|
} as NapCoreCompatBasicInfo;
|
|
}
|
|
|
|
get config () {
|
|
return this.core.configLoader.configData;
|
|
}
|
|
|
|
sendSsoCmdReqByContend = (cmd: string, data: Buffer) => this.core.context.session.getMsgService().sendSsoCmdReqByContend(cmd, data);
|
|
}
|