node-karin 1.3.22-pr.284.51e08fd → 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.
Files changed (40) hide show
  1. package/dist/index.d.ts +35 -1
  2. package/dist/index.js +233 -124
  3. package/dist/web/assets/cssMode-CjM7nXyh.js.gz +0 -0
  4. package/dist/web/assets/freemarker2-DmpxUHfz.js.gz +0 -0
  5. package/dist/web/assets/handlebars-BImxsWdi.js.gz +0 -0
  6. package/dist/web/assets/html-xOz6JgnH.js.gz +0 -0
  7. package/dist/web/assets/htmlMode-T_Sttj3r.js.gz +0 -0
  8. package/dist/web/assets/index-CDvgk1hj.js +1 -0
  9. package/dist/web/assets/index-CcGvaFJt.js +1 -0
  10. package/dist/web/assets/index-D2VON33P.js.gz +0 -0
  11. package/dist/web/assets/javascript-Brs2F13H.js.gz +0 -0
  12. package/dist/web/assets/jsonMode-BYyn1Sp0.js.gz +0 -0
  13. package/dist/web/assets/liquid-UK3XkEOD.js.gz +0 -0
  14. package/dist/web/assets/mdx-DqdZcXHk.js.gz +0 -0
  15. package/dist/web/assets/python-Do9M9P5l.js.gz +0 -0
  16. package/dist/web/assets/razor-ovkT8T2z.js.gz +0 -0
  17. package/dist/web/assets/tsMode-BYHCzFsx.js.gz +0 -0
  18. package/dist/web/assets/typescript-BxocgfRf.js.gz +0 -0
  19. package/dist/web/assets/xml-B9aYgEa3.js.gz +0 -0
  20. package/dist/web/assets/yaml-B7KHlGBf.js.gz +0 -0
  21. package/dist/web/index.html +1 -1
  22. package/package.json +1 -1
  23. package/dist/web/assets/cssMode-CbD7NRo2.js.gz +0 -0
  24. package/dist/web/assets/freemarker2-CmEg6ok0.js.gz +0 -0
  25. package/dist/web/assets/handlebars-Ba2z_L5p.js.gz +0 -0
  26. package/dist/web/assets/html-B_rLa2Iw.js.gz +0 -0
  27. package/dist/web/assets/htmlMode-elhiPcPa.js.gz +0 -0
  28. package/dist/web/assets/index-BGVAquX8.js +0 -1
  29. package/dist/web/assets/index-Bswf77Ah.js.gz +0 -0
  30. package/dist/web/assets/index-C93ejmwj.js +0 -1
  31. package/dist/web/assets/javascript-DAWnWc01.js.gz +0 -0
  32. package/dist/web/assets/jsonMode-DiAIRZf1.js.gz +0 -0
  33. package/dist/web/assets/liquid-7-OzV4NU.js.gz +0 -0
  34. package/dist/web/assets/mdx-DSznKLX2.js.gz +0 -0
  35. package/dist/web/assets/python-DHAwsB7p.js.gz +0 -0
  36. package/dist/web/assets/razor-C_mcHwHT.js.gz +0 -0
  37. package/dist/web/assets/tsMode-DN8mHtc9.js.gz +0 -0
  38. package/dist/web/assets/typescript-BhTBqlRk.js.gz +0 -0
  39. package/dist/web/assets/xml-Bz_17ZdD.js.gz +0 -0
  40. package/dist/web/assets/yaml-lxHDnpl6.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
@@ -2946,85 +2946,8 @@ var init_config2 = __esm({
2946
2946
  }
2947
2947
  });
2948
2948
 
