mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-19 05:05:44 +08:00
Replace nap-proto-core with napcat-protobuf package
Switched all imports from '@napneko/nap-proto-core' to the new 'napcat-protobuf' package across napcat-core and related packages. Updated dependencies and references to support the new package structure, improving maintainability and workspace integration.
This commit is contained in:
parent
8bc8df32f9
commit
36aa08a8f5
@ -7,12 +7,14 @@
|
|||||||
"build:shell": "pnpm --filter napcat-shell run build || exit 1",
|
"build:shell": "pnpm --filter napcat-shell run build || exit 1",
|
||||||
"build:framework": "pnpm --filter napcat-framework run build || exit 1",
|
"build:framework": "pnpm --filter napcat-framework run build || exit 1",
|
||||||
"build:webui": "pnpm --filter napcat-webui-frontend run build || exit 1",
|
"build:webui": "pnpm --filter napcat-webui-frontend run build || exit 1",
|
||||||
"dev:shell": "pnpm --filter napcat-develop run dev || exit 1"
|
"dev:shell": "pnpm --filter napcat-develop run dev || exit 1",
|
||||||
|
"typecheck": "pnpm -w -r --filter napcat-shell --filter napcat-framework run typecheck"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rollup/plugin-node-resolve": "^16.0.3",
|
"@rollup/plugin-node-resolve": "^16.0.3",
|
||||||
"vite": "^6.4.1",
|
"vite": "^6.4.1",
|
||||||
"vite-plugin-cp": "^6.0.3"
|
"vite-plugin-cp": "^6.0.3",
|
||||||
|
"typescript": "^5.3.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"silk-wasm": "^3.6.1",
|
"silk-wasm": "^3.6.1",
|
||||||
|
|||||||
@ -1 +1,3 @@
|
|||||||
export const napCatVersion = import.meta.env.VITE_NAPCAT_VERSION || 'alpha';
|
// @ts-ignore
|
||||||
|
export const napCatVersion = (typeof import.meta?.env !== 'undefined' && import.meta.env.VITE_NAPCAT_VERSION) || 'alpha';
|
||||||
|
|
||||||
|
|||||||
@ -26,7 +26,7 @@ import { SendMessageContext } from 'napcat-onebot/api/msg';
|
|||||||
import { getFileTypeForSendType } from '../helper/msg';
|
import { getFileTypeForSendType } from '../helper/msg';
|
||||||
import { FFmpegService } from 'napcat-common/src/ffmpeg';
|
import { FFmpegService } from 'napcat-common/src/ffmpeg';
|
||||||
import { rkeyDataType } from '../types/file';
|
import { rkeyDataType } from '../types/file';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { FileId } from '../packet/transformer/proto/misc/fileid';
|
import { FileId } from '../packet/transformer/proto/misc/fileid';
|
||||||
import { imageSizeFallBack } from 'napcat-image-size';
|
import { imageSizeFallBack } from 'napcat-image-size';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// TODO: further refactor in NapCat.Packet v2
|
// TODO: further refactor in NapCat.Packet v2
|
||||||
import { NapProtoMsg, ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { NapProtoMsg, ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
const LikeDetail = {
|
const LikeDetail = {
|
||||||
txt: ProtoField(1, ScalarType.STRING),
|
txt: ProtoField(1, ScalarType.STRING),
|
||||||
|
|||||||
@ -14,7 +14,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@protobuf-ts/runtime": "^2.11.1",
|
"@protobuf-ts/runtime": "^2.11.1",
|
||||||
"@napneko/nap-proto-core": "^0.0.4",
|
"napcat-protobuf": "workspace:*",
|
||||||
"ajv": "^8.13.0",
|
"ajv": "^8.13.0",
|
||||||
"@sinclair/typebox": "^0.34.38",
|
"@sinclair/typebox": "^0.34.38",
|
||||||
"file-type": "^21.0.0",
|
"file-type": "^21.0.0",
|
||||||
|
|||||||
@ -12,7 +12,7 @@ import {
|
|||||||
import { ChatType, MsgSourceType, NTMsgType, RawMessage } from 'napcat-core/index';
|
import { ChatType, MsgSourceType, NTMsgType, RawMessage } from 'napcat-core/index';
|
||||||
import { MiniAppRawData, MiniAppReqParams } from '@/napcat-core/packet/entities/miniApp';
|
import { MiniAppRawData, MiniAppReqParams } from '@/napcat-core/packet/entities/miniApp';
|
||||||
import { AIVoiceChatType } from '@/napcat-core/packet/entities/aiChat';
|
import { AIVoiceChatType } from '@/napcat-core/packet/entities/aiChat';
|
||||||
import { NapProtoDecodeStructType, NapProtoEncodeStructType, NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoDecodeStructType, NapProtoEncodeStructType, NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { IndexNode, LongMsgResult, MsgInfo, PushMsgBody } from '@/napcat-core/packet/transformer/proto';
|
import { IndexNode, LongMsgResult, MsgInfo, PushMsgBody } from '@/napcat-core/packet/transformer/proto';
|
||||||
import { OidbPacket } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket } from '@/napcat-core/packet/transformer/base';
|
||||||
import { ImageOcrResult } from '@/napcat-core/packet/entities/ocrResult';
|
import { ImageOcrResult } from '@/napcat-core/packet/entities/ocrResult';
|
||||||
|
|||||||
@ -11,7 +11,7 @@ import {
|
|||||||
import { ChatType, Peer } from '@/napcat-core/index';
|
import { ChatType, Peer } from '@/napcat-core/index';
|
||||||
import { calculateSha1, calculateSha1StreamBytes, computeMd5AndLengthWithLimit } from '@/napcat-core/packet/utils/crypto/hash';
|
import { calculateSha1, calculateSha1StreamBytes, computeMd5AndLengthWithLimit } from '@/napcat-core/packet/utils/crypto/hash';
|
||||||
import UploadGroupImage from '@/napcat-core/packet/transformer/highway/UploadGroupImage';
|
import UploadGroupImage from '@/napcat-core/packet/transformer/highway/UploadGroupImage';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import * as trans from '@/napcat-core/packet/transformer';
|
import * as trans from '@/napcat-core/packet/transformer';
|
||||||
import fs from 'fs';
|
import fs from 'fs';
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import crypto from 'node:crypto';
|
import crypto from 'node:crypto';
|
||||||
import http from 'node:http';
|
import http from 'node:http';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { IHighwayUploader } from '@/napcat-core/packet/highway/uploader/highwayUploader';
|
import { IHighwayUploader } from '@/napcat-core/packet/highway/uploader/highwayUploader';
|
||||||
import { Frame } from '@/napcat-core/packet/highway/frame';
|
import { Frame } from '@/napcat-core/packet/highway/frame';
|
||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import net from 'node:net';
|
import net from 'node:net';
|
||||||
import stream from 'node:stream';
|
import stream from 'node:stream';
|
||||||
import crypto from 'node:crypto';
|
import crypto from 'node:crypto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { BlockSize } from '@/napcat-core/packet/highway/highwayContext';
|
import { BlockSize } from '@/napcat-core/packet/highway/highwayContext';
|
||||||
import { Frame } from '@/napcat-core/packet/highway/frame';
|
import { Frame } from '@/napcat-core/packet/highway/frame';
|
||||||
import { IHighwayUploader } from '@/napcat-core/packet/highway/uploader/highwayUploader';
|
import { IHighwayUploader } from '@/napcat-core/packet/highway/uploader/highwayUploader';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
// import * as tea from '@/napcat-core/packet/utils/crypto/tea';
|
// import * as tea from '@/napcat-core/packet/utils/crypto/tea';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { PacketHighwayTrans } from '@/napcat-core/packet/highway/client';
|
import { PacketHighwayTrans } from '@/napcat-core/packet/highway/client';
|
||||||
import { PacketLogger } from '@/napcat-core/packet/context/loggerContext';
|
import { PacketLogger } from '@/napcat-core/packet/context/loggerContext';
|
||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { NapProtoEncodeStructType } from '@napneko/nap-proto-core';
|
import { NapProtoEncodeStructType } from 'napcat-protobuf';
|
||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
|
|
||||||
export const int32ip2str = (ip: number) => {
|
export const int32ip2str = (ip: number) => {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import * as crypto from 'crypto';
|
import * as crypto from 'crypto';
|
||||||
import { PushMsgBody } from '@/napcat-core/packet/transformer/proto';
|
import { PushMsgBody } from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoEncodeStructType } from '@napneko/nap-proto-core';
|
import { NapProtoEncodeStructType } from 'napcat-protobuf';
|
||||||
import { PacketMsg, PacketSendMsgElement } from '@/napcat-core/packet/message/message';
|
import { PacketMsg, PacketSendMsgElement } from '@/napcat-core/packet/message/message';
|
||||||
import { IPacketMsgElement, PacketMsgTextElement } from '@/napcat-core/packet/message/element';
|
import { IPacketMsgElement, PacketMsgTextElement } from '@/napcat-core/packet/message/element';
|
||||||
import { SendTextElement } from '@/napcat-core/index';
|
import { SendTextElement } from '@/napcat-core/index';
|
||||||
|
|||||||
@ -32,7 +32,7 @@ import {
|
|||||||
PacketMultiMsgElement,
|
PacketMultiMsgElement,
|
||||||
} from '@/napcat-core/packet/message/element';
|
} from '@/napcat-core/packet/message/element';
|
||||||
import { PacketMsg, PacketSendMsgElement } from '@/napcat-core/packet/message/message';
|
import { PacketMsg, PacketSendMsgElement } from '@/napcat-core/packet/message/message';
|
||||||
import { NapProtoDecodeStructType } from '@napneko/nap-proto-core';
|
import { NapProtoDecodeStructType } from 'napcat-protobuf';
|
||||||
import { Elem } from '@/napcat-core/packet/transformer/proto';
|
import { Elem } from '@/napcat-core/packet/transformer/proto';
|
||||||
|
|
||||||
const SupportedElementTypes = [
|
const SupportedElementTypes = [
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as zlib from 'node:zlib';
|
import * as zlib from 'node:zlib';
|
||||||
import { NapProtoDecodeStructType, NapProtoEncodeStructType, NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoDecodeStructType, NapProtoEncodeStructType, NapProtoMsg } from 'napcat-protobuf';
|
||||||
import {
|
import {
|
||||||
CustomFace,
|
CustomFace,
|
||||||
Elem,
|
Elem,
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
import { AIVoiceChatType } from '@/napcat-core/packet/entities/aiChat';
|
import { AIVoiceChatType } from '@/napcat-core/packet/entities/aiChat';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
import { AIVoiceChatType } from '@/napcat-core/packet/entities/aiChat';
|
import { AIVoiceChatType } from '@/napcat-core/packet/entities/aiChat';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import { MiniAppReqParams } from '@/napcat-core/packet/entities/miniApp';
|
import { MiniAppReqParams } from '@/napcat-core/packet/entities/miniApp';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { NapProtoDecodeStructType } from '@napneko/nap-proto-core';
|
import { NapProtoDecodeStructType } from 'napcat-protobuf';
|
||||||
import { PacketMsgBuilder } from '@/napcat-core/packet/message/builder';
|
import { PacketMsgBuilder } from '@/napcat-core/packet/message/builder';
|
||||||
|
|
||||||
export type PacketBuf = Buffer & { readonly hexNya: unique symbol; };
|
export type PacketBuf = Buffer & { readonly hexNya: unique symbol; };
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoEncodeStructType, NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoEncodeStructType, NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
import { IndexNode } from '@/napcat-core/packet/transformer/proto';
|
import { IndexNode } from '@/napcat-core/packet/transformer/proto';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoEncodeStructType, NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoEncodeStructType, NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoEncodeStructType, NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoEncodeStructType, NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
import { IndexNode } from '@/napcat-core/packet/transformer/proto';
|
import { IndexNode } from '@/napcat-core/packet/transformer/proto';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoEncodeStructType, NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoEncodeStructType, NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
import { IndexNode } from '@/napcat-core/packet/transformer/proto';
|
import { IndexNode } from '@/napcat-core/packet/transformer/proto';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoEncodeStructType, NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoEncodeStructType, NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
import { IndexNode } from '@/napcat-core/packet/transformer/proto';
|
import { IndexNode } from '@/napcat-core/packet/transformer/proto';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoEncodeStructType, NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoEncodeStructType, NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
import { IndexNode } from '@/napcat-core/packet/transformer/proto';
|
import { IndexNode } from '@/napcat-core/packet/transformer/proto';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
|
|
||||||
class FetchSessionKey extends PacketTransformer<typeof proto.HttpConn0x6ff_501Response> {
|
class FetchSessionKey extends PacketTransformer<typeof proto.HttpConn0x6ff_501Response> {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
import { PacketMsgFileElement } from '@/napcat-core/packet/message/element';
|
import { PacketMsgFileElement } from '@/napcat-core/packet/message/element';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
import crypto from 'node:crypto';
|
import crypto from 'node:crypto';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
import crypto from 'node:crypto';
|
import crypto from 'node:crypto';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
import crypto from 'node:crypto';
|
import crypto from 'node:crypto';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
import { PacketMsgFileElement } from '@/napcat-core/packet/message/element';
|
import { PacketMsgFileElement } from '@/napcat-core/packet/message/element';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
import crypto from 'node:crypto';
|
import crypto from 'node:crypto';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
import crypto from 'node:crypto';
|
import crypto from 'node:crypto';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
import crypto from 'node:crypto';
|
import crypto from 'node:crypto';
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
|
|
||||||
class DownloadForwardMsg extends PacketTransformer<typeof proto.RecvLongMsgResp> {
|
class DownloadForwardMsg extends PacketTransformer<typeof proto.RecvLongMsgResp> {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
|
|
||||||
class FetchC2CMessage extends PacketTransformer<typeof proto.SsoGetC2cMsgResponse> {
|
class FetchC2CMessage extends PacketTransformer<typeof proto.SsoGetC2cMsgResponse> {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
|
|
||||||
class FetchGroupMessage extends PacketTransformer<typeof proto.SsoGetGroupMsgResponse> {
|
class FetchGroupMessage extends PacketTransformer<typeof proto.SsoGetGroupMsgResponse> {
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import zlib from 'node:zlib';
|
import zlib from 'node:zlib';
|
||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import { PacketMsg } from '@/napcat-core/packet/message/message';
|
import { PacketMsg } from '@/napcat-core/packet/message/message';
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketBufBuilder, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
|
|
||||||
class OidbBase extends PacketTransformer<typeof proto.OidbSvcTrpcTcpBase> {
|
class OidbBase extends PacketTransformer<typeof proto.OidbSvcTrpcTcpBase> {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import { ScalarType } from '@protobuf-ts/runtime';
|
import { ScalarType } from '@protobuf-ts/runtime';
|
||||||
import { ProtoField } from '@napneko/nap-proto-core';
|
import { ProtoField } from 'napcat-protobuf';
|
||||||
import { ContentHead, MessageBody, MessageControl, RoutingHead } from '@/napcat-core/packet/transformer/proto';
|
import { ContentHead, MessageBody, MessageControl, RoutingHead } from '@/napcat-core/packet/transformer/proto';
|
||||||
|
|
||||||
export const FaceRoamRequest = {
|
export const FaceRoamRequest = {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
export const MiniAppAdaptShareInfoReq = {
|
export const MiniAppAdaptShareInfoReq = {
|
||||||
appId: ProtoField(2, ScalarType.STRING),
|
appId: ProtoField(2, ScalarType.STRING),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
import { MsgInfoBody } from '@/napcat-core/packet/transformer/proto';
|
import { MsgInfoBody } from '@/napcat-core/packet/transformer/proto';
|
||||||
|
|
||||||
export const DataHighwayHead = {
|
export const DataHighwayHead = {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
import { PushMsgBody } from '@/napcat-core/packet/transformer/proto';
|
import { PushMsgBody } from '@/napcat-core/packet/transformer/proto';
|
||||||
|
|
||||||
export const LongMsgResult = {
|
export const LongMsgResult = {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
export const C2C = {
|
export const C2C = {
|
||||||
uin: ProtoField(1, ScalarType.UINT32, true),
|
uin: ProtoField(1, ScalarType.UINT32, true),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
import { Elem } from '@/napcat-core/packet/transformer/proto';
|
import { Elem } from '@/napcat-core/packet/transformer/proto';
|
||||||
|
|
||||||
export const Attr = {
|
export const Attr = {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
export const Elem = {
|
export const Elem = {
|
||||||
text: ProtoField(1, () => Text, true),
|
text: ProtoField(1, () => Text, true),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
export const GroupRecallMsg = {
|
export const GroupRecallMsg = {
|
||||||
type: ProtoField(1, ScalarType.UINT32),
|
type: ProtoField(1, ScalarType.UINT32),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
export const GroupAdminExtra = {
|
export const GroupAdminExtra = {
|
||||||
adminUid: ProtoField(1, ScalarType.STRING),
|
adminUid: ProtoField(1, ScalarType.STRING),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
import {
|
import {
|
||||||
C2C,
|
C2C,
|
||||||
ForwardHead,
|
ForwardHead,
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
export const FriendRecall = {
|
export const FriendRecall = {
|
||||||
info: ProtoField(1, () => FriendRecallInfo),
|
info: ProtoField(1, () => FriendRecallInfo),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
export const ForwardHead = {
|
export const ForwardHead = {
|
||||||
field1: ProtoField(1, ScalarType.UINT32, true),
|
field1: ProtoField(1, ScalarType.UINT32, true),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
export const FileId = {
|
export const FileId = {
|
||||||
appid: ProtoField(4, ScalarType.UINT32, true),
|
appid: ProtoField(4, ScalarType.UINT32, true),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
import { OidbSvcTrpcTcp0XE37_800_1200Metadata } from '@/napcat-core/packet/transformer/proto';
|
import { OidbSvcTrpcTcp0XE37_800_1200Metadata } from '@/napcat-core/packet/transformer/proto';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0XE37_800 = {
|
export const OidbSvcTrpcTcp0XE37_800 = {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0XFE1_2 = {
|
export const OidbSvcTrpcTcp0XFE1_2 = {
|
||||||
uin: ProtoField(1, ScalarType.UINT32),
|
uin: ProtoField(1, ScalarType.UINT32),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0x6D6 = {
|
export const OidbSvcTrpcTcp0x6D6 = {
|
||||||
file: ProtoField(1, () => OidbSvcTrpcTcp0x6D6Upload, true),
|
file: ProtoField(1, () => OidbSvcTrpcTcp0x6D6Upload, true),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
// 设置群头衔 OidbSvcTrpcTcp.0x8fc_2
|
// 设置群头衔 OidbSvcTrpcTcp.0x8fc_2
|
||||||
export const OidbSvcTrpcTcp0X8FC_2_Body = {
|
export const OidbSvcTrpcTcp0X8FC_2_Body = {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
import { MultiMediaReqHead } from './common/Ntv2.RichMediaReq';
|
import { MultiMediaReqHead } from './common/Ntv2.RichMediaReq';
|
||||||
|
|
||||||
// Req
|
// Req
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
import { MsgInfo } from '@/napcat-core/packet/transformer/proto';
|
import { MsgInfo } from '@/napcat-core/packet/transformer/proto';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0X929D_0 = {
|
export const OidbSvcTrpcTcp0X929D_0 = {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0xE07_0 = {
|
export const OidbSvcTrpcTcp0xE07_0 = {
|
||||||
version: ProtoField(1, ScalarType.UINT32),
|
version: ProtoField(1, ScalarType.UINT32),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0XE37_1200 = {
|
export const OidbSvcTrpcTcp0XE37_1200 = {
|
||||||
subCommand: ProtoField(1, ScalarType.UINT32, true),
|
subCommand: ProtoField(1, ScalarType.UINT32, true),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0XE37_1700 = {
|
export const OidbSvcTrpcTcp0XE37_1700 = {
|
||||||
command: ProtoField(1, ScalarType.UINT32, true),
|
command: ProtoField(1, ScalarType.UINT32, true),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0XEB7_Body = {
|
export const OidbSvcTrpcTcp0XEB7_Body = {
|
||||||
uin: ProtoField(1, ScalarType.STRING),
|
uin: ProtoField(1, ScalarType.STRING),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
// Send Poke
|
// Send Poke
|
||||||
export const OidbSvcTrpcTcp0XED3_1 = {
|
export const OidbSvcTrpcTcp0XED3_1 = {
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcp0XF90_1 = {
|
export const OidbSvcTrpcTcp0XF90_1 = {
|
||||||
groupUin: ProtoField(1, ScalarType.UINT32),
|
groupUin: ProtoField(1, ScalarType.UINT32),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
export const OidbSvcTrpcTcpBase = {
|
export const OidbSvcTrpcTcpBase = {
|
||||||
command: ProtoField(1, ScalarType.UINT32),
|
command: ProtoField(1, ScalarType.UINT32),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
|
|
||||||
export const NTV2RichMediaReq = {
|
export const NTV2RichMediaReq = {
|
||||||
ReqHead: ProtoField(1, () => MultiMediaReqHead),
|
ReqHead: ProtoField(1, () => MultiMediaReqHead),
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
import { ProtoField, ScalarType } from '@napneko/nap-proto-core';
|
import { ProtoField, ScalarType } from 'napcat-protobuf';
|
||||||
import { CommonHead, MsgInfo, PicUrlExtInfo, VideoExtInfo } from '@/napcat-core/packet/transformer/proto';
|
import { CommonHead, MsgInfo, PicUrlExtInfo, VideoExtInfo } from '@/napcat-core/packet/transformer/proto';
|
||||||
|
|
||||||
export const NTV2RichMediaResp = {
|
export const NTV2RichMediaResp = {
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
import * as proto from '@/napcat-core/packet/transformer/proto';
|
import * as proto from '@/napcat-core/packet/transformer/proto';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
import { OidbPacket, PacketTransformer } from '@/napcat-core/packet/transformer/base';
|
||||||
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
import OidbBase from '@/napcat-core/packet/transformer/oidb/oidbBase';
|
||||||
|
|
||||||
|
|||||||
@ -5,7 +5,8 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "index.ts",
|
"main": "index.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build"
|
"build": "vite build",
|
||||||
|
"typecheck": "tsc --noEmit --skipLibCheck -p tsconfig.json"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
|
|||||||
@ -35,6 +35,12 @@
|
|||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/napcat-onebot/*": ["../napcat-onebot/*"],
|
||||||
|
"@/napcat-core/*": ["../napcat-core/*"],
|
||||||
|
"@/napcat-common/*": ["../napcat-common/src/*"],
|
||||||
|
"@/napcat-webui-backend/*": ["../napcat-webui-backend/src/*"]
|
||||||
|
},
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"skipDefaultLibCheck": true
|
"skipDefaultLibCheck": true
|
||||||
},
|
},
|
||||||
|
|||||||
@ -24,7 +24,7 @@ import { OB11GroupUploadNoticeEvent } from '../event/notice/OB11GroupUploadNotic
|
|||||||
import { OB11GroupNameEvent } from '../event/notice/OB11GroupNameEvent';
|
import { OB11GroupNameEvent } from '../event/notice/OB11GroupNameEvent';
|
||||||
import { FileNapCatOneBotUUID } from 'napcat-common/src/file-uuid';
|
import { FileNapCatOneBotUUID } from 'napcat-common/src/file-uuid';
|
||||||
import { OB11GroupIncreaseEvent } from '../event/notice/OB11GroupIncreaseEvent';
|
import { OB11GroupIncreaseEvent } from '../event/notice/OB11GroupIncreaseEvent';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { GroupReactNotify, PushMsg } from 'napcat-core/packet/transformer/proto';
|
import { GroupReactNotify, PushMsg } from 'napcat-core/packet/transformer/proto';
|
||||||
|
|
||||||
export class OneBotGroupApi {
|
export class OneBotGroupApi {
|
||||||
|
|||||||
@ -37,7 +37,7 @@ import { RequestUtil } from 'napcat-common/src/request';
|
|||||||
import fsPromise from 'node:fs/promises';
|
import fsPromise from 'node:fs/promises';
|
||||||
import { OB11FriendAddNoticeEvent } from '@/napcat-onebot/event/notice/OB11FriendAddNoticeEvent';
|
import { OB11FriendAddNoticeEvent } from '@/napcat-onebot/event/notice/OB11FriendAddNoticeEvent';
|
||||||
import { ForwardMsgBuilder } from 'napcat-common/src/forward-msg-builder';
|
import { ForwardMsgBuilder } from 'napcat-common/src/forward-msg-builder';
|
||||||
import { NapProtoMsg } from '@napneko/nap-proto-core';
|
import { NapProtoMsg } from 'napcat-protobuf';
|
||||||
import { OB11GroupIncreaseEvent } from '../event/notice/OB11GroupIncreaseEvent';
|
import { OB11GroupIncreaseEvent } from '../event/notice/OB11GroupIncreaseEvent';
|
||||||
import { GroupDecreaseSubType, OB11GroupDecreaseEvent } from '../event/notice/OB11GroupDecreaseEvent';
|
import { GroupDecreaseSubType, OB11GroupDecreaseEvent } from '../event/notice/OB11GroupDecreaseEvent';
|
||||||
import { GroupAdmin } from 'napcat-core/packet/transformer/proto/message/groupAdmin';
|
import { GroupAdmin } from 'napcat-core/packet/transformer/proto/message/groupAdmin';
|
||||||
|
|||||||
@ -24,7 +24,7 @@
|
|||||||
"ws": "^8.18.3",
|
"ws": "^8.18.3",
|
||||||
"file-type": "^21.0.0",
|
"file-type": "^21.0.0",
|
||||||
"async-mutex": "^0.5.0",
|
"async-mutex": "^0.5.0",
|
||||||
"@napneko/nap-proto-core": "^0.0.4",
|
"napcat-protobuf": "workspace:*",
|
||||||
"json5": "^2.2.3",
|
"json5": "^2.2.3",
|
||||||
"napcat-core": "workspace:*",
|
"napcat-core": "workspace:*",
|
||||||
"napcat-webui-backend": "workspace:*",
|
"napcat-webui-backend": "workspace:*",
|
||||||
|
|||||||
200
packages/napcat-protobuf/NapProto.ts
Normal file
200
packages/napcat-protobuf/NapProto.ts
Normal file
@ -0,0 +1,200 @@
|
|||||||
|
// @ts-nocheck
|
||||||
|
import { MessageType, PartialMessage, RepeatType, ScalarType } from '@protobuf-ts/runtime';
|
||||||
|
import { PartialFieldInfo } from '@protobuf-ts/runtime/build/types/reflection-info';
|
||||||
|
|
||||||
|
type LowerCamelCase<S extends string> = CamelCaseHelper<S, false, true>;
|
||||||
|
|
||||||
|
type CamelCaseHelper<
|
||||||
|
S extends string,
|
||||||
|
CapNext extends boolean,
|
||||||
|
IsFirstChar extends boolean,
|
||||||
|
> = S extends `${infer F}${infer R}`
|
||||||
|
? F extends '_'
|
||||||
|
? CamelCaseHelper<R, true, false>
|
||||||
|
: F extends `${number}`
|
||||||
|
? `${F}${CamelCaseHelper<R, true, false>}`
|
||||||
|
: CapNext extends true
|
||||||
|
? `${Uppercase<F>}${CamelCaseHelper<R, false, false>}`
|
||||||
|
: IsFirstChar extends true
|
||||||
|
? `${Lowercase<F>}${CamelCaseHelper<R, false, false>}`
|
||||||
|
: `${F}${CamelCaseHelper<R, false, false>}`
|
||||||
|
: '';
|
||||||
|
|
||||||
|
type ScalarTypeToTsType<T extends ScalarType> = T extends
|
||||||
|
| ScalarType.DOUBLE
|
||||||
|
| ScalarType.FLOAT
|
||||||
|
| ScalarType.INT32
|
||||||
|
| ScalarType.FIXED32
|
||||||
|
| ScalarType.UINT32
|
||||||
|
| ScalarType.SFIXED32
|
||||||
|
| ScalarType.SINT32
|
||||||
|
? number
|
||||||
|
: T extends ScalarType.INT64 | ScalarType.UINT64 | ScalarType.FIXED64 | ScalarType.SFIXED64 | ScalarType.SINT64
|
||||||
|
? bigint
|
||||||
|
: T extends ScalarType.BOOL
|
||||||
|
? boolean
|
||||||
|
: T extends ScalarType.STRING
|
||||||
|
? string
|
||||||
|
: T extends ScalarType.BYTES
|
||||||
|
? Uint8Array
|
||||||
|
: never;
|
||||||
|
|
||||||
|
interface BaseProtoFieldType<T, O extends boolean, R extends O extends true ? false : boolean> {
|
||||||
|
kind: 'scalar' | 'message';
|
||||||
|
no: number;
|
||||||
|
type: T;
|
||||||
|
optional: O;
|
||||||
|
repeat: R;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface ScalarProtoFieldType<T extends ScalarType, O extends boolean, R extends O extends true ? false : boolean>
|
||||||
|
extends BaseProtoFieldType<T, O, R> {
|
||||||
|
kind: 'scalar';
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface MessageProtoFieldType<
|
||||||
|
T extends () => ProtoMessageType,
|
||||||
|
O extends boolean,
|
||||||
|
R extends O extends true ? false : boolean,
|
||||||
|
> extends BaseProtoFieldType<T, O, R> {
|
||||||
|
kind: 'message';
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProtoFieldType =
|
||||||
|
| ScalarProtoFieldType<ScalarType, boolean, boolean>
|
||||||
|
| MessageProtoFieldType<() => ProtoMessageType, boolean, boolean>;
|
||||||
|
|
||||||
|
type ProtoMessageType = {
|
||||||
|
[key: string]: ProtoFieldType;
|
||||||
|
};
|
||||||
|
|
||||||
|
export function ProtoField<
|
||||||
|
T extends ScalarType,
|
||||||
|
O extends boolean = false,
|
||||||
|
R extends O extends true ? false : boolean = false,
|
||||||
|
>(no: number, type: T, optional?: O, repeat?: R): ScalarProtoFieldType<T, O, R>;
|
||||||
|
export function ProtoField<
|
||||||
|
T extends () => ProtoMessageType,
|
||||||
|
O extends boolean = false,
|
||||||
|
R extends O extends true ? false : boolean = false,
|
||||||
|
>(no: number, type: T, optional?: O, repeat?: R): MessageProtoFieldType<T, O, R>;
|
||||||
|
export function ProtoField(
|
||||||
|
no: number,
|
||||||
|
type: ScalarType | (() => ProtoMessageType),
|
||||||
|
optional?: boolean,
|
||||||
|
repeat?: boolean
|
||||||
|
): ProtoFieldType {
|
||||||
|
if (typeof type === 'function') {
|
||||||
|
return { kind: 'message', no: no, type: type, optional: optional ?? false, repeat: repeat ?? false };
|
||||||
|
} else {
|
||||||
|
return { kind: 'scalar', no: no, type: type, optional: optional ?? false, repeat: repeat ?? false };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type ProtoFieldReturnType<T, E extends boolean> =
|
||||||
|
NonNullable<T> extends ScalarProtoFieldType<infer S, infer O, infer R>
|
||||||
|
? ScalarTypeToTsType<S>
|
||||||
|
: T extends NonNullable<MessageProtoFieldType<infer S, infer O, infer R>>
|
||||||
|
? NonNullable<NapProtoStructType<ReturnType<S>, E>>
|
||||||
|
: never;
|
||||||
|
|
||||||
|
type RequiredFieldsBaseType<T, E extends boolean> = {
|
||||||
|
[K in keyof T as T[K] extends { optional: true } ? never : LowerCamelCase<K & string>]: T[K] extends {
|
||||||
|
repeat: true;
|
||||||
|
}
|
||||||
|
? ProtoFieldReturnType<T[K], E>[]
|
||||||
|
: ProtoFieldReturnType<T[K], E>;
|
||||||
|
};
|
||||||
|
|
||||||
|
type OptionalFieldsBaseType<T, E extends boolean> = {
|
||||||
|
[K in keyof T as T[K] extends { optional: true } ? LowerCamelCase<K & string> : never]?: T[K] extends {
|
||||||
|
repeat: true;
|
||||||
|
}
|
||||||
|
? ProtoFieldReturnType<T[K], E>[]
|
||||||
|
: ProtoFieldReturnType<T[K], E>;
|
||||||
|
};
|
||||||
|
|
||||||
|
type RequiredFieldsType<T, E extends boolean> = E extends true
|
||||||
|
? Partial<RequiredFieldsBaseType<T, E>>
|
||||||
|
: RequiredFieldsBaseType<T, E>;
|
||||||
|
|
||||||
|
type OptionalFieldsType<T, E extends boolean> = E extends true
|
||||||
|
? Partial<OptionalFieldsBaseType<T, E>>
|
||||||
|
: OptionalFieldsBaseType<T, E>;
|
||||||
|
|
||||||
|
type NapProtoStructType<T, E extends boolean> = RequiredFieldsType<T, E> & OptionalFieldsType<T, E>;
|
||||||
|
|
||||||
|
export type NapProtoEncodeStructType<T> = NapProtoStructType<T, true>;
|
||||||
|
|
||||||
|
export type NapProtoDecodeStructType<T> = NapProtoStructType<T, false>;
|
||||||
|
|
||||||
|
class NapProtoRealMsg<T extends ProtoMessageType> {
|
||||||
|
private readonly _field: PartialFieldInfo[];
|
||||||
|
private readonly _proto_msg: MessageType<NapProtoStructType<T, boolean>>;
|
||||||
|
private static cache = new WeakMap<ProtoMessageType, NapProtoRealMsg<any>>();
|
||||||
|
|
||||||
|
private constructor(fields: T) {
|
||||||
|
this._field = Object.keys(fields).map((key) => {
|
||||||
|
const field = fields[key];
|
||||||
|
if (field.kind === 'scalar') {
|
||||||
|
const repeatType = field.repeat
|
||||||
|
? [ScalarType.STRING, ScalarType.BYTES].includes(field.type)
|
||||||
|
? RepeatType.UNPACKED
|
||||||
|
: RepeatType.PACKED
|
||||||
|
: RepeatType.NO;
|
||||||
|
return {
|
||||||
|
no: field.no,
|
||||||
|
name: key,
|
||||||
|
kind: 'scalar',
|
||||||
|
T: field.type,
|
||||||
|
opt: field.optional,
|
||||||
|
repeat: repeatType,
|
||||||
|
};
|
||||||
|
} else if (field.kind === 'message') {
|
||||||
|
return {
|
||||||
|
no: field.no,
|
||||||
|
name: key,
|
||||||
|
kind: 'message',
|
||||||
|
repeat: field.repeat ? RepeatType.PACKED : RepeatType.NO,
|
||||||
|
T: () => NapProtoRealMsg.getInstance(field.type())._proto_msg,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}) as PartialFieldInfo[];
|
||||||
|
this._proto_msg = new MessageType<NapProtoStructType<T, boolean>>('nya', this._field);
|
||||||
|
}
|
||||||
|
|
||||||
|
static getInstance<T extends ProtoMessageType>(fields: T): NapProtoRealMsg<T> {
|
||||||
|
let instance = this.cache.get(fields);
|
||||||
|
if (!instance) {
|
||||||
|
instance = new NapProtoRealMsg(fields);
|
||||||
|
this.cache.set(fields, instance);
|
||||||
|
}
|
||||||
|
return instance;
|
||||||
|
}
|
||||||
|
|
||||||
|
encode(data: NapProtoEncodeStructType<T>): Uint8Array {
|
||||||
|
return this._proto_msg.toBinary(this._proto_msg.create(data as PartialMessage<NapProtoEncodeStructType<T>>));
|
||||||
|
}
|
||||||
|
|
||||||
|
decode(data: Uint8Array): NapProtoDecodeStructType<T> {
|
||||||
|
return this._proto_msg.fromBinary(data) as NapProtoDecodeStructType<T>;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export class NapProtoMsg<T extends ProtoMessageType> {
|
||||||
|
private realMsg: NapProtoRealMsg<T>;
|
||||||
|
|
||||||
|
constructor(fields: T) {
|
||||||
|
this.realMsg = NapProtoRealMsg.getInstance(fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
encode(data: NapProtoEncodeStructType<T>): Uint8Array {
|
||||||
|
return this.realMsg.encode(data);
|
||||||
|
}
|
||||||
|
|
||||||
|
decode(data: Uint8Array): NapProtoDecodeStructType<T> {
|
||||||
|
return this.realMsg.decode(data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export { ScalarType } from '@protobuf-ts/runtime';
|
||||||
17
packages/napcat-protobuf/package.json
Normal file
17
packages/napcat-protobuf/package.json
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
{
|
||||||
|
"name": "napcat-protobuf",
|
||||||
|
"type": "module",
|
||||||
|
"version": "0.0.4",
|
||||||
|
"description": "A lightweight, elegant, and efficient protobuf-ts solution",
|
||||||
|
"main": "NapProto.ts",
|
||||||
|
"scripts": {
|
||||||
|
"test": "echo \"Error: no test specified\" && exit 1",
|
||||||
|
"prepack": "tsc"
|
||||||
|
},
|
||||||
|
"dependencies": {
|
||||||
|
"@protobuf-ts/runtime": "^2.9.4"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"typescript": "^5.6"
|
||||||
|
}
|
||||||
|
}
|
||||||
18
packages/napcat-protobuf/tsconfig.json
Normal file
18
packages/napcat-protobuf/tsconfig.json
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ESNext",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "Node",
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"strict": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"outDir": "dist",
|
||||||
|
"declaration": true,
|
||||||
|
"declarationDir": "dist",
|
||||||
|
"sourceMap": true
|
||||||
|
},
|
||||||
|
"include": [
|
||||||
|
"*.ts"
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -5,7 +5,8 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "index.ts",
|
"main": "index.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build"
|
"build": "vite build",
|
||||||
|
"typecheck": "tsc --noEmit --skipLibCheck -p tsconfig.json"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
".": {
|
".": {
|
||||||
|
|||||||
@ -35,6 +35,12 @@
|
|||||||
"allowSyntheticDefaultImports": true,
|
"allowSyntheticDefaultImports": true,
|
||||||
"resolveJsonModule": true,
|
"resolveJsonModule": true,
|
||||||
"baseUrl": ".",
|
"baseUrl": ".",
|
||||||
|
"paths": {
|
||||||
|
"@/napcat-onebot/*": ["../napcat-onebot/*"],
|
||||||
|
"@/napcat-core/*": ["../napcat-core/*"],
|
||||||
|
"@/napcat-common/*": ["../napcat-common/src/*"],
|
||||||
|
"@/napcat-webui-backend/*": ["../napcat-webui-backend/src/*"]
|
||||||
|
},
|
||||||
"skipLibCheck": true,
|
"skipLibCheck": true,
|
||||||
"skipDefaultLibCheck": true
|
"skipDefaultLibCheck": true
|
||||||
},
|
},
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import type { LoginRuntimeType } from '../types/data';
|
|
||||||
import store from 'napcat-common/src/store';
|
import store from 'napcat-common/src/store';
|
||||||
import { napCatVersion } from 'napcat-common/src/version';
|
import { napCatVersion } from 'napcat-common/src/version';
|
||||||
|
import type { LoginRuntimeType } from '../types';
|
||||||
|
|
||||||
const LoginRuntime: LoginRuntimeType = {
|
const LoginRuntime: LoginRuntimeType = {
|
||||||
LoginCurrentTime: Date.now(),
|
LoginCurrentTime: Date.now(),
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
import crypto from 'crypto';
|
import crypto from 'crypto';
|
||||||
import store from 'napcat-common/src/store';
|
import store from 'napcat-common/src/store';
|
||||||
|
import type { WebUiCredentialJson, WebUiCredentialInnerJson } from '@/napcat-webui-backend/types';
|
||||||
export class AuthHelper {
|
export class AuthHelper {
|
||||||
private static readonly secretKey = Math.random().toString(36).slice(2);
|
private static readonly secretKey = Math.random().toString(36).slice(2);
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
import express from 'express';
|
import express from 'express';
|
||||||
|
import type { WebUiConfigType } from './types';
|
||||||
import { createServer } from 'http';
|
import { createServer } from 'http';
|
||||||
import { randomUUID } from 'node:crypto';
|
import { randomUUID } from 'node:crypto';
|
||||||
import { createServer as createHttpsServer } from 'https';
|
import { createServer as createHttpsServer } from 'https';
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import { getInitialWebUiToken } from '@/napcat-webui-backend/index';
|
|||||||
|
|
||||||
import { AuthHelper } from '@/napcat-webui-backend/helper/SignToken';
|
import { AuthHelper } from '@/napcat-webui-backend/helper/SignToken';
|
||||||
import { sendError } from '@/napcat-webui-backend/utils/response';
|
import { sendError } from '@/napcat-webui-backend/utils/response';
|
||||||
|
import type { WebUiCredentialJson } from '@/napcat-webui-backend/types';
|
||||||
|
|
||||||
// 鉴权中间件
|
// 鉴权中间件
|
||||||
export async function auth (req: Request, res: Response, next: NextFunction) {
|
export async function auth (req: Request, res: Response, next: NextFunction) {
|
||||||
|
|||||||
@ -1,6 +1,7 @@
|
|||||||
// import './init-dynamic-dirname';
|
// import './init-dynamic-dirname';
|
||||||
import { WebUiConfig } from '../index';
|
import { WebUiConfig } from '../index';
|
||||||
import { AuthHelper } from '../helper/SignToken';
|
import { AuthHelper } from '../helper/SignToken';
|
||||||
|
import type { WebUiCredentialJson } from '@/napcat-webui-backend/types';
|
||||||
import { LogWrapper } from 'napcat-common/src/log';
|
import { LogWrapper } from 'napcat-common/src/log';
|
||||||
import { WebSocket, WebSocketServer } from 'ws';
|
import { WebSocket, WebSocketServer } from 'ws';
|
||||||
import os from 'os';
|
import os from 'os';
|
||||||
|
|||||||
@ -1,6 +0,0 @@
|
|||||||
interface WebUiConfigType {
|
|
||||||
host: string;
|
|
||||||
port: number;
|
|
||||||
token: string;
|
|
||||||
loginRate: number;
|
|
||||||
}
|
|
||||||
@ -1,7 +1,23 @@
|
|||||||
import type { LoginListItem, SelfInfo } from 'napcat-core';
|
import type { LoginListItem, SelfInfo } from 'napcat-core';
|
||||||
import type { OneBotConfig } from 'napcat-onebot/config/config';
|
import type { OneBotConfig } from 'napcat-onebot/config/config';
|
||||||
|
|
||||||
interface LoginRuntimeType {
|
export interface WebUiConfigType {
|
||||||
|
host: string;
|
||||||
|
port: number;
|
||||||
|
token: string;
|
||||||
|
loginRate: number;
|
||||||
|
}
|
||||||
|
export interface WebUiCredentialInnerJson {
|
||||||
|
CreatedTime: number;
|
||||||
|
HashEncoded: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface WebUiCredentialJson {
|
||||||
|
Data: WebUiCredentialInnerJson;
|
||||||
|
Hmac: string;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface LoginRuntimeType {
|
||||||
LoginCurrentTime: number;
|
LoginCurrentTime: number;
|
||||||
LoginCurrentRate: number;
|
LoginCurrentRate: number;
|
||||||
QQLoginStatus: boolean;
|
QQLoginStatus: boolean;
|
||||||
@ -20,3 +36,5 @@ interface LoginRuntimeType {
|
|||||||
};
|
};
|
||||||
NapCatVersion: string;
|
NapCatVersion: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {};
|
||||||
@ -1,7 +0,0 @@
|
|||||||
interface APIResponse<T> {
|
|
||||||
code: number;
|
|
||||||
message: string;
|
|
||||||
data: T;
|
|
||||||
}
|
|
||||||
|
|
||||||
type Protocol = 'http' | 'https' | 'ws' | 'wss';
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
interface WebUiCredentialInnerJson {
|
|
||||||
CreatedTime: number;
|
|
||||||
HashEncoded: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface WebUiCredentialJson {
|
|
||||||
Data: WebUiCredentialInnerJson;
|
|
||||||
Hmac: string;
|
|
||||||
}
|
|
||||||
@ -44,7 +44,8 @@
|
|||||||
"skipDefaultLibCheck": true
|
"skipDefaultLibCheck": true
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"src/**/*.ts"
|
"src/**/*.ts",
|
||||||
|
"src/**/*.d.ts"
|
||||||
],
|
],
|
||||||
"exclude": [
|
"exclude": [
|
||||||
"node_modules",
|
"node_modules",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user