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
package/src/ktr/template/bilibili/dynamic/DYNAMIC_TYPE_FORWARD/components/DYNAMIC_TYPE_FORWARD.tsx
ADDED
|
@@ -0,0 +1,348 @@
|
|
|
1
|
+
import { renderRichTextToReact } from '@kkk/richtext'
|
|
2
|
+
import { Clock } from 'lucide-react'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
import { isDark } from '../../../../../utils/theme'
|
|
6
|
+
import { DefaultLayout } from '../../../../components/DefaultLayout'
|
|
7
|
+
import type { PosterProps } from '../../../../types/ctx'
|
|
8
|
+
import { DecorationCard, EnhancedImage, UsernameDisplay } from '../../../components/shared'
|
|
9
|
+
import { BilibiliAdditionalCard } from '../../components/AdditionalCard'
|
|
10
|
+
import { BilibiliDynamicFooter, BilibiliDynamicStatus, BilibiliDynamicUserInfo } from '../../components/CommonComponents'
|
|
11
|
+
import type { DecorationCardData, OriginalContentAV, OriginalContentDraw, OriginalContentLiveRcmd, OriginalContentWord } from '../../types'
|
|
12
|
+
import type { BilibiliForwardDynamicData } from './types'
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* 原始内容用户信息组件
|
|
16
|
+
*/
|
|
17
|
+
const OriginalUserInfo: React.FC<{
|
|
18
|
+
avatar_url: string
|
|
19
|
+
frame?: string
|
|
20
|
+
usernameMeta: { name: string; vipStatus: number; nicknameColor: string | null }
|
|
21
|
+
create_time: string
|
|
22
|
+
decoration_card?: DecorationCardData
|
|
23
|
+
}> = (props) => {
|
|
24
|
+
return (
|
|
25
|
+
<div className="flex justify-between items-center pl-8 pr-0">
|
|
26
|
+
<div className="flex gap-10 items-center min-w-0">
|
|
27
|
+
<div className="relative shrink-0">
|
|
28
|
+
<EnhancedImage src={props.avatar_url} alt="转发用户头像" className="rounded-full shadow-medium w-30 h-30" />
|
|
29
|
+
{props.frame && <EnhancedImage src={props.frame} alt="转发用户头像框" className="absolute inset-0 transform scale-180" />}
|
|
30
|
+
</div>
|
|
31
|
+
<div className="flex flex-col gap-4 text-7xl">
|
|
32
|
+
<div className="text-5xl font-normal select-text text-foreground">
|
|
33
|
+
<UsernameDisplay metadata={props.usernameMeta} />
|
|
34
|
+
</div>
|
|
35
|
+
<div className="flex gap-2 items-center text-4xl font-normal whitespace-nowrap text-muted">
|
|
36
|
+
<Clock size={32} />
|
|
37
|
+
{props.create_time}
|
|
38
|
+
</div>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
{props.decoration_card && (
|
|
42
|
+
<div className="shrink-0">
|
|
43
|
+
<DecorationCard data={props.decoration_card} />
|
|
44
|
+
</div>
|
|
45
|
+
)}
|
|
46
|
+
</div>
|
|
47
|
+
)
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* AV类型原始内容组件
|
|
52
|
+
*/
|
|
53
|
+
const OriginalAVContent: React.FC<{ content: OriginalContentAV }> = ({ content }) => {
|
|
54
|
+
return (
|
|
55
|
+
<div className="px-12 py-8 mt-4 w-full rounded-8xl bg-surface-secondary">
|
|
56
|
+
<div className="h-10" />
|
|
57
|
+
|
|
58
|
+
<OriginalUserInfo
|
|
59
|
+
avatar_url={content.avatar_url}
|
|
60
|
+
frame={content.frame}
|
|
61
|
+
usernameMeta={content.usernameMeta}
|
|
62
|
+
create_time={content.create_time}
|
|
63
|
+
decoration_card={content.decoration_card}
|
|
64
|
+
/>
|
|
65
|
+
|
|
66
|
+
<div className="h-15" />
|
|
67
|
+
|
|
68
|
+
<div className="relative items-center text-5xl tracking-wider wrap-break-word text-muted leading-relaxed">
|
|
69
|
+
{content.text.nodes.length > 0 &&
|
|
70
|
+
renderRichTextToReact(content.text, {
|
|
71
|
+
at: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
72
|
+
topic: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
73
|
+
lottery: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
74
|
+
webLink: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
75
|
+
vote: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
76
|
+
viewPicture: { className: 'text-[#006A9E] dark:text-[#58B0D5]' }
|
|
77
|
+
})}
|
|
78
|
+
</div>
|
|
79
|
+
|
|
80
|
+
{content.text.nodes.length > 0 && <div className="h-5" />}
|
|
81
|
+
|
|
82
|
+
<div className="flex overflow-hidden relative flex-col items-center w-full rounded-5xl aspect-video">
|
|
83
|
+
<EnhancedImage src={content.cover} alt="视频封面" className="w-full h-full" />
|
|
84
|
+
<div className="absolute right-0 bottom-0 left-0 h-1/2 bg-linear-to-t to-transparent pointer-events-none from-black/75" />
|
|
85
|
+
<div className="absolute right-5 left-12 bottom-14 z-10 text-4xl font-light text-white select-text">
|
|
86
|
+
<span className="px-4 py-2 mr-3 text-4xl text-white rounded-2xl bg-black/50">{content.duration_text}</span>
|
|
87
|
+
{content.play}观看 {content.danmaku}弹幕
|
|
88
|
+
</div>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<div className="h-10" />
|
|
92
|
+
|
|
93
|
+
<div className="pl-2 text-6xl font-bold select-text leading-20 text-foreground">
|
|
94
|
+
{content.title &&
|
|
95
|
+
renderRichTextToReact(content.title, {
|
|
96
|
+
at: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
97
|
+
topic: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
98
|
+
lottery: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
99
|
+
webLink: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
100
|
+
vote: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
101
|
+
viewPicture: { className: 'text-[#006A9E] dark:text-[#58B0D5]' }
|
|
102
|
+
})}
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<div className="h-4" />
|
|
106
|
+
</div>
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* DRAW类型原始内容组件
|
|
112
|
+
*/
|
|
113
|
+
const OriginalDrawContent: React.FC<{ content: OriginalContentDraw }> = ({ content }) => {
|
|
114
|
+
return (
|
|
115
|
+
<div className="px-12 py-12 mt-4 w-full rounded-8xl bg-surface-secondary">
|
|
116
|
+
<OriginalUserInfo
|
|
117
|
+
avatar_url={content.avatar_url}
|
|
118
|
+
frame={content.frame}
|
|
119
|
+
usernameMeta={content.usernameMeta}
|
|
120
|
+
create_time={content.create_time}
|
|
121
|
+
decoration_card={content.decoration_card}
|
|
122
|
+
/>
|
|
123
|
+
|
|
124
|
+
<div className="h-15" />
|
|
125
|
+
|
|
126
|
+
<div className="text-5xl leading-relaxed text-foreground wrap-break-word">
|
|
127
|
+
{content.title && (
|
|
128
|
+
<span className="text-6xl font-bold">
|
|
129
|
+
{content.title}
|
|
130
|
+
<br />
|
|
131
|
+
<br />
|
|
132
|
+
</span>
|
|
133
|
+
)}
|
|
134
|
+
{content.text &&
|
|
135
|
+
renderRichTextToReact(content.text, {
|
|
136
|
+
at: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
137
|
+
topic: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
138
|
+
lottery: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
139
|
+
webLink: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
140
|
+
vote: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
141
|
+
viewPicture: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
142
|
+
iconScale: 0.8
|
|
143
|
+
})}
|
|
144
|
+
</div>
|
|
145
|
+
|
|
146
|
+
{content.image_url && content.image_url.length === 1 ? (
|
|
147
|
+
<div className="flex justify-center py-11 pb-0">
|
|
148
|
+
<div className="flex overflow-hidden flex-col items-center w-full rounded-4xl shadow-large">
|
|
149
|
+
<EnhancedImage src={content.image_url[0].image_src} alt="图片" className="object-cover w-full h-full rounded-6" />
|
|
150
|
+
</div>
|
|
151
|
+
</div>
|
|
152
|
+
) : (
|
|
153
|
+
<div className={`grid gap-3 ${content.image_url?.length === 4 ? 'grid-cols-2' : 'grid-cols-3'}`}>
|
|
154
|
+
{content.image_url?.map((img, index) => {
|
|
155
|
+
const total = content.image_url?.length || 0
|
|
156
|
+
const cols = total === 4 ? 2 : 3
|
|
157
|
+
const row = Math.floor(index / cols)
|
|
158
|
+
const col = index % cols
|
|
159
|
+
const lastRow = Math.floor((total - 1) / cols)
|
|
160
|
+
const firstRowLastCol = Math.min(cols, total) - 1
|
|
161
|
+
const lastRowLastCol = (total - 1) % cols
|
|
162
|
+
|
|
163
|
+
const cornerClasses = [
|
|
164
|
+
'overflow-hidden',
|
|
165
|
+
'relative',
|
|
166
|
+
'shadow-medium',
|
|
167
|
+
'aspect-square',
|
|
168
|
+
'rounded-2xl',
|
|
169
|
+
row === 0 && col === 0 ? 'rounded-tl-4xl' : '',
|
|
170
|
+
row === 0 && col === firstRowLastCol ? 'rounded-tr-4xl' : '',
|
|
171
|
+
row === lastRow && col === 0 ? 'rounded-bl-4xl' : '',
|
|
172
|
+
row === lastRow && col === lastRowLastCol ? 'rounded-br-4xl' : ''
|
|
173
|
+
]
|
|
174
|
+
.filter(Boolean)
|
|
175
|
+
.join(' ')
|
|
176
|
+
|
|
177
|
+
return (
|
|
178
|
+
<div key={index} className={cornerClasses}>
|
|
179
|
+
<EnhancedImage src={img.image_src} alt={`图片${index + 1}`} className="object-cover w-full h-full" />
|
|
180
|
+
</div>
|
|
181
|
+
)
|
|
182
|
+
})}
|
|
183
|
+
</div>
|
|
184
|
+
)}
|
|
185
|
+
</div>
|
|
186
|
+
)
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
/**
|
|
190
|
+
* WORD类型原始内容组件
|
|
191
|
+
*/
|
|
192
|
+
const OriginalWordContent: React.FC<{ content: OriginalContentWord }> = ({ content }) => {
|
|
193
|
+
return (
|
|
194
|
+
<div className="px-12 py-8 mt-4 w-full rounded-8xl bg-surface-secondary">
|
|
195
|
+
<OriginalUserInfo
|
|
196
|
+
avatar_url={content.avatar_url}
|
|
197
|
+
frame={content.frame}
|
|
198
|
+
usernameMeta={content.usernameMeta}
|
|
199
|
+
create_time={content.create_time}
|
|
200
|
+
decoration_card={content.decoration_card}
|
|
201
|
+
/>
|
|
202
|
+
|
|
203
|
+
<div className="py-4">
|
|
204
|
+
<div className="text-5xl leading-relaxed text-foreground wrap-break-word">
|
|
205
|
+
{content.text &&
|
|
206
|
+
renderRichTextToReact(content.text, {
|
|
207
|
+
at: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
208
|
+
topic: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
209
|
+
lottery: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
210
|
+
webLink: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
211
|
+
vote: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
212
|
+
viewPicture: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
213
|
+
iconScale: 0.8
|
|
214
|
+
})}
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
217
|
+
<BilibiliAdditionalCard additional={content.additional} gap={false} className="pb-4" />
|
|
218
|
+
</div>
|
|
219
|
+
)
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* LIVE_RCMD类型原始内容组件
|
|
224
|
+
*/
|
|
225
|
+
const OriginalLiveRcmdContent: React.FC<{ content: OriginalContentLiveRcmd }> = ({ content }) => {
|
|
226
|
+
return (
|
|
227
|
+
<div className="px-12 py-8 mt-4 w-full rounded-8xl bg-surface-secondary">
|
|
228
|
+
<OriginalUserInfo
|
|
229
|
+
avatar_url={content.avatar_url}
|
|
230
|
+
frame={content.frame}
|
|
231
|
+
usernameMeta={content.usernameMeta}
|
|
232
|
+
create_time={content.create_time}
|
|
233
|
+
decoration_card={content.decoration_card}
|
|
234
|
+
/>
|
|
235
|
+
|
|
236
|
+
<div className="flex flex-col items-center py-11">
|
|
237
|
+
<div className="flex overflow-hidden relative flex-col items-center w-full rounded-10 aspect-video shadow-large">
|
|
238
|
+
<EnhancedImage src={content.cover} alt="直播封面" className="object-cover absolute w-full h-full rounded-3xl" />
|
|
239
|
+
<div className="absolute right-0 bottom-0 left-0 h-1/2 bg-linear-to-t to-transparent pointer-events-none from-black/75 rounded-3xl" />
|
|
240
|
+
<div className="absolute right-5 bottom-8 left-12 z-10 text-4xl font-light text-white select-text">
|
|
241
|
+
<span className="px-4 py-2 mr-3 text-3xl text-white bg-black/50 rounded-3xl">{content.area_name}</span>
|
|
242
|
+
{content.text_large}、在线: {content.online}
|
|
243
|
+
</div>
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
246
|
+
|
|
247
|
+
<div className="pl-8 text-6xl font-bold select-text text-foreground mb-8">
|
|
248
|
+
{content.title &&
|
|
249
|
+
renderRichTextToReact(content.title, {
|
|
250
|
+
at: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
251
|
+
topic: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
252
|
+
lottery: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
253
|
+
webLink: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
254
|
+
vote: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
255
|
+
viewPicture: { className: 'text-[#006A9E] dark:text-[#58B0D5]' }
|
|
256
|
+
})}
|
|
257
|
+
</div>
|
|
258
|
+
</div>
|
|
259
|
+
)
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
/**
|
|
263
|
+
* B站转发动态内容组件
|
|
264
|
+
*/
|
|
265
|
+
const BilibiliForwardContent: React.FC<BilibiliForwardDynamicData> = (props) => {
|
|
266
|
+
return (
|
|
267
|
+
<>
|
|
268
|
+
{/* 转发文本内容 */}
|
|
269
|
+
<div className="flex flex-col px-20 w-full">
|
|
270
|
+
<div className="relative items-center text-6xl tracking-wider wrap-break-word text-foreground leading-relaxed">
|
|
271
|
+
{props.text &&
|
|
272
|
+
renderRichTextToReact(props.text, {
|
|
273
|
+
at: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
274
|
+
topic: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
275
|
+
lottery: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
276
|
+
webLink: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
277
|
+
vote: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
278
|
+
viewPicture: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
279
|
+
iconScale: 0.8
|
|
280
|
+
})}
|
|
281
|
+
</div>
|
|
282
|
+
{props.imgList && props.imgList.length === 0 && <div className="h-15" />}
|
|
283
|
+
</div>
|
|
284
|
+
|
|
285
|
+
{props.imgList && props.imgList.length > 0 && (
|
|
286
|
+
<div className="flex flex-col items-center px-20 w-full">
|
|
287
|
+
{props.imgList.map((img, idx) => (
|
|
288
|
+
<React.Fragment key={`${img}-${idx}`}>
|
|
289
|
+
<div className="flex overflow-hidden relative flex-col items-center rounded-3xl shadow-large">
|
|
290
|
+
<EnhancedImage src={img} alt={`图片${idx + 1}`} className="object-contain w-full h-full rounded-3xl" />
|
|
291
|
+
</div>
|
|
292
|
+
<div className="h-10" />
|
|
293
|
+
</React.Fragment>
|
|
294
|
+
))}
|
|
295
|
+
</div>
|
|
296
|
+
)}
|
|
297
|
+
|
|
298
|
+
{/* 原始内容 */}
|
|
299
|
+
<div className="flex px-20">
|
|
300
|
+
{props.original_content.DYNAMIC_TYPE_AV && <OriginalAVContent content={props.original_content.DYNAMIC_TYPE_AV} />}
|
|
301
|
+
{props.original_content.DYNAMIC_TYPE_DRAW && <OriginalDrawContent content={props.original_content.DYNAMIC_TYPE_DRAW} />}
|
|
302
|
+
{props.original_content.DYNAMIC_TYPE_WORD && <OriginalWordContent content={props.original_content.DYNAMIC_TYPE_WORD} />}
|
|
303
|
+
{props.original_content.DYNAMIC_TYPE_LIVE_RCMD && (
|
|
304
|
+
<OriginalLiveRcmdContent content={props.original_content.DYNAMIC_TYPE_LIVE_RCMD} />
|
|
305
|
+
)}
|
|
306
|
+
</div>
|
|
307
|
+
</>
|
|
308
|
+
)
|
|
309
|
+
}
|
|
310
|
+
|
|
311
|
+
/**
|
|
312
|
+
* B站转发动态组件
|
|
313
|
+
*/
|
|
314
|
+
export const BilibiliForwardDynamic: React.FC<PosterProps<BilibiliForwardDynamicData>> = React.memo((props) => {
|
|
315
|
+
return (
|
|
316
|
+
<DefaultLayout {...props}>
|
|
317
|
+
<div className="p-4">
|
|
318
|
+
{/* 间距 */}
|
|
319
|
+
<div className="h-25" />
|
|
320
|
+
|
|
321
|
+
{/* 用户信息 */}
|
|
322
|
+
<BilibiliDynamicUserInfo {...props.data} />
|
|
323
|
+
|
|
324
|
+
{/* 间距 */}
|
|
325
|
+
<div className="h-15" />
|
|
326
|
+
|
|
327
|
+
{/* 转发动态内容 */}
|
|
328
|
+
<BilibiliForwardContent {...props.data} />
|
|
329
|
+
|
|
330
|
+
{/* 间距 */}
|
|
331
|
+
<div className="h-25" />
|
|
332
|
+
|
|
333
|
+
{/* 动态状态 */}
|
|
334
|
+
<BilibiliDynamicStatus {...props.data} />
|
|
335
|
+
|
|
336
|
+
{/* 间距 */}
|
|
337
|
+
<div className="h-40" />
|
|
338
|
+
|
|
339
|
+
{/* 底部信息 */}
|
|
340
|
+
<BilibiliDynamicFooter {...props.data} useDarkTheme={isDark(props.ctx)} />
|
|
341
|
+
</div>
|
|
342
|
+
</DefaultLayout>
|
|
343
|
+
)
|
|
344
|
+
})
|
|
345
|
+
|
|
346
|
+
BilibiliForwardDynamic.displayName = 'BilibiliForwardDynamic'
|
|
347
|
+
|
|
348
|
+
export default BilibiliForwardDynamic
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/** 本模板的数据类型(路由 index.tsx 与 components/ 实现共用)。 */
|
|
2
|
+
import type { RichTextDocument } from '@kkk/richtext'
|
|
3
|
+
|
|
4
|
+
import type { BilibiliDynamicBaseData, BilibiliForwardOriginalContentProps } from '../../types'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* B站转发动态组件属性接口
|
|
8
|
+
*/
|
|
9
|
+
export interface BilibiliForwardDynamicData extends BilibiliDynamicBaseData {
|
|
10
|
+
/** 动态文本内容(富文本文档) */
|
|
11
|
+
text: RichTextDocument
|
|
12
|
+
/** 原始内容 */
|
|
13
|
+
original_content: BilibiliForwardOriginalContentProps['original_content']
|
|
14
|
+
/** 图片URL */
|
|
15
|
+
imgList: string[] | null
|
|
16
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { defineTemplate } from '@karinjs/template-react'
|
|
2
|
+
|
|
3
|
+
import { BilibiliForwardDynamic } from './components/DYNAMIC_TYPE_FORWARD'
|
|
4
|
+
import type { BilibiliForwardDynamicData } from './components/types'
|
|
5
|
+
|
|
6
|
+
export default defineTemplate({
|
|
7
|
+
name: '转发动态',
|
|
8
|
+
description: 'B站转发动态展示模板',
|
|
9
|
+
component: BilibiliForwardDynamic,
|
|
10
|
+
validate: (data): data is BilibiliForwardDynamicData =>
|
|
11
|
+
typeof data === 'object' && data !== null && typeof (data as any).share_url === 'string'
|
|
12
|
+
})
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { extractRichTextPlainText, renderRichTextToReact } from '@kkk/richtext'
|
|
2
|
+
import { Clock, Radio, UsersRound } from 'lucide-react'
|
|
3
|
+
import React from 'react'
|
|
4
|
+
|
|
5
|
+
// import { cn } from '../../../../../utils/cn'
|
|
6
|
+
import { isDark } from '../../../../../utils/theme'
|
|
7
|
+
import { AmbientCover } from '../../../../components/AmbientCover'
|
|
8
|
+
import { DefaultLayout } from '../../../../components/DefaultLayout'
|
|
9
|
+
import { QRCodeWithAvatar } from '../../../../components/QRCodeWithAvatar'
|
|
10
|
+
import type { PosterProps } from '../../../../types/ctx'
|
|
11
|
+
import { EnhancedImage, UsernameDisplay } from '../../../components/shared'
|
|
12
|
+
import type { BilibiliLiveDynamicData } from './types'
|
|
13
|
+
|
|
14
|
+
/** B站品牌粉,直播状态徽章 / 脉冲灯 / 均衡器强调条统一使用,与封面取色无关。 */
|
|
15
|
+
const LIVE_PINK = '#FB7299'
|
|
16
|
+
|
|
17
|
+
/** 压在封面上的白色文字统一使用重投影,保证在任意封面亮度下可读(与弹幕层同策略)。 */
|
|
18
|
+
const onCoverTextShadow: React.CSSProperties = {
|
|
19
|
+
textShadow: '0 4px 14px rgba(0,0,0,0.78), 0 0 4px rgba(0,0,0,0.9)'
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/**
|
|
23
|
+
* 封面底部溶解遮罩:多段停靠点模拟 smoothstep,
|
|
24
|
+
* 让封面下缘无明显线性拐点地融入下方的氛围背景层。
|
|
25
|
+
*/
|
|
26
|
+
const coverMaskStyle: React.CSSProperties = {
|
|
27
|
+
maskImage:
|
|
28
|
+
'linear-gradient(to bottom, black 52%, rgba(0,0,0,0.9) 60%, rgba(0,0,0,0.68) 70%, rgba(0,0,0,0.35) 82%, rgba(0,0,0,0.1) 93%, transparent 100%)',
|
|
29
|
+
WebkitMaskImage:
|
|
30
|
+
'linear-gradient(to bottom, black 52%, rgba(0,0,0,0.9) 60%, rgba(0,0,0,0.68) 70%, rgba(0,0,0,0.35) 82%, rgba(0,0,0,0.1) 93%, transparent 100%)'
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 全局氛围背景层:模糊封面 + 渐变遮罩 + 高对比杂色纹理。
|
|
35
|
+
* 背景色完全取自封面图本身,不再依赖后端取色。
|
|
36
|
+
*/
|
|
37
|
+
const LiveAmbientBackground: React.FC<{ cover: string; ctx: PosterProps<BilibiliLiveDynamicData>['ctx'] }> = React.memo(
|
|
38
|
+
({ cover, ctx }) => (
|
|
39
|
+
<div className="pointer-events-none absolute inset-0 overflow-hidden select-none">
|
|
40
|
+
<AmbientCover src={cover} ctx={ctx} />
|
|
41
|
+
|
|
42
|
+
{/* 高对比杂色纹理层 */}
|
|
43
|
+
<div className="absolute inset-0 opacity-[0.45] mix-blend-overlay dark:mix-blend-soft-light">
|
|
44
|
+
<svg className="h-full w-full" xmlns="http://www.w3.org/2000/svg">
|
|
45
|
+
<defs>
|
|
46
|
+
<filter id="liveRcmdNoise">
|
|
47
|
+
<feTurbulence type="fractalNoise" baseFrequency="1.4" numOctaves="3" stitchTiles="stitch" />
|
|
48
|
+
<feColorMatrix type="saturate" values="0" />
|
|
49
|
+
<feComponentTransfer>
|
|
50
|
+
<feFuncR type="discrete" tableValues="0 1" />
|
|
51
|
+
<feFuncG type="discrete" tableValues="0 1" />
|
|
52
|
+
<feFuncB type="discrete" tableValues="0 1" />
|
|
53
|
+
</feComponentTransfer>
|
|
54
|
+
<feComponentTransfer>
|
|
55
|
+
<feFuncA type="linear" slope="2.5" intercept="-0.6" />
|
|
56
|
+
</feComponentTransfer>
|
|
57
|
+
</filter>
|
|
58
|
+
<mask id="liveRcmdNoiseMask">
|
|
59
|
+
<linearGradient id="liveRcmdNoiseGradient" x1="0%" y1="0%" x2="0%" y2="100%">
|
|
60
|
+
<stop offset="0%" stopColor="white" stopOpacity="0.85" />
|
|
61
|
+
<stop offset="25%" stopColor="white" stopOpacity="0.4" />
|
|
62
|
+
<stop offset="50%" stopColor="white" stopOpacity="0.08" />
|
|
63
|
+
<stop offset="75%" stopColor="white" stopOpacity="0.4" />
|
|
64
|
+
<stop offset="100%" stopColor="white" stopOpacity="0.85" />
|
|
65
|
+
</linearGradient>
|
|
66
|
+
<rect width="100%" height="100%" fill="url(#liveRcmdNoiseGradient)" />
|
|
67
|
+
</mask>
|
|
68
|
+
</defs>
|
|
69
|
+
<rect width="100%" height="100%" filter="url(#liveRcmdNoise)" mask="url(#liveRcmdNoiseMask)" fill="white" />
|
|
70
|
+
</svg>
|
|
71
|
+
</div>
|
|
72
|
+
</div>
|
|
73
|
+
)
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
LiveAmbientBackground.displayName = 'LiveAmbientBackground'
|
|
77
|
+
|
|
78
|
+
/** 直播音频均衡器装饰条:直播模板的专属信号装饰。 */
|
|
79
|
+
const LiveEqualizer: React.FC = React.memo(() => (
|
|
80
|
+
<div className="flex items-end gap-2.5 pb-4">
|
|
81
|
+
{[46, 88, 62, 98, 52].map((height, index) => (
|
|
82
|
+
<span
|
|
83
|
+
key={index}
|
|
84
|
+
className="w-2.5 rounded-full"
|
|
85
|
+
style={{
|
|
86
|
+
height: `${height}px`,
|
|
87
|
+
backgroundColor: index === 3 ? LIVE_PINK : 'rgba(255,255,255,0.88)',
|
|
88
|
+
boxShadow: '0 3px 12px rgba(0,0,0,0.55)'
|
|
89
|
+
}}
|
|
90
|
+
/>
|
|
91
|
+
))}
|
|
92
|
+
</div>
|
|
93
|
+
))
|
|
94
|
+
|
|
95
|
+
LiveEqualizer.displayName = 'LiveEqualizer'
|
|
96
|
+
|
|
97
|
+
const stripHtmlTags = (content: string): string => {
|
|
98
|
+
return content.replace(/<[^>]+>/g, '').trim()
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
const getSingleLineFontSize = (content: string, base: number, min: number): number => {
|
|
102
|
+
const length = stripHtmlTags(content).length
|
|
103
|
+
if (length <= 4) return base
|
|
104
|
+
if (length <= 8) return base - 4
|
|
105
|
+
if (length <= 12) return base - 10
|
|
106
|
+
if (length <= 18) return base - 16
|
|
107
|
+
return min
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export const BilibiliLiveDynamic: React.FC<PosterProps<BilibiliLiveDynamicData>> = React.memo((props) => {
|
|
111
|
+
const { data, ctx } = props
|
|
112
|
+
const dark = isDark(ctx)
|
|
113
|
+
|
|
114
|
+
// 面板允许数据文件缺字段,关键引用全部兜底,避免白屏
|
|
115
|
+
const usernameMeta = data.usernameMeta ?? { name: '', vipStatus: 0, nicknameColor: null }
|
|
116
|
+
const liveinf = data.liveinf ?? ''
|
|
117
|
+
const fans = data.fans ?? ''
|
|
118
|
+
const liveTitleLength = data.text ? extractRichTextPlainText(data.text).length : 0
|
|
119
|
+
|
|
120
|
+
const logo = dark ? '/image/bilibili/bilibili-light.png' : '/image/bilibili/bilibili.png'
|
|
121
|
+
const streamerName = usernameMeta.name
|
|
122
|
+
const streamerFontSize = getSingleLineFontSize(streamerName, 68, 42)
|
|
123
|
+
const liveInfoFontSize = getSingleLineFontSize(liveinf, 36, 26)
|
|
124
|
+
const followerFontSize = getSingleLineFontSize(`${fans} 粉丝`, 30, 24)
|
|
125
|
+
const liveTitleFontSize = liveTitleLength <= 16 ? 74 : liveTitleLength <= 28 ? 66 : liveTitleLength <= 44 ? 58 : 52
|
|
126
|
+
|
|
127
|
+
return (
|
|
128
|
+
<DefaultLayout {...props} className="relative overflow-hidden">
|
|
129
|
+
{/* 全局氛围层:模糊封面 + 高对比杂色 */}
|
|
130
|
+
{data.image_url && <LiveAmbientBackground cover={data.image_url} ctx={props.ctx} />}
|
|
131
|
+
|
|
132
|
+
<div className="relative z-10 flex flex-col">
|
|
133
|
+
{/* 封面:占满模板全宽,底部溶解进氛围层 */}
|
|
134
|
+
{data.image_url && (
|
|
135
|
+
<section className="relative">
|
|
136
|
+
<div className="overflow-hidden" style={coverMaskStyle}>
|
|
137
|
+
<EnhancedImage src={data.image_url} alt="直播封面" className="block h-auto w-full object-cover" />
|
|
138
|
+
</div>
|
|
139
|
+
|
|
140
|
+
{/* 底部直播状态:压在封面溶解区上,靠重投影保持可读 */}
|
|
141
|
+
<div className="absolute inset-x-0 bottom-0 flex items-end justify-between gap-10 px-16 pb-4" style={onCoverTextShadow}>
|
|
142
|
+
<div className="min-w-0">
|
|
143
|
+
<div className="inline-flex items-center gap-3 text-[20px] font-black tracking-[0.26em] uppercase text-white/85">
|
|
144
|
+
<span className="h-3 w-3 animate-pulse rounded-full" style={{ backgroundColor: LIVE_PINK }} />
|
|
145
|
+
<span>Now Live</span>
|
|
146
|
+
</div>
|
|
147
|
+
<div className="mt-2 flex items-end gap-7">
|
|
148
|
+
<span className="text-[92px] leading-none font-black tracking-[-0.03em] whitespace-nowrap text-white select-text">
|
|
149
|
+
正在开播
|
|
150
|
+
</span>
|
|
151
|
+
<LiveEqualizer />
|
|
152
|
+
</div>
|
|
153
|
+
<div className="mt-5 inline-flex max-w-full items-center gap-3 font-bold text-white/92">
|
|
154
|
+
<Radio size={26} className="shrink-0" />
|
|
155
|
+
<span className="min-w-0 select-text" style={{ fontSize: `${liveInfoFontSize}px` }}>
|
|
156
|
+
{liveinf}
|
|
157
|
+
</span>
|
|
158
|
+
</div>
|
|
159
|
+
</div>
|
|
160
|
+
<div className="shrink-0 pb-2 text-right font-mono text-white/85">
|
|
161
|
+
<div className="inline-flex items-center gap-3 text-[26px] font-bold whitespace-nowrap select-text">
|
|
162
|
+
<Clock size={24} />
|
|
163
|
+
<span>{data.create_time}</span>
|
|
164
|
+
</div>
|
|
165
|
+
</div>
|
|
166
|
+
</div>
|
|
167
|
+
</section>
|
|
168
|
+
)}
|
|
169
|
+
|
|
170
|
+
{/* 内容区:压在氛围层之上 */}
|
|
171
|
+
<section className="relative flex flex-col px-16 pt-14">
|
|
172
|
+
{/* 背景气氛字 */}
|
|
173
|
+
<div className="pointer-events-none absolute top-24 right-0 z-0 opacity-[0.05] select-none">
|
|
174
|
+
<div className="text-[190px] leading-[0.88] font-black tracking-tighter text-foreground">ON</div>
|
|
175
|
+
<div className="text-[190px] leading-[0.88] font-black tracking-tighter text-foreground">AIR</div>
|
|
176
|
+
</div>
|
|
177
|
+
|
|
178
|
+
{/* 直播标题:主视觉文本 */}
|
|
179
|
+
<h1
|
|
180
|
+
className="relative z-10 leading-[1.18] font-black tracking-[-0.02em] whitespace-pre-wrap text-foreground select-text"
|
|
181
|
+
style={{ fontSize: `${liveTitleFontSize}px`, wordBreak: 'break-word', overflowWrap: 'break-word' }}
|
|
182
|
+
>
|
|
183
|
+
{data.text &&
|
|
184
|
+
renderRichTextToReact(data.text, {
|
|
185
|
+
at: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
186
|
+
topic: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
187
|
+
lottery: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
188
|
+
webLink: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
189
|
+
vote: { className: 'text-[#006A9E] dark:text-[#58B0D5]' },
|
|
190
|
+
viewPicture: { className: 'text-[#006A9E] dark:text-[#58B0D5]' }
|
|
191
|
+
})}
|
|
192
|
+
</h1>
|
|
193
|
+
|
|
194
|
+
{/* 主播身份行 */}
|
|
195
|
+
<div className="relative z-10 mt-14 flex items-center justify-between gap-10">
|
|
196
|
+
<div className="flex min-w-0 items-center gap-7">
|
|
197
|
+
<div className="relative shrink-0">
|
|
198
|
+
<EnhancedImage src={data.avatar_url} alt="头像" className="h-36 w-36 rounded-full object-cover" isCircular />
|
|
199
|
+
{data.frame && <EnhancedImage src={data.frame} alt="头像框" className="absolute inset-0 scale-160" />}
|
|
200
|
+
</div>
|
|
201
|
+
<div className="min-w-0">
|
|
202
|
+
<div className="text-[20px] font-black tracking-[0.28em] uppercase text-muted">Live Streamer</div>
|
|
203
|
+
<div
|
|
204
|
+
className="mt-3 truncate leading-none font-black tracking-[-0.03em] text-foreground select-text"
|
|
205
|
+
style={{ fontSize: `${streamerFontSize}px` }}
|
|
206
|
+
>
|
|
207
|
+
<UsernameDisplay metadata={usernameMeta} />
|
|
208
|
+
</div>
|
|
209
|
+
<div className="mt-4 inline-flex items-center gap-3 font-bold text-foreground/70">
|
|
210
|
+
<UsersRound size={26} />
|
|
211
|
+
<span className="select-text" style={{ fontSize: `${followerFontSize}px` }}>
|
|
212
|
+
{fans} 粉丝
|
|
213
|
+
</span>
|
|
214
|
+
</div>
|
|
215
|
+
</div>
|
|
216
|
+
</div>
|
|
217
|
+
|
|
218
|
+
<div className="shrink-0 text-right">
|
|
219
|
+
<div className="text-[20px] font-black tracking-[0.26em] uppercase text-muted">Signal Time</div>
|
|
220
|
+
<div className="mt-3 font-mono text-[30px] font-bold text-foreground/75 select-text">{data.now_time}</div>
|
|
221
|
+
</div>
|
|
222
|
+
</div>
|
|
223
|
+
|
|
224
|
+
{/* 底部:品牌 + 行动区 */}
|
|
225
|
+
<footer className="relative z-10 mt-16 flex items-end justify-between gap-14 pb-16">
|
|
226
|
+
<div className="min-w-0">
|
|
227
|
+
<img src={logo} alt="哔哩哔哩" className={`h-auto ${dark ? 'w-72' : 'w-108'}`} />
|
|
228
|
+
<div className="mt-5 text-[26px] font-bold text-muted select-text">你感兴趣的直播都在哔哩哔哩</div>
|
|
229
|
+
<div className="mt-4 flex flex-wrap items-center gap-x-5 gap-y-2 text-[22px] font-semibold text-foreground/50">
|
|
230
|
+
<span className="select-text">{data.dynamicTYPE}</span>
|
|
231
|
+
<span className="opacity-40">/</span>
|
|
232
|
+
<span className="font-mono select-text">{data.now_time}</span>
|
|
233
|
+
</div>
|
|
234
|
+
</div>
|
|
235
|
+
|
|
236
|
+
<div className="shrink-0 text-right">
|
|
237
|
+
<div className="text-[20px] font-black tracking-[0.24em] uppercase text-muted">Scan To Watch</div>
|
|
238
|
+
<div className="mt-2 text-[40px] leading-none font-black tracking-[-0.02em] text-foreground select-text">扫码进入直播间</div>
|
|
239
|
+
<div className="mt-6 flex justify-end">
|
|
240
|
+
{data.share_url ? (
|
|
241
|
+
<QRCodeWithAvatar
|
|
242
|
+
value={data.share_url}
|
|
243
|
+
avatarUrl={data.avatar_url}
|
|
244
|
+
useDarkTheme={dark}
|
|
245
|
+
alt="二维码"
|
|
246
|
+
className="h-72 w-72 object-contain drop-shadow-[0_20px_38px_rgba(0,0,0,0.18)]"
|
|
247
|
+
/>
|
|
248
|
+
) : (
|
|
249
|
+
<div className="flex h-72 w-72 items-center justify-center">
|
|
250
|
+
<span className="text-[28px] text-muted">二维码</span>
|
|
251
|
+
</div>
|
|
252
|
+
)}
|
|
253
|
+
</div>
|
|
254
|
+
</div>
|
|
255
|
+
</footer>
|
|
256
|
+
</section>
|
|
257
|
+
</div>
|
|
258
|
+
</DefaultLayout>
|
|
259
|
+
)
|
|
260
|
+
})
|
|
261
|
+
|
|
262
|
+
BilibiliLiveDynamic.displayName = 'BilibiliLiveDynamic'
|
|
263
|
+
|
|
264
|
+
export default BilibiliLiveDynamic
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/** 本模板的数据类型(路由 index.tsx 与 components/ 实现共用)。 */
|
|
2
|
+
import type { RichTextDocument } from '@kkk/richtext'
|
|
3
|
+
|
|
4
|
+
import type { UsernameMetadata } from '../../types'
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* B站直播动态组件属性接口
|
|
8
|
+
*/
|
|
9
|
+
export interface BilibiliLiveDynamicData {
|
|
10
|
+
/** 直播封面 */
|
|
11
|
+
image_url: string
|
|
12
|
+
/** 直播标题 */
|
|
13
|
+
text: RichTextDocument
|
|
14
|
+
/** 直播房间信息(分区 | 房间号) */
|
|
15
|
+
liveinf: string
|
|
16
|
+
/** 用户名元数据 */
|
|
17
|
+
usernameMeta: UsernameMetadata
|
|
18
|
+
/** 用户头像URL */
|
|
19
|
+
avatar_url: string
|
|
20
|
+
/** 头像框 */
|
|
21
|
+
frame?: string
|
|
22
|
+
/** 粉丝数 */
|
|
23
|
+
fans: string
|
|
24
|
+
/** 时间信息 */
|
|
25
|
+
create_time: string
|
|
26
|
+
/** 直播开始时间 */
|
|
27
|
+
now_time: string
|
|
28
|
+
/** 分享和配置 */
|
|
29
|
+
share_url: string
|
|
30
|
+
/** 动态类型 */
|
|
31
|
+
dynamicTYPE: string
|
|
32
|
+
}
|