node-karin 1.3.21 → 1.3.22-pr.284.987b16f
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/dist/index.d.ts +35 -1
- package/dist/index.js +235 -70
- package/dist/web/assets/cssMode-CjM7nXyh.js.gz +0 -0
- package/dist/web/assets/freemarker2-DmpxUHfz.js.gz +0 -0
- package/dist/web/assets/handlebars-BImxsWdi.js.gz +0 -0
- package/dist/web/assets/html-xOz6JgnH.js.gz +0 -0
- package/dist/web/assets/htmlMode-T_Sttj3r.js.gz +0 -0
- package/dist/web/assets/index-CDvgk1hj.js +1 -0
- package/dist/web/assets/index-CcGvaFJt.js +1 -0
- package/dist/web/assets/index-D2VON33P.js.gz +0 -0
- package/dist/web/assets/javascript-Brs2F13H.js.gz +0 -0
- package/dist/web/assets/jsonMode-BYyn1Sp0.js.gz +0 -0
- package/dist/web/assets/liquid-UK3XkEOD.js.gz +0 -0
- package/dist/web/assets/mdx-DqdZcXHk.js.gz +0 -0
- package/dist/web/assets/python-Do9M9P5l.js.gz +0 -0
- package/dist/web/assets/razor-ovkT8T2z.js.gz +0 -0
- package/dist/web/assets/ts.worker-Bd4z-OY3.js.gz +0 -0
- package/dist/web/assets/tsMode-BYHCzFsx.js.gz +0 -0
- package/dist/web/assets/typescript-BxocgfRf.js.gz +0 -0
- package/dist/web/assets/xml-B9aYgEa3.js.gz +0 -0
- package/dist/web/assets/yaml-B7KHlGBf.js.gz +0 -0
- package/dist/web/index.html +1 -1
- package/package.json +2 -1
- package/dist/web/assets/cssMode-CXt7sC6Q.js.gz +0 -0
- package/dist/web/assets/freemarker2-BLcwjvni.js.gz +0 -0
- package/dist/web/assets/handlebars-BeoMr5t2.js.gz +0 -0
- package/dist/web/assets/html--oHLJbOk.js.gz +0 -0
- package/dist/web/assets/htmlMode-CTOVHQWr.js.gz +0 -0
- package/dist/web/assets/index-2uUnpL8J.js +0 -1
- package/dist/web/assets/index-DGetM7dl.js.gz +0 -0
- package/dist/web/assets/index-DoJKQ5We.js +0 -1
- package/dist/web/assets/javascript-DoSLL0Rs.js.gz +0 -0
- package/dist/web/assets/jsonMode-BtZSHYnG.js.gz +0 -0
- package/dist/web/assets/liquid-119c8epZ.js.gz +0 -0
- package/dist/web/assets/mdx-BIG6P5wX.js.gz +0 -0
- package/dist/web/assets/python-BS9UkpxF.js.gz +0 -0
- package/dist/web/assets/razor-DEK9xP0N.js.gz +0 -0
- package/dist/web/assets/ts.worker-B_RpyLgm.js.gz +0 -0
- package/dist/web/assets/tsMode-6TGGnvhR.js.gz +0 -0
- package/dist/web/assets/typescript-CSABQyh4.js.gz +0 -0
- package/dist/web/assets/xml-DGLphCom.js.gz +0 -0
- package/dist/web/assets/yaml-7MPaJ_zV.js.gz +0 -0
package/dist/index.d.ts
CHANGED
|
@@ -11188,6 +11188,40 @@ interface GetConfigResponse {
|
|
|
11188
11188
|
info: LocalApiResponse;
|
|
11189
11189
|
}
|
|
11190
11190
|
|
|
11191
|
+
/** JWT验证基础接口 */
|
|
11192
|
+
interface JwtVerifyBase {
|
|
11193
|
+
/** 状态码 */
|
|
11194
|
+
status: number;
|
|
11195
|
+
/** 返回数据 */
|
|
11196
|
+
data: string;
|
|
11197
|
+
}
|
|
11198
|
+
/** 鉴权成功 */
|
|
11199
|
+
interface JwtVerifySuccess extends JwtVerifyBase {
|
|
11200
|
+
status: 200;
|
|
11201
|
+
/** 用户id */
|
|
11202
|
+
data: string;
|
|
11203
|
+
}
|
|
11204
|
+
/** 鉴权失败 */
|
|
11205
|
+
interface JwtVerifyUnauthorized extends JwtVerifyBase {
|
|
11206
|
+
status: 401;
|
|
11207
|
+
/** 错误信息 */
|
|
11208
|
+
data: string;
|
|
11209
|
+
}
|
|
11210
|
+
/** 令牌过期 */
|
|
11211
|
+
interface JwtVerifyExpired extends JwtVerifyBase {
|
|
11212
|
+
status: 419;
|
|
11213
|
+
/** 错误信息 */
|
|
11214
|
+
data: string;
|
|
11215
|
+
}
|
|
11216
|
+
/** 服务器错误 */
|
|
11217
|
+
interface JwtVerifyError extends JwtVerifyBase {
|
|
11218
|
+
status: 500;
|
|
11219
|
+
/** 错误信息 */
|
|
11220
|
+
data: string;
|
|
11221
|
+
}
|
|
11222
|
+
/** JWT验证返回类型 */
|
|
11223
|
+
type JwtVerifyResult = JwtVerifySuccess | JwtVerifyUnauthorized | JwtVerifyExpired | JwtVerifyError;
|
|
11224
|
+
|
|
11191
11225
|
type UnionMessage = Message$2 | FriendMessage | GroupMessage | GuildMessage | DirectMessage | GroupTempMessage;
|
|
11192
11226
|
/** 调用后继续执行下一个钩子 如果没钩子则继续正常流程 */
|
|
11193
11227
|
type HookNext = () => void;
|
|
@@ -11291,4 +11325,4 @@ declare let level: ReturnType<typeof createLevelDB>;
|
|
|
11291
11325
|
*/
|
|
11292
11326
|
declare const start: () => Promise<void>;
|
|
11293
11327
|
|
|
11294
|
-
export { type Accept, type AccordionItemProps, type AccordionKV, type AccordionProProps, type AccordionProResult, type AccordionProps, type AccordionResult, type AccountInfo, type Adapter, AdapterBase, type AdapterCommunication, type AdapterInfo, AdapterOneBot, type AdapterOptions, type AdapterPlatform, type AdapterProtocol, type AdapterStandard, type AdapterType, type Adapters, type AllPluginMethods, type AnonymousSegment, type Apps, type ArrayField, type AtElement, type AtSegment, type BaseContact, BaseEvent, type BaseEventOptions, type BaseEventType, type BaseForwardCallback, type BaseMessageCallback, type BasketballElement, Bot, type BoundingBox, type BubbleFaceElement, type Button, type ButtonElement, type Cache, type CacheEntry, type CheckboxField, type CheckboxGroupProps, type CheckboxProps, type CheckboxResult, type Children, type CmdFnc, type Command, type CommandClass, type ComponentConfig, type ComponentProps, type ComponentType, type Components, type ComponentsClass, type Config, type Contact, type ContactElement, type ContactSegment, type Count, type CreateGroupFolderResponse, type CustomMusicElement, type CustomMusicSegment, type CustomNodeElement, type CustomNodeSegments, type DbStreamStatus, type DbStreams, type DiceElement, type DiceSegment, type DirectContact, DirectMessage, type DirectMessageOptions, type DirectNodeElement, type DirectNodeSegment, type DirectSender, type DividerField, type DividerProps, type DownloadFileOptions, type DownloadFileResponse, EVENT_COUNT, type ElementTypes, type Elements, type Env, type Event, type EventParent, type EventToSubEvent, type ExecOptions, type ExecReturn, type ExecType, FILE_CHANGE, type FaceElement, type FaceSegment, type FieldType, type FileElement, type FileList, type FileListMap, type FileSegment, type FileToUrlHandler, type FileToUrlResult, type FormField, type ForwardMessageCallback, type ForwardOptions, type ForwardSegment, type FriendContact, type FriendData, FriendDecreaseNotice, type FriendDecreaseOptions, FriendIncreaseNotice, type FriendIncreaseOptions, FriendMessage, type FriendMessageOptions, type FriendNoticeEventMap, type FriendRequestEventMap, type FriendRequestOptions, type FriendSender, type GetAtAllCountResponse, type GetBot, type GetConfigRequest, type GetConfigResponse, type GetGroupFileListResponse, type GetGroupFileSystemInfoResponse, type GetGroupHighlightsResponse, type GetGroupInfo, type GetGroupMemberInfo, type GetGroupMuteListResponse, type GetMsg, type GetPluginReturn, type GetPluginType, type GiftElement, type GoToOptions, GroupAdminChangedNotice, type GroupAdminChangedOptions, GroupApplyRequest, type GroupApplyRequestOptions, GroupCardChangedNotice, type GroupCardChangedOptions, type GroupContact, type GroupData, GroupFileUploadedNotice, type GroupFileUploadedOptions, GroupHlightsChangedNotice, type GroupHlightsChangedOptions, GroupHonorChangedNotice, type GroupHonorChangedOptions, type GroupInfo, GroupInviteRequest, type GroupInviteRequestOptions, GroupLuckKingNotice, type GroupLuckKingOptions, GroupMemberBanNotice, type GroupMemberBanOptions, type GroupMemberData, GroupMemberDecreaseNotice, type GroupMemberDecreaseOptions, GroupMemberIncreaseNotice, type GroupMemberIncreaseOptions, type GroupMemberInfo, GroupMemberTitleUpdatedNotice, type GroupMemberUniqueTitleChangedOptions, GroupMessage, type GroupMessageOptions, GroupMessageReactionNotice, type GroupMessageReactionOptions, GroupNotice, type GroupNoticeEventMap, GroupPokeNotice, type GroupPokeOptions, GroupRecallNotice, type GroupRecallOptions, type GroupRequestEventMap, type GroupSender, GroupSignInNotice, type GroupSignInOptions, type GroupTempContact, GroupTempMessage, type GroupTempMessageOptions, type GroupTempSender, GroupWholeBanNotice, type GroupWholeBanOptions, type Groups, type GroupsObjectValue, type GuildContact, GuildMessage, type GuildMessageOptions, type GuildSender, type Handler, type HandlerType, type HonorInfoList, type HookCache, type HookCallback, type HookEmitForward, type HookEmitMessage, type HookNext, type HookOptions, type ImageElement, type ImageSegment, type InputGroupProps, type InputProps, type InputResult, type JsonElement, type JsonSegment, type KarinButton, type KeyboardElement, type LocalApiResponse, type LocationElement, type LocationSegment, type Log, type Logger, type LoggerExpand, type LoggerLevel, type LoggerOptions, type LongMsgElement, type MarkdownElement, type MarkdownTplElement, type MarketFaceElement, type Message$2 as Message, MessageBase, type MessageEventMap, type MessageEventSub, type MessageHookItem, type MessageOptions, type MessageResponse, type MetaEventBase, type MusicElement, type MusicPlatform, type MusicSegment, type NodeElement, type NormalMessageCallback, type Notice, type NoticeAndRequest, NoticeBase, type NoticeEventMap, type NoticeEventSub, type NoticeOptions, type NumberField, type OB11AllEvent, OB11ApiAction, type OB11ApiParams, type OB11ApiRequest, OB11Event, type OB11EventBase, type OB11FriendSender, type OB11GroupMessage, type OB11GroupSender, type OB11GroupTempMessage, type OB11Message, OB11MessageSubType, OB11MessageType, type OB11Meta, type OB11NodeSegment, type OB11Notice, type OB11NoticeBaseType, OB11NoticeType, type OB11OtherFriendMessage, type OB11PrivateMessage, type OB11Request, type OB11RequestBaseType, OB11RequestType, type OB11Segment, type OB11SegmentBase, type OB11SegmentType, OB11Sex, type OB11serInfo, type ObjectArrayField, type ObjectField, type OneBot11FriendAdd, type OneBot11FriendRecall, type OneBot11FriendRequest, type OneBot11GroupAdmin, type OneBot11GroupBan, type OneBot11GroupCard, type OneBot11GroupDecrease, type OneBot11GroupEssence, type OneBot11GroupIncrease, type OneBot11GroupMessageReaction, type OneBot11GroupMessageReactionLagrange, type OneBot11GroupRecall, type OneBot11GroupRequest, type OneBot11GroupUpload, type OneBot11Heartbeat, type OneBot11Honor, type OneBot11Lifecycle, type OneBot11LuckyKing, type OneBot11Poke, type OnlinePluginInfo, type Option, type Options, type PM2, type Package, type Parser, type PasmsgElement, type Permission, type PkgData, type PkgInfo, Plugin, type PluginFile, type PluginFncTypes, type PluginLists, type PluginOptions, type PluginRule, type PluginUpdateInfo, type Point, type PokeSegment, PrivateApplyRequest, type PrivateApplyRequestOptions, PrivateFileUploadedNotice, type PrivateFileUploadedOptions, PrivatePokeNotice, type PrivatePokeOptions, PrivateRecallNotice, type PrivateRecallOptions, type Privates, type PrivatesObjectValue, type PuppeteerLifeCycleEvent, type QQBotButton, type QQButtonTextType, type QQGroupFileInfo, type QQGroupFolderInfo, type QQGroupHonorInfo, RECV_MSG, type Radio, type RadioField, type RadioGroupProps, type RadioResult, type RawElement, type ReadyMusicElement, ReceiveLikeNotice, type ReceiveLikeOptions, type RecordElement, type RecordSegment, type Redis, type Render, type RenderResult, Renderer, type Renders, type Reply, type ReplyElement, type ReplySegment, type Request, RequestBase, type RequestEventMap, type RequestEventSub, type RequestOptions, type RequireFunction, type RequireFunctionSync, type RequireOptions, type Role, type RpsElement, type RpsSegment, SEND_MSG, type SandBoxAccountInfo, type SandboxMsgRecord, type SandboxSendApi, type SandboxSendSendFriendMsg, type SandboxSendSendGroupMsg, type SandboxSendSendMsg, type SaveResult, type Scene, type ScreenshotClip, type ScreenshotOptions, type SectionField, type Segment, type SelectField, type SendElement, type SendForwardMessageResponse, type SendMessage, type SendMsgHookItem, type SendMsgResults, type Sender, type SenderBase, type SenderGroup, type Sex, type ShakeSegment, type ShareElement, type ShareSegment, type SrcReply, type SwitchField, type SwitchProps, type SwitchResult, type Task, type TextElement, type TextField, type TextSegment, type TitleField, type UnionMessage, type UnregisterBot, type UserInfo, type ValidationRule, type ValueType, type VideoElement, type VideoSegment, type WaitForOptions, Watch, Watcher, type WeatherElement, type XmlElement, type XmlSegment, type YamlComment, YamlEditor, type YamlValue, absPath, accordion, accordionItem, accordionPro, app, applyComments, base64, buffer, buttonHandle, callRender, changelog, checkGitPluginUpdate, checkPkgUpdate, clearRequire, clearRequireFile, comment, index$1 as common, components, index as config, contact, contactDirect, contactFriend, contactGroup, contactGroupTemp, contactGuild, copyConfig, copyConfigSync, copyFiles, copyFilesSync, createDirectMessage, createFriendDecreaseNotice, createFriendIncreaseNotice, createFriendMessage, createGroupAdminChangedNotice, createGroupApplyRequest, createGroupCardChangedNotice, createGroupFileUploadedNotice, createGroupHlightsChangedNotice, createGroupHonorChangedNotice, createGroupInviteRequest, createGroupLuckKingNotice, createGroupMemberAddNotice, createGroupMemberBanNotice, createGroupMemberDelNotice, createGroupMemberTitleUpdatedNotice, createGroupMessage, createGroupMessageReactionNotice, createGroupPokeNotice, createGroupRecallNotice, createGroupSignInNotice, createGroupTempMessage, createGroupWholeBanNotice, createGuildMessage, createInnerLogger, createPluginDir, createPrivateApplyRequest, createPrivateFileUploadedNotice, createPrivatePokeNotice, createPrivateRecallNotice, createRawMessage, createReceiveLikeNotice, debug, karin as default, divider, downFile, errorToString, exec, existToMkdir, existToMkdirSync, exists, existsSync, ffmpeg, ffplay, ffprobe, fs as file, fileToUrl, fileToUrlHandlerKey, filesByExt, formatTime$1 as formatTime, index$3 as fs, getAllBot, getAllBotID, getAllBotList, getBot, getBotCount, getCommit, getFiles, getHash, getPid, getPkgVersion, getPluginInfo, getPlugins, getRelPath, getRemotePkgVersion, getRender, getRenderCount, getRenderList, getRequestIp, getTime, handler$1 as handler, hooks, importModule, initOneBot, input, isClass, isDir, isDirSync, isDocker, isFile, isFileSync, isIPv4Loop, isIPv6Loop, isLinux, isLocalRequest, isLoopback, isMac, isPlugin, isRoot, isStatic, isSubPath, isWin, json$1 as json, karin, karinToQQBot, key, level, lock, lockMethod, lockProp, log, logger, logs, makeForward, makeMessage, type messageType, mkdir, mkdirSync, parseChangelog, pkgRoot, qqbotToKarin, randomStr, range, read, readFile, readJson, readJsonSync, redis, registerBot, registerRender, render, renderHtml, renderMultiHtml, requireFile, requireFileSync, restart, restartDirect, rmSync, save, type screenshot, segment, sendMsg, sender, senderDirect, senderFriend, senderGroup, senderGroupTemp, senderGuild, sep, server, splitPath, start, stream, stringifyError, switchComponent, index$2 as system, unregisterBot, unregisterRender, updateAllGitPlugin, updateAllPkg, updateGitPlugin, updatePkg, uptime$1 as uptime, urlToPath, watch, watchAndMerge, write, writeJson, writeJsonSync, yaml };
|
|
11328
|
+
export { type Accept, type AccordionItemProps, type AccordionKV, type AccordionProProps, type AccordionProResult, type AccordionProps, type AccordionResult, type AccountInfo, type Adapter, AdapterBase, type AdapterCommunication, type AdapterInfo, AdapterOneBot, type AdapterOptions, type AdapterPlatform, type AdapterProtocol, type AdapterStandard, type AdapterType, type Adapters, type AllPluginMethods, type AnonymousSegment, type Apps, type ArrayField, type AtElement, type AtSegment, type BaseContact, BaseEvent, type BaseEventOptions, type BaseEventType, type BaseForwardCallback, type BaseMessageCallback, type BasketballElement, Bot, type BoundingBox, type BubbleFaceElement, type Button, type ButtonElement, type Cache, type CacheEntry, type CheckboxField, type CheckboxGroupProps, type CheckboxProps, type CheckboxResult, type Children, type CmdFnc, type Command, type CommandClass, type ComponentConfig, type ComponentProps, type ComponentType, type Components, type ComponentsClass, type Config, type Contact, type ContactElement, type ContactSegment, type Count, type CreateGroupFolderResponse, type CustomMusicElement, type CustomMusicSegment, type CustomNodeElement, type CustomNodeSegments, type DbStreamStatus, type DbStreams, type DiceElement, type DiceSegment, type DirectContact, DirectMessage, type DirectMessageOptions, type DirectNodeElement, type DirectNodeSegment, type DirectSender, type DividerField, type DividerProps, type DownloadFileOptions, type DownloadFileResponse, EVENT_COUNT, type ElementTypes, type Elements, type Env, type Event, type EventParent, type EventToSubEvent, type ExecOptions, type ExecReturn, type ExecType, FILE_CHANGE, type FaceElement, type FaceSegment, type FieldType, type FileElement, type FileList, type FileListMap, type FileSegment, type FileToUrlHandler, type FileToUrlResult, type FormField, type ForwardMessageCallback, type ForwardOptions, type ForwardSegment, type FriendContact, type FriendData, FriendDecreaseNotice, type FriendDecreaseOptions, FriendIncreaseNotice, type FriendIncreaseOptions, FriendMessage, type FriendMessageOptions, type FriendNoticeEventMap, type FriendRequestEventMap, type FriendRequestOptions, type FriendSender, type GetAtAllCountResponse, type GetBot, type GetConfigRequest, type GetConfigResponse, type GetGroupFileListResponse, type GetGroupFileSystemInfoResponse, type GetGroupHighlightsResponse, type GetGroupInfo, type GetGroupMemberInfo, type GetGroupMuteListResponse, type GetMsg, type GetPluginReturn, type GetPluginType, type GiftElement, type GoToOptions, GroupAdminChangedNotice, type GroupAdminChangedOptions, GroupApplyRequest, type GroupApplyRequestOptions, GroupCardChangedNotice, type GroupCardChangedOptions, type GroupContact, type GroupData, GroupFileUploadedNotice, type GroupFileUploadedOptions, GroupHlightsChangedNotice, type GroupHlightsChangedOptions, GroupHonorChangedNotice, type GroupHonorChangedOptions, type GroupInfo, GroupInviteRequest, type GroupInviteRequestOptions, GroupLuckKingNotice, type GroupLuckKingOptions, GroupMemberBanNotice, type GroupMemberBanOptions, type GroupMemberData, GroupMemberDecreaseNotice, type GroupMemberDecreaseOptions, GroupMemberIncreaseNotice, type GroupMemberIncreaseOptions, type GroupMemberInfo, GroupMemberTitleUpdatedNotice, type GroupMemberUniqueTitleChangedOptions, GroupMessage, type GroupMessageOptions, GroupMessageReactionNotice, type GroupMessageReactionOptions, GroupNotice, type GroupNoticeEventMap, GroupPokeNotice, type GroupPokeOptions, GroupRecallNotice, type GroupRecallOptions, type GroupRequestEventMap, type GroupSender, GroupSignInNotice, type GroupSignInOptions, type GroupTempContact, GroupTempMessage, type GroupTempMessageOptions, type GroupTempSender, GroupWholeBanNotice, type GroupWholeBanOptions, type Groups, type GroupsObjectValue, type GuildContact, GuildMessage, type GuildMessageOptions, type GuildSender, type Handler, type HandlerType, type HonorInfoList, type HookCache, type HookCallback, type HookEmitForward, type HookEmitMessage, type HookNext, type HookOptions, type ImageElement, type ImageSegment, type InputGroupProps, type InputProps, type InputResult, type JsonElement, type JsonSegment, type JwtVerifyBase, type JwtVerifyError, type JwtVerifyExpired, type JwtVerifyResult, type JwtVerifySuccess, type JwtVerifyUnauthorized, type KarinButton, type KeyboardElement, type LocalApiResponse, type LocationElement, type LocationSegment, type Log, type Logger, type LoggerExpand, type LoggerLevel, type LoggerOptions, type LongMsgElement, type MarkdownElement, type MarkdownTplElement, type MarketFaceElement, type Message$2 as Message, MessageBase, type MessageEventMap, type MessageEventSub, type MessageHookItem, type MessageOptions, type MessageResponse, type MetaEventBase, type MusicElement, type MusicPlatform, type MusicSegment, type NodeElement, type NormalMessageCallback, type Notice, type NoticeAndRequest, NoticeBase, type NoticeEventMap, type NoticeEventSub, type NoticeOptions, type NumberField, type OB11AllEvent, OB11ApiAction, type OB11ApiParams, type OB11ApiRequest, OB11Event, type OB11EventBase, type OB11FriendSender, type OB11GroupMessage, type OB11GroupSender, type OB11GroupTempMessage, type OB11Message, OB11MessageSubType, OB11MessageType, type OB11Meta, type OB11NodeSegment, type OB11Notice, type OB11NoticeBaseType, OB11NoticeType, type OB11OtherFriendMessage, type OB11PrivateMessage, type OB11Request, type OB11RequestBaseType, OB11RequestType, type OB11Segment, type OB11SegmentBase, type OB11SegmentType, OB11Sex, type OB11serInfo, type ObjectArrayField, type ObjectField, type OneBot11FriendAdd, type OneBot11FriendRecall, type OneBot11FriendRequest, type OneBot11GroupAdmin, type OneBot11GroupBan, type OneBot11GroupCard, type OneBot11GroupDecrease, type OneBot11GroupEssence, type OneBot11GroupIncrease, type OneBot11GroupMessageReaction, type OneBot11GroupMessageReactionLagrange, type OneBot11GroupRecall, type OneBot11GroupRequest, type OneBot11GroupUpload, type OneBot11Heartbeat, type OneBot11Honor, type OneBot11Lifecycle, type OneBot11LuckyKing, type OneBot11Poke, type OnlinePluginInfo, type Option, type Options, type PM2, type Package, type Parser, type PasmsgElement, type Permission, type PkgData, type PkgInfo, Plugin, type PluginFile, type PluginFncTypes, type PluginLists, type PluginOptions, type PluginRule, type PluginUpdateInfo, type Point, type PokeSegment, PrivateApplyRequest, type PrivateApplyRequestOptions, PrivateFileUploadedNotice, type PrivateFileUploadedOptions, PrivatePokeNotice, type PrivatePokeOptions, PrivateRecallNotice, type PrivateRecallOptions, type Privates, type PrivatesObjectValue, type PuppeteerLifeCycleEvent, type QQBotButton, type QQButtonTextType, type QQGroupFileInfo, type QQGroupFolderInfo, type QQGroupHonorInfo, RECV_MSG, type Radio, type RadioField, type RadioGroupProps, type RadioResult, type RawElement, type ReadyMusicElement, ReceiveLikeNotice, type ReceiveLikeOptions, type RecordElement, type RecordSegment, type Redis, type Render, type RenderResult, Renderer, type Renders, type Reply, type ReplyElement, type ReplySegment, type Request, RequestBase, type RequestEventMap, type RequestEventSub, type RequestOptions, type RequireFunction, type RequireFunctionSync, type RequireOptions, type Role, type RpsElement, type RpsSegment, SEND_MSG, type SandBoxAccountInfo, type SandboxMsgRecord, type SandboxSendApi, type SandboxSendSendFriendMsg, type SandboxSendSendGroupMsg, type SandboxSendSendMsg, type SaveResult, type Scene, type ScreenshotClip, type ScreenshotOptions, type SectionField, type Segment, type SelectField, type SendElement, type SendForwardMessageResponse, type SendMessage, type SendMsgHookItem, type SendMsgResults, type Sender, type SenderBase, type SenderGroup, type Sex, type ShakeSegment, type ShareElement, type ShareSegment, type SrcReply, type SwitchField, type SwitchProps, type SwitchResult, type Task, type TextElement, type TextField, type TextSegment, type TitleField, type UnionMessage, type UnregisterBot, type UserInfo, type ValidationRule, type ValueType, type VideoElement, type VideoSegment, type WaitForOptions, Watch, Watcher, type WeatherElement, type XmlElement, type XmlSegment, type YamlComment, YamlEditor, type YamlValue, absPath, accordion, accordionItem, accordionPro, app, applyComments, base64, buffer, buttonHandle, callRender, changelog, checkGitPluginUpdate, checkPkgUpdate, clearRequire, clearRequireFile, comment, index$1 as common, components, index as config, contact, contactDirect, contactFriend, contactGroup, contactGroupTemp, contactGuild, copyConfig, copyConfigSync, copyFiles, copyFilesSync, createDirectMessage, createFriendDecreaseNotice, createFriendIncreaseNotice, createFriendMessage, createGroupAdminChangedNotice, createGroupApplyRequest, createGroupCardChangedNotice, createGroupFileUploadedNotice, createGroupHlightsChangedNotice, createGroupHonorChangedNotice, createGroupInviteRequest, createGroupLuckKingNotice, createGroupMemberAddNotice, createGroupMemberBanNotice, createGroupMemberDelNotice, createGroupMemberTitleUpdatedNotice, createGroupMessage, createGroupMessageReactionNotice, createGroupPokeNotice, createGroupRecallNotice, createGroupSignInNotice, createGroupTempMessage, createGroupWholeBanNotice, createGuildMessage, createInnerLogger, createPluginDir, createPrivateApplyRequest, createPrivateFileUploadedNotice, createPrivatePokeNotice, createPrivateRecallNotice, createRawMessage, createReceiveLikeNotice, debug, karin as default, divider, downFile, errorToString, exec, existToMkdir, existToMkdirSync, exists, existsSync, ffmpeg, ffplay, ffprobe, fs as file, fileToUrl, fileToUrlHandlerKey, filesByExt, formatTime$1 as formatTime, index$3 as fs, getAllBot, getAllBotID, getAllBotList, getBot, getBotCount, getCommit, getFiles, getHash, getPid, getPkgVersion, getPluginInfo, getPlugins, getRelPath, getRemotePkgVersion, getRender, getRenderCount, getRenderList, getRequestIp, getTime, handler$1 as handler, hooks, importModule, initOneBot, input, isClass, isDir, isDirSync, isDocker, isFile, isFileSync, isIPv4Loop, isIPv6Loop, isLinux, isLocalRequest, isLoopback, isMac, isPlugin, isRoot, isStatic, isSubPath, isWin, json$1 as json, karin, karinToQQBot, key, level, lock, lockMethod, lockProp, log, logger, logs, makeForward, makeMessage, type messageType, mkdir, mkdirSync, parseChangelog, pkgRoot, qqbotToKarin, randomStr, range, read, readFile, readJson, readJsonSync, redis, registerBot, registerRender, render, renderHtml, renderMultiHtml, requireFile, requireFileSync, restart, restartDirect, rmSync, save, type screenshot, segment, sendMsg, sender, senderDirect, senderFriend, senderGroup, senderGroupTemp, senderGuild, sep, server, splitPath, start, stream, stringifyError, switchComponent, index$2 as system, unregisterBot, unregisterRender, updateAllGitPlugin, updateAllPkg, updateGitPlugin, updatePkg, uptime$1 as uptime, urlToPath, watch, watchAndMerge, write, writeJson, writeJsonSync, yaml };
|
package/dist/index.js
CHANGED
|
@@ -14,9 +14,9 @@ var __export = (target, all) => {
|
|
|
14
14
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
-
// ../../node_modules/.pnpm/tsup@8.
|
|
17
|
+
// ../../node_modules/.pnpm/tsup@8.4.0_tsx@4.19.3_typescript@5.7.3/node_modules/tsup/assets/esm_shims.js
|
|
18
18
|
var init_esm_shims = __esm({
|
|
19
|
-
"../../node_modules/.pnpm/tsup@8.
|
|
19
|
+
"../../node_modules/.pnpm/tsup@8.4.0_tsx@4.19.3_typescript@5.7.3/node_modules/tsup/assets/esm_shims.js"() {
|
|
20
20
|
"use strict";
|
|
21
21
|
}
|
|
22
22
|
});
|
|
@@ -2946,43 +2946,8 @@ var init_config2 = __esm({
|
|
|
2946
2946
|
}
|
|
2947
2947
|
});
|
|
2948
2948
|
|
|
2949
|
-
// src/server/auth/index.ts
|
|
2950
|
-
var auth;
|
|
2951
|
-
var init_auth = __esm({
|
|
2952
|
-
"src/server/auth/index.ts"() {
|
|
2953
|
-
"use strict";
|
|
2954
|
-
init_esm_shims();
|
|
2955
|
-
init_config2();
|
|
2956
|
-
auth = {
|
|
2957
|
-
/**
|
|
2958
|
-
* get请求鉴权
|
|
2959
|
-
* @description 支持请求头中携带`Authorization`字段
|
|
2960
|
-
* @description 支持请求参数中携带`token`字段
|
|
2961
|
-
*/
|
|
2962
|
-
getAuth: (req) => {
|
|
2963
|
-
var _a, _b;
|
|
2964
|
-
const token = ((_a = req == null ? void 0 : req.headers) == null ? void 0 : _a.authorization) || ((_b = req == null ? void 0 : req.query) == null ? void 0 : _b.token);
|
|
2965
|
-
if (!token) return false;
|
|
2966
|
-
const value = authKey();
|
|
2967
|
-
return token === `Bearer ${value}` || token === value;
|
|
2968
|
-
},
|
|
2969
|
-
/**
|
|
2970
|
-
* post请求鉴权
|
|
2971
|
-
* @description 仅支持请求头中携带`Authorization`字段
|
|
2972
|
-
*/
|
|
2973
|
-
postAuth: (req) => {
|
|
2974
|
-
var _a;
|
|
2975
|
-
const token = (_a = req == null ? void 0 : req.headers) == null ? void 0 : _a.authorization;
|
|
2976
|
-
if (!token) return false;
|
|
2977
|
-
const value = authKey();
|
|
2978
|
-
return token === `Bearer ${value}` || token === value;
|
|
2979
|
-
}
|
|
2980
|
-
};
|
|
2981
|
-
}
|
|
2982
|
-
});
|
|
2983
|
-
|
|
2984
2949
|
// src/server/utils/response.ts
|
|
2985
|
-
var createResponse, createSuccessResponse, createUnauthorizedResponse, createNotFoundResponse, createServerErrorResponse, createBadRequestResponse, createPayloadTooLargeResponse, createForbiddenResponse;
|
|
2950
|
+
var createResponse, createSuccessResponse, createUnauthorizedResponse, createAccessTokenExpiredResponse, createRefreshTokenExpiredResponse, createNotFoundResponse, createServerErrorResponse, createBadRequestResponse, createPayloadTooLargeResponse, createMethodNotAllowedResponse, createForbiddenResponse;
|
|
2986
2951
|
var init_response = __esm({
|
|
2987
2952
|
"src/server/utils/response.ts"() {
|
|
2988
2953
|
"use strict";
|
|
@@ -3007,6 +2972,12 @@ message: ${message2}
|
|
|
3007
2972
|
createUnauthorizedResponse = (res, message2 = "\u672A\u767B\u5F55") => {
|
|
3008
2973
|
return createResponse(res, 401 /* Unauthorized */, null, message2);
|
|
3009
2974
|
};
|
|
2975
|
+
createAccessTokenExpiredResponse = (res, message2 = "\u8BBF\u95EE\u4EE4\u724C\u5DF2\u8FC7\u671F") => {
|
|
2976
|
+
return createResponse(res, 419 /* AccessTokenExpired */, null, message2);
|
|
2977
|
+
};
|
|
2978
|
+
createRefreshTokenExpiredResponse = (res, message2 = "\u5237\u65B0\u4EE4\u724C\u5DF2\u8FC7\u671F") => {
|
|
2979
|
+
return createResponse(res, 420 /* RefreshTokenExpired */, null, message2);
|
|
2980
|
+
};
|
|
3010
2981
|
createNotFoundResponse = (res, message2 = "\u672A\u627E\u5230") => {
|
|
3011
2982
|
return createResponse(res, 404 /* NotFound */, null, message2);
|
|
3012
2983
|
};
|
|
@@ -3019,12 +2990,152 @@ message: ${message2}
|
|
|
3019
2990
|
createPayloadTooLargeResponse = (res, message2 = "\u8BF7\u6C42\u4F53\u8FC7\u5927") => {
|
|
3020
2991
|
return createResponse(res, 413 /* PayloadTooLarge */, null, message2);
|
|
3021
2992
|
};
|
|
2993
|
+
createMethodNotAllowedResponse = (res, message2 = "\u65B9\u6CD5\u4E0D\u5141\u8BB8") => {
|
|
2994
|
+
return createResponse(res, 405 /* MethodNotAllowed */, null, message2);
|
|
2995
|
+
};
|
|
3022
2996
|
createForbiddenResponse = (res, message2 = "\u7981\u6B62\u8BBF\u95EE") => {
|
|
3023
2997
|
return createResponse(res, 403 /* Forbidden */, null, message2);
|
|
3024
2998
|
};
|
|
3025
2999
|
}
|
|
3026
3000
|
});
|
|
3027
3001
|
|
|
3002
|
+
// src/server/utils/jwt.ts
|
|
3003
|
+
import jwt from "jsonwebtoken";
|
|
3004
|
+
import crypto from "node:crypto";
|
|
3005
|
+
var EXPIRES_IN, REFRESH_EXPIRES_IN, secretOrPrivateKey, initSecretOrPrivateKey, getSecretOrPrivateKey, createJwt, verifyJwt, verifyRefreshToken, refreshAccessToken;
|
|
3006
|
+
var init_jwt = __esm({
|
|
3007
|
+
"src/server/utils/jwt.ts"() {
|
|
3008
|
+
"use strict";
|
|
3009
|
+
init_esm_shims();
|
|
3010
|
+
init_config2();
|
|
3011
|
+
init_response();
|
|
3012
|
+
EXPIRES_IN = process.env.EXPIRES_IN || "7d";
|
|
3013
|
+
REFRESH_EXPIRES_IN = "30d";
|
|
3014
|
+
secretOrPrivateKey = "";
|
|
3015
|
+
initSecretOrPrivateKey = () => {
|
|
3016
|
+
if (!secretOrPrivateKey) {
|
|
3017
|
+
secretOrPrivateKey = crypto.createHash("sha256").update(authKey()).digest("hex");
|
|
3018
|
+
}
|
|
3019
|
+
};
|
|
3020
|
+
getSecretOrPrivateKey = () => {
|
|
3021
|
+
initSecretOrPrivateKey();
|
|
3022
|
+
return secretOrPrivateKey;
|
|
3023
|
+
};
|
|
3024
|
+
createJwt = () => {
|
|
3025
|
+
initSecretOrPrivateKey();
|
|
3026
|
+
const userId = crypto.randomUUID();
|
|
3027
|
+
const accessToken = jwt.sign({ userId }, secretOrPrivateKey, { expiresIn: EXPIRES_IN });
|
|
3028
|
+
const refreshToken = jwt.sign({ userId, accessToken }, secretOrPrivateKey, { expiresIn: REFRESH_EXPIRES_IN });
|
|
3029
|
+
return { userId, accessToken, refreshToken };
|
|
3030
|
+
};
|
|
3031
|
+
verifyJwt = (token, userId) => {
|
|
3032
|
+
try {
|
|
3033
|
+
initSecretOrPrivateKey();
|
|
3034
|
+
const decoded = jwt.verify(token, secretOrPrivateKey);
|
|
3035
|
+
if (decoded.userId === userId) {
|
|
3036
|
+
return { status: 200 /* OK */, data: decoded.userId };
|
|
3037
|
+
}
|
|
3038
|
+
return { status: 401 /* Unauthorized */, data: "jwt\u9274\u6743\u5931\u8D25 \u7528\u6237id\u4E0D\u5339\u914D" };
|
|
3039
|
+
} catch (error) {
|
|
3040
|
+
if (error instanceof jwt.JsonWebTokenError) {
|
|
3041
|
+
if (error.name === "TokenExpiredError") {
|
|
3042
|
+
return { status: 419 /* AccessTokenExpired */, data: "jwt\u4EE4\u724C\u5DF2\u8FC7\u671F" };
|
|
3043
|
+
}
|
|
3044
|
+
return { status: 401 /* Unauthorized */, data: "jwt\u9274\u6743\u5931\u8D25 \u8BF7\u767B\u5F55" };
|
|
3045
|
+
}
|
|
3046
|
+
logger.error(error);
|
|
3047
|
+
return { status: 500 /* InternalServerError */, data: "\u670D\u52A1\u5668\u5185\u90E8\u9519\u8BEF" };
|
|
3048
|
+
}
|
|
3049
|
+
};
|
|
3050
|
+
verifyRefreshToken = (token, expiredToken) => {
|
|
3051
|
+
try {
|
|
3052
|
+
initSecretOrPrivateKey();
|
|
3053
|
+
const decoded = jwt.verify(token, secretOrPrivateKey);
|
|
3054
|
+
if (decoded.accessToken === expiredToken) {
|
|
3055
|
+
return { status: true, data: decoded.userId };
|
|
3056
|
+
}
|
|
3057
|
+
return { status: false, data: "\u65E0\u6548\u4EE4\u724C" };
|
|
3058
|
+
} catch (error) {
|
|
3059
|
+
if (error instanceof jwt.JsonWebTokenError) {
|
|
3060
|
+
return { status: false, data: "\u5237\u65B0\u4EE4\u724C\u5DF2\u8FC7\u671F" };
|
|
3061
|
+
}
|
|
3062
|
+
logger.error(error);
|
|
3063
|
+
return { status: false, data: "\u670D\u52A1\u5668\u5185\u90E8\u9519\u8BEF" };
|
|
3064
|
+
}
|
|
3065
|
+
};
|
|
3066
|
+
refreshAccessToken = (userId) => {
|
|
3067
|
+
initSecretOrPrivateKey();
|
|
3068
|
+
const accessToken = jwt.sign({ userId }, secretOrPrivateKey, { expiresIn: EXPIRES_IN });
|
|
3069
|
+
return accessToken;
|
|
3070
|
+
};
|
|
3071
|
+
}
|
|
3072
|
+
});
|
|
3073
|
+
|
|
3074
|
+
// src/server/auth/index.ts
|
|
3075
|
+
var verifyToken, auth;
|
|
3076
|
+
var init_auth = __esm({
|
|
3077
|
+
"src/server/auth/index.ts"() {
|
|
3078
|
+
"use strict";
|
|
3079
|
+
init_esm_shims();
|
|
3080
|
+
init_config2();
|
|
3081
|
+
init_jwt();
|
|
3082
|
+
init_response();
|
|
3083
|
+
verifyToken = async (token, userId, res) => {
|
|
3084
|
+
if (!token) {
|
|
3085
|
+
createUnauthorizedResponse(res, "\u9274\u6743\u5931\u8D25: \u7F3A\u5C11authorization" /* MissingToken */);
|
|
3086
|
+
return false;
|
|
3087
|
+
}
|
|
3088
|
+
if (!userId) {
|
|
3089
|
+
if (authKey() === token) return true;
|
|
3090
|
+
createUnauthorizedResponse(res, "\u9274\u6743\u5931\u8D25: \u7F3A\u5C11x-user-id" /* MissingUserId */);
|
|
3091
|
+
return false;
|
|
3092
|
+
}
|
|
3093
|
+
const verifyStatus = verifyJwt(token, userId);
|
|
3094
|
+
if (verifyStatus.status === 200 /* OK */) return true;
|
|
3095
|
+
if (authKey() === token) return true;
|
|
3096
|
+
switch (verifyStatus.status) {
|
|
3097
|
+
case 401 /* Unauthorized */:
|
|
3098
|
+
createUnauthorizedResponse(res, verifyStatus.data);
|
|
3099
|
+
return false;
|
|
3100
|
+
case 419 /* AccessTokenExpired */:
|
|
3101
|
+
createAccessTokenExpiredResponse(res);
|
|
3102
|
+
return false;
|
|
3103
|
+
case 500 /* InternalServerError */:
|
|
3104
|
+
createServerErrorResponse(res, verifyStatus.data);
|
|
3105
|
+
return false;
|
|
3106
|
+
default:
|
|
3107
|
+
createServerErrorResponse(res, "\u670D\u52A1\u5668\u5185\u90E8\u9519\u8BEF");
|
|
3108
|
+
return false;
|
|
3109
|
+
}
|
|
3110
|
+
};
|
|
3111
|
+
auth = {
|
|
3112
|
+
/**
|
|
3113
|
+
* get请求鉴权
|
|
3114
|
+
* @description 支持请求头中携带`Authorization`字段
|
|
3115
|
+
* @description 支持请求参数中携带`token`字段
|
|
3116
|
+
* @description 支持明文密码
|
|
3117
|
+
*/
|
|
3118
|
+
getAuth: async (req, res) => {
|
|
3119
|
+
var _a, _b, _c, _d;
|
|
3120
|
+
const token = ((_b = (_a = req == null ? void 0 : req.headers) == null ? void 0 : _a.authorization) == null ? void 0 : _b.replace("Bearer ", "")) || ((_c = req == null ? void 0 : req.query) == null ? void 0 : _c.token);
|
|
3121
|
+
const userId = (_d = req == null ? void 0 : req.headers) == null ? void 0 : _d["x-user-id"];
|
|
3122
|
+
return verifyToken(token, userId, res);
|
|
3123
|
+
},
|
|
3124
|
+
/**
|
|
3125
|
+
* post请求鉴权
|
|
3126
|
+
* @description 仅支持请求头中携带`Authorization`字段
|
|
3127
|
+
* @description 除了支持jwt之外,还支持明文密码
|
|
3128
|
+
*/
|
|
3129
|
+
postAuth: async (req, res) => {
|
|
3130
|
+
var _a, _b, _c;
|
|
3131
|
+
const token = (_b = (_a = req == null ? void 0 : req.headers) == null ? void 0 : _a.authorization) == null ? void 0 : _b.replace("Bearer ", "");
|
|
3132
|
+
const userId = (_c = req == null ? void 0 : req.headers) == null ? void 0 : _c["x-user-id"];
|
|
3133
|
+
return verifyToken(token, userId, res);
|
|
3134
|
+
}
|
|
3135
|
+
};
|
|
3136
|
+
}
|
|
3137
|
+
});
|
|
3138
|
+
|
|
3028
3139
|
// src/server/middleware.ts
|
|
3029
3140
|
var authMiddleware;
|
|
3030
3141
|
var init_middleware = __esm({
|
|
@@ -3043,18 +3154,18 @@ headers: ${JSON.stringify(req.headers)}
|
|
|
3043
3154
|
body: ${JSON.stringify(req.body)}
|
|
3044
3155
|
`
|
|
3045
3156
|
);
|
|
3046
|
-
|
|
3047
|
-
if (req.path === "/ping" || req.path.startsWith("/console")) {
|
|
3157
|
+
if (req.path === "/ping" || req.path === "/login" || req.path === "/refresh" || req.path.startsWith("/console")) {
|
|
3048
3158
|
next();
|
|
3049
3159
|
return;
|
|
3050
3160
|
}
|
|
3051
|
-
if (
|
|
3052
|
-
|
|
3053
|
-
return;
|
|
3054
|
-
}
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3161
|
+
if (req.method === "POST") {
|
|
3162
|
+
const verify = await auth.postAuth(req, res);
|
|
3163
|
+
if (!verify) return;
|
|
3164
|
+
} else if (req.method === "GET") {
|
|
3165
|
+
const verify = await auth.getAuth(req, res);
|
|
3166
|
+
if (!verify) return;
|
|
3167
|
+
} else {
|
|
3168
|
+
createMethodNotAllowedResponse(res);
|
|
3058
3169
|
return;
|
|
3059
3170
|
}
|
|
3060
3171
|
next();
|
|
@@ -5668,21 +5779,6 @@ var init_log = __esm({
|
|
|
5668
5779
|
}
|
|
5669
5780
|
});
|
|
5670
5781
|
|
|
5671
|
-
// src/server/api/system/login.ts
|
|
5672
|
-
var loginRouter;
|
|
5673
|
-
var init_login = __esm({
|
|
5674
|
-
"src/server/api/system/login.ts"() {
|
|
5675
|
-
"use strict";
|
|
5676
|
-
init_esm_shims();
|
|
5677
|
-
init_router();
|
|
5678
|
-
init_response();
|
|
5679
|
-
loginRouter = async (_req, res) => {
|
|
5680
|
-
createSuccessResponse(res, null, "\u767B\u5F55\u6210\u529F");
|
|
5681
|
-
};
|
|
5682
|
-
router.post("/login", loginRouter);
|
|
5683
|
-
}
|
|
5684
|
-
});
|
|
5685
|
-
|
|
5686
5782
|
// src/server/api/system/index.ts
|
|
5687
5783
|
var init_system = __esm({
|
|
5688
5784
|
"src/server/api/system/index.ts"() {
|
|
@@ -5690,7 +5786,6 @@ var init_system = __esm({
|
|
|
5690
5786
|
init_esm_shims();
|
|
5691
5787
|
init_manage();
|
|
5692
5788
|
init_log();
|
|
5693
|
-
init_login();
|
|
5694
5789
|
}
|
|
5695
5790
|
});
|
|
5696
5791
|
|
|
@@ -12048,6 +12143,75 @@ var init_utils = __esm({
|
|
|
12048
12143
|
}
|
|
12049
12144
|
});
|
|
12050
12145
|
|
|
12146
|
+
// src/server/api/auth/login.ts
|
|
12147
|
+
var loginRouter;
|
|
12148
|
+
var init_login = __esm({
|
|
12149
|
+
"src/server/api/auth/login.ts"() {
|
|
12150
|
+
"use strict";
|
|
12151
|
+
init_esm_shims();
|
|
12152
|
+
init_router();
|
|
12153
|
+
init_response();
|
|
12154
|
+
init_jwt();
|
|
12155
|
+
loginRouter = async (req, res) => {
|
|
12156
|
+
try {
|
|
12157
|
+
const { authorization } = req.body || {};
|
|
12158
|
+
const tips3 = "\u5BC6\u7801\u9519\u8BEF";
|
|
12159
|
+
if (!authorization) return createBadRequestResponse(res, tips3);
|
|
12160
|
+
const token = authorization == null ? void 0 : authorization.replace("Bearer ", "");
|
|
12161
|
+
if (!token || token !== getSecretOrPrivateKey()) return createBadRequestResponse(res, tips3);
|
|
12162
|
+
const { userId, accessToken, refreshToken } = createJwt();
|
|
12163
|
+
createSuccessResponse(res, { userId, accessToken, refreshToken }, "\u767B\u5F55\u6210\u529F");
|
|
12164
|
+
} catch (error) {
|
|
12165
|
+
logger.error(error);
|
|
12166
|
+
createServerErrorResponse(res, error instanceof Error ? error.message : "\u670D\u52A1\u5668\u9519\u8BEF");
|
|
12167
|
+
}
|
|
12168
|
+
};
|
|
12169
|
+
router.post("/login", loginRouter);
|
|
12170
|
+
}
|
|
12171
|
+
});
|
|
12172
|
+
|
|
12173
|
+
// src/server/api/auth/refresh.ts
|
|
12174
|
+
var refreshRouter;
|
|
12175
|
+
var init_refresh = __esm({
|
|
12176
|
+
"src/server/api/auth/refresh.ts"() {
|
|
12177
|
+
"use strict";
|
|
12178
|
+
init_esm_shims();
|
|
12179
|
+
init_router();
|
|
12180
|
+
init_jwt();
|
|
12181
|
+
init_response();
|
|
12182
|
+
refreshRouter = async (req, res) => {
|
|
12183
|
+
try {
|
|
12184
|
+
const { accessToken, refreshToken } = req.body || {};
|
|
12185
|
+
if (!accessToken || !refreshToken) return createBadRequestResponse(res);
|
|
12186
|
+
const { status, data } = verifyRefreshToken(refreshToken, accessToken);
|
|
12187
|
+
if (!status) {
|
|
12188
|
+
if (data.includes("\u8FC7\u671F")) {
|
|
12189
|
+
return createRefreshTokenExpiredResponse(res);
|
|
12190
|
+
}
|
|
12191
|
+
return createUnauthorizedResponse(res, data);
|
|
12192
|
+
}
|
|
12193
|
+
const newAccessToken = refreshAccessToken(data);
|
|
12194
|
+
logger.mark(`[refresh] \u5237\u65B0\u6210\u529F: ${accessToken} -> ${newAccessToken}`);
|
|
12195
|
+
createSuccessResponse(res, { accessToken: newAccessToken }, "\u5237\u65B0\u6210\u529F");
|
|
12196
|
+
} catch (error) {
|
|
12197
|
+
logger.error(error);
|
|
12198
|
+
createServerErrorResponse(res, error instanceof Error ? error.message : "\u670D\u52A1\u5668\u9519\u8BEF");
|
|
12199
|
+
}
|
|
12200
|
+
};
|
|
12201
|
+
router.post("/refresh", refreshRouter);
|
|
12202
|
+
}
|
|
12203
|
+
});
|
|
12204
|
+
|
|
12205
|
+
// src/server/api/auth/index.ts
|
|
12206
|
+
var init_auth2 = __esm({
|
|
12207
|
+
"src/server/api/auth/index.ts"() {
|
|
12208
|
+
"use strict";
|
|
12209
|
+
init_esm_shims();
|
|
12210
|
+
init_login();
|
|
12211
|
+
init_refresh();
|
|
12212
|
+
}
|
|
12213
|
+
});
|
|
12214
|
+
|
|
12051
12215
|
// src/server/api/index.ts
|
|
12052
12216
|
var api_exports = {};
|
|
12053
12217
|
var init_api = __esm({
|
|
@@ -12062,6 +12226,7 @@ var init_api = __esm({
|
|
|
12062
12226
|
init_sandbox();
|
|
12063
12227
|
init_plugins();
|
|
12064
12228
|
init_utils();
|
|
12229
|
+
init_auth2();
|
|
12065
12230
|
}
|
|
12066
12231
|
});
|
|
12067
12232
|
|
|
@@ -13720,7 +13885,7 @@ var init_cache4 = __esm({
|
|
|
13720
13885
|
|
|
13721
13886
|
// src/adapter/render/connect/http.ts
|
|
13722
13887
|
import axios9 from "axios";
|
|
13723
|
-
import
|
|
13888
|
+
import crypto2 from "node:crypto";
|
|
13724
13889
|
var createHttpRenderClient;
|
|
13725
13890
|
var init_http = __esm({
|
|
13726
13891
|
"src/adapter/render/connect/http.ts"() {
|
|
@@ -13738,7 +13903,7 @@ var init_http = __esm({
|
|
|
13738
13903
|
let { url, token, enable } = item;
|
|
13739
13904
|
if (!enable) return;
|
|
13740
13905
|
url = url.replace("/puppeteer", "");
|
|
13741
|
-
const headers = { authorization:
|
|
13906
|
+
const headers = { authorization: crypto2.createHash("md5").update(`Bearer ${token}`).digest("hex") };
|
|
13742
13907
|
try {
|
|
13743
13908
|
const result = await axios9.get(`${url}/ping`, { timeout: 5e3 });
|
|
13744
13909
|
if (result.status !== 200 || String(result.data.status) !== "200") {
|
|
@@ -13865,7 +14030,7 @@ var init_template = __esm({
|
|
|
13865
14030
|
|
|
13866
14031
|
// src/adapter/render/connect/ws.ts
|
|
13867
14032
|
import fs28 from "node:fs";
|
|
13868
|
-
import
|
|
14033
|
+
import crypto3 from "node:crypto";
|
|
13869
14034
|
var WebSocketRender;
|
|
13870
14035
|
var init_ws2 = __esm({
|
|
13871
14036
|
"src/adapter/render/connect/ws.ts"() {
|
|
@@ -13918,10 +14083,10 @@ var init_ws2 = __esm({
|
|
|
13918
14083
|
auth(token, targetToken) {
|
|
13919
14084
|
if (token !== targetToken) {
|
|
13920
14085
|
if (token.length !== 32) {
|
|
13921
|
-
token =
|
|
14086
|
+
token = crypto3.createHash("md5").update(`Bearer ${token}`).digest("hex");
|
|
13922
14087
|
}
|
|
13923
14088
|
if (targetToken.length !== 32) {
|
|
13924
|
-
targetToken =
|
|
14089
|
+
targetToken = crypto3.createHash("md5").update(`Bearer ${targetToken}`).digest("hex");
|
|
13925
14090
|
}
|
|
13926
14091
|
if (token !== targetToken) {
|
|
13927
14092
|
return false;
|
|
@@ -13976,7 +14141,7 @@ var init_ws2 = __esm({
|
|
|
13976
14141
|
|
|
13977
14142
|
// src/adapter/render/connect/client.ts
|
|
13978
14143
|
import WebSocket from "ws";
|
|
13979
|
-
import
|
|
14144
|
+
import crypto4 from "node:crypto";
|
|
13980
14145
|
var WebSocketClientRenderer, createWebSocketRenderClient;
|
|
13981
14146
|
var init_client = __esm({
|
|
13982
14147
|
"src/adapter/render/connect/client.ts"() {
|
|
@@ -14050,7 +14215,7 @@ var init_client = __esm({
|
|
|
14050
14215
|
return Promise.allSettled(cfg.ws_client.map(async (item) => {
|
|
14051
14216
|
const { url, token, enable } = item;
|
|
14052
14217
|
if (!enable) return;
|
|
14053
|
-
const headers = { Authorization:
|
|
14218
|
+
const headers = { Authorization: crypto4.createHash("md5").update(`Bearer ${token}`).digest("hex") };
|
|
14054
14219
|
const socket = new WebSocket(url, { headers });
|
|
14055
14220
|
const renderer = new WebSocketClientRenderer(socket, url, headers);
|
|
14056
14221
|
socket.once("open", async () => {
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as a}from"./index-D2VON33P.js";var r=a;export{r as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{d as a}from"./index-D2VON33P.js";var o=a;export{o as default};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/web/index.html
CHANGED
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
content="viewport-fit=cover, width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
|
|
15
15
|
name="viewport" />
|
|
16
16
|
<link href="/web/assets/favicon-BoqZd694.ico" rel="icon" />
|
|
17
|
-
<script type="module" crossorigin src="/web/assets/index-
|
|
17
|
+
<script type="module" crossorigin src="/web/assets/index-D2VON33P.js"></script>
|
|
18
18
|
<link rel="stylesheet" crossorigin href="/web/assets/index-CIP0gmfD.css">
|
|
19
19
|
</head>
|
|
20
20
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-karin",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.22-pr.284.987b16f",
|
|
4
4
|
"description": "Lightweight, efficient, concise, and stable robot framework.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"node",
|
|
@@ -76,6 +76,7 @@
|
|
|
76
76
|
"commander": "^13.0.0",
|
|
77
77
|
"dotenv": "^16.4.7",
|
|
78
78
|
"express": "4.21.2",
|
|
79
|
+
"jsonwebtoken": "^9.0.2",
|
|
79
80
|
"level": "9.0.0",
|
|
80
81
|
"lodash": "4.17.21",
|
|
81
82
|
"log4js": "6.9.1",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as a}from"./index-DGetM7dl.js";var r=a;export{r as default};
|
|
Binary file
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{d as a}from"./index-DGetM7dl.js";var o=a;export{o as default};
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|