2949
- // src/server/auth/index.ts
2950
- import jwt from "jsonwebtoken";
2951
- import crypto from "node:crypto";
2952
- var loginAuth, setToken2Level, verifyToken, auth;
2953
- var init_auth = __esm({
2954
- "src/server/auth/index.ts"() {
2955
- "use strict";
2956
- init_esm_shims();
2957
- init_config2();
2958
- init_index();
2959
- loginAuth = async (req) => {
2960
- var _a;
2961
- const token = (_a = req == null ? void 0 : req.headers) == null ? void 0 : _a.password;
2962
- if (!token) return false;
2963
- const uToken = authKey();
2964
- const hashedData = crypto.createHash("sha256").update(uToken).digest("hex");
2965
- if (token === hashedData) {
2966
- const payload = { userId: uToken, passWord: hashedData };
2967
- const jwtToken = await setToken2Level(payload, payload.userId);
2968
- await level.set(`HTTP_AUTH_TOKEN:${uToken}`, jwtToken);
2969
- return true;
2970
- }
2971
- return false;
2972
- };
2973
- setToken2Level = async (payload, token) => {
2974
- const secretKey = jwt.sign(payload, token, { expiresIn: "3h" });
2975
- await level.set(`HTTP_AUTH_TOKEN:${payload.userId}`, secretKey);
2976
- return secretKey;
2977
- };
2978
- verifyToken = async (secreKey, token) => {
2979
- const uToken = authKey();
2980
- const cacheSecreKey = await level.get(`HTTP_AUTH_TOKEN:${uToken}`);
2981
- if (secreKey === cacheSecreKey || token === uToken) {
2982
- try {
2983
- const isValid = !!jwt.verify(secreKey, token);
2984
- if (!isValid) return { status: false };
2985
- return { status: true };
2986
- } catch {
2987
- logger.debug(logger.yellow("\u7F51\u9875\u767B\u5F55\u4EE4\u724C\u5DF2\u8FC7\u671F\uFF0C\u5C06\u91CD\u65B0\u91CD\u65B0\u751F\u6210\u4EE4\u724C"));
2988
- const newsecreKey = crypto.createHash("sha256").update(token).digest("hex");
2989
- const payload = { userId: uToken, passWord: newsecreKey };
2990
- const newJwtToken = await setToken2Level(payload, payload.userId);
2991
- return { status: true, newToken: newJwtToken };
2992
- }
2993
- }
2994
- return { status: false };
2995
- };
2996
- auth = {
2997
- /**
2998
- * get请求鉴权
2999
- * @description 支持请求头中携带`Authorization`字段
3000
- * @description 支持请求参数中携带`token`字段
3001
- */
3002
- getAuth: async (req) => {
3003
- var _a, _b, _c;
3004
- const secreKey = ((_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);
3005
- if (!secreKey) return { status: false };
3006
- const uToken = authKey();
3007
- const verifyStatus = await verifyToken(secreKey, uToken);
3008
- return verifyStatus;
3009
- },
3010
- /**
3011
- * post请求鉴权
3012
- * @description 仅支持请求头中携带`Authorization`字段
3013
- */
3014
- postAuth: async (req) => {
3015
- var _a, _b;
3016
- const secreKey = (_b = (_a = req == null ? void 0 : req.headers) == null ? void 0 : _a.authorization) == null ? void 0 : _b.replace("Bearer ", "");
3017
- if (!secreKey) return { status: false };
3018
- const uToken = authKey();
3019
- const verifyStatus = await verifyToken(secreKey, uToken);
3020
- return verifyStatus;
3021
- }
3022
- };
3023
- }
3024
- });
3025
-
3026
2949
  // src/server/utils/response.ts
3027
- var createResponse, createSuccessResponse, createUnauthorizedResponse, createNotFoundResponse, createServerErrorResponse, createBadRequestResponse, createPayloadTooLargeResponse, createForbiddenResponse;
2950
+ var createResponse, createSuccessResponse, createUnauthorizedResponse, createAccessTokenExpiredResponse, createRefreshTokenExpiredResponse, createNotFoundResponse, createServerErrorResponse, createBadRequestResponse, createPayloadTooLargeResponse, createMethodNotAllowedResponse, createForbiddenResponse;
3028
2951
  var init_response = __esm({
3029
2952
  "src/server/utils/response.ts"() {
3030
2953
  "use strict";
@@ -3049,6 +2972,12 @@ message: ${message2}
3049
2972
  createUnauthorizedResponse = (res, message2 = "\u672A\u767B\u5F55") => {
3050
2973
  return createResponse(res, 401 /* Unauthorized */, null, message2);
3051
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
+ };
3052
2981
  createNotFoundResponse = (res, message2 = "\u672A\u627E\u5230") => {
3053
2982
  return createResponse(res, 404 /* NotFound */, null, message2);
3054
2983
  };
@@ -3061,12 +2990,152 @@ message: ${message2}
3061
2990
  createPayloadTooLargeResponse = (res, message2 = "\u8BF7\u6C42\u4F53\u8FC7\u5927") => {
3062
2991
  return createResponse(res, 413 /* PayloadTooLarge */, null, message2);
3063
2992
  };
2993
+ createMethodNotAllowedResponse = (res, message2 = "\u65B9\u6CD5\u4E0D\u5141\u8BB8") => {
2994
+ return createResponse(res, 405 /* MethodNotAllowed */, null, message2);
2995
+ };
3064
2996
  createForbiddenResponse = (res, message2 = "\u7981\u6B62\u8BBF\u95EE") => {
3065
2997
  return createResponse(res, 403 /* Forbidden */, null, message2);
3066
2998
  };
3067
2999
  }
3068
3000
  });
3069
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
+
3070
3139
  // src/server/middleware.ts
3071
3140
  var authMiddleware;
3072
3141
  var init_middleware = __esm({
@@ -3085,25 +3154,20 @@ headers: ${JSON.stringify(req.headers)}
3085
3154
  body: ${JSON.stringify(req.body)}
3086
3155
  `
3087
3156
  );
3088
- const checkResult = await auth.getAuth(req) || await auth.postAuth(req);
3089
- const Pass = checkResult.status;
3090
- if (req.path === "/ping" || req.path.startsWith("/console")) {
3157
+ if (req.path === "/ping" || req.path === "/login" || req.path === "/refresh" || req.path.startsWith("/console")) {
3091
3158
  next();
3092
3159
  return;
3093
3160
  }
3094
- const loginPass = await loginAuth(req);
3095
- if (!loginPass && req.path === "/login") {
3096
- createResponse(res, 500 /* InternalServerError */, { e: "HTTP \u9274\u6743\u5BC6\u94A5\u9519\u8BEF" }, "HTTP \u9274\u6743\u5BC6\u94A5\u9519\u8BEF");
3097
- return;
3098
- }
3099
- if (!Pass && req.path !== "/login") {
3100
- createUnauthorizedResponse(res, "\u9274\u6743\u5931\u8D25 / check failed");
3101
- logger.error(`[express][${req.ip}] \u9274\u6743\u9519\u8BEF: /api/v1/${req.path}`);
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);
3102
3169
  return;
3103
3170
  }
3104
- if (checkResult.newToken) {
3105
- res.setHeader("authorization", checkResult.newToken);
3106
- }
3107
3171
  next();
3108
3172
  };
3109
3173
  }
@@ -5715,30 +5779,6 @@ var init_log = __esm({
5715
5779
  }
5716
5780
  });
5717
5781
 
5718
- // src/server/api/system/login.ts
5719
- import crypto2 from "crypto";
5720
- var loginRouter;
5721
- var init_login = __esm({
5722
- "src/server/api/system/login.ts"() {
5723
- "use strict";
5724
- init_esm_shims();
5725
- init_router();
5726
- init_response();
5727
- init_index();
5728
- init_config2();
5729
- loginRouter = async (_req, res) => {
5730
- const uToken = authKey();
5731
- const hashedData = crypto2.createHash("sha256").update(uToken).digest("hex");
5732
- let authorization = "";
5733
- if (_req.body.password === hashedData) {
5734
- authorization = await level.get(`HTTP_AUTH_TOKEN:${uToken}`);
5735
- }
5736
- createSuccessResponse(res, { authorization }, "\u767B\u5F55\u6210\u529F");
5737
- };
5738
- router.post("/login", loginRouter);
5739
- }
5740
- });
5741
-
5742
5782
  // src/server/api/system/index.ts
5743
5783
  var init_system = __esm({
5744
5784
  "src/server/api/system/index.ts"() {
@@ -5746,7 +5786,6 @@ var init_system = __esm({
5746
5786
  init_esm_shims();
5747
5787
  init_manage();
5748
5788
  init_log();
5749
- init_login();
5750
5789
  }
5751
5790
  });
5752
5791
 
@@ -12104,6 +12143,75 @@ var init_utils = __esm({
12104
12143
  }
12105
12144
  });
12106
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
+
12107
12215
  // src/server/api/index.ts
12108
12216
  var api_exports = {};
12109
12217
  var init_api = __esm({
@@ -12118,6 +12226,7 @@ var init_api = __esm({
12118
12226
  init_sandbox();
12119
12227
  init_plugins();
12120
12228
  init_utils();
12229
+ init_auth2();
12121
12230
  }
12122
12231
  });
12123
12232
 
@@ -13776,7 +13885,7 @@ var init_cache4 = __esm({
13776
13885
 
13777
13886
  // src/adapter/render/connect/http.ts
13778
13887
  import axios9 from "axios";
13779
- import crypto3 from "node:crypto";
13888
+ import crypto2 from "node:crypto";
13780
13889
  var createHttpRenderClient;
13781
13890
  var init_http = __esm({
13782
13891
  "src/adapter/render/connect/http.ts"() {
@@ -13794,7 +13903,7 @@ var init_http = __esm({
13794
13903
  let { url, token, enable } = item;
13795
13904
  if (!enable) return;
13796
13905
  url = url.replace("/puppeteer", "");
13797
- const headers = { authorization: crypto3.createHash("md5").update(`Bearer ${token}`).digest("hex") };
13906
+ const headers = { authorization: crypto2.createHash("md5").update(`Bearer ${token}`).digest("hex") };
13798
13907
  try {
13799
13908
  const result = await axios9.get(`${url}/ping`, { timeout: 5e3 });
13800
13909
  if (result.status !== 200 || String(result.data.status) !== "200") {
@@ -13921,7 +14030,7 @@ var init_template = __esm({
13921
14030
 
13922
14031
  // src/adapter/render/connect/ws.ts
13923
14032
  import fs28 from "node:fs";
13924
- import crypto4 from "node:crypto";
14033
+ import crypto3 from "node:crypto";
13925
14034
  var WebSocketRender;
13926
14035
  var init_ws2 = __esm({
13927
14036
  "src/adapter/render/connect/ws.ts"() {
@@ -13974,10 +14083,10 @@ var init_ws2 = __esm({
13974
14083
  auth(token, targetToken) {
13975
14084
  if (token !== targetToken) {
13976
14085
  if (token.length !== 32) {
13977
- token = crypto4.createHash("md5").update(`Bearer ${token}`).digest("hex");
14086
+ token = crypto3.createHash("md5").update(`Bearer ${token}`).digest("hex");
13978
14087
  }
13979
14088
  if (targetToken.length !== 32) {
13980
- targetToken = crypto4.createHash("md5").update(`Bearer ${targetToken}`).digest("hex");
14089
+ targetToken = crypto3.createHash("md5").update(`Bearer ${targetToken}`).digest("hex");
13981
14090
  }
13982
14091
  if (token !== targetToken) {
13983
14092
  return false;
@@ -14032,7 +14141,7 @@ var init_ws2 = __esm({
14032
14141
 
14033
14142
  // src/adapter/render/connect/client.ts
14034
14143
  import WebSocket from "ws";
14035
- import crypto5 from "node:crypto";
14144
+ import crypto4 from "node:crypto";
14036
14145
  var WebSocketClientRenderer, createWebSocketRenderClient;
14037
14146
  var init_client = __esm({
14038
14147
  "src/adapter/render/connect/client.ts"() {
@@ -14106,7 +14215,7 @@ var init_client = __esm({
14106
14215
  return Promise.allSettled(cfg.ws_client.map(async (item) => {
14107
14216
  const { url, token, enable } = item;
14108
14217
  if (!enable) return;
14109
- const headers = { Authorization: crypto5.createHash("md5").update(`Bearer ${token}`).digest("hex") };
14218
+ const headers = { Authorization: crypto4.createHash("md5").update(`Bearer ${token}`).digest("hex") };
14110
14219
  const socket = new WebSocket(url, { headers });
14111
14220
  const renderer = new WebSocketClientRenderer(socket, url, headers);
14112
14221
  socket.once("open", async () => {
@@ -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};
@@ -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-Bswf77Ah.js"></script>
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.22-pr.284.51e08fd",
3
+ "version": "1.3.22-pr.284.987b16f",
4
4
  "description": "Lightweight, efficient, concise, and stable robot framework.",
5
5
  "keywords": [
6
6
  "node",
Binary file
@@ -1 +0,0 @@
1
- import{d as a}from"./index-Bswf77Ah.js";var o=a;export{o as default};
@@ -1 +0,0 @@
1
- import{d as a}from"./index-Bswf77Ah.js";var r=a;export{r as default};
Binary file
Binary file
Binary file