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,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GroupStatistics = void 0;
|
|
4
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
5
|
+
const theme_1 = require("../../../../utils/theme");
|
|
6
|
+
const DefaultLayout_1 = require("../../../components/DefaultLayout");
|
|
7
|
+
const ChartCard_1 = require("../../components/ChartCard");
|
|
8
|
+
const PlatformTable_1 = require("../../components/PlatformTable");
|
|
9
|
+
const RankList_1 = require("../../components/RankList");
|
|
10
|
+
const KpiCard_1 = require("../../components/KpiCard");
|
|
11
|
+
const SSRChart_1 = require("../../components/SSRChart");
|
|
12
|
+
const chartTheme_1 = require("../../components/chartTheme");
|
|
13
|
+
const chartPresets_1 = require("../../components/chartPresets");
|
|
14
|
+
const format_1 = require("../../components/format");
|
|
15
|
+
/**
|
|
16
|
+
* 群组解析统计海报。
|
|
17
|
+
*
|
|
18
|
+
* 版式按「手机竖屏一屏尽量装下」设计:1440 宽的画面里全部走卡片网格,
|
|
19
|
+
* 每张图独占一张卡,卡内自带紧凑标题行 —— 旧版那种「大标题 + 160px 下边距」的分区头
|
|
20
|
+
* 每张图要吃掉 360px,是海报被撑到 6900px 的主因。
|
|
21
|
+
*
|
|
22
|
+
* 图表由 ECharts 在 render 期同步渲染成 SVG 字符串后注入,
|
|
23
|
+
* 组件不持有状态、不碰 DOM、不用 hooks。配色约束见 `chartTheme.ts` 文件头。
|
|
24
|
+
*/
|
|
25
|
+
/** 海报内容区宽度:1440 - 左右各 72(p-18) */
|
|
26
|
+
const CONTENT_WIDTH = 1296;
|
|
27
|
+
/** 两列网格的间距与单卡宽度:gap-14(56px) 下正好铺满内容区 */
|
|
28
|
+
const GRID_GAP = 56;
|
|
29
|
+
const HALF_CARD_WIDTH = (CONTENT_WIDTH - GRID_GAP) / 2;
|
|
30
|
+
/** 卡片内边距 p-6 = 24px,算图表画布宽度时必须减掉,否则 SVG 会溢出卡片边框 */
|
|
31
|
+
const CARD_PADDING = 24;
|
|
32
|
+
const FULL_CHART_WIDTH = CONTENT_WIDTH - CARD_PADDING * 2;
|
|
33
|
+
const HALF_CHART_WIDTH = HALF_CARD_WIDTH - CARD_PADDING * 2;
|
|
34
|
+
/** 半宽卡片的图表高度 */
|
|
35
|
+
const HALF_CHART_HEIGHT = 340;
|
|
36
|
+
/**
|
|
37
|
+
* 极坐标那一行的画布尺寸。
|
|
38
|
+
*
|
|
39
|
+
* 「活跃时段」那张是极坐标图,圆的外接正方形只能用画布**短边**,
|
|
40
|
+
* 所以常规的 572×340 里有 116px×2 的横向空间是纯浪费的。
|
|
41
|
+
* 处理办法是两件事一起做:
|
|
42
|
+
* 1. 把这一行整体加高 —— 半径上限就是短边的一半,不加高光调比例没用;
|
|
43
|
+
* 2. 把这一行拆成 1 : 1.35,让极坐标卡窄一点、周内分布宽一点,
|
|
44
|
+
* 加高到 480 之后短边就轮到宽度来当了,再高也不会更大。
|
|
45
|
+
* 同排的周内分布跟着一起长,不然网格拉平后那张卡底部会空出一块。
|
|
46
|
+
*/
|
|
47
|
+
const POLAR_CHART_WIDTH = 479;
|
|
48
|
+
const POLAR_CHART_HEIGHT = 480;
|
|
49
|
+
/** 周内分布那张卡的画布宽度(1.35 份) */
|
|
50
|
+
const WEEKDAY_CHART_WIDTH = 664;
|
|
51
|
+
/** 平台分布里环形图的画布尺寸,剩下宽度留给右侧明细列表 */
|
|
52
|
+
const DONUT_SIZE = { width: 420, height: 300 };
|
|
53
|
+
/**
|
|
54
|
+
* 活跃时段:24 小时极坐标柱,峰值小时单独提亮。
|
|
55
|
+
* 半径按画布短边换算 —— 极坐标图的实际可用直径受限于较短的那条边。
|
|
56
|
+
*/
|
|
57
|
+
const buildHourPolarOption = (hourly, size, dark) => {
|
|
58
|
+
const palette = (0, chartTheme_1.getChartPalette)(dark);
|
|
59
|
+
const peakHour = hourly.indexOf(Math.max(...hourly));
|
|
60
|
+
const short = Math.min(size.width, size.height);
|
|
61
|
+
return {
|
|
62
|
+
// 0.40 是留给轴标签后的上限:外圈半径 + 标签高度不能超过画布短边的一半
|
|
63
|
+
polar: { radius: [Math.round(short * 0.15), Math.round(short * 0.4)], center: ['50%', '50%'] },
|
|
64
|
+
angleAxis: {
|
|
65
|
+
type: 'category',
|
|
66
|
+
data: hourly.map((_, hour) => `${hour}时`),
|
|
67
|
+
startAngle: 90,
|
|
68
|
+
axisLine: (0, chartTheme_1.axisLineStyle)(palette),
|
|
69
|
+
axisTick: { show: false },
|
|
70
|
+
// 24 个刻度全画会糊,每 3 小时标一个
|
|
71
|
+
axisLabel: { ...(0, chartTheme_1.axisLabelStyle)(palette, 20), interval: 2 }
|
|
72
|
+
},
|
|
73
|
+
radiusAxis: {
|
|
74
|
+
axisLine: { show: false },
|
|
75
|
+
axisTick: { show: false },
|
|
76
|
+
axisLabel: { show: false },
|
|
77
|
+
splitLine: (0, chartTheme_1.splitLineStyle)(palette)
|
|
78
|
+
},
|
|
79
|
+
series: [
|
|
80
|
+
{
|
|
81
|
+
type: 'bar',
|
|
82
|
+
coordinateSystem: 'polar',
|
|
83
|
+
barWidth: '60%',
|
|
84
|
+
itemStyle: { borderRadius: [6, 6, 0, 0] },
|
|
85
|
+
data: hourly.map((count, hour) => ({
|
|
86
|
+
value: count,
|
|
87
|
+
itemStyle: { color: hour === peakHour && count > 0 ? palette.accent : (0, chartTheme_1.withAlpha)(palette.accent, 0.4) }
|
|
88
|
+
}))
|
|
89
|
+
}
|
|
90
|
+
]
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* 内容形态构成:矩形树图。
|
|
95
|
+
*
|
|
96
|
+
* 试过饼图和玫瑰图,都不合适:内容形态天然是单项独大(视频常占一半以上),
|
|
97
|
+
* 饼图/玫瑰图会把这个大类摊成一整块扇形,整张图歪向一边。
|
|
98
|
+
* 树图的面积严格正比于数值,独大项只体现为大矩形,不会破坏版面平衡。
|
|
99
|
+
*/
|
|
100
|
+
const buildWorkTypeTreemapOption = (workTypes, dark) => {
|
|
101
|
+
const palette = (0, chartTheme_1.getChartPalette)(dark);
|
|
102
|
+
const total = workTypes.reduce((sum, item) => sum + item.count, 0);
|
|
103
|
+
return {
|
|
104
|
+
series: [
|
|
105
|
+
{
|
|
106
|
+
type: 'treemap',
|
|
107
|
+
roam: false,
|
|
108
|
+
nodeClick: false,
|
|
109
|
+
// 关掉面包屑,否则它会占掉顶部一条高,树图也就填不满画布
|
|
110
|
+
breadcrumb: { show: false },
|
|
111
|
+
itemStyle: { borderColor: 'transparent', borderWidth: 5, gapWidth: 5, borderRadius: 12 },
|
|
112
|
+
label: {
|
|
113
|
+
show: true,
|
|
114
|
+
fontSize: 26,
|
|
115
|
+
fontWeight: 'bold',
|
|
116
|
+
color: palette.textOnColor,
|
|
117
|
+
fontFamily: chartTheme_1.CHART_FONT_FAMILY,
|
|
118
|
+
formatter: '{b}'
|
|
119
|
+
},
|
|
120
|
+
data: workTypes.map((item) => ({
|
|
121
|
+
name: chartTheme_1.WORK_TYPE_META[item.workType].label,
|
|
122
|
+
value: item.count,
|
|
123
|
+
// 小块塞不下整词,会被截成一个字(「文」「直」),反而更难读;交给下方图例认色
|
|
124
|
+
label: { show: total > 0 && item.count / total >= 0.08 },
|
|
125
|
+
itemStyle: { color: chartTheme_1.WORK_TYPE_META[item.workType].color }
|
|
126
|
+
}))
|
|
127
|
+
}
|
|
128
|
+
]
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
/**
|
|
132
|
+
* 群组解析统计组件 Group Statistics
|
|
133
|
+
*/
|
|
134
|
+
const GroupStatistics = (props) => {
|
|
135
|
+
const dark = (0, theme_1.isDark)(props.ctx);
|
|
136
|
+
const data = props.data;
|
|
137
|
+
const platformTotal = data.platformData.reduce((sum, item) => sum + item.count, 0);
|
|
138
|
+
const workTypeTotal = data.workTypes.reduce((sum, item) => sum + item.count, 0);
|
|
139
|
+
const hourlyTotal = data.hourly.reduce((sum, count) => sum + count, 0);
|
|
140
|
+
const weekdayTotal = data.weekday.reduce((sum, count) => sum + count, 0);
|
|
141
|
+
const hasTrend = data.trend.some((point) => point.count > 0);
|
|
142
|
+
const peakHour = hourlyTotal > 0 ? data.hourly.indexOf(Math.max(...data.hourly)) : -1;
|
|
143
|
+
const topPlatform = data.topPlatform ? chartTheme_1.PLATFORM_META[data.topPlatform] : undefined;
|
|
144
|
+
const platformLegend = (0, chartPresets_1.buildPlatformLegend)(data.platformData, dark);
|
|
145
|
+
const maxPlatformCount = Math.max(...data.platformData.map((item) => item.count), 1);
|
|
146
|
+
/** 排行条:按平台堆叠,条尾标总次数 */
|
|
147
|
+
const userRows = data.topUsers.map((user) => ({
|
|
148
|
+
name: user.name,
|
|
149
|
+
avatar: user.avatar,
|
|
150
|
+
segments: user.segments,
|
|
151
|
+
label: `${(0, format_1.formatWithCommas)(user.count)} 次`
|
|
152
|
+
}));
|
|
153
|
+
return ((0, jsx_runtime_1.jsxs)(DefaultLayout_1.DefaultLayout, { ...props, className: "relative overflow-hidden bg-surface", children: [(0, jsx_runtime_1.jsxs)("div", { className: "absolute inset-0 pointer-events-none z-0", children: [(0, jsx_runtime_1.jsx)("div", { className: "absolute rounded-full w-450 h-500 -top-100 -left-75 blur-[180px]", style: {
|
|
154
|
+
background: `radial-gradient(ellipse at 40% 40%, ${dark ? 'rgba(236, 72, 153, 0.4)' : 'rgba(244, 114, 182, 0.5)'} 0%, transparent 70%)`
|
|
155
|
+
} }), (0, jsx_runtime_1.jsx)("div", { className: "absolute rounded-full w-350 h-400 top-150 -right-50 blur-[160px]", style: {
|
|
156
|
+
background: `radial-gradient(ellipse at 50% 50%, ${dark ? 'rgba(139, 92, 246, 0.3)' : 'rgba(167, 139, 250, 0.4)'} 0%, transparent 70%)`
|
|
157
|
+
} }), (0, jsx_runtime_1.jsx)("div", { className: "absolute rounded-full w-400 h-350 -bottom-75 left-75 blur-[180px]", style: {
|
|
158
|
+
background: `radial-gradient(ellipse at 50% 60%, ${dark ? 'rgba(59, 130, 246, 0.25)' : 'rgba(96, 165, 250, 0.3)'} 0%, transparent 70%)`
|
|
159
|
+
} })] }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 pointer-events-none z-0 opacity-[0.08] dark:opacity-[0.12]", children: (0, jsx_runtime_1.jsxs)("svg", { className: "w-full h-full", xmlns: "http://www.w3.org/2000/svg", children: [(0, jsx_runtime_1.jsxs)("filter", { id: "pixelNoise", children: [(0, jsx_runtime_1.jsx)("feTurbulence", { type: "fractalNoise", baseFrequency: "0.8", numOctaves: "1", 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)("rect", { width: "100%", height: "100%", filter: "url(#pixelNoise)" })] }) }), (0, jsx_runtime_1.jsx)("div", { className: "absolute top-24 right-15 pointer-events-none select-none opacity-[0.03] z-0", children: (0, jsx_runtime_1.jsx)("span", { className: "text-[180px] font-black tracking-tighter leading-none block text-right text-foreground", children: "STATS" }) }), (0, jsx_runtime_1.jsxs)("div", { className: "relative z-10 p-14 flex flex-col gap-8", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-8 border-b-4 border-border/30 pb-8", children: [data.groupAvatar && ((0, jsx_runtime_1.jsx)("img", { src: data.groupAvatar, alt: "\u7FA4\u5934\u50CF", className: "w-28 h-28 rounded-2xl object-cover border-4 border-border/50 shrink-0" })), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1 min-w-0", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4 opacity-60 mb-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "w-3 h-3 rounded-full bg-pink-500 animate-pulse" }), (0, jsx_runtime_1.jsx)("span", { className: "text-2xl font-mono tracking-widest text-muted/80", children: "GROUP_ANALYTICS" })] }), (0, jsx_runtime_1.jsx)("h1", { className: "text-[5rem] font-black leading-none tracking-tighter text-foreground/90", children: "\u89E3\u6790\u7EDF\u8BA1" })] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-right shrink-0", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-3xl font-bold text-foreground/80 max-w-140 truncate", children: [data.groupName, "(", data.groupId, ")"] }), (0, jsx_runtime_1.jsxs)("div", { className: "text-2xl text-muted/70 mt-2", children: [data.groupMemberCount ? `共 ${data.groupMemberCount} 人 · ` : '', "\u6570\u636E\u622A\u6B62 ", data.generatedAt] })] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-6 gap-5", children: [(0, jsx_runtime_1.jsx)(KpiCard_1.KpiCard, { title: "\u672C\u7FA4\u89E3\u6790", titleEn: "GROUP TOTAL", value: (0, format_1.formatCompact)(data.groupTotalParses), unit: "\u6B21" }), (0, jsx_runtime_1.jsx)(KpiCard_1.KpiCard, { title: "\u4F7F\u7528\u7528\u6237", titleEn: "UNIQUE USERS", value: (0, format_1.formatCompact)(data.groupUniqueUsers), unit: "\u4EBA" }), (0, jsx_runtime_1.jsx)(KpiCard_1.KpiCard, { title: "\u4EBA\u5747\u89E3\u6790", titleEn: "PER USER", value: data.parsesPerUser.toFixed(1), unit: "\u6B21" }), (0, jsx_runtime_1.jsx)(KpiCard_1.KpiCard, { title: "\u65E5\u5747\u89E3\u6790", titleEn: "DAILY AVG", value: (data.activeDays > 0 ? data.groupTotalParses / data.activeDays : 0).toFixed(1), unit: "\u6B21", hint: data.activeDays > 0 ? `${data.activeDays} 天` : '无按天数据' }), (0, jsx_runtime_1.jsx)(KpiCard_1.KpiCard, { title: "\u6D3B\u8DC3\u5929\u6570", titleEn: "ACTIVE DAYS", value: (0, format_1.formatCompact)(data.activeDays), unit: "\u5929" }), (0, jsx_runtime_1.jsx)(KpiCard_1.KpiCard, { title: "\u4E3B\u529B\u5E73\u53F0", titleEn: "TOP PLATFORM", value: topPlatform ? topPlatform.name : '—', hint: topPlatform ? `占 ${(0, format_1.formatPercent)(data.platformData[0]?.count ?? 0, platformTotal)}%` : '暂无数据' })] }), platformTotal > 0 && ((0, jsx_runtime_1.jsx)(ChartCard_1.ChartCard, { title: "\u5E73\u53F0\u5206\u5E03", subtitle: "DISTRIBUTION", accentClassName: "bg-blue-500", children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-6", children: [(0, jsx_runtime_1.jsx)(SSRChart_1.SSRChart, { option: (0, chartPresets_1.buildPlatformDonutOption)(data.platformData, dark, DONUT_SIZE, 'TOTAL PARSES'), width: DONUT_SIZE.width, height: DONUT_SIZE.height, className: "shrink-0" }), (0, jsx_runtime_1.jsx)(PlatformTable_1.PlatformTable, { className: "flex-1", columns: ['解析次数', '占比', '使用人数'], rows: platformLegend.map((row) => {
|
|
160
|
+
const detail = data.platformData.find((item) => item.platform === row.key);
|
|
161
|
+
return {
|
|
162
|
+
key: row.key,
|
|
163
|
+
logo: row.logo,
|
|
164
|
+
name: row.name,
|
|
165
|
+
color: row.color,
|
|
166
|
+
// 条长按「相对最大项」而不是相对总量:最大的那条顶满,量级差距一眼可见
|
|
167
|
+
barPercent: (row.count / maxPlatformCount) * 100,
|
|
168
|
+
cells: [(0, format_1.formatWithCommas)(row.count), `${row.percent}%`, detail ? (0, format_1.formatWithCommas)(detail.users) : '—']
|
|
169
|
+
};
|
|
170
|
+
}) })] }) })), (0, jsx_runtime_1.jsx)(ChartCard_1.ChartCard, { title: "\u89E3\u6790\u8D8B\u52BF", subtitle: "TREND", accentClassName: "bg-violet-500", children: hasTrend ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(SSRChart_1.SSRChart, { option: (0, chartPresets_1.buildTrendLineOption)(data.trend, dark, { baseline: data.globalDailyAverage, baselineLabel: '全局日均' }), width: FULL_CHART_WIDTH, height: 360 }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-2 text-center text-xl text-muted/80", children: ["\u8FD1 30 \u5929 \u00B7 \u865A\u7EBF\u4E3A\u5168\u5C40\u65E5\u5747 ", (0, jsx_runtime_1.jsx)("span", { className: "font-bold text-foreground/80", children: data.globalDailyAverage.toFixed(1) }), " \u6B21"] })] })) : ((0, jsx_runtime_1.jsxs)("div", { className: "h-80 flex flex-col items-center justify-center gap-3 text-muted/70", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-3xl font-bold", children: "\u6682\u65E0\u8D8B\u52BF\u6570\u636E" }), (0, jsx_runtime_1.jsx)("div", { className: "text-xl", children: "\u8BE5\u7EDF\u8BA1\u4ECE\u672C\u529F\u80FD\u4E0A\u7EBF\u540E\u5F00\u59CB\u6309\u5929\u8BB0\u5F55\uFF0C\u5148\u79EF\u7D2F\u51E0\u5929\u518D\u6765\u770B ~" })] })) }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-[1fr_1.35fr] gap-14", children: [hourlyTotal > 0 && ((0, jsx_runtime_1.jsx)(ChartCard_1.ChartCard, { title: "\u6D3B\u8DC3\u65F6\u6BB5", subtitle: "ACTIVE HOURS", accentClassName: "bg-amber-500", caption: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u6700\u6D3B\u8DC3\u65F6\u6BB5 ", peakHour, ":00 - ", peakHour + 1, ":00"] }), children: (0, jsx_runtime_1.jsx)(SSRChart_1.SSRChart, { option: buildHourPolarOption(data.hourly, { width: POLAR_CHART_WIDTH, height: POLAR_CHART_HEIGHT }, dark), width: POLAR_CHART_WIDTH, height: POLAR_CHART_HEIGHT }) })), weekdayTotal > 0 && ((0, jsx_runtime_1.jsx)(ChartCard_1.ChartCard, { title: "\u5468\u5185\u5206\u5E03", subtitle: "BY WEEKDAY", accentClassName: "bg-sky-500", caption: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u6A2A\u8F74 = \u5468\u4E00\u5230\u5468\u65E5 \u00B7 \u7EB5\u8F74 = \u8BE5\u661F\u671F\u51E0\u7684", (0, jsx_runtime_1.jsx)("b", { className: "text-foreground/80", children: "\u65E5\u5747" }), "\u89E3\u6790\u6B21\u6570 \u00B7 \u865A\u7EBF = \u4E03\u65E5\u5747\u503C", (0, jsx_runtime_1.jsx)("br", {}), "\u53D6\u65E5\u5747\u800C\u4E0D\u662F\u4E03\u5929\u603B\u548C\uFF1A\u7A97\u53E3\u4E0D\u662F\u6574\u5468\uFF0C\u76F4\u63A5\u52A0\u603B\u4F1A\u8BA9\u672B\u5C3E\u90A3\u4E24\u4E2A\u661F\u671F\u51E0\u51ED\u7A7A\u9AD8\u51FA\u4E00\u622A"] }), children: (0, jsx_runtime_1.jsx)(SSRChart_1.SSRChart, { option: (0, chartPresets_1.buildWeekdayOption)(data.weekday, dark), width: WEEKDAY_CHART_WIDTH, height: POLAR_CHART_HEIGHT }) }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "grid grid-cols-2 gap-14", children: [workTypeTotal > 0 && ((0, jsx_runtime_1.jsxs)(ChartCard_1.ChartCard, { title: "\u5185\u5BB9\u5F62\u6001", subtitle: "WORK TYPES", accentClassName: "bg-cyan-500", children: [(0, jsx_runtime_1.jsx)(SSRChart_1.SSRChart, { option: buildWorkTypeTreemapOption(data.workTypes, dark), width: HALF_CHART_WIDTH, height: HALF_CHART_HEIGHT }), (0, jsx_runtime_1.jsx)("div", { className: "mt-2 flex flex-wrap justify-center gap-x-6 gap-y-2", children: (0, chartPresets_1.buildWorkTypeLegend)(data.workTypes).map((row) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("span", { className: "w-6 h-6 rounded shrink-0", style: { backgroundColor: row.color } }), (0, jsx_runtime_1.jsx)("span", { className: "text-xl text-foreground/80", children: row.label })] }, row.key))) })] })), hourlyTotal > 0 && data.platformHourly.length > 0 && ((0, jsx_runtime_1.jsxs)(ChartCard_1.ChartCard, { title: "\u5E73\u53F0 \u00D7 \u65F6\u6BB5", subtitle: "PLATFORM BY HOUR", accentClassName: "bg-indigo-500", children: [(0, jsx_runtime_1.jsx)(SSRChart_1.SSRChart, { option: (0, chartPresets_1.buildPlatformHourOption)(data.platformHourly, dark), width: HALF_CHART_WIDTH, height: HALF_CHART_HEIGHT }), (0, jsx_runtime_1.jsx)("div", { className: "mt-2 flex flex-wrap justify-center gap-x-6 gap-y-2", children: data.platformHourly.map((item) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3", children: [(0, jsx_runtime_1.jsx)("span", { className: "w-6 h-6 rounded shrink-0", style: { backgroundColor: (0, chartTheme_1.platformColor)(item.platform, dark) } }), (0, jsx_runtime_1.jsx)("span", { className: "text-xl text-foreground/80", children: chartTheme_1.PLATFORM_META[item.platform].name })] }, item.platform))) })] }))] }), data.metrics.map((item) => {
|
|
171
|
+
// 拿「≤5s」那一档的累计占比当读法示例。档位会被裁剪,只能按标签找,不能按下标
|
|
172
|
+
const metricTotal = item.buckets.reduce((sum, bucket) => sum + bucket.count, 0);
|
|
173
|
+
const fiveSecondIndex = item.buckets.findIndex((bucket) => bucket.upper === '≤5s');
|
|
174
|
+
const fiveSecondShare = fiveSecondIndex >= 0 && metricTotal > 0
|
|
175
|
+
? Math.round((item.buckets.slice(0, fiveSecondIndex + 1).reduce((sum, bucket) => sum + bucket.count, 0) / metricTotal) * 100)
|
|
176
|
+
: undefined;
|
|
177
|
+
return ((0, jsx_runtime_1.jsx)(ChartCard_1.ChartCard, { title: chartTheme_1.METRIC_META[item.metric].title, subtitle: chartTheme_1.METRIC_META[item.metric].subtitle, accentClassName: chartTheme_1.METRIC_META[item.metric].accent, caption: (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u6A2A\u8F74 = ", (0, jsx_runtime_1.jsx)("b", { className: "text-foreground/80", children: "\u8017\u65F6\u4E0A\u9650" }), " \u00B7 \u7EB5\u8F74 = \u6709\u591A\u5C11\u6BD4\u4F8B\u7684\u89E3\u6790\u5728\u8FD9\u4E2A\u65F6\u95F4\u5185\u8DD1\u5B8C \u00B7 \u4E24\u6761\u865A\u7EBF\u662F 50% / 90% \u7684\u4F4D\u7F6E", (0, jsx_runtime_1.jsx)("br", {}), "\u8BFB\u6CD5\uFF1A", fiveSecondShare !== undefined ? ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: ["\u300C\u22645s\u300D\u90A3\u4E2A\u70B9\u662F ", (0, jsx_runtime_1.jsxs)("b", { className: "text-foreground/80", children: [fiveSecondShare, "%"] }), "\uFF0C\u610F\u601D\u5C31\u662F ", fiveSecondShare, "% \u7684\u89E3\u6790 5 \u79D2\u5185\u8DD1\u5B8C"] })) : ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: "\u4EFB\u53D6\u4E00\u70B9\uFF0C\u6A2A\u8F74\u662F\u8017\u65F6\u4E0A\u9650\u3001\u7EB5\u8F74\u5C31\u662F\u8DD1\u5B8C\u7684\u6BD4\u4F8B" })), "\uFF1B\u66F2\u7EBF\u8D8A\u9661\u8BF4\u660E\u89E3\u6790\u8D8A\u96C6\u4E2D\u5728\u8FD9\u4E00\u6BB5"] }), children: (0, jsx_runtime_1.jsx)(SSRChart_1.SSRChart, { option: (0, chartPresets_1.buildDurationCurveOption)(item, dark), width: FULL_CHART_WIDTH, height: 380 }) }, item.metric));
|
|
178
|
+
}), userRows.length > 0 && ((0, jsx_runtime_1.jsxs)(ChartCard_1.ChartCard, { title: "\u6D3B\u8DC3\u7528\u6237", subtitle: "TOP USERS", accentClassName: "bg-emerald-500", caption: "\u8FDB\u5EA6\u6761\u6309\u5E73\u53F0\u5206\u8272\uFF0C\u989C\u8272 = \u8BE5\u7528\u6237\u5728\u8FD9\u4E2A\u7FA4\u91CC\u7684\u89E3\u6790\u6765\u81EA\u54EA\u4E2A\u5E73\u53F0\uFF1B\u53F3\u4FA7\u662F\u603B\u6B21\u6570", children: [(0, jsx_runtime_1.jsx)(RankList_1.RankList, { rows: userRows, dark: dark }), (0, jsx_runtime_1.jsx)(RankList_1.RankLegend, { platforms: (0, RankList_1.collectRankPlatforms)(userRows), dark: dark })] })), (0, jsx_runtime_1.jsx)("div", { className: "pt-6", children: (0, jsx_runtime_1.jsxs)("div", { className: "text-center", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-2xl font-mono tracking-widest text-muted mb-2", children: "TOTAL SERVICE" }), (0, jsx_runtime_1.jsxs)("div", { className: "text-3xl font-medium text-foreground/70", children: ["\u7D2F\u8BA1\u670D\u52A1 ", (0, jsx_runtime_1.jsx)("span", { className: "font-black text-foreground", children: (0, format_1.formatWithCommas)(data.globalTotalGroups) }), " \u4E2A\u7FA4\u7EC4 \u00B7 \u89E3\u6790", ' ', (0, jsx_runtime_1.jsx)("span", { className: "font-black text-foreground", children: (0, format_1.formatWithCommas)(data.globalTotalParses) }), " \u6B21"] })] }) })] })] }));
|
|
179
|
+
};
|
|
180
|
+
exports.GroupStatistics = GroupStatistics;
|
|
181
|
+
exports.default = exports.GroupStatistics;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const template_react_1 = require("../../../../compat/template-react.js");
|
|
4
|
+
const GroupStatistics_1 = require("./components/GroupStatistics");
|
|
5
|
+
exports.default = (0, template_react_1.defineTemplate)({
|
|
6
|
+
name: '群组统计',
|
|
7
|
+
description: '群组解析统计页面',
|
|
8
|
+
component: GroupStatistics_1.GroupStatistics
|
|
9
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
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.XiaohongshuComment = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const richtext_1 = require("../../../../../richtext");
|
|
9
|
+
const date_fns_1 = require("date-fns");
|
|
10
|
+
const locale_1 = require("date-fns/locale");
|
|
11
|
+
const lucide_react_1 = require("lucide-react");
|
|
12
|
+
const react_1 = __importDefault(require("react"));
|
|
13
|
+
const QRcode_1 = require("../../../../utils/QRcode");
|
|
14
|
+
const theme_1 = require("../../../../utils/theme");
|
|
15
|
+
const DefaultLayout_1 = require("../../../components/DefaultLayout");
|
|
16
|
+
const xiaohongshuMentionClassName = 'text-[#13386c] dark:text-[#c7daef]';
|
|
17
|
+
const renderXiaohongshuCommentRichText = (content) => {
|
|
18
|
+
return (0, richtext_1.renderRichTextToReact)(content, {
|
|
19
|
+
mention: { className: xiaohongshuMentionClassName }
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
const formatXiaohongshuCommentTime = (timestamp) => {
|
|
23
|
+
if (!timestamp) {
|
|
24
|
+
return '';
|
|
25
|
+
}
|
|
26
|
+
const commentDate = new Date(timestamp);
|
|
27
|
+
const diffSeconds = (0, date_fns_1.differenceInSeconds)(new Date(), commentDate);
|
|
28
|
+
if (diffSeconds < 30) {
|
|
29
|
+
return '刚刚';
|
|
30
|
+
}
|
|
31
|
+
if (diffSeconds < 7776000) {
|
|
32
|
+
return (0, date_fns_1.formatDistanceToNow)(commentDate, {
|
|
33
|
+
locale: locale_1.zhCN,
|
|
34
|
+
addSuffix: true
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return (0, date_fns_1.format)(commentDate, 'yyyy-MM-dd');
|
|
38
|
+
};
|
|
39
|
+
const formatXiaohongshuLikeCount = (count) => {
|
|
40
|
+
const numberCount = Number(count);
|
|
41
|
+
if (Number.isFinite(numberCount) && numberCount >= 10000) {
|
|
42
|
+
return `${(numberCount / 10000).toFixed(1)}w`;
|
|
43
|
+
}
|
|
44
|
+
return count || '0';
|
|
45
|
+
};
|
|
46
|
+
/**
|
|
47
|
+
* 笔记信息头部组件
|
|
48
|
+
* @param props 组件属性
|
|
49
|
+
* @returns JSX元素
|
|
50
|
+
*/
|
|
51
|
+
const NoteInfoHeader = (props) => {
|
|
52
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center max-w-300 mx-auto p-5", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col justify-center items-start", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex justify-start items-center", children: (0, jsx_runtime_1.jsx)("img", { src: "/image/xiaohongshu/logo.png", alt: "\u5C0F\u7EA2\u4E66Logo", className: "object-contain mb-20 max-w-full max-h-full scale-180 ml-15", onError: (e) => {
|
|
53
|
+
const target = e.target;
|
|
54
|
+
target.style.display = 'none';
|
|
55
|
+
const parent = target.parentElement;
|
|
56
|
+
if (parent) {
|
|
57
|
+
parent.innerHTML = '<div class="flex justify-start items-center h-full text-2xl font-bold text-foreground/70">小红书</div>';
|
|
58
|
+
}
|
|
59
|
+
} }) }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-8 space-y-4 text-left text-muted", children: [(0, jsx_runtime_1.jsxs)("div", { className: "tracking-[6px] text-[45px] select-text", children: ["\u7B14\u8BB0\u7C7B\u578B\uFF1A", props.Type] }), (0, jsx_runtime_1.jsxs)("div", { className: "tracking-[6px] text-[45px] select-text", children: ["\u8BC4\u8BBA\u6570\u91CF\uFF1A", props.CommentLength, "\u6761"] }), props.Type === '图文' && props.ImageLength && ((0, jsx_runtime_1.jsxs)("div", { className: "tracking-[6px] text-[45px] select-text", children: ["\u56FE\u7247\u6570\u91CF\uFF1A", props.ImageLength, "\u5F20"] }))] })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex flex-col justify-center items-center p-5", children: [(0, jsx_runtime_1.jsx)("div", { className: "flex overflow-hidden justify-center items-center bg-white w-110 h-110", children: (0, jsx_runtime_1.jsx)("img", { src: (0, QRcode_1.generateQRCode)(props.share_url, props.useDarkTheme), alt: "\u4E8C\u7EF4\u7801", className: "object-contain" }) }), (0, jsx_runtime_1.jsx)("p", { className: "mt-5 text-[40px] text-muted text-center", children: "\u626B\u7801\u67E5\u770B\u539F\u7B14\u8BB0" })] })] }));
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* 单个评论组件
|
|
63
|
+
* @param props 组件属性
|
|
64
|
+
* @returns JSX元素
|
|
65
|
+
*/
|
|
66
|
+
const CommentItemComponent = ({ ...props }, isLast = false) => {
|
|
67
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: `flex px-10 pt-15 ${isLast ? 'pb-0' : 'pb-15'}`, children: [(0, jsx_runtime_1.jsx)("img", { src: props.user_info.image, className: "mb-12.5 w-[187.5px] h-[187.5px] rounded-full mr-8 object-cover shadow-lg", alt: "\u7528\u6237\u5934\u50CF" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1", children: [(0, jsx_runtime_1.jsxs)("div", { className: "mb-12.5 text-[50px] text-foreground/70 relative flex items-center select-text", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-5xl", children: props.user_info.nickname }), props.show_tags &&
|
|
68
|
+
props.show_tags.length > 0 &&
|
|
69
|
+
props.show_tags.map((tag, index) => {
|
|
70
|
+
if (tag === 'is_author') {
|
|
71
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "inline-block px-6 py-3 ml-3 text-4xl rounded-full bg-surface text-muted", children: "\u4F5C\u8005" }, index));
|
|
72
|
+
}
|
|
73
|
+
else if (tag === 'user_top') {
|
|
74
|
+
return ((0, jsx_runtime_1.jsx)("div", { className: "inline-block px-6 py-3 rounded-full ml-3 text-4xl bg-[#ff2e4d0f] text-[#ff2e4d]", children: "\u7F6E\u9876\u8BC4\u8BBA" }, index));
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
})] }), (0, jsx_runtime_1.jsx)("div", { className: "text-[60px] text-foreground leading-relaxed mb-2 whitespace-pre-wrap select-text", style: {
|
|
80
|
+
wordBreak: 'break-word',
|
|
81
|
+
overflowWrap: 'break-word'
|
|
82
|
+
}, children: renderXiaohongshuCommentRichText(props.content) }), props.pictures && props.pictures.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "flex my-5 overflow-hidden shadow-md rounded-2xl w-[95%] flex-1", children: (0, jsx_runtime_1.jsx)("img", { className: "object-contain w-full h-full rounded-2xl", src: props.pictures[0].url_default, alt: "\u8BC4\u8BBA\u56FE\u7247" }) })), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center mt-6 text-muted", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center space-x-6 select-text", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-[45px]", children: formatXiaohongshuCommentTime(props.create_time) }), (0, jsx_runtime_1.jsx)("span", { className: "text-[45px]", children: props.ip_location }), parseInt(props.sub_comment_count) > 0 ? ((0, jsx_runtime_1.jsxs)("span", { className: "text-[40px] text-foreground/70", children: ["\u5171", props.sub_comment_count, "\u6761\u56DE\u590D"] })) : ((0, jsx_runtime_1.jsx)("span", { className: "text-[40px] text-foreground/70", children: "\u56DE\u590D" }))] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center space-x-6", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center space-x-2 transition-colors cursor-pointer", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Heart, { size: 60, className: props.liked ? 'text-red-500 fill-current' : 'text-muted' }), (0, jsx_runtime_1.jsx)("span", { className: "text-[50px] select-text", children: formatXiaohongshuLikeCount(props.like_count) })] }), (0, jsx_runtime_1.jsx)("div", { className: "flex items-center transition-colors cursor-pointer", children: (0, jsx_runtime_1.jsx)(lucide_react_1.MessageCircle, { size: 60, className: "stroke-current text-muted" }) })] })] }), props.sub_comments && props.sub_comments.length > 0 && ((0, jsx_runtime_1.jsx)("div", { className: "pl-6 mt-6", children: props.sub_comments.map((subComment, index) => ((0, jsx_runtime_1.jsx)("div", { className: `py-4 ${index !== props.sub_comments.length - 1 ? 'border-b border-divider' : ''}`, children: (0, jsx_runtime_1.jsxs)("div", { className: "flex items-start space-x-4", children: [(0, jsx_runtime_1.jsx)("img", { src: subComment.user_info.image, className: "object-cover mr-8 w-32 h-32 rounded-full", alt: "\u7528\u6237\u5934\u50CF" }), (0, jsx_runtime_1.jsxs)("div", { className: "flex-1", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center mb-2 space-x-2", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-[40px] font-medium text-foreground/70", children: subComment.user_info.nickname }), subComment.show_tags &&
|
|
83
|
+
subComment.show_tags.length > 0 &&
|
|
84
|
+
subComment.show_tags.map((tag, tagIndex) => tag === 'is_author' ? ((0, jsx_runtime_1.jsx)("div", { className: "inline-block px-5 py-2 ml-2 text-3xl rounded-full bg-surface text-muted", children: "\u4F5C\u8005" }, tagIndex)) : null)] }), (0, jsx_runtime_1.jsx)("div", { className: "text-[45px] text-foreground leading-relaxed mb-2 whitespace-pre-wrap select-text", style: {
|
|
85
|
+
wordBreak: 'break-word',
|
|
86
|
+
overflowWrap: 'break-word'
|
|
87
|
+
}, children: (0, richtext_1.renderRichTextToReact)(subComment.content, {
|
|
88
|
+
mention: { className: xiaohongshuMentionClassName }
|
|
89
|
+
}) }), (0, jsx_runtime_1.jsxs)("div", { className: "flex justify-between items-center text-muted", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center space-x-4", children: [(0, jsx_runtime_1.jsx)("span", { className: "text-[35px]", children: formatXiaohongshuCommentTime(subComment.create_time) }), (0, jsx_runtime_1.jsx)("span", { className: "text-[35px]", children: subComment.ip_location })] }), (0, jsx_runtime_1.jsxs)("div", { className: "flex items-center space-x-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Heart, { size: 40, className: subComment.liked ? 'text-red-500 fill-current' : 'text-muted' }), (0, jsx_runtime_1.jsx)("span", { className: "text-[35px]", children: formatXiaohongshuLikeCount(subComment.like_count) })] })] })] })] }) }, subComment.id))) }))] })] }));
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* 小红书评论组件
|
|
93
|
+
* @param props 组件属性
|
|
94
|
+
* @returns JSX元素
|
|
95
|
+
*/
|
|
96
|
+
exports.XiaohongshuComment = react_1.default.memo((props) => {
|
|
97
|
+
return ((0, jsx_runtime_1.jsxs)(DefaultLayout_1.DefaultLayout, { ...props, children: [(0, jsx_runtime_1.jsx)("div", { className: "h-30" }), (0, jsx_runtime_1.jsx)(NoteInfoHeader, { ...props.data, useDarkTheme: (0, theme_1.isDark)(props.ctx) }), (0, jsx_runtime_1.jsx)("div", { className: "overflow-auto mx-20 max-w-full", children: props.data.CommentsData.length > 0 ? ((0, jsx_runtime_1.jsx)("div", { className: "divide-y divide-divider", children: props.data.CommentsData.map((comment, index) => ((0, jsx_runtime_1.jsx)(CommentItemComponent, { ...comment, isLast: index === props.data.CommentsData.length - 1 }, comment.id))) })) : ((0, jsx_runtime_1.jsx)("div", { className: "flex justify-center items-center py-20", children: (0, jsx_runtime_1.jsx)("p", { className: "text-[60px] text-muted", children: props.data.ErrorText ?? '暂无评论' }) })) })] }));
|
|
98
|
+
});
|
|
99
|
+
exports.default = exports.XiaohongshuComment;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const template_react_1 = require("../../../../compat/template-react.js");
|
|
4
|
+
const Comment_1 = require("./components/Comment");
|
|
5
|
+
exports.default = (0, template_react_1.defineTemplate)({
|
|
6
|
+
name: '评论列表',
|
|
7
|
+
description: '小红书评论列表展示模板',
|
|
8
|
+
component: Comment_1.XiaohongshuComment
|
|
9
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
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.XiaohongshuNoteInfo = void 0;
|
|
7
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
8
|
+
const richtext_1 = require("../../../../../richtext");
|
|
9
|
+
const react_1 = require("../../../../../compat/phosphor-icons.js");
|
|
10
|
+
const date_fns_1 = require("date-fns");
|
|
11
|
+
const lucide_react_1 = require("lucide-react");
|
|
12
|
+
const react_2 = __importDefault(require("react"));
|
|
13
|
+
const theme_1 = require("../../../../utils/theme");
|
|
14
|
+
const AmbientCover_1 = require("../../../components/AmbientCover");
|
|
15
|
+
const DefaultLayout_1 = require("../../../components/DefaultLayout");
|
|
16
|
+
const QRCodeWithAvatar_1 = require("../../../components/QRCodeWithAvatar");
|
|
17
|
+
/** 小红书品牌红:整图唯一强调色,只用于点赞图标与头像描边 */
|
|
18
|
+
const XHS_RED = '#FF2442';
|
|
19
|
+
const xiaohongshuNoteMentionClassName = 'text-[#13386c] dark:text-[#c7daef]';
|
|
20
|
+
/**
|
|
21
|
+
* 格式化互动数:纯数字串过万缩写为 x.x万;API 已格式化的「5.7万」等原样返回
|
|
22
|
+
* @param num 数字
|
|
23
|
+
* @returns 格式化后的字符串
|
|
24
|
+
*/
|
|
25
|
+
const formatNumber = (num) => {
|
|
26
|
+
if (typeof num === 'string' && !/^\d+$/.test(num.trim()))
|
|
27
|
+
return num || '0';
|
|
28
|
+
const numValue = typeof num === 'string' ? parseInt(num, 10) : num;
|
|
29
|
+
if (!Number.isFinite(numValue))
|
|
30
|
+
return String(num) || '0';
|
|
31
|
+
if (numValue >= 10000) {
|
|
32
|
+
return `${(numValue / 10000).toFixed(1)}万`;
|
|
33
|
+
}
|
|
34
|
+
return numValue.toLocaleString();
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* 全局氛围背景层:弥散渐变封面 + 高对比杂色纹理。
|
|
38
|
+
* 与抖音/B站同一套骨架,噪点集中在上下两端、中间让位给正文。
|
|
39
|
+
*/
|
|
40
|
+
const NoteDiffuseBackground = ({ data, ctx }) => ((0, jsx_runtime_1.jsxs)("div", { className: "pointer-events-none absolute inset-0 overflow-hidden select-none", children: [(0, jsx_runtime_1.jsx)(AmbientCover_1.AmbientCover, { src: data.image_url, ctx: ctx }), (0, jsx_runtime_1.jsx)("div", { className: "absolute inset-0 opacity-[0.4] 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: "xhsNoteNoise", 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.5", intercept: "-0.6" }) })] }), (0, jsx_runtime_1.jsxs)("mask", { id: "xhsNoteNoiseMask", children: [(0, jsx_runtime_1.jsxs)("linearGradient", { id: "xhsNoteNoiseGradient", x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [(0, jsx_runtime_1.jsx)("stop", { offset: "0%", stopColor: "white", stopOpacity: "0.85" }), (0, jsx_runtime_1.jsx)("stop", { offset: "25%", stopColor: "white", stopOpacity: "0.4" }), (0, jsx_runtime_1.jsx)("stop", { offset: "50%", stopColor: "white", stopOpacity: "0.08" }), (0, jsx_runtime_1.jsx)("stop", { offset: "75%", stopColor: "white", stopOpacity: "0.4" }), (0, jsx_runtime_1.jsx)("stop", { offset: "100%", stopColor: "white", stopOpacity: "0.85" })] }), (0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", fill: "url(#xhsNoteNoiseGradient)" })] })] }), (0, jsx_runtime_1.jsx)("rect", { width: "100%", height: "100%", filter: "url(#xhsNoteNoise)", mask: "url(#xhsNoteNoiseMask)", fill: "white" })] }) })] }));
|
|
41
|
+
/**
|
|
42
|
+
* 顶部系统标签行:海报式技术标签 + 笔记 ID,替代平台 Logo 的顶部占位
|
|
43
|
+
*/
|
|
44
|
+
const NoteSystemLabel = ({ data }) => ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center justify-between", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-4", children: [(0, jsx_runtime_1.jsx)("span", { className: "h-8 w-2 rounded-full", style: { backgroundColor: XHS_RED } }), (0, jsx_runtime_1.jsx)("span", { className: "text-[26px] font-bold tracking-[0.3em] uppercase text-foreground/60", children: "Xiaohongshu Note" })] }), (0, jsx_runtime_1.jsxs)("span", { className: "font-mono text-[26px] text-foreground/40 select-text", children: ["ID: ", data.note_id] })] }));
|
|
45
|
+
/**
|
|
46
|
+
* 笔记封面:官方分享长图的干净大图样式,圆角 + 大投影,不做溶解遮罩。
|
|
47
|
+
* 图集在右下角堆叠预览后续图片,超出部分以 +N 收尾;视频笔记改为白色半透明播放图标。
|
|
48
|
+
*/
|
|
49
|
+
const NoteCover = ({ data }) => {
|
|
50
|
+
const images = data.image_list?.length ? data.image_list : [data.image_url];
|
|
51
|
+
const previewImages = data.is_video ? [] : images.slice(1, 4).filter(Boolean);
|
|
52
|
+
const remainingPreviewCount = Math.max(images.length - previewImages.length - 1, 0);
|
|
53
|
+
return ((0, jsx_runtime_1.jsxs)("section", { className: "relative mt-12 overflow-hidden rounded-[3rem] shadow-2xl", children: [(0, jsx_runtime_1.jsx)("img", { src: data.image_url, alt: data.title || '小红书笔记封面', className: "block h-auto w-full object-cover", referrerPolicy: "no-referrer", crossOrigin: "anonymous" }), data.is_video && ((0, jsx_runtime_1.jsx)(react_1.PlayIcon, { size: 104, weight: "fill", "aria-label": "\u89C6\u9891\u7B14\u8BB0", className: "absolute right-10 bottom-10 z-10 text-white/50" })), previewImages.length > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "absolute right-10 bottom-10 z-10 flex items-center -space-x-5 drop-shadow-2xl", children: [previewImages.map((url, index) => ((0, jsx_runtime_1.jsx)("img", { src: url, alt: "\u56FE\u96C6\u9884\u89C8", className: "h-28 w-28 rounded-3xl object-cover ring-2 ring-white/25", style: { transform: `rotate(${(index - 1) * 8}deg)` }, referrerPolicy: "no-referrer", crossOrigin: "anonymous" }, `${url}-${index}`))), remainingPreviewCount > 0 && ((0, jsx_runtime_1.jsxs)("div", { className: "flex h-28 w-28 items-center justify-center rounded-3xl bg-black/50 px-5 text-[32px] font-black text-white ring-2 ring-white/25 backdrop-blur-xs", children: ["+", remainingPreviewCount] }))] }))] }));
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* 作者行:官方长图位置(封面之后、标题之前),头像带品牌红描边
|
|
57
|
+
*/
|
|
58
|
+
const NoteAuthorRow = ({ data }) => ((0, jsx_runtime_1.jsxs)("section", { className: "mt-14 flex items-center gap-6", children: [(0, jsx_runtime_1.jsx)("img", { src: data.author.avatar, alt: data.author.nickname, className: "h-28 w-28 shrink-0 rounded-full border-4 object-cover shadow-xl", style: { borderColor: `${XHS_RED}33` }, referrerPolicy: "no-referrer", crossOrigin: "anonymous" }), (0, jsx_runtime_1.jsxs)("div", { className: "min-w-0", children: [(0, jsx_runtime_1.jsx)("div", { className: "max-w-200 truncate text-[52px] font-black leading-tight text-foreground select-text", children: data.author.nickname }), (0, jsx_runtime_1.jsxs)("div", { className: "mt-3 flex flex-wrap items-center gap-x-6 gap-y-2 text-[30px] text-muted", children: [(0, jsx_runtime_1.jsxs)("span", { className: "inline-flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.Calendar, { size: 28 }), (0, jsx_runtime_1.jsx)("span", { className: "select-text", children: (0, date_fns_1.format)(new Date(data.time), 'yyyy-MM-dd HH:mm') })] }), data.ip_location && ((0, jsx_runtime_1.jsxs)("span", { className: "inline-flex items-center gap-2", children: [(0, jsx_runtime_1.jsx)(lucide_react_1.MapPin, { size: 28 }), (0, jsx_runtime_1.jsx)("span", { className: "select-text", children: data.ip_location })] }))] })] })] }));
|
|
59
|
+
/**
|
|
60
|
+
* 标题与正文:标题是唯一大字层级,正文降为次级明度
|
|
61
|
+
*/
|
|
62
|
+
const NoteContent = ({ data }) => ((0, jsx_runtime_1.jsxs)("section", { className: "mt-10", children: [data.title && ((0, jsx_runtime_1.jsx)("h1", { className: "text-[68px] font-black leading-[1.2] tracking-tight text-foreground select-text", style: { wordBreak: 'break-word', overflowWrap: 'break-word' }, children: data.title })), (0, jsx_runtime_1.jsx)("div", { className: "mt-8 whitespace-pre-wrap text-[42px] font-medium leading-[1.55] text-foreground/80 select-text", style: { wordBreak: 'break-word', overflowWrap: 'break-word' }, children: (0, richtext_1.renderRichTextToReact)(data.desc, {
|
|
63
|
+
mention: { className: xiaohongshuNoteMentionClassName }
|
|
64
|
+
}) })] }));
|
|
65
|
+
/**
|
|
66
|
+
* 互动数据行:大数字做视觉锚点,只有点赞用心红,其余中性色
|
|
67
|
+
*/
|
|
68
|
+
const NoteStatsRow = ({ data }) => {
|
|
69
|
+
const stats = [
|
|
70
|
+
{ icon: lucide_react_1.Heart, value: data.statistics.liked_count, label: '点赞', accent: true },
|
|
71
|
+
{ icon: lucide_react_1.MessageCircle, value: data.statistics.comment_count, label: '评论', accent: false },
|
|
72
|
+
{ icon: lucide_react_1.Star, value: data.statistics.collected_count, label: '收藏', accent: false },
|
|
73
|
+
{ icon: lucide_react_1.Share2, value: data.statistics.share_count, label: '分享', accent: false }
|
|
74
|
+
];
|
|
75
|
+
return ((0, jsx_runtime_1.jsx)("section", { className: "mt-14 flex flex-wrap items-end gap-x-20 gap-y-8", children: stats.map((stat) => {
|
|
76
|
+
const Icon = stat.icon;
|
|
77
|
+
return ((0, jsx_runtime_1.jsxs)("div", { className: "min-w-40", children: [(0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-3 text-[28px] font-semibold text-muted", children: [(0, jsx_runtime_1.jsx)(Icon, { size: 36, strokeWidth: 2.2, style: stat.accent ? { color: XHS_RED, fill: XHS_RED } : undefined, className: stat.accent ? undefined : 'text-foreground/70' }), (0, jsx_runtime_1.jsx)("span", { children: stat.label })] }), (0, jsx_runtime_1.jsx)("div", { className: "mt-3 text-[64px] font-black leading-none text-foreground tabular-nums select-text", children: formatNumber(stat.value) })] }, stat.label));
|
|
78
|
+
}) }));
|
|
79
|
+
};
|
|
80
|
+
/**
|
|
81
|
+
* 底部行动条:官方长图的小红书 Logo + 二维码收尾
|
|
82
|
+
*/
|
|
83
|
+
const NoteFooter = ({ data, ctx }) => ((0, jsx_runtime_1.jsx)("footer", { className: "mt-16", children: (0, jsx_runtime_1.jsxs)("div", { className: "mt-12 flex items-center justify-between gap-16", children: [(0, jsx_runtime_1.jsx)("img", { src: "/image/xiaohongshu/logo.png", alt: "\u5C0F\u7EA2\u4E66", className: "h-16 w-auto shrink-0 object-contain opacity-90" }), data.share_url && ((0, jsx_runtime_1.jsxs)("div", { className: "flex items-center gap-8", children: [(0, jsx_runtime_1.jsxs)("div", { className: "text-right", children: [(0, jsx_runtime_1.jsx)("div", { className: "text-[32px] font-black text-foreground", children: "\u626B\u7801\u67E5\u770B\u539F\u7B14\u8BB0" }), (0, jsx_runtime_1.jsx)("div", { className: "mt-2 text-[26px] text-muted", children: "\u957F\u6309\u8BC6\u522B\u4E8C\u7EF4\u7801" })] }), (0, jsx_runtime_1.jsx)("div", { className: "shrink-0 drop-shadow-2xl", children: (0, jsx_runtime_1.jsx)(QRCodeWithAvatar_1.QRCodeWithAvatar, { value: data.share_url, useDarkTheme: (0, theme_1.isDark)(ctx), alt: "\u7B14\u8BB0\u4E8C\u7EF4\u7801", className: "h-60 w-60" }) })] }))] }) }));
|
|
84
|
+
/**
|
|
85
|
+
* 小红书笔记信息组件
|
|
86
|
+
* @param props 组件属性
|
|
87
|
+
* @returns JSX元素
|
|
88
|
+
*/
|
|
89
|
+
exports.XiaohongshuNoteInfo = react_2.default.memo((props) => {
|
|
90
|
+
return ((0, jsx_runtime_1.jsxs)(DefaultLayout_1.DefaultLayout, { ...props, className: "relative overflow-hidden", children: [(0, jsx_runtime_1.jsx)(NoteDiffuseBackground, { ...props }), (0, jsx_runtime_1.jsxs)("section", { className: "relative z-10 px-20 pt-16", children: [(0, jsx_runtime_1.jsx)(NoteSystemLabel, { ...props }), (0, jsx_runtime_1.jsx)(NoteCover, { ...props }), (0, jsx_runtime_1.jsx)(NoteAuthorRow, { ...props }), (0, jsx_runtime_1.jsx)(NoteContent, { ...props }), (0, jsx_runtime_1.jsx)(NoteStatsRow, { ...props }), (0, jsx_runtime_1.jsx)(NoteFooter, { ...props })] })] }));
|
|
91
|
+
});
|
|
92
|
+
exports.XiaohongshuNoteInfo.displayName = 'XiaohongshuNoteInfo';
|
|
93
|
+
exports.default = exports.XiaohongshuNoteInfo;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const template_react_1 = require("../../../../compat/template-react.js");
|
|
4
|
+
const noteInfo_1 = require("./components/noteInfo");
|
|
5
|
+
exports.default = (0, template_react_1.defineTemplate)({
|
|
6
|
+
name: '笔记信息',
|
|
7
|
+
description: '小红书笔记信息展示模板',
|
|
8
|
+
component: noteInfo_1.XiaohongshuNoteInfo
|
|
9
|
+
});
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.loadQRCodeAvatar = void 0;
|
|
4
|
+
const avatarProxy_1 = require("./avatarProxy");
|
|
5
|
+
const MAX_QRCODE_AVATAR_BYTES = 2 * 1024 * 1024;
|
|
6
|
+
const QRCODE_AVATAR_TIMEOUT_MS = 5000;
|
|
7
|
+
const QRCODE_AVATAR_CACHE_SIZE = 128;
|
|
8
|
+
const SUPPORTED_QRCODE_AVATAR_TYPES = new Set(['image/png', 'image/jpeg', 'image/webp']);
|
|
9
|
+
const avatarRequestCache = new Map();
|
|
10
|
+
const isSupportedImageBytes = (image) => {
|
|
11
|
+
const isPng = image.byteLength >= 8 &&
|
|
12
|
+
image[0] === 0x89 &&
|
|
13
|
+
image[1] === 0x50 &&
|
|
14
|
+
image[2] === 0x4e &&
|
|
15
|
+
image[3] === 0x47 &&
|
|
16
|
+
image[4] === 0x0d &&
|
|
17
|
+
image[5] === 0x0a &&
|
|
18
|
+
image[6] === 0x1a &&
|
|
19
|
+
image[7] === 0x0a;
|
|
20
|
+
const isJpeg = image.byteLength >= 3 && image[0] === 0xff && image[1] === 0xd8 && image[2] === 0xff;
|
|
21
|
+
const isWebp = image.byteLength >= 12 &&
|
|
22
|
+
image[0] === 0x52 &&
|
|
23
|
+
image[1] === 0x49 &&
|
|
24
|
+
image[2] === 0x46 &&
|
|
25
|
+
image[3] === 0x46 &&
|
|
26
|
+
image[8] === 0x57 &&
|
|
27
|
+
image[9] === 0x45 &&
|
|
28
|
+
image[10] === 0x42 &&
|
|
29
|
+
image[11] === 0x50;
|
|
30
|
+
return isPng || isJpeg || isWebp;
|
|
31
|
+
};
|
|
32
|
+
const requestAvatarBytes = async (url) => {
|
|
33
|
+
try {
|
|
34
|
+
const response = await fetch(url, {
|
|
35
|
+
headers: {
|
|
36
|
+
accept: 'image/png,image/jpeg,image/webp,image/*;q=0.8,*/*;q=0.5'
|
|
37
|
+
},
|
|
38
|
+
signal: AbortSignal.timeout(QRCODE_AVATAR_TIMEOUT_MS)
|
|
39
|
+
});
|
|
40
|
+
if (!response.ok)
|
|
41
|
+
return undefined;
|
|
42
|
+
const declaredLength = Number(response.headers.get('content-length') ?? 0);
|
|
43
|
+
if (declaredLength > MAX_QRCODE_AVATAR_BYTES)
|
|
44
|
+
return undefined;
|
|
45
|
+
const contentType = response.headers.get('content-type')?.split(';', 1)[0]?.trim().toLowerCase();
|
|
46
|
+
const image = new Uint8Array(await response.arrayBuffer());
|
|
47
|
+
if (image.byteLength === 0 || image.byteLength > MAX_QRCODE_AVATAR_BYTES)
|
|
48
|
+
return undefined;
|
|
49
|
+
if (contentType && SUPPORTED_QRCODE_AVATAR_TYPES.has(contentType))
|
|
50
|
+
return image;
|
|
51
|
+
return isSupportedImageBytes(image) ? image : undefined;
|
|
52
|
+
}
|
|
53
|
+
catch {
|
|
54
|
+
return undefined;
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* 依次尝试的取图地址。
|
|
59
|
+
*
|
|
60
|
+
* 浏览器(只有 ktr 开发面板会走到)里头像 CDN 多半缺 CORS 头,直连必被同源策略拦,
|
|
61
|
+
* 所以优先走 dev 服务器的同源代理,代理不在(如面板未启动)时再退回直连。
|
|
62
|
+
* Node SSR 侧没有同源策略,始终直连。
|
|
63
|
+
*/
|
|
64
|
+
const avatarCandidates = (url) => {
|
|
65
|
+
if (typeof window === 'undefined' || !(0, avatarProxy_1.isProxyableAvatarUrl)(url))
|
|
66
|
+
return [url];
|
|
67
|
+
return [(0, avatarProxy_1.toProxiedAvatarUrl)(url), url];
|
|
68
|
+
};
|
|
69
|
+
const fetchQRCodeAvatar = async (url) => {
|
|
70
|
+
for (const candidate of avatarCandidates(url)) {
|
|
71
|
+
const image = await requestAvatarBytes(candidate);
|
|
72
|
+
if (image)
|
|
73
|
+
return image;
|
|
74
|
+
}
|
|
75
|
+
return undefined;
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* 加载并缓存二维码头像。同一头像的并发渲染会复用请求,失败结果不会进入缓存。
|
|
79
|
+
*/
|
|
80
|
+
const loadQRCodeAvatar = (url) => {
|
|
81
|
+
if (!url || !/^https?:\/\//i.test(url))
|
|
82
|
+
return Promise.resolve(undefined);
|
|
83
|
+
const cached = avatarRequestCache.get(url);
|
|
84
|
+
if (cached)
|
|
85
|
+
return cached;
|
|
86
|
+
if (avatarRequestCache.size >= QRCODE_AVATAR_CACHE_SIZE) {
|
|
87
|
+
const oldestKey = avatarRequestCache.keys().next().value;
|
|
88
|
+
if (oldestKey)
|
|
89
|
+
avatarRequestCache.delete(oldestKey);
|
|
90
|
+
}
|
|
91
|
+
const request = fetchQRCodeAvatar(url);
|
|
92
|
+
avatarRequestCache.set(url, request);
|
|
93
|
+
void request.then((image) => {
|
|
94
|
+
if (!image)
|
|
95
|
+
avatarRequestCache.delete(url);
|
|
96
|
+
});
|
|
97
|
+
return request;
|
|
98
|
+
};
|
|
99
|
+
exports.loadQRCodeAvatar = loadQRCodeAvatar;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.generateQRCode = exports.hasQrcodeGenerator = exports.setQrcodeGenerator = void 0;
|
|
4
|
+
let generateSyncImpl;
|
|
5
|
+
/** 由渲染入口在 SSR 之前注入(见 module/utils/Render/index.ts) */
|
|
6
|
+
const setQrcodeGenerator = (impl) => {
|
|
7
|
+
generateSyncImpl = impl;
|
|
8
|
+
};
|
|
9
|
+
exports.setQrcodeGenerator = setQrcodeGenerator;
|
|
10
|
+
/** 生成器是否已就绪 */
|
|
11
|
+
const hasQrcodeGenerator = () => typeof generateSyncImpl === 'function';
|
|
12
|
+
exports.hasQrcodeGenerator = hasQrcodeGenerator;
|
|
13
|
+
/**
|
|
14
|
+
* Generates a QR code image in base64 format for the given text.
|
|
15
|
+
*
|
|
16
|
+
* @param {string} text - The text to encode in the QR code.
|
|
17
|
+
* @param {boolean} [useDarkTheme=false] - Whether to use a dark theme for the QR code.
|
|
18
|
+
* @param {Uint8Array} [image] - Optional binary logo image embedded in the center of the QR code.
|
|
19
|
+
* @return {string} The base64-encoded QR code image.
|
|
20
|
+
*/
|
|
21
|
+
const generateQRCode = (text, useDarkTheme = false, image) => {
|
|
22
|
+
if (typeof generateSyncImpl !== 'function') {
|
|
23
|
+
throw new Error('二维码生成器未初始化(@ikenxuan/qrcode 未加载)');
|
|
24
|
+
}
|
|
25
|
+
const hasImage = Boolean(image?.byteLength);
|
|
26
|
+
const base64 = generateSyncImpl({
|
|
27
|
+
data: text,
|
|
28
|
+
size: 1000,
|
|
29
|
+
dotsOptions: {
|
|
30
|
+
dotType: 'extra-rounded',
|
|
31
|
+
color: useDarkTheme ? 'rgba(255, 255, 255, 0.9)' : 'rgba(0, 0, 0, 0.8)'
|
|
32
|
+
},
|
|
33
|
+
cornersSquareOptions: {
|
|
34
|
+
cornerType: 'dot',
|
|
35
|
+
color: useDarkTheme ? 'rgba(255, 255, 255, 0.9)' : 'rgba(0, 0, 0, 0.8)'
|
|
36
|
+
},
|
|
37
|
+
cornersDotOptions: {
|
|
38
|
+
cornerType: 'dot',
|
|
39
|
+
color: useDarkTheme ? 'rgba(255, 255, 255, 0.9)' : 'rgba(0, 0, 0, 0.8)'
|
|
40
|
+
},
|
|
41
|
+
backgroundOptions: {
|
|
42
|
+
transparent: true
|
|
43
|
+
},
|
|
44
|
+
image: hasImage ? image : undefined,
|
|
45
|
+
imageOptions: hasImage
|
|
46
|
+
? {
|
|
47
|
+
imageSize: 0.2,
|
|
48
|
+
margin: 24,
|
|
49
|
+
round: 0.2,
|
|
50
|
+
hideBackgroundDots: true
|
|
51
|
+
}
|
|
52
|
+
: undefined
|
|
53
|
+
}, 'webp', 'base64');
|
|
54
|
+
return `data:image/webp;base64,${base64}`;
|
|
55
|
+
};
|
|
56
|
+
exports.generateQRCode = generateQRCode;
|