koishi-plugin-kkk 1.0.0
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/CHANGELOG.md +57 -0
- package/LICENSE +674 -0
- package/README.md +98 -0
- package/assets/web/assets/CronEditor-CYgFpX-g.js +1 -0
- package/assets/web/assets/DesktopLayout-iI43ij11.js +1 -0
- package/assets/web/assets/MobileLayout-CziU8MCR.js +1 -0
- package/assets/web/assets/ThemeSwitch-DFohhwd9.js +1 -0
- package/assets/web/assets/index-BRROK0vh.js +47 -0
- package/assets/web/assets/index-Dj-StEiS.css +2 -0
- package/assets/web/assets/separator-CxcFlCzz.js +1 -0
- package/assets/web/favicon.svg +1 -0
- package/assets/web/icons.svg +24 -0
- package/assets/web/index.html +15 -0
- package/assets/webui.html +115 -0
- package/client/index.ts +63 -0
- package/config/default_config/app.yaml +64 -0
- package/config/default_config/bilibili.yaml +116 -0
- package/config/default_config/config.json +157 -0
- package/config/default_config/cookies.yaml +11 -0
- package/config/default_config/douyin.yaml +99 -0
- package/config/default_config/kuaishou.yaml +8 -0
- package/config/default_config/pushlist.yaml +37 -0
- package/config/default_config/request.yaml +22 -0
- package/config/default_config/upload.yaml +50 -0
- package/config/default_config/xiaohongshu.yaml +23 -0
- package/dist/index.js +1 -0
- package/lib/compat/axios.js +23 -0
- package/lib/compat/cron.js +77 -0
- package/lib/compat/esm.js +15 -0
- package/lib/compat/express.js +23 -0
- package/lib/compat/heroui.js +12 -0
- package/lib/compat/lodash.js +33 -0
- package/lib/compat/logger.js +118 -0
- package/lib/compat/node-karin.js +1053 -0
- package/lib/compat/phosphor-icons.js +27 -0
- package/lib/compat/qqcard.js +256 -0
- package/lib/compat/root.js +44 -0
- package/lib/compat/runtime.js +87 -0
- package/lib/compat/segment.js +167 -0
- package/lib/compat/sqlite3.js +117 -0
- package/lib/compat/start.js +7 -0
- package/lib/compat/syncConfig.js +65 -0
- package/lib/compat/template-react.js +30 -0
- package/lib/compat/text.js +65 -0
- package/lib/compat/yaml.js +13 -0
- package/lib/configBridge.js +91 -0
- package/lib/index.js +775 -0
- package/lib/karin/app.js +34 -0
- package/lib/karin/apps/__ready.js +9 -0
- package/lib/karin/apps/admin.js +136 -0
- package/lib/karin/apps/help.js +233 -0
- package/lib/karin/apps/push.js +291 -0
- package/lib/karin/apps/qrlogin.js +176 -0
- package/lib/karin/apps/statistics.js +209 -0
- package/lib/karin/apps/testPush.js +247 -0
- package/lib/karin/apps/tools.js +473 -0
- package/lib/karin/apps/update.js +252 -0
- package/lib/karin/index.js +37 -0
- package/lib/karin/module/db/bilibili.js +831 -0
- package/lib/karin/module/db/douyin.js +918 -0
- package/lib/karin/module/db/index.js +165 -0
- package/lib/karin/module/db/migration.js +199 -0
- package/lib/karin/module/db/statistics.js +559 -0
- package/lib/karin/module/index.js +94 -0
- package/lib/karin/module/server/constants/routes.js +48 -0
- package/lib/karin/module/server/controllers/bots.js +230 -0
- package/lib/karin/module/server/controllers/config.js +75 -0
- package/lib/karin/module/server/controllers/video.js +208 -0
- package/lib/karin/module/server/index.js +26 -0
- package/lib/karin/module/server/middlewares/auth.js +133 -0
- package/lib/karin/module/server/routes/amagi.js +57 -0
- package/lib/karin/module/server/routes/api.js +40 -0
- package/lib/karin/module/server/routes/index.js +97 -0
- package/lib/karin/module/server/routes/ssr.js +16 -0
- package/lib/karin/module/server/routes/static.js +43 -0
- package/lib/karin/module/utils/Base.js +403 -0
- package/lib/karin/module/utils/CardParser.js +487 -0
- package/lib/karin/module/utils/Common.js +418 -0
- package/lib/karin/module/utils/Config.js +434 -0
- package/lib/karin/module/utils/EmojiReaction.js +242 -0
- package/lib/karin/module/utils/ErrorHandler/handler.js +114 -0
- package/lib/karin/module/utils/ErrorHandler/index.js +55 -0
- package/lib/karin/module/utils/ErrorHandler/render.js +182 -0
- package/lib/karin/module/utils/ErrorHandler/sender.js +206 -0
- package/lib/karin/module/utils/ErrorHandler/strategy.js +41 -0
- package/lib/karin/module/utils/ErrorHandler/types.js +2 -0
- package/lib/karin/module/utils/ErrorHandler/utils.js +108 -0
- package/lib/karin/module/utils/FFmpeg.js +298 -0
- package/lib/karin/module/utils/ImageHelper.js +91 -0
- package/lib/karin/module/utils/ImageSlice.js +429 -0
- package/lib/karin/module/utils/MotionPhoto.js +250 -0
- package/lib/karin/module/utils/Network/Downloader.js +413 -0
- package/lib/karin/module/utils/Network/ImageDownloader.js +250 -0
- package/lib/karin/module/utils/Network/Network.js +332 -0
- package/lib/karin/module/utils/Network/ThrottleStream.js +71 -0
- package/lib/karin/module/utils/Network/constants.js +129 -0
- package/lib/karin/module/utils/Network/helpers.js +174 -0
- package/lib/karin/module/utils/Network/index.js +34 -0
- package/lib/karin/module/utils/Network/types.js +12 -0
- package/lib/karin/module/utils/Networks.js +17 -0
- package/lib/karin/module/utils/ParseLock.js +34 -0
- package/lib/karin/module/utils/ParseOverride.js +88 -0
- package/lib/karin/module/utils/QqCardResolve.js +114 -0
- package/lib/karin/module/utils/QqPanel.js +879 -0
- package/lib/karin/module/utils/Render/coverTheme.js +256 -0
- package/lib/karin/module/utils/Render/index.js +582 -0
- package/lib/karin/module/utils/amagiClient.js +338 -0
- package/lib/karin/module/utils/avatar.js +201 -0
- package/lib/karin/module/utils/bot.js +141 -0
- package/lib/karin/module/utils/build-metadata.js +50 -0
- package/lib/karin/module/utils/changelog.js +166 -0
- package/lib/karin/module/utils/index.js +26 -0
- package/lib/karin/module/utils/loginSession.js +259 -0
- package/lib/karin/module/utils/parseTip.js +93 -0
- package/lib/karin/module/utils/runtime-report.js +140 -0
- package/lib/karin/module/utils/semver.js +72 -0
- package/lib/karin/module/utils/statisticsAggregate.js +415 -0
- package/lib/karin/platform/bilibili/bilibili.js +1805 -0
- package/lib/karin/platform/bilibili/comments.js +294 -0
- package/lib/karin/platform/bilibili/danmaku.js +555 -0
- package/lib/karin/platform/bilibili/dynamic-text.js +827 -0
- package/lib/karin/platform/bilibili/genParams.js +37 -0
- package/lib/karin/platform/bilibili/getID.js +159 -0
- package/lib/karin/platform/bilibili/index.js +24 -0
- package/lib/karin/platform/bilibili/live-status.js +40 -0
- package/lib/karin/platform/bilibili/login.js +132 -0
- package/lib/karin/platform/bilibili/push.js +1397 -0
- package/lib/karin/platform/bilibili/riskControl.js +133 -0
- package/lib/karin/platform/bilibili/search.js +299 -0
- package/lib/karin/platform/common/danmaku-types.js +12 -0
- package/lib/karin/platform/douyin/comments.js +310 -0
- package/lib/karin/platform/douyin/danmaku.js +893 -0
- package/lib/karin/platform/douyin/douyin.js +1145 -0
- package/lib/karin/platform/douyin/getID.js +94 -0
- package/lib/karin/platform/douyin/index.js +24 -0
- package/lib/karin/platform/douyin/login.js +230 -0
- package/lib/karin/platform/douyin/push/favorite.js +75 -0
- package/lib/karin/platform/douyin/push/index.js +21 -0
- package/lib/karin/platform/douyin/push/live.js +69 -0
- package/lib/karin/platform/douyin/push/post.js +60 -0
- package/lib/karin/platform/douyin/push/recommend.js +74 -0
- package/lib/karin/platform/douyin/push/render.js +621 -0
- package/lib/karin/platform/douyin/push/types.js +2 -0
- package/lib/karin/platform/douyin/push.js +1128 -0
- package/lib/karin/platform/douyin/types.js +13 -0
- package/lib/karin/platform/douyin/videoQuality.js +222 -0
- package/lib/karin/platform/douyin/workType.js +182 -0
- package/lib/karin/platform/index.js +20 -0
- package/lib/karin/platform/kuaishou/comments.js +91 -0
- package/lib/karin/platform/kuaishou/getID.js +43 -0
- package/lib/karin/platform/kuaishou/getdata.js +41 -0
- package/lib/karin/platform/kuaishou/index.js +20 -0
- package/lib/karin/platform/kuaishou/kuaishou.js +122 -0
- package/lib/karin/platform/xiaohongshu/comments.js +162 -0
- package/lib/karin/platform/xiaohongshu/getID.js +129 -0
- package/lib/karin/platform/xiaohongshu/index.js +18 -0
- package/lib/karin/platform/xiaohongshu/xiaohongshu.js +643 -0
- package/lib/karin/root.js +73 -0
- package/lib/karin/setup.js +99 -0
- package/lib/karin/types/config/amagi.js +2 -0
- package/lib/karin/types/config/app.js +2 -0
- package/lib/karin/types/config/bilibili.js +2 -0
- package/lib/karin/types/config/cookies.js +2 -0
- package/lib/karin/types/config/douyin.js +2 -0
- package/lib/karin/types/config/index.js +2 -0
- package/lib/karin/types/config/kuaishou.js +2 -0
- package/lib/karin/types/config/pushlist.js +2 -0
- package/lib/karin/types/config/request.js +2 -0
- package/lib/karin/types/config/upload.js +2 -0
- package/lib/karin/types/config/xiaohongshu.js +2 -0
- package/lib/karin/types/datatypes.js +2 -0
- package/lib/karin/types/index.js +18 -0
- package/lib/karin/types/netrorks/NetworksConfigType.js +2 -0
- package/lib/karin/types/netrorks/index.js +17 -0
- package/lib/karin/web.config.js +49 -0
- package/lib/ktr/registry.js +82 -0
- package/lib/ktr/template/_preview/components/PreviewInfoCard.js +10 -0
- package/lib/ktr/template/_preview/components/PreviewLayout.js +10 -0
- package/lib/ktr/template/_preview/components/PreviewVideoCard.js +8 -0
- package/lib/ktr/template/_preview/render.js +142 -0
- package/lib/ktr/template/_preview/types.js +2 -0
- package/lib/ktr/template/_preview/utils/status.js +31 -0
- package/lib/ktr/template/_preview/utils/time.js +12 -0
- package/lib/ktr/template/bilibili/bangumi/components/bangumi.js +127 -0
- package/lib/ktr/template/bilibili/bangumi/components/types.js +2 -0
- package/lib/ktr/template/bilibili/bangumi/index.js +12 -0
- package/lib/ktr/template/bilibili/comment/components/Comment.js +193 -0
- package/lib/ktr/template/bilibili/comment/components/types.js +2 -0
- package/lib/ktr/template/bilibili/comment/index.js +10 -0
- package/lib/ktr/template/bilibili/components/Icons.js +66 -0
- package/lib/ktr/template/bilibili/components/shared.js +93 -0
- package/lib/ktr/template/bilibili/components/types.js +2 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_ARTICLE/components/DYNAMIC_TYPE_ARTICLE.js +66 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_ARTICLE/components/types.js +2 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_ARTICLE/index.js +10 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_AV/components/DYNAMIC_TYPE_AV.js +87 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_AV/components/types.js +2 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_AV/index.js +10 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_DRAW/components/DYNAMIC_TYPE_DRAW.js +93 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_DRAW/components/types.js +2 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_DRAW/index.js +10 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_FORWARD/components/DYNAMIC_TYPE_FORWARD.js +132 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_FORWARD/components/types.js +2 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_FORWARD/index.js +10 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_LIVE_RCMD/components/DYNAMIC_TYPE_LIVE_RCMD.js +84 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_LIVE_RCMD/components/types.js +2 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_LIVE_RCMD/index.js +10 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_WORD/components/DYNAMIC_TYPE_WORD.js +38 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_WORD/components/types.js +2 -0
- package/lib/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_WORD/index.js +10 -0
- package/lib/ktr/template/bilibili/dynamic/components/AdditionalCard.js +59 -0
- package/lib/ktr/template/bilibili/dynamic/components/CommonComponents.js +30 -0
- package/lib/ktr/template/bilibili/dynamic/types.js +2 -0
- package/lib/ktr/template/bilibili/qrcodeImg/components/qrcodeImg.js +48 -0
- package/lib/ktr/template/bilibili/qrcodeImg/components/types.js +3 -0
- package/lib/ktr/template/bilibili/qrcodeImg/index.js +10 -0
- package/lib/ktr/template/bilibili/userlist/components/UserList.js +53 -0
- package/lib/ktr/template/bilibili/userlist/components/types.js +3 -0
- package/lib/ktr/template/bilibili/userlist/index.js +13 -0
- package/lib/ktr/template/bilibili/videoInfo/components/types.js +2 -0
- package/lib/ktr/template/bilibili/videoInfo/components/videoInfo.js +62 -0
- package/lib/ktr/template/bilibili/videoInfo/index.js +10 -0
- package/lib/ktr/template/components/AmbientCover.js +36 -0
- package/lib/ktr/template/components/DefaultLayout.js +33 -0
- package/lib/ktr/template/components/GlowImage.js +276 -0
- package/lib/ktr/template/components/QRCodeWithAvatar.js +34 -0
- package/lib/ktr/template/components/RolldownLogo.js +6 -0
- package/lib/ktr/template/components/ViteLogo.js +6 -0
- package/lib/ktr/template/components/iconRegistry.js +173 -0
- package/lib/ktr/template/douyin/article-work/components/ArticleWork.js +99 -0
- package/lib/ktr/template/douyin/article-work/components/types.js +3 -0
- package/lib/ktr/template/douyin/article-work/index.js +10 -0
- package/lib/ktr/template/douyin/comment/components/Comment.js +189 -0
- package/lib/ktr/template/douyin/comment/components/types.js +2 -0
- package/lib/ktr/template/douyin/comment/index.js +10 -0
- package/lib/ktr/template/douyin/components/Icons.js +29 -0
- package/lib/ktr/template/douyin/components/types.js +3 -0
- package/lib/ktr/template/douyin/dynamic/components/Dynamic.js +90 -0
- package/lib/ktr/template/douyin/dynamic/components/types.js +3 -0
- package/lib/ktr/template/douyin/dynamic/index.js +10 -0
- package/lib/ktr/template/douyin/favorite-list/components/FavoriteList.js +30 -0
- package/lib/ktr/template/douyin/favorite-list/components/types.js +3 -0
- package/lib/ktr/template/douyin/favorite-list/index.js +10 -0
- package/lib/ktr/template/douyin/image-work/components/ImageWork.js +136 -0
- package/lib/ktr/template/douyin/image-work/components/types.js +2 -0
- package/lib/ktr/template/douyin/image-work/index.js +10 -0
- package/lib/ktr/template/douyin/live/components/Live.js +51 -0
- package/lib/ktr/template/douyin/live/components/types.js +3 -0
- package/lib/ktr/template/douyin/live/index.js +10 -0
- package/lib/ktr/template/douyin/musicinfo/components/MusicInfo.js +60 -0
- package/lib/ktr/template/douyin/musicinfo/components/types.js +3 -0
- package/lib/ktr/template/douyin/musicinfo/index.js +10 -0
- package/lib/ktr/template/douyin/qrcodeImg/components/qrcodeImg.js +39 -0
- package/lib/ktr/template/douyin/qrcodeImg/components/types.js +3 -0
- package/lib/ktr/template/douyin/qrcodeImg/index.js +9 -0
- package/lib/ktr/template/douyin/recommend-list/components/RecommendList.js +30 -0
- package/lib/ktr/template/douyin/recommend-list/components/types.js +3 -0
- package/lib/ktr/template/douyin/recommend-list/index.js +10 -0
- package/lib/ktr/template/douyin/user_profile/components/UserVideoList.js +54 -0
- package/lib/ktr/template/douyin/user_profile/components/types.js +3 -0
- package/lib/ktr/template/douyin/user_profile/index.js +9 -0
- package/lib/ktr/template/douyin/userlist/components/UserList.js +50 -0
- package/lib/ktr/template/douyin/userlist/components/types.js +3 -0
- package/lib/ktr/template/douyin/userlist/index.js +13 -0
- package/lib/ktr/template/douyin/video-work/components/VideoWork.js +127 -0
- package/lib/ktr/template/douyin/video-work/components/types.js +2 -0
- package/lib/ktr/template/douyin/video-work/index.js +10 -0
- package/lib/ktr/template/kuaishou/comment/components/Comment.js +88 -0
- package/lib/ktr/template/kuaishou/comment/components/types.js +2 -0
- package/lib/ktr/template/kuaishou/comment/index.js +10 -0
- package/lib/ktr/template/other/changelog/components/changelog.js +117 -0
- package/lib/ktr/template/other/changelog/components/types.js +3 -0
- package/lib/ktr/template/other/changelog/index.js +9 -0
- package/lib/ktr/template/other/handlerError/components/errorTitles.js +227 -0
- package/lib/ktr/template/other/handlerError/components/handlerError.js +392 -0
- package/lib/ktr/template/other/handlerError/components/stackHighlight.js +109 -0
- package/lib/ktr/template/other/handlerError/components/types.js +2 -0
- package/lib/ktr/template/other/handlerError/index.js +9 -0
- package/lib/ktr/template/other/help/components/Help.js +79 -0
- package/lib/ktr/template/other/help/components/types.js +3 -0
- package/lib/ktr/template/other/help/index.js +12 -0
- package/lib/ktr/template/other/live-photo-tip/components/LivePhotoTip.js +80 -0
- package/lib/ktr/template/other/live-photo-tip/components/types.js +3 -0
- package/lib/ktr/template/other/live-photo-tip/index.js +9 -0
- package/lib/ktr/template/other/qrlogin/components/qrlogin.js +58 -0
- package/lib/ktr/template/other/qrlogin/components/types.js +3 -0
- package/lib/ktr/template/other/qrlogin/index.js +9 -0
- package/lib/ktr/template/other/runtime/components/runtime.js +101 -0
- package/lib/ktr/template/other/runtime/components/types.js +3 -0
- package/lib/ktr/template/other/runtime/index.js +9 -0
- package/lib/ktr/template/other/version_warning/components/VersionWarning.js +38 -0
- package/lib/ktr/template/other/version_warning/components/types.js +3 -0
- package/lib/ktr/template/other/version_warning/index.js +9 -0
- package/lib/ktr/template/statistics/components/BoxplotGuide.js +17 -0
- package/lib/ktr/template/statistics/components/ChartCard.js +15 -0
- package/lib/ktr/template/statistics/components/KpiCard.js +14 -0
- package/lib/ktr/template/statistics/components/PlatformTable.js +20 -0
- package/lib/ktr/template/statistics/components/RankList.js +61 -0
- package/lib/ktr/template/statistics/components/SSRChart.js +22 -0
- package/lib/ktr/template/statistics/components/chartPresets.js +630 -0
- package/lib/ktr/template/statistics/components/chartTheme.js +226 -0
- package/lib/ktr/template/statistics/components/format.js +38 -0
- package/lib/ktr/template/statistics/components/types.js +9 -0
- package/lib/ktr/template/statistics/global/components/GlobalStatistics.js +246 -0
- package/lib/ktr/template/statistics/global/components/types.js +3 -0
- package/lib/ktr/template/statistics/global/index.js +9 -0
- package/lib/ktr/template/statistics/group/components/GroupStatistics.js +181 -0
- package/lib/ktr/template/statistics/group/components/types.js +3 -0
- package/lib/ktr/template/statistics/group/index.js +9 -0
- package/lib/ktr/template/types/ctx.js +2 -0
- package/lib/ktr/template/xiaohongshu/comment/components/Comment.js +99 -0
- package/lib/ktr/template/xiaohongshu/comment/components/types.js +3 -0
- package/lib/ktr/template/xiaohongshu/comment/index.js +9 -0
- package/lib/ktr/template/xiaohongshu/noteInfo/components/noteInfo.js +93 -0
- package/lib/ktr/template/xiaohongshu/noteInfo/components/types.js +2 -0
- package/lib/ktr/template/xiaohongshu/noteInfo/index.js +9 -0
- package/lib/ktr/utils/QRCodeAvatar.js +99 -0
- package/lib/ktr/utils/QRcode.js +56 -0
- package/lib/ktr/utils/avatarProxy.js +45 -0
- package/lib/ktr/utils/cn.js +11 -0
- package/lib/ktr/utils/theme.js +12 -0
- package/lib/qqFields.json +75 -0
- package/lib/qqOptions.js +44 -0
- package/lib/richtext/index.js +25 -0
- package/lib/richtext/parse/index.js +232 -0
- package/lib/richtext/react/cn.js +11 -0
- package/lib/richtext/react/index.js +221 -0
- package/lib/richtext/types.js +2 -0
- package/lib/schema.js +352 -0
- package/lib/webui.js +341 -0
- package/package.json +88 -0
- package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_BV.svg +1 -0
- package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_GOODS.svg +1 -0
- package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_LOTTERY.svg +1 -0
- package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_VIEW_PICTURE.svg +1 -0
- package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_VOTE.svg +1 -0
- package/resources/image/bilibili/RICH_TEXT_NODE_TYPE/RICH_TEXT_NODE_TYPE_WEB.svg +1 -0
- package/resources/image/bilibili/bilibili-dark.png +0 -0
- package/resources/image/bilibili/bilibili-light.png +0 -0
- package/resources/image/bilibili/bilibili.png +0 -0
- package/resources/image/bilibili/id-dark.svg +1 -0
- package/resources/image/bilibili/id-light.svg +1 -0
- package/resources/image/bilibili/level/lv0.svg +1 -0
- package/resources/image/bilibili/level/lv1.svg +1 -0
- package/resources/image/bilibili/level/lv2.svg +1 -0
- package/resources/image/bilibili/level/lv3.svg +1 -0
- package/resources/image/bilibili/level/lv4.svg +1 -0
- package/resources/image/bilibili/level/lv5.svg +1 -0
- package/resources/image/bilibili/level/lv6.svg +1 -0
- package/resources/image/bilibili/level/lv7.svg +1 -0
- package/resources/image/bilibili/like-dark.svg +6 -0
- package/resources/image/bilibili/like-light.svg +6 -0
- package/resources/image/bilibili/play.svg +28 -0
- package/resources/image/bilibili/res-local1.png +0 -0
- package/resources/image/bilibili/up_pb.svg +1 -0
- package/resources/image/bilibili//347/233/264/346/222/255/344/270/255.png +0 -0
- package/resources/image/douyin/douyin.png +0 -0
- package/resources/image/douyin/dylogo-dark.svg +23 -0
- package/resources/image/douyin/dylogo-light.svg +38 -0
- package/resources/image/douyin/search-dark.svg +1 -0
- package/resources/image/douyin/search-light.svg +3 -0
- package/resources/image/douyin//346/212/226/351/237/263-/347/233/264/346/222/255/344/270/255.png +0 -0
- package/resources/image/frame-logo.png +0 -0
- package/resources/image/kuaishou/logo.png +0 -0
- package/resources/image/other/handlerError/Milky.png +0 -0
- package/resources/image/other/handlerError/chronocat.svg +43 -0
- package/resources/image/other/handlerError/conwechat.webp +0 -0
- package/resources/image/other/handlerError/gocq-http.webp +0 -0
- package/resources/image/other/handlerError/lagrange.webp +0 -0
- package/resources/image/other/handlerError/llonebot.webp +0 -0
- package/resources/image/other/handlerError/napcat.webp +0 -0
- package/resources/image/other/handlerError/onebot.png +0 -0
- package/resources/image/other/handlerError/satori.png +0 -0
- package/resources/image/xiaohongshu/logo.png +0 -0
- package/resources/template/style.css +23708 -0
- package/resources/vite.svg +130 -0
- package/scripts/build.mjs +129 -0
- package/scripts/check-schema.cjs +55 -0
- package/scripts/deploy.mjs +78 -0
- package/scripts/make-demo-placeholders.mjs +112 -0
- package/scripts/patch-deps.mjs +46 -0
- package/scripts/patch-webui.mjs +112 -0
- package/scripts/smoke-commands.cjs +39 -0
- package/scripts/smoke-config.cjs +122 -0
- package/scripts/smoke-douyin.cjs +170 -0
- package/scripts/smoke-koishi-commands.cjs +210 -0
- package/scripts/smoke-login.cjs +110 -0
- package/scripts/smoke-parse.cjs +54 -0
- package/scripts/smoke-push-mock.cjs +114 -0
- package/scripts/smoke-push.cjs +104 -0
- package/scripts/smoke-qq.cjs +147 -0
- package/scripts/smoke-qqcard.cjs +108 -0
- package/scripts/smoke-qqpanel.cjs +205 -0
- package/scripts/smoke-render.cjs +106 -0
- package/scripts/smoke-server.cjs +94 -0
- package/src/compat/axios.ts +5 -0
- package/src/compat/cron.ts +86 -0
- package/src/compat/esm.ts +13 -0
- package/src/compat/express.ts +5 -0
- package/src/compat/heroui.tsx +53 -0
- package/src/compat/lodash.ts +32 -0
- package/src/compat/logger.ts +121 -0
- package/src/compat/node-karin.ts +1064 -0
- package/src/compat/phosphor-icons.tsx +25 -0
- package/src/compat/qqcard.ts +251 -0
- package/src/compat/root.ts +44 -0
- package/src/compat/runtime.ts +120 -0
- package/src/compat/segment.ts +161 -0
- package/src/compat/sqlite3.ts +123 -0
- package/src/compat/start.ts +3 -0
- package/src/compat/syncConfig.ts +64 -0
- package/src/compat/template-react.ts +54 -0
- package/src/compat/text.ts +58 -0
- package/src/compat/yaml.ts +6 -0
- package/src/configBridge.ts +94 -0
- package/src/index.ts +769 -0
- package/src/karin/app.ts +1 -0
- package/src/karin/apps/__ready.ts +14 -0
- package/src/karin/apps/admin.ts +127 -0
- package/src/karin/apps/help.ts +228 -0
- package/src/karin/apps/push.ts +327 -0
- package/src/karin/apps/qrlogin.ts +160 -0
- package/src/karin/apps/statistics.ts +203 -0
- package/src/karin/apps/testPush.ts +226 -0
- package/src/karin/apps/tools.ts +510 -0
- package/src/karin/apps/update.ts +239 -0
- package/src/karin/index.ts +9 -0
- package/src/karin/module/db/bilibili.ts +1089 -0
- package/src/karin/module/db/douyin.ts +1218 -0
- package/src/karin/module/db/index.ts +159 -0
- package/src/karin/module/db/migration.ts +249 -0
- package/src/karin/module/db/statistics.ts +817 -0
- package/src/karin/module/index.ts +37 -0
- package/src/karin/module/server/constants/routes.ts +53 -0
- package/src/karin/module/server/controllers/bots.ts +289 -0
- package/src/karin/module/server/controllers/config.ts +85 -0
- package/src/karin/module/server/controllers/video.ts +212 -0
- package/src/karin/module/server/index.ts +11 -0
- package/src/karin/module/server/middlewares/auth.ts +147 -0
- package/src/karin/module/server/routes/amagi.ts +57 -0
- package/src/karin/module/server/routes/api.ts +42 -0
- package/src/karin/module/server/routes/index.ts +68 -0
- package/src/karin/module/server/routes/ssr.ts +14 -0
- package/src/karin/module/server/routes/static.ts +43 -0
- package/src/karin/module/utils/Base.ts +497 -0
- package/src/karin/module/utils/CardParser.ts +503 -0
- package/src/karin/module/utils/Common.ts +448 -0
- package/src/karin/module/utils/Config.ts +443 -0
- package/src/karin/module/utils/EmojiReaction.ts +268 -0
- package/src/karin/module/utils/ErrorHandler/handler.ts +124 -0
- package/src/karin/module/utils/ErrorHandler/index.ts +48 -0
- package/src/karin/module/utils/ErrorHandler/render.ts +180 -0
- package/src/karin/module/utils/ErrorHandler/sender.ts +192 -0
- package/src/karin/module/utils/ErrorHandler/strategy.ts +41 -0
- package/src/karin/module/utils/ErrorHandler/types.ts +122 -0
- package/src/karin/module/utils/ErrorHandler/utils.ts +108 -0
- package/src/karin/module/utils/FFmpeg.ts +357 -0
- package/src/karin/module/utils/ImageHelper.ts +90 -0
- package/src/karin/module/utils/ImageSlice.ts +383 -0
- package/src/karin/module/utils/MotionPhoto.ts +297 -0
- package/src/karin/module/utils/Network/Downloader.ts +481 -0
- package/src/karin/module/utils/Network/ImageDownloader.ts +291 -0
- package/src/karin/module/utils/Network/Network.ts +344 -0
- package/src/karin/module/utils/Network/ThrottleStream.ts +76 -0
- package/src/karin/module/utils/Network/constants.ts +135 -0
- package/src/karin/module/utils/Network/helpers.ts +183 -0
- package/src/karin/module/utils/Network/index.ts +28 -0
- package/src/karin/module/utils/Network/types.ts +46 -0
- package/src/karin/module/utils/Networks.ts +20 -0
- package/src/karin/module/utils/ParseLock.ts +33 -0
- package/src/karin/module/utils/ParseOverride.ts +128 -0
- package/src/karin/module/utils/QqCardResolve.ts +116 -0
- package/src/karin/module/utils/QqPanel.ts +880 -0
- package/src/karin/module/utils/Render/coverTheme.ts +294 -0
- package/src/karin/module/utils/Render/index.ts +574 -0
- package/src/karin/module/utils/amagiClient.ts +368 -0
- package/src/karin/module/utils/avatar.ts +220 -0
- package/src/karin/module/utils/bot.ts +115 -0
- package/src/karin/module/utils/build-metadata.ts +60 -0
- package/src/karin/module/utils/changelog.ts +175 -0
- package/src/karin/module/utils/index.ts +10 -0
- package/src/karin/module/utils/loginSession.ts +291 -0
- package/src/karin/module/utils/parseTip.ts +59 -0
- package/src/karin/module/utils/runtime-report.ts +142 -0
- package/src/karin/module/utils/semver.ts +60 -0
- package/src/karin/module/utils/statisticsAggregate.ts +507 -0
- package/src/karin/platform/bilibili/bilibili.ts +2004 -0
- package/src/karin/platform/bilibili/comments.ts +397 -0
- package/src/karin/platform/bilibili/danmaku.ts +653 -0
- package/src/karin/platform/bilibili/dynamic-text.ts +926 -0
- package/src/karin/platform/bilibili/genParams.ts +30 -0
- package/src/karin/platform/bilibili/getID.ts +163 -0
- package/src/karin/platform/bilibili/index.ts +8 -0
- package/src/karin/platform/bilibili/live-status.ts +36 -0
- package/src/karin/platform/bilibili/login.ts +130 -0
- package/src/karin/platform/bilibili/push.ts +1615 -0
- package/src/karin/platform/bilibili/riskControl.ts +114 -0
- package/src/karin/platform/bilibili/search.ts +305 -0
- package/src/karin/platform/common/danmaku-types.ts +18 -0
- package/src/karin/platform/douyin/comments.ts +404 -0
- package/src/karin/platform/douyin/danmaku.ts +1187 -0
- package/src/karin/platform/douyin/douyin.ts +1244 -0
- package/src/karin/platform/douyin/getID.ts +101 -0
- package/src/karin/platform/douyin/index.ts +8 -0
- package/src/karin/platform/douyin/login.ts +251 -0
- package/src/karin/platform/douyin/push/favorite.ts +97 -0
- package/src/karin/platform/douyin/push/index.ts +5 -0
- package/src/karin/platform/douyin/push/live.ts +86 -0
- package/src/karin/platform/douyin/push/post.ts +75 -0
- package/src/karin/platform/douyin/push/recommend.ts +96 -0
- package/src/karin/platform/douyin/push/render.ts +768 -0
- package/src/karin/platform/douyin/push/types.ts +41 -0
- package/src/karin/platform/douyin/push.ts +1241 -0
- package/src/karin/platform/douyin/types.ts +151 -0
- package/src/karin/platform/douyin/videoQuality.ts +234 -0
- package/src/karin/platform/douyin/workType.ts +238 -0
- package/src/karin/platform/index.ts +4 -0
- package/src/karin/platform/kuaishou/comments.ts +114 -0
- package/src/karin/platform/kuaishou/getID.ts +48 -0
- package/src/karin/platform/kuaishou/getdata.ts +78 -0
- package/src/karin/platform/kuaishou/index.ts +4 -0
- package/src/karin/platform/kuaishou/kuaishou.ts +130 -0
- package/src/karin/platform/xiaohongshu/comments.ts +227 -0
- package/src/karin/platform/xiaohongshu/getID.ts +127 -0
- package/src/karin/platform/xiaohongshu/index.ts +2 -0
- package/src/karin/platform/xiaohongshu/xiaohongshu.ts +733 -0
- package/src/karin/root.ts +78 -0
- package/src/karin/setup.ts +77 -0
- package/src/karin/types/config/amagi.ts +46 -0
- package/src/karin/types/config/app.ts +129 -0
- package/src/karin/types/config/bilibili.ts +121 -0
- package/src/karin/types/config/cookies.ts +11 -0
- package/src/karin/types/config/douyin.ts +93 -0
- package/src/karin/types/config/index.ts +41 -0
- package/src/karin/types/config/kuaishou.ts +10 -0
- package/src/karin/types/config/pushlist.ts +55 -0
- package/src/karin/types/config/request.ts +27 -0
- package/src/karin/types/config/upload.ts +49 -0
- package/src/karin/types/config/xiaohongshu.ts +24 -0
- package/src/karin/types/datatypes.ts +42 -0
- package/src/karin/types/index.ts +4 -0
- package/src/karin/types/netrorks/NetworksConfigType.ts +61 -0
- package/src/karin/types/netrorks/index.ts +1 -0
- package/src/karin/web.config.ts +48 -0
- package/src/ktr/registry.ts +55 -0
- package/src/ktr/template/_preview/components/PreviewInfoCard.tsx +33 -0
- package/src/ktr/template/_preview/components/PreviewLayout.tsx +65 -0
- package/src/ktr/template/_preview/components/PreviewVideoCard.tsx +22 -0
- package/src/ktr/template/_preview/render.ts +158 -0
- package/src/ktr/template/_preview/types.ts +15 -0
- package/src/ktr/template/_preview/utils/status.ts +29 -0
- package/src/ktr/template/_preview/utils/time.ts +8 -0
- package/src/ktr/template/bilibili/bangumi/components/bangumi.tsx +462 -0
- package/src/ktr/template/bilibili/bangumi/components/types.ts +36 -0
- package/src/ktr/template/bilibili/bangumi/index.tsx +9 -0
- package/src/ktr/template/bilibili/comment/components/Comment.tsx +657 -0
- package/src/ktr/template/bilibili/comment/components/types.ts +26 -0
- package/src/ktr/template/bilibili/comment/index.tsx +11 -0
- package/src/ktr/template/bilibili/components/Icons.tsx +209 -0
- package/src/ktr/template/bilibili/components/shared.tsx +162 -0
- package/src/ktr/template/bilibili/components/types.ts +388 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_ARTICLE/components/DYNAMIC_TYPE_ARTICLE.tsx +251 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_ARTICLE/components/types.ts +67 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_ARTICLE/index.tsx +12 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_AV/components/DYNAMIC_TYPE_AV.tsx +238 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_AV/components/types.ts +39 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_AV/index.tsx +12 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_DRAW/components/DYNAMIC_TYPE_DRAW.tsx +205 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_DRAW/components/types.ts +20 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_DRAW/index.tsx +11 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_FORWARD/components/DYNAMIC_TYPE_FORWARD.tsx +348 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_FORWARD/components/types.ts +16 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_FORWARD/index.tsx +12 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_LIVE_RCMD/components/DYNAMIC_TYPE_LIVE_RCMD.tsx +264 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_LIVE_RCMD/components/types.ts +32 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_LIVE_RCMD/index.tsx +12 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_WORD/components/DYNAMIC_TYPE_WORD.tsx +68 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_WORD/components/types.ts +14 -0
- package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_WORD/index.tsx +12 -0
- package/src/ktr/template/bilibili/dynamic/components/AdditionalCard.tsx +165 -0
- package/src/ktr/template/bilibili/dynamic/components/CommonComponents.tsx +142 -0
- package/src/ktr/template/bilibili/dynamic/types.ts +382 -0
- package/src/ktr/template/bilibili/qrcodeImg/components/qrcodeImg.tsx +179 -0
- package/src/ktr/template/bilibili/qrcodeImg/components/types.ts +9 -0
- package/src/ktr/template/bilibili/qrcodeImg/index.tsx +12 -0
- package/src/ktr/template/bilibili/userlist/components/UserList.tsx +246 -0
- package/src/ktr/template/bilibili/userlist/components/types.ts +35 -0
- package/src/ktr/template/bilibili/userlist/index.tsx +11 -0
- package/src/ktr/template/bilibili/videoInfo/components/types.ts +28 -0
- package/src/ktr/template/bilibili/videoInfo/components/videoInfo.tsx +217 -0
- package/src/ktr/template/bilibili/videoInfo/index.tsx +12 -0
- package/src/ktr/template/components/AmbientCover.tsx +50 -0
- package/src/ktr/template/components/DefaultLayout.tsx +166 -0
- package/src/ktr/template/components/GlowImage.tsx +572 -0
- package/src/ktr/template/components/QRCodeWithAvatar.tsx +52 -0
- package/src/ktr/template/components/RolldownLogo.tsx +110 -0
- package/src/ktr/template/components/ViteLogo.tsx +134 -0
- package/src/ktr/template/components/iconRegistry.ts +294 -0
- package/src/ktr/template/douyin/article-work/components/ArticleWork.tsx +301 -0
- package/src/ktr/template/douyin/article-work/components/types.ts +53 -0
- package/src/ktr/template/douyin/article-work/index.tsx +12 -0
- package/src/ktr/template/douyin/comment/components/Comment.tsx +612 -0
- package/src/ktr/template/douyin/comment/components/types.ts +85 -0
- package/src/ktr/template/douyin/comment/index.tsx +11 -0
- package/src/ktr/template/douyin/components/Icons.tsx +75 -0
- package/src/ktr/template/douyin/components/types.ts +83 -0
- package/src/ktr/template/douyin/dynamic/components/Dynamic.tsx +283 -0
- package/src/ktr/template/douyin/dynamic/components/types.ts +46 -0
- package/src/ktr/template/douyin/dynamic/index.tsx +11 -0
- package/src/ktr/template/douyin/favorite-list/components/FavoriteList.tsx +201 -0
- package/src/ktr/template/douyin/favorite-list/components/types.ts +38 -0
- package/src/ktr/template/douyin/favorite-list/index.tsx +12 -0
- package/src/ktr/template/douyin/image-work/components/ImageWork.tsx +437 -0
- package/src/ktr/template/douyin/image-work/components/types.ts +78 -0
- package/src/ktr/template/douyin/image-work/index.tsx +11 -0
- package/src/ktr/template/douyin/live/components/Live.tsx +229 -0
- package/src/ktr/template/douyin/live/components/types.ts +47 -0
- package/src/ktr/template/douyin/live/index.tsx +11 -0
- package/src/ktr/template/douyin/musicinfo/components/MusicInfo.tsx +187 -0
- package/src/ktr/template/douyin/musicinfo/components/types.ts +31 -0
- package/src/ktr/template/douyin/musicinfo/index.tsx +11 -0
- package/src/ktr/template/douyin/qrcodeImg/components/qrcodeImg.tsx +170 -0
- package/src/ktr/template/douyin/qrcodeImg/components/types.ts +9 -0
- package/src/ktr/template/douyin/qrcodeImg/index.tsx +9 -0
- package/src/ktr/template/douyin/recommend-list/components/RecommendList.tsx +201 -0
- package/src/ktr/template/douyin/recommend-list/components/types.ts +37 -0
- package/src/ktr/template/douyin/recommend-list/index.tsx +12 -0
- package/src/ktr/template/douyin/user_profile/components/UserVideoList.tsx +225 -0
- package/src/ktr/template/douyin/user_profile/components/types.ts +71 -0
- package/src/ktr/template/douyin/user_profile/index.tsx +9 -0
- package/src/ktr/template/douyin/userlist/components/UserList.tsx +229 -0
- package/src/ktr/template/douyin/userlist/components/types.ts +35 -0
- package/src/ktr/template/douyin/userlist/index.tsx +11 -0
- package/src/ktr/template/douyin/video-work/components/VideoWork.tsx +398 -0
- package/src/ktr/template/douyin/video-work/components/types.ts +80 -0
- package/src/ktr/template/douyin/video-work/index.tsx +11 -0
- package/src/ktr/template/font.css +6071 -0
- package/src/ktr/template/global.d.ts +69 -0
- package/src/ktr/template/kuaishou/comment/components/Comment.tsx +207 -0
- package/src/ktr/template/kuaishou/comment/components/types.ts +47 -0
- package/src/ktr/template/kuaishou/comment/index.tsx +11 -0
- package/src/ktr/template/other/changelog/components/changelog.tsx +411 -0
- package/src/ktr/template/other/changelog/components/types.ts +21 -0
- package/src/ktr/template/other/changelog/index.tsx +9 -0
- package/src/ktr/template/other/handlerError/components/errorTitles.ts +224 -0
- package/src/ktr/template/other/handlerError/components/handlerError.tsx +1076 -0
- package/src/ktr/template/other/handlerError/components/stackHighlight.ts +127 -0
- package/src/ktr/template/other/handlerError/components/types.ts +124 -0
- package/src/ktr/template/other/handlerError/index.tsx +9 -0
- package/src/ktr/template/other/help/components/Help.tsx +249 -0
- package/src/ktr/template/other/help/components/types.ts +47 -0
- package/src/ktr/template/other/help/index.tsx +9 -0
- package/src/ktr/template/other/live-photo-tip/components/LivePhotoTip.tsx +295 -0
- package/src/ktr/template/other/live-photo-tip/components/types.ts +8 -0
- package/src/ktr/template/other/live-photo-tip/index.tsx +9 -0
- package/src/ktr/template/other/qrlogin/components/qrlogin.tsx +295 -0
- package/src/ktr/template/other/qrlogin/components/types.ts +11 -0
- package/src/ktr/template/other/qrlogin/index.tsx +9 -0
- package/src/ktr/template/other/runtime/components/runtime.tsx +347 -0
- package/src/ktr/template/other/runtime/components/types.ts +75 -0
- package/src/ktr/template/other/runtime/index.tsx +9 -0
- package/src/ktr/template/other/version_warning/components/VersionWarning.tsx +392 -0
- package/src/ktr/template/other/version_warning/components/types.ts +8 -0
- package/src/ktr/template/other/version_warning/index.tsx +9 -0
- package/src/ktr/template/statistics/components/BoxplotGuide.tsx +57 -0
- package/src/ktr/template/statistics/components/ChartCard.tsx +40 -0
- package/src/ktr/template/statistics/components/KpiCard.tsx +39 -0
- package/src/ktr/template/statistics/components/PlatformTable.tsx +83 -0
- package/src/ktr/template/statistics/components/RankList.tsx +127 -0
- package/src/ktr/template/statistics/components/SSRChart.tsx +41 -0
- package/src/ktr/template/statistics/components/chartPresets.ts +700 -0
- package/src/ktr/template/statistics/components/chartTheme.ts +234 -0
- package/src/ktr/template/statistics/components/format.ts +33 -0
- package/src/ktr/template/statistics/components/types.ts +92 -0
- package/src/ktr/template/statistics/global/components/GlobalStatistics.tsx +597 -0
- package/src/ktr/template/statistics/global/components/types.ts +138 -0
- package/src/ktr/template/statistics/global/index.tsx +9 -0
- package/src/ktr/template/statistics/group/components/GroupStatistics.tsx +468 -0
- package/src/ktr/template/statistics/group/components/types.ts +113 -0
- package/src/ktr/template/statistics/group/index.tsx +9 -0
- package/src/ktr/template/style.css +65 -0
- package/src/ktr/template/types/ctx.ts +42 -0
- package/src/ktr/template/xiaohongshu/comment/components/Comment.tsx +264 -0
- package/src/ktr/template/xiaohongshu/comment/components/types.ts +119 -0
- package/src/ktr/template/xiaohongshu/comment/index.tsx +9 -0
- package/src/ktr/template/xiaohongshu/noteInfo/components/noteInfo.tsx +271 -0
- package/src/ktr/template/xiaohongshu/noteInfo/components/types.ts +66 -0
- package/src/ktr/template/xiaohongshu/noteInfo/index.tsx +9 -0
- package/src/ktr/utils/QRCodeAvatar.ts +102 -0
- package/src/ktr/utils/QRcode.ts +65 -0
- package/src/ktr/utils/avatarProxy.ts +42 -0
- package/src/ktr/utils/cn.ts +6 -0
- package/src/ktr/utils/theme.ts +10 -0
- package/src/qqFields.json +75 -0
- package/src/qqOptions.ts +64 -0
- package/src/richtext/index.ts +9 -0
- package/src/richtext/parse/index.ts +271 -0
- package/src/richtext/react/cn.ts +6 -0
- package/src/richtext/react/index.tsx +582 -0
- package/src/richtext/types.ts +320 -0
- package/src/schema.ts +372 -0
- package/src/webui.ts +352 -0
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Root = void 0;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const resolvePluginRoot = (startUrl) => {
|
|
10
|
+
let dir = node_path_1.default.dirname(startUrl);
|
|
11
|
+
for (let i = 0; i < 8; i++) {
|
|
12
|
+
const pkgPath = node_path_1.default.join(dir, 'package.json');
|
|
13
|
+
if (node_fs_1.default.existsSync(pkgPath)) {
|
|
14
|
+
return dir;
|
|
15
|
+
}
|
|
16
|
+
const parent = node_path_1.default.dirname(dir);
|
|
17
|
+
if (parent === dir)
|
|
18
|
+
break;
|
|
19
|
+
dir = parent;
|
|
20
|
+
}
|
|
21
|
+
return node_path_1.default.resolve(startUrl, '../..');
|
|
22
|
+
};
|
|
23
|
+
// Koishi 移植:编译为 CJS 后没有 import.meta,改用 __filename
|
|
24
|
+
const pluginPath = resolvePluginRoot(__filename);
|
|
25
|
+
const pkg = JSON.parse(node_fs_1.default.readFileSync(node_path_1.default.join(pluginPath, 'package.json'), 'utf-8'));
|
|
26
|
+
/**
|
|
27
|
+
* 框架版本号。
|
|
28
|
+
*
|
|
29
|
+
* 上游 karin 用 `process.env.KARIN_VERSION`;Koishi 移植版里这个环境变量通常不存在,
|
|
30
|
+
* 于是各处(错误卡片、运行环境诊断海报)都会显示成字面量 `koishi-compat`,
|
|
31
|
+
* 卡片页脚看上去就是「vkoishi-compat」这种没意义的版本号。
|
|
32
|
+
* 这里改成报**真实运行框架的版本**:优先环境变量,其次 Koishi 自己的版本号。
|
|
33
|
+
*/
|
|
34
|
+
const resolveFrameworkVersion = () => {
|
|
35
|
+
if (process.env.KARIN_VERSION)
|
|
36
|
+
return process.env.KARIN_VERSION;
|
|
37
|
+
const candidates = ['koishi/package.json', '@koishijs/core/package.json'];
|
|
38
|
+
for (const id of candidates) {
|
|
39
|
+
try {
|
|
40
|
+
// 编译产物是 CJS,这里的 require 能直接从插件的 node_modules 解析到宿主 koishi
|
|
41
|
+
const loaded = require(id);
|
|
42
|
+
const version = String(loaded?.version ?? '');
|
|
43
|
+
if (version)
|
|
44
|
+
return version;
|
|
45
|
+
}
|
|
46
|
+
catch { /* 换下一个候选 */ }
|
|
47
|
+
}
|
|
48
|
+
// 兜底:从插件目录往上找宿主的 node_modules/koishi/package.json
|
|
49
|
+
try {
|
|
50
|
+
let dir = pluginPath;
|
|
51
|
+
for (let i = 0; i < 8; i++) {
|
|
52
|
+
const candidate = node_path_1.default.join(dir, 'node_modules', 'koishi', 'package.json');
|
|
53
|
+
if (node_fs_1.default.existsSync(candidate)) {
|
|
54
|
+
const version = String(JSON.parse(node_fs_1.default.readFileSync(candidate, 'utf-8'))?.version ?? '');
|
|
55
|
+
if (version)
|
|
56
|
+
return version;
|
|
57
|
+
}
|
|
58
|
+
const parent = node_path_1.default.dirname(dir);
|
|
59
|
+
if (parent === dir)
|
|
60
|
+
break;
|
|
61
|
+
dir = parent;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
catch { /* 忽略 */ }
|
|
65
|
+
return 'koishi-compat';
|
|
66
|
+
};
|
|
67
|
+
exports.Root = {
|
|
68
|
+
pluginName: pkg.name,
|
|
69
|
+
pluginVersion: pkg.version,
|
|
70
|
+
pluginPath,
|
|
71
|
+
karinVersion: resolveFrameworkVersion(),
|
|
72
|
+
pkg
|
|
73
|
+
};
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
require(".//module/server");
|
|
37
|
+
require(".//platform/bilibili/riskControl");
|
|
38
|
+
const node_karin_1 = __importStar(require("../compat/node-karin.js"));
|
|
39
|
+
const root_1 = require("../compat/root.js");
|
|
40
|
+
const module_1 = require(".//module");
|
|
41
|
+
const db_1 = require(".//module/db");
|
|
42
|
+
const semver_1 = require("./module/utils/semver");
|
|
43
|
+
// ----------------- VERSION CHECK -----------------
|
|
44
|
+
const requireVersion = typeof __REQUIRE_KARIN_VERSION__ !== 'undefined' ? __REQUIRE_KARIN_VERSION__ : '1.1145.14';
|
|
45
|
+
// const requireVersion = '1.14514.1'
|
|
46
|
+
if (process.env.NODE_ENV !== 'development' && (0, semver_1.isSemverGreater)(requireVersion, module_1.Root.karinVersion)) {
|
|
47
|
+
const msg = `[koishi-plugin-kkk] 插件构建时的 karin 版本 (${requireVersion}) 高于当前运行版本 (${module_1.Root.karinVersion}),可能会出现兼容性问题!`;
|
|
48
|
+
node_karin_1.logger.warn(msg);
|
|
49
|
+
/** 已发送通知的 Bot ID 和主人 ID 组合,格式:`${botId}:${master}` */
|
|
50
|
+
const notifiedSet = new Set();
|
|
51
|
+
node_karin_1.default.on(node_karin_1.BOT_CONNECT, async (bot) => {
|
|
52
|
+
const botId = bot.selfId;
|
|
53
|
+
// 跳过 console Bot
|
|
54
|
+
if (botId === 'console')
|
|
55
|
+
return;
|
|
56
|
+
// 增加延迟,确保 bot 完全初始化
|
|
57
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
58
|
+
const masters = node_karin_1.config.master();
|
|
59
|
+
node_karin_1.logger.info(`[koishi-plugin-kkk] 监测到 Bot 连接: ${botId}, 准备发送版本警告`);
|
|
60
|
+
// 生成警告图片
|
|
61
|
+
let warningImage = null;
|
|
62
|
+
for (const master of masters) {
|
|
63
|
+
if (master === 'console')
|
|
64
|
+
continue;
|
|
65
|
+
try {
|
|
66
|
+
warningImage = await (0, module_1.Render)({ bot: node_karin_1.default.getBot(botId) }, 'other/version_warning', {
|
|
67
|
+
requireVersion,
|
|
68
|
+
currentVersion: module_1.Root.karinVersion
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
catch (error) {
|
|
72
|
+
node_karin_1.logger.error(`[koishi-plugin-kkk] 生成版本警告图片失败: ${error}`);
|
|
73
|
+
}
|
|
74
|
+
const key = `${botId}:${master}`;
|
|
75
|
+
if (notifiedSet.has(key))
|
|
76
|
+
continue;
|
|
77
|
+
try {
|
|
78
|
+
const elements = [];
|
|
79
|
+
if (warningImage) {
|
|
80
|
+
elements.push(...warningImage);
|
|
81
|
+
}
|
|
82
|
+
await node_karin_1.default.sendMaster(botId, master, elements);
|
|
83
|
+
notifiedSet.add(key);
|
|
84
|
+
node_karin_1.logger.info(`[koishi-plugin-kkk] 已发送版本警告给主人: ${master} (via ${botId})`);
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
node_karin_1.logger.error(`[koishi-plugin-kkk] 发送版本警告给主人 (${master}) 失败: ${error}`);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
// ----------------- DATABASE INIT -----------------
|
|
93
|
+
await (0, db_1.initAllDatabases)().catch((err) => {
|
|
94
|
+
node_karin_1.logger.error(`[koishi-plugin-kkk] 数据库初始化失败: ${err.message}`);
|
|
95
|
+
});
|
|
96
|
+
// ------------------- MAIN INIT -------------------
|
|
97
|
+
(0, node_karin_1.mkdirSync)(`${root_1.karinPathBase}/${module_1.Root.pluginName}/data`);
|
|
98
|
+
(0, node_karin_1.mkdirSync)(module_1.Common.tempDri.images);
|
|
99
|
+
(0, node_karin_1.mkdirSync)(module_1.Common.tempDri.video);
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./config"), exports);
|
|
18
|
+
__exportStar(require("./netrorks"), exports);
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./NetworksConfigType"), exports);
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.webConfig = void 0;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const node_karin_1 = require("../compat/node-karin.js");
|
|
10
|
+
const module_1 = require(".//module");
|
|
11
|
+
const resolveRealPath = (value) => {
|
|
12
|
+
try {
|
|
13
|
+
return node_fs_1.default.realpathSync.native(value);
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return node_path_1.default.resolve(value);
|
|
17
|
+
}
|
|
18
|
+
};
|
|
19
|
+
const isLocalDevelopment = process.env.NODE_ENV === 'development' && resolveRealPath(module_1.Root.pluginPath) === resolveRealPath(process.cwd());
|
|
20
|
+
exports.webConfig = (0, node_karin_1.defineConfig)({
|
|
21
|
+
info: {
|
|
22
|
+
id: 'koishi-plugin-kkk',
|
|
23
|
+
name: 'kkk插件',
|
|
24
|
+
description: `Karin 的「抖音」「B站」视频解析/动态推送插件。v${module_1.Root.pluginVersion}`,
|
|
25
|
+
icon: {
|
|
26
|
+
name: 'radio_button_checked',
|
|
27
|
+
color: '#F31260'
|
|
28
|
+
},
|
|
29
|
+
version: module_1.Root.pluginVersion,
|
|
30
|
+
author: [
|
|
31
|
+
{
|
|
32
|
+
name: 'ikenxuan',
|
|
33
|
+
home: 'https://github.com/ikenxuan',
|
|
34
|
+
avatar: 'https://github.com/ikenxuan.png'
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'sj817',
|
|
38
|
+
home: 'https://github.com/sj817',
|
|
39
|
+
avatar: 'https://github.com/sj817.png'
|
|
40
|
+
}
|
|
41
|
+
]
|
|
42
|
+
},
|
|
43
|
+
page: {
|
|
44
|
+
url: isLocalDevelopment ? 'http://localhost:5176/kkk/assets/karin-config' : '/kkk/assets/karin-config',
|
|
45
|
+
title: 'kkk插件配置管理',
|
|
46
|
+
description: '使用 kkk 插件自带的配置管理页面'
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
exports.default = exports.webConfig;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.templateRegistry = void 0;
|
|
37
|
+
exports.loadTemplate = loadTemplate;
|
|
38
|
+
exports.templateRegistry = {
|
|
39
|
+
'bilibili/bangumi': () => Promise.resolve().then(() => __importStar(require('./template/bilibili/bangumi'))),
|
|
40
|
+
'bilibili/comment': () => Promise.resolve().then(() => __importStar(require('./template/bilibili/comment'))),
|
|
41
|
+
'bilibili/dynamic/DYNAMIC_TYPE_ARTICLE': () => Promise.resolve().then(() => __importStar(require('./template/bilibili/dynamic/DYNAMIC_TYPE_ARTICLE'))),
|
|
42
|
+
'bilibili/dynamic/DYNAMIC_TYPE_AV': () => Promise.resolve().then(() => __importStar(require('./template/bilibili/dynamic/DYNAMIC_TYPE_AV'))),
|
|
43
|
+
'bilibili/dynamic/DYNAMIC_TYPE_DRAW': () => Promise.resolve().then(() => __importStar(require('./template/bilibili/dynamic/DYNAMIC_TYPE_DRAW'))),
|
|
44
|
+
'bilibili/dynamic/DYNAMIC_TYPE_FORWARD': () => Promise.resolve().then(() => __importStar(require('./template/bilibili/dynamic/DYNAMIC_TYPE_FORWARD'))),
|
|
45
|
+
'bilibili/dynamic/DYNAMIC_TYPE_LIVE_RCMD': () => Promise.resolve().then(() => __importStar(require('./template/bilibili/dynamic/DYNAMIC_TYPE_LIVE_RCMD'))),
|
|
46
|
+
'bilibili/dynamic/DYNAMIC_TYPE_WORD': () => Promise.resolve().then(() => __importStar(require('./template/bilibili/dynamic/DYNAMIC_TYPE_WORD'))),
|
|
47
|
+
'bilibili/qrcodeImg': () => Promise.resolve().then(() => __importStar(require('./template/bilibili/qrcodeImg'))),
|
|
48
|
+
'bilibili/userlist': () => Promise.resolve().then(() => __importStar(require('./template/bilibili/userlist'))),
|
|
49
|
+
'bilibili/videoInfo': () => Promise.resolve().then(() => __importStar(require('./template/bilibili/videoInfo'))),
|
|
50
|
+
'douyin/article-work': () => Promise.resolve().then(() => __importStar(require('./template/douyin/article-work'))),
|
|
51
|
+
'douyin/comment': () => Promise.resolve().then(() => __importStar(require('./template/douyin/comment'))),
|
|
52
|
+
'douyin/dynamic': () => Promise.resolve().then(() => __importStar(require('./template/douyin/dynamic'))),
|
|
53
|
+
'douyin/favorite-list': () => Promise.resolve().then(() => __importStar(require('./template/douyin/favorite-list'))),
|
|
54
|
+
'douyin/image-work': () => Promise.resolve().then(() => __importStar(require('./template/douyin/image-work'))),
|
|
55
|
+
'douyin/live': () => Promise.resolve().then(() => __importStar(require('./template/douyin/live'))),
|
|
56
|
+
'douyin/musicinfo': () => Promise.resolve().then(() => __importStar(require('./template/douyin/musicinfo'))),
|
|
57
|
+
'douyin/qrcodeImg': () => Promise.resolve().then(() => __importStar(require('./template/douyin/qrcodeImg'))),
|
|
58
|
+
'douyin/recommend-list': () => Promise.resolve().then(() => __importStar(require('./template/douyin/recommend-list'))),
|
|
59
|
+
'douyin/userlist': () => Promise.resolve().then(() => __importStar(require('./template/douyin/userlist'))),
|
|
60
|
+
'douyin/user_profile': () => Promise.resolve().then(() => __importStar(require('./template/douyin/user_profile'))),
|
|
61
|
+
'douyin/video-work': () => Promise.resolve().then(() => __importStar(require('./template/douyin/video-work'))),
|
|
62
|
+
'kuaishou/comment': () => Promise.resolve().then(() => __importStar(require('./template/kuaishou/comment'))),
|
|
63
|
+
'other/changelog': () => Promise.resolve().then(() => __importStar(require('./template/other/changelog'))),
|
|
64
|
+
'other/handlerError': () => Promise.resolve().then(() => __importStar(require('./template/other/handlerError'))),
|
|
65
|
+
'other/help': () => Promise.resolve().then(() => __importStar(require('./template/other/help'))),
|
|
66
|
+
'other/live-photo-tip': () => Promise.resolve().then(() => __importStar(require('./template/other/live-photo-tip'))),
|
|
67
|
+
'other/qrlogin': () => Promise.resolve().then(() => __importStar(require('./template/other/qrlogin'))),
|
|
68
|
+
'other/runtime': () => Promise.resolve().then(() => __importStar(require('./template/other/runtime'))),
|
|
69
|
+
'other/version_warning': () => Promise.resolve().then(() => __importStar(require('./template/other/version_warning'))),
|
|
70
|
+
'statistics/global': () => Promise.resolve().then(() => __importStar(require('./template/statistics/global'))),
|
|
71
|
+
'statistics/group': () => Promise.resolve().then(() => __importStar(require('./template/statistics/group'))),
|
|
72
|
+
'xiaohongshu/comment': () => Promise.resolve().then(() => __importStar(require('./template/xiaohongshu/comment'))),
|
|
73
|
+
'xiaohongshu/noteInfo': () => Promise.resolve().then(() => __importStar(require('./template/xiaohongshu/noteInfo')))
|
|
74
|
+
};
|
|
75
|
+
/** 取某个路由的模板定义(不做缓存,模块本身有 require 缓存) */
|
|
76
|
+
async function loadTemplate(route) {
|
|
77
|
+
const loader = exports.templateRegistry[route];
|
|
78
|
+
if (!loader)
|
|
79
|
+
return undefined;
|
|
80
|
+
const mod = await loader();
|
|
81
|
+
return mod?.default ?? mod;
|
|
82
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PreviewInfoCard = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const status_1 = require("../utils/status");
|
|
6
|
+
const PreviewInfoCard = ({ state }) => {
|
|
7
|
+
const status = (0, status_1.buildStatus)(state);
|
|
8
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "relative z-10 mt-12 flex flex-col gap-4 sm:flex-row sm:items-end sm:justify-between", style: { mixBlendMode: 'difference', color: '#ffffff' }, children: [(0, jsx_runtime_1.jsxs)("div", { children: [(0, jsx_runtime_1.jsx)("div", { className: "text-xs uppercase tracking-[0.2em]", children: "\u5220\u9664\u5012\u8BA1\u65F6" }), (0, jsx_runtime_1.jsx)("div", { className: "mt-2 text-5xl font-semibold", id: "preview-countdown", children: status.countdownText })] }), (0, jsx_runtime_1.jsx)("a", { className: "inline-flex h-10 items-center justify-center rounded-full border border-white/50 px-4 text-sm font-medium text-white backdrop-blur", href: state.videoUrl, download: true, children: "\u4E0B\u8F7D\u89C6\u9891" })] }));
|
|
9
|
+
};
|
|
10
|
+
exports.PreviewInfoCard = PreviewInfoCard;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PreviewLayout = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const PreviewInfoCard_1 = require("./PreviewInfoCard");
|
|
6
|
+
const PreviewVideoCard_1 = require("./PreviewVideoCard");
|
|
7
|
+
const PreviewLayout = ({ state }) => {
|
|
8
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "relative min-h-screen bg-(--preview-bg) text-(--preview-fg)", children: [(0, jsx_runtime_1.jsxs)("div", { className: "absolute inset-0 overflow-hidden", children: [(0, jsx_runtime_1.jsx)("video", { className: "h-full w-full object-cover blur-3xl scale-110 saturate-150 contrast-125", autoPlay: true, loop: true, muted: true, playsInline: true, preload: "metadata", src: state.videoUrl }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 pointer-events-none opacity-[0.35] mix-blend-overlay dark:mix-blend-soft-light", children: (0, jsx_runtime_1.jsxs)("svg", { className: "h-full w-full", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsxs)("defs", { children: [(0, jsx_runtime_1.jsxs)("filter", { id: "previewNoise", children: [(0, jsx_runtime_1.jsx)("feTurbulence", { type: "fractalNoise", baseFrequency: "1.2", numOctaves: "3", stitchTiles: "stitch" }), (0, jsx_runtime_1.jsx)("feColorMatrix", { type: "saturate", values: "0" }), (0, jsx_runtime_1.jsxs)("feComponentTransfer", { children: [(0, jsx_runtime_1.jsx)("feFuncR", { type: "discrete", tableValues: "0 1" }), (0, jsx_runtime_1.jsx)("feFuncG", { type: "discrete", tableValues: "0 1" }), (0, jsx_runtime_1.jsx)("feFuncB", { type: "discrete", tableValues: "0 1" })] }), (0, jsx_runtime_1.jsx)("feComponentTransfer", { children: (0, jsx_runtime_1.jsx)("feFuncA", { type: "linear", slope: "2", intercept: "-0.5" }) })] }), (0, jsx_runtime_1.jsxs)("mask", { id: "previewNoiseMask", children: [(0, jsx_runtime_1.jsxs)("linearGradient", { id: "previewNoiseGradient", x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [(0, jsx_runtime_1.jsx)("stop", { offset: "0%", stopColor: "white", stopOpacity: "1" }), (0, jsx_runtime_1.jsx)("stop", { offset: "15%", stopColor: "white", stopOpacity: "0.6" }), (0, jsx_runtime_1.jsx)("stop", { offset: "50%", stopColor: "white", stopOpacity: "0.15" }), (0, jsx_runtime_1.jsx)("stop", { offset: "85%", stopColor: "white", stopOpacity: "0.6" }), (0, jsx_runtime_1.jsx)("stop", { offset: "100%", stopColor: "white", stopOpacity: "1" })] }), (0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", fill: "url(#previewNoiseGradient)" })] })] }), (0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", filter: "url(#previewNoise)", mask: "url(#previewNoiseMask)", fill: "white" })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 bg-black/35" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "relative z-10 w-full px-4 py-16 sm:px-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col gap-2", style: { mixBlendMode: 'difference', color: '#ffffff' }, children: [(0, jsx_runtime_1.jsx)("h1", { className: "text-2xl font-semibold", children: "\u4E34\u65F6\u9884\u89C8" }), (0, jsx_runtime_1.jsx)("p", { className: "text-sm", children: "\u67E5\u770B\u89C6\u9891\u5185\u5BB9\u4E0E\u5220\u9664\u65F6\u95F4" })] }), (0, jsx_runtime_1.jsx)(PreviewVideoCard_1.PreviewVideoCard, { videoUrl: state.videoUrl }), (0, jsx_runtime_1.jsx)(PreviewInfoCard_1.PreviewInfoCard, { state: state })] })] }));
|
|
9
|
+
};
|
|
10
|
+
exports.PreviewLayout = PreviewLayout;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PreviewVideoCard = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const PreviewVideoCard = ({ videoUrl }) => {
|
|
6
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "relative z-10 mt-10 w-full", children: (0, jsx_runtime_1.jsx)("video", { className: "w-full max-h-[86vh] rounded-2xl bg-black shadow-2xl", controls: true, preload: "metadata", autoPlay: true, loop: true, muted: true, playsInline: true, src: videoUrl }) }));
|
|
7
|
+
};
|
|
8
|
+
exports.PreviewVideoCard = PreviewVideoCard;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.renderVideoPreviewPage = void 0;
|
|
7
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
8
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
9
|
+
const template_react_1 = require("../../../compat/template-react.js");
|
|
10
|
+
const react_1 = __importDefault(require("react"));
|
|
11
|
+
const server_1 = require("react-dom/server");
|
|
12
|
+
const PreviewLayout_1 = require("./components/PreviewLayout");
|
|
13
|
+
/**
|
|
14
|
+
* 向上定位 koishi-plugin-kkk 包根目录。
|
|
15
|
+
* 生产环境当前模块在 lib/core_chunk 内,向上两级即包根;
|
|
16
|
+
* 开发环境本文件在 packages/template/src/_preview,回退到 monorepo 的 packages/core。
|
|
17
|
+
* @returns core 包根目录绝对路径。
|
|
18
|
+
*/
|
|
19
|
+
const findCoreRoot = () => {
|
|
20
|
+
// Koishi 移植:产物是 CJS,没有 import.meta;直接取 __dirname。
|
|
21
|
+
// 同时把包名判断放宽到移植后的包名(koishi-plugin-kkk),否则永远找不到包根。
|
|
22
|
+
const moduleDir = __dirname;
|
|
23
|
+
let dir = moduleDir;
|
|
24
|
+
for (let i = 0; i < 10; i++) {
|
|
25
|
+
const pkgPath = node_path_1.default.join(dir, 'package.json');
|
|
26
|
+
if (node_fs_1.default.existsSync(pkgPath)) {
|
|
27
|
+
try {
|
|
28
|
+
const name = JSON.parse(node_fs_1.default.readFileSync(pkgPath, 'utf-8')).name;
|
|
29
|
+
if (name === 'koishi-plugin-kkk' || name === 'koishi-plugin-kkk') {
|
|
30
|
+
return dir;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// package.json 解析失败时继续向上找
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
const parent = node_path_1.default.dirname(dir);
|
|
38
|
+
if (parent === dir)
|
|
39
|
+
break;
|
|
40
|
+
dir = parent;
|
|
41
|
+
}
|
|
42
|
+
return node_path_1.default.resolve(moduleDir, '..', '..', '..', 'core');
|
|
43
|
+
};
|
|
44
|
+
/** 读取并按需内联模板 CSS(相对 url 资源转 data URI)。 */
|
|
45
|
+
const loadInlineTemplateCss = () => {
|
|
46
|
+
const coreRoot = findCoreRoot();
|
|
47
|
+
const cssPath = (0, template_react_1.resolveTemplateStyle)({
|
|
48
|
+
cachePath: node_path_1.default.join(coreRoot, 'node_modules', '.cache', 'ktr', 'style.css'),
|
|
49
|
+
distDir: node_path_1.default.join(coreRoot, 'lib')
|
|
50
|
+
});
|
|
51
|
+
// HtmlWrapper 只借用它的 CSS 内联能力,不走完整外壳包装。
|
|
52
|
+
return new template_react_1.HtmlWrapper({ cssPath }).loadInlineCss(cssPath);
|
|
53
|
+
};
|
|
54
|
+
const escapeVideoPreviewJson = (data) => {
|
|
55
|
+
return JSON.stringify(data).replace(/</g, '\\u003c');
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* 渲染临时视频预览页 HTML(/kkk/ssr/video/* 使用)。
|
|
59
|
+
* 逻辑与旧引擎 main.ts 中的实现一致,仅 CSS 来源换成 ktr 构建的 style.css。
|
|
60
|
+
*/
|
|
61
|
+
const renderVideoPreviewPage = (options) => {
|
|
62
|
+
const serverNow = Date.now();
|
|
63
|
+
const remainingMs = options.removeCache && options.expireAt ? Math.max(options.expireAt - serverNow, 0) : null;
|
|
64
|
+
const state = {
|
|
65
|
+
...options,
|
|
66
|
+
eventsUrl: options.eventsUrl ?? '',
|
|
67
|
+
serverNow,
|
|
68
|
+
remainingMs,
|
|
69
|
+
removed: false
|
|
70
|
+
};
|
|
71
|
+
const appHtml = (0, server_1.renderToString)(react_1.default.createElement(PreviewLayout_1.PreviewLayout, { state }));
|
|
72
|
+
const serializedState = escapeVideoPreviewJson(state);
|
|
73
|
+
const cssContent = loadInlineTemplateCss();
|
|
74
|
+
return `<!DOCTYPE html>
|
|
75
|
+
<html lang="zh-CN">
|
|
76
|
+
<head>
|
|
77
|
+
<meta charset="UTF-8" />
|
|
78
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
79
|
+
<title>临时预览</title>
|
|
80
|
+
<style>
|
|
81
|
+
* { box-sizing: border-box; }
|
|
82
|
+
:root { --preview-bg: #ffffff; --preview-fg: #0f172a; --preview-muted: #64748b; }
|
|
83
|
+
@media (prefers-color-scheme: dark) {
|
|
84
|
+
:root { --preview-bg: #050505; --preview-fg: #e2e8f0; --preview-muted: #94a3b8; }
|
|
85
|
+
}
|
|
86
|
+
body { margin: 0; font-family: "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif; background: var(--preview-bg); color: var(--preview-fg); }
|
|
87
|
+
.preview-noise { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='160' height='160' filter='url(%23n)' opacity='0.25'/%3E%3C/svg%3E"); mix-blend-mode: soft-light; opacity: 0.8; }
|
|
88
|
+
@media (max-width: 720px) {
|
|
89
|
+
.max-w-6xl { padding-left: 16px; padding-right: 16px; }
|
|
90
|
+
}
|
|
91
|
+
</style>
|
|
92
|
+
<style>${cssContent}</style>
|
|
93
|
+
</head>
|
|
94
|
+
<body>
|
|
95
|
+
<div id="app">${appHtml}</div>
|
|
96
|
+
<script>
|
|
97
|
+
window.__VIDEO_PREVIEW__=${serializedState};
|
|
98
|
+
(() => {
|
|
99
|
+
const state = window.__VIDEO_PREVIEW__ || {};
|
|
100
|
+
const countdownEl = document.getElementById('preview-countdown');
|
|
101
|
+
if (!countdownEl) return;
|
|
102
|
+
const format = (ms) => {
|
|
103
|
+
const totalSeconds = Math.max(Math.floor(ms / 1000), 0);
|
|
104
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
105
|
+
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
106
|
+
const seconds = totalSeconds % 60;
|
|
107
|
+
const pad = (value) => String(value).padStart(2, '0');
|
|
108
|
+
return hours > 0 ? pad(hours) + ':' + pad(minutes) + ':' + pad(seconds) : pad(minutes) + ':' + pad(seconds);
|
|
109
|
+
};
|
|
110
|
+
const update = (payload) => {
|
|
111
|
+
if (!payload.removeCache) {
|
|
112
|
+
countdownEl.textContent = '不删除';
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
if (payload.removed) {
|
|
116
|
+
countdownEl.textContent = '00:00';
|
|
117
|
+
return;
|
|
118
|
+
}
|
|
119
|
+
const remainingMs = typeof payload.remainingMs === 'number'
|
|
120
|
+
? payload.remainingMs
|
|
121
|
+
: (payload.expireAt ? Math.max(payload.expireAt - (payload.serverNow || Date.now()), 0) : null);
|
|
122
|
+
if (remainingMs === null) {
|
|
123
|
+
countdownEl.textContent = '--:--';
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
countdownEl.textContent = format(remainingMs);
|
|
127
|
+
};
|
|
128
|
+
update(state);
|
|
129
|
+
if (state.eventsUrl) {
|
|
130
|
+
const source = new EventSource(state.eventsUrl);
|
|
131
|
+
source.onmessage = (event) => {
|
|
132
|
+
try {
|
|
133
|
+
update(JSON.parse(event.data));
|
|
134
|
+
} catch {}
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
})();
|
|
138
|
+
</script>
|
|
139
|
+
</body>
|
|
140
|
+
</html>`;
|
|
141
|
+
};
|
|
142
|
+
exports.renderVideoPreviewPage = renderVideoPreviewPage;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.buildStatus = void 0;
|
|
4
|
+
const time_1 = require("./time");
|
|
5
|
+
const buildStatus = (state) => {
|
|
6
|
+
const filePath = state.filePath || state.filename;
|
|
7
|
+
if (!state.removeCache) {
|
|
8
|
+
return {
|
|
9
|
+
statusText: `文件 ${filePath} 不会自动删除`,
|
|
10
|
+
countdownText: '不删除'
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
if (state.removed) {
|
|
14
|
+
return {
|
|
15
|
+
statusText: `文件 ${filePath} 已删除`,
|
|
16
|
+
countdownText: '00:00'
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
if (state.remainingMs === null) {
|
|
20
|
+
return {
|
|
21
|
+
statusText: `文件 ${filePath} 将在未知时间后删除`,
|
|
22
|
+
countdownText: '--:--'
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const countdownText = (0, time_1.formatDuration)(state.remainingMs);
|
|
26
|
+
return {
|
|
27
|
+
statusText: `文件 ${filePath} 将在 ${countdownText} 后删除`,
|
|
28
|
+
countdownText
|
|
29
|
+
};
|
|
30
|
+
};
|
|
31
|
+
exports.buildStatus = buildStatus;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.formatDuration = void 0;
|
|
4
|
+
const formatDuration = (ms) => {
|
|
5
|
+
const totalSeconds = Math.max(Math.floor(ms / 1000), 0);
|
|
6
|
+
const hours = Math.floor(totalSeconds / 3600);
|
|
7
|
+
const minutes = Math.floor((totalSeconds % 3600) / 60);
|
|
8
|
+
const seconds = totalSeconds % 60;
|
|
9
|
+
const pad = (value) => String(value).padStart(2, '0');
|
|
10
|
+
return hours > 0 ? `${pad(hours)}:${pad(minutes)}:${pad(seconds)}` : `${pad(minutes)}:${pad(seconds)}`;
|
|
11
|
+
};
|
|
12
|
+
exports.formatDuration = formatDuration;
|