@lf_maple/koishi-plugin-phi-plugin-full 0.1.80
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/LICENSE +22 -0
- package/core/.github/ISSUE_TEMPLATE/bug.yaml +133 -0
- package/core/.github/ISSUE_TEMPLATE/config.yml +1 -0
- package/core/.github/ISSUE_TEMPLATE/enhancement.yml +44 -0
- package/core/.vscode/c_cpp_properties.json +18 -0
- package/core/.vscode/launch.json +24 -0
- package/core/.vscode/settings.json +59 -0
- package/core/CHANGELOG.md +184 -0
- package/core/LICENSE +674 -0
- package/core/README.md +330 -0
- package/core/README_en.md +285 -0
- package/core/apps/Dan.js +129 -0
- package/core/apps/RankList.js +322 -0
- package/core/apps/aliasProposal.js +223 -0
- package/core/apps/apiSetting.js +592 -0
- package/core/apps/b19.js +1329 -0
- package/core/apps/botClient.js +64 -0
- package/core/apps/chart.js +692 -0
- package/core/apps/guessGame/guessIll.js +821 -0
- package/core/apps/guessGame/guessLetter.js +831 -0
- package/core/apps/guessGame/guessTips.js +254 -0
- package/core/apps/guessGame/letterGameUtils.js +74 -0
- package/core/apps/guessGame.js +214 -0
- package/core/apps/help.js +117 -0
- package/core/apps/manage.js +288 -0
- package/core/apps/market.js +243 -0
- package/core/apps/money.js +1064 -0
- package/core/apps/phisong.js +1418 -0
- package/core/apps/session.js +664 -0
- package/core/apps/setting.js +468 -0
- package/core/apps/update.js +541 -0
- package/core/apps/user.js +968 -0
- package/core/components/Config.js +249 -0
- package/core/components/Data.js +304 -0
- package/core/components/FileWatcherRegistry.js +102 -0
- package/core/components/Logger.js +11 -0
- package/core/components/ProcessCleanup.js +113 -0
- package/core/components/Version.js +56 -0
- package/core/components/YamlReader.js +157 -0
- package/core/components/baseClass.js +287 -0
- package/core/components/common.js +47 -0
- package/core/components/index.js +13 -0
- package/core/components/platform/index.js +79 -0
- package/core/components/platform/koishi.js +800 -0
- package/core/components/platform/koishiDatabaseRedis.js +391 -0
- package/core/components/platform/memoryRedis.js +209 -0
- package/core/components/platform/types.d.ts +272 -0
- package/core/components/platform/yunzai.js +604 -0
- package/core/components/segment.js +4 -0
- package/core/config/config//350/277/231/351/207/214/346/230/257/351/205/215/347/275/256/346/226/207/344/273/266/347/233/256/345/275/225.txt +0 -0
- package/core/config/default_config/banGroup.yaml +14 -0
- package/core/config/default_config/config.yaml +159 -0
- package/core/config/default_config/nickconfig.yaml +6 -0
- package/core/config/default_config/otherinfo.yaml +51 -0
- package/core/guoba.support.js +597 -0
- package/core/index.js +85 -0
- package/core/lib/AES.js +40 -0
- package/core/lib/Base64.js +22 -0
- package/core/lib/ByteReader.js +168 -0
- package/core/lib/GameProgress.js +37 -0
- package/core/lib/GameRecord.js +47 -0
- package/core/lib/GameSettings.js +24 -0
- package/core/lib/GameUser.js +19 -0
- package/core/lib/Level.js +6 -0
- package/core/lib/LevelRecord.js +9 -0
- package/core/lib/PhigrosUser.js +135 -0
- package/core/lib/SaveManager.js +117 -0
- package/core/lib/Summary.js +47 -0
- package/core/lib/TapTap/CompleteQRCodeData.js +27 -0
- package/core/lib/TapTap/LCHelper.js +81 -0
- package/core/lib/TapTap/TapTapHelper.js +170 -0
- package/core/lib/TapTap/getQRcode.js +61 -0
- package/core/lib/Util.js +30 -0
- package/core/lib/getQRcode.js +73 -0
- package/core/lib/http.js +105 -0
- package/core/model/README.md +3 -0
- package/core/model/api/aliasProposalService.js +151 -0
- package/core/model/api/apiVersion.js +67 -0
- package/core/model/api/autoSeekApi.js +165 -0
- package/core/model/api/botApiAuth.js +208 -0
- package/core/model/api/botSyncService.js +78 -0
- package/core/model/api/gameRecordPayload.js +24 -0
- package/core/model/api/makeRequest.js +1004 -0
- package/core/model/api/makeRequestFnc.js +17 -0
- package/core/model/api/phiApiClient.js +53 -0
- package/core/model/api/phiApiErrors.js +121 -0
- package/core/model/filesystem/getFile.js +256 -0
- package/core/model/filesystem/path.js +84 -0
- package/core/model/game/Chart.js +57 -0
- package/core/model/game/LevelRecordInfo.js +109 -0
- package/core/model/game/SongsInfo.js +46 -0
- package/core/model/game/b30Analysis.js +93 -0
- package/core/model/game/chartParser/Chart.js +23 -0
- package/core/model/game/chartParser/JudgeLine.js +38 -0
- package/core/model/game/chartParser/base/JudgeLineEvent.js +99 -0
- package/core/model/game/chartParser/base/Note.js +44 -0
- package/core/model/game/chartParser/base/SpeedEvent.js +25 -0
- package/core/model/game/chartParser/base/baseType.js +2 -0
- package/core/model/game/constNum.js +215 -0
- package/core/model/game/fCompute.js +711 -0
- package/core/model/game/getChartTag.js +140 -0
- package/core/model/game/getComment.js +132 -0
- package/core/model/game/getInfo.js +1069 -0
- package/core/model/game/getRksRank.js +77 -0
- package/core/model/game/markdown.js +77 -0
- package/core/model/integrations/Vika.js +103 -0
- package/core/model/integrations/getInfoFromTap.js +80 -0
- package/core/model/render/getPic.js +79 -0
- package/core/model/render/picmodle.js +496 -0
- package/core/model/render/progress-bar.js +44 -0
- package/core/model/render/puppeteer.js +431 -0
- package/core/model/render/renderPressureHistory.js +71 -0
- package/core/model/render/send.js +94 -0
- package/core/model/save/Save.js +953 -0
- package/core/model/save/analyzeSaveHistory.js +413 -0
- package/core/model/save/getBackup.js +328 -0
- package/core/model/save/getSave.js +90 -0
- package/core/model/save/getSaveFromApi.js +46 -0
- package/core/model/save/saveHistory.js +586 -0
- package/core/model/save/scoreHistory.js +101 -0
- package/core/model/theme/catalog.js +192 -0
- package/core/model/theme/installGuard.js +275 -0
- package/core/model/theme/installLock.js +174 -0
- package/core/model/theme/installer.js +398 -0
- package/core/model/theme/manager.js +408 -0
- package/core/model/theme/marketClient.js +294 -0
- package/core/model/theme/paths.js +42 -0
- package/core/model/theme/policy.js +54 -0
- package/core/model/theme/recovery.js +167 -0
- package/core/model/theme/useService.js +187 -0
- package/core/model/type/aliasProposal.d.ts +45 -0
- package/core/model/type/type.js +420 -0
- package/core/model/user/apiPermission.js +62 -0
- package/core/model/user/getBanGroup.js +120 -0
- package/core/model/user/getNotes.js +48 -0
- package/core/model/user/pluginData.js +101 -0
- package/core/model/user/userCredentialStore.js +154 -0
- package/core/model/user/userCredentials.js +860 -0
- package/core/package.json +60 -0
- package/core/resources/0608badSave/save.json +1 -0
- package/core/resources/LICENSE +201 -0
- package/core/resources/html/analyzeSaveHistory/analyzeSaveHistory.art +220 -0
- package/core/resources/html/analyzeSaveHistory/analyzeSaveHistory.css +345 -0
- package/core/resources/html/analyzeSaveHistory/analyzeSaveHistory.html +434 -0
- package/core/resources/html/arcgrosB19/arcgros.png +0 -0
- package/core/resources/html/arcgrosB19/arcgrosB19-orz.html +276 -0
- package/core/resources/html/arcgrosB19/arcgrosB19.art +168 -0
- package/core/resources/html/arcgrosB19/arcgrosB19.css +637 -0
- package/core/resources/html/atlas/atlas-orz.html +313 -0
- package/core/resources/html/atlas/atlas.art +194 -0
- package/core/resources/html/atlas/atlas.css +695 -0
- package/core/resources/html/avatar/-SURREALISM-.png +0 -0
- package/core/resources/html/avatar/Alkaid.png +0 -0
- package/core/resources/html/avatar/Aphasia.png +0 -0
- package/core/resources/html/avatar/Artificial Existence.png +0 -0
- package/core/resources/html/avatar/Bonus Time.png +0 -0
- package/core/resources/html/avatar/Burn.png +0 -0
- package/core/resources/html/avatar/Cereris1.png +0 -0
- package/core/resources/html/avatar/Cereris2.png +0 -0
- package/core/resources/html/avatar/Cereris3.png +0 -0
- package/core/resources/html/avatar/Christmas -2019.png +0 -0
- package/core/resources/html/avatar/Cipher1.png +0 -0
- package/core/resources/html/avatar/Class Memories.png +0 -0
- package/core/resources/html/avatar/Credits.png +0 -0
- package/core/resources/html/avatar/Dash.png +0 -0
- package/core/resources/html/avatar/Dlyrotz.png +0 -0
- package/core/resources/html/avatar/Doppelganger1.png +0 -0
- package/core/resources/html/avatar/Doppelganger2.png +0 -0
- package/core/resources/html/avatar/Drop it.png +0 -0
- package/core/resources/html/avatar/Energy Synergy Matrix1.png +0 -0
- package/core/resources/html/avatar/Energy Synergy Matrix2.png +0 -0
- package/core/resources/html/avatar/Energy Synergy Matrix3.png +0 -0
- package/core/resources/html/avatar/Engine x Start!! (melody mix).png +0 -0
- package/core/resources/html/avatar/Engine x Start!! extra 1 -by cycats.png +0 -0
- package/core/resources/html/avatar/Eradication Catastrophe.png +0 -0
- package/core/resources/html/avatar/FULi AUTO SHOOTER extra 1 -by cycats.png +0 -0
- package/core/resources/html/avatar/FULi AUTO SHOOTER.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/264-Special1.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/264-Special2.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2641.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2642.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2643.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2644.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2645.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2646.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2647.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2648.png +0 -0
- package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2649.png +0 -0
- package/core/resources/html/avatar/Find_Me.png +0 -0
- package/core/resources/html/avatar/Geopelia 1 -by cycats.png +0 -0
- package/core/resources/html/avatar/Geopelia 2 -by cycats.png +0 -0
- package/core/resources/html/avatar/Geopelia 3 -by /344/275/225/345/221/265.png +0 -0
- package/core/resources/html/avatar/Geopelia in WEPLAY -by /346/265/267/344/272/247.png +0 -0
- package/core/resources/html/avatar/Gino-AprilFool.png +0 -0
- package/core/resources/html/avatar/Glaciaxion.png +0 -0
- package/core/resources/html/avatar/HumaN.png +0 -0
- package/core/resources/html/avatar/Indelible Scar.png +0 -0
- package/core/resources/html/avatar/Introduction.png +0 -0
- package/core/resources/html/avatar/Khronostasis Katharsis.png +0 -0
- package/core/resources/html/avatar/MARENOL.png +0 -0
- package/core/resources/html/avatar/Marenol extra 1 -by /345/226/265n/350/221/265.png +0 -0
- package/core/resources/html/avatar/Non-Melodic Ragez (MUG Edit).png +0 -0
- package/core/resources/html/avatar/Non-Melodic Ragez extra 1 -by cycats.png +0 -0
- package/core/resources/html/avatar/Oblivion +0 -0
- package/core/resources/html/avatar/OblivionPHIN.png +0 -0
- package/core/resources/html/avatar/Para.png +0 -0
- package/core/resources/html/avatar/Pixel Rebelz1.png +0 -0
- package/core/resources/html/avatar/Pixel Rebelz2.png +0 -0
- package/core/resources/html/avatar/Pixel Rebelz3.png +0 -0
- package/core/resources/html/avatar/RIPPER extra 1 -by cycats.png +0 -0
- package/core/resources/html/avatar/RIPPER extra 2 -by /344/275/225/345/221/265.png +0 -0
- package/core/resources/html/avatar/Sein.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-Special.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-Special2.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-/346/231/256/351/200/232.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-/346/233/262/347/273/230Ver.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/351/270/240-Special.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/351/270/240-/346/231/256/351/200/232.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/351/270/240-/346/233/262/347/273/230Ver.png +0 -0
- package/core/resources/html/avatar/ShineAfter-/351/270/240/345/222/214/346/260/264/351/235/222-Special.png +0 -0
- package/core/resources/html/avatar/Snow Desert.png +0 -0
- package/core/resources/html/avatar/Sparkle New Life.png +0 -0
- package/core/resources/html/avatar/Sultan Rage.png +0 -0
- package/core/resources/html/avatar/Winter /342/206/221cube/342/206/223.png +0 -0
- package/core/resources/html/avatar/Xenolith.png +0 -0
- package/core/resources/html/avatar/[PRAW].png +0 -0
- package/core/resources/html/avatar/dB doll.png +0 -0
- package/core/resources/html/avatar/ripper.png +0 -0
- package/core/resources/html/avatar//343/202/202/343/201/272/343/202/202/343/201/2721.png +0 -0
- package/core/resources/html/avatar//343/202/202/343/201/272/343/202/202/343/201/2722.png +0 -0
- package/core/resources/html/avatar//344/270/207/345/220/250/345/214/277/345/220/215/344/277/241.png +0 -0
- package/core/resources/html/avatar//344/272/221/345/245/263/345/255/251 extra 1 -by /345/276/241/345/235/202/346/236/234/345/255/220.png +0 -0
- package/core/resources/html/avatar//344/272/221/345/245/263/345/255/251.png +0 -0
- package/core/resources/html/avatar//345/205/211.png +0 -0
- package/core/resources/html/avatar//345/274/200/345/277/203/347/227/2051.png +0 -0
- package/core/resources/html/avatar//345/274/200/345/277/203/347/227/2052.png +0 -0
- package/core/resources/html/avatar//346/260/264/351/235/222-/344/270/200/345/221/250/345/271/264/347/233/270/350/201/232.png +0 -0
- package/core/resources/html/avatar//346/267/267/344/271/261-Confusion.png +0 -0
- package/core/resources/html/avatar//347/213/202/345/226/234/350/230/255/350/210/2361.png +0 -0
- package/core/resources/html/avatar//347/213/202/345/226/234/350/230/255/350/210/2362.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/201-Special.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2011.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2012.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2013.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2014.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2015.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2016.png +0 -0
- package/core/resources/html/avatar//347/223/267/345/262/2017.png +0 -0
- package/core/resources/html/avatar//347/233/217/350/214/227-Special.png +0 -0
- package/core/resources/html/avatar//347/233/217/350/214/2271.png +0 -0
- package/core/resources/html/avatar//347/233/217/350/214/2272.png +0 -0
- package/core/resources/html/avatar//347/233/217/350/214/2273.png +0 -0
- package/core/resources/html/avatar//350/217/257/347/201/257/347/210/2611.png +0 -0
- package/core/resources/html/avatar//350/217/257/347/201/257/347/210/2612.png +0 -0
- package/core/resources/html/avatar//350/220/244/347/201/253/350/231/253/343/201/256/346/200/2501.png +0 -0
- package/core/resources/html/avatar//350/220/244/347/201/253/350/231/253/343/201/256/346/200/2502.png +0 -0
- package/core/resources/html/avatar//351/235/222/350/212/275-Special.png +0 -0
- package/core/resources/html/avatar//351/235/222/350/212/275.png +0 -0
- package/core/resources/html/avatar//351/243/216/345/261/277.png +0 -0
- package/core/resources/html/avatar//351/270/240-AprilFool.png +0 -0
- package/core/resources/html/avatar//351/270/240-/344/270/200/345/221/250/345/271/264/347/233/270/350/201/232.png +0 -0
- package/core/resources/html/b19/b19.art +490 -0
- package/core/resources/html/b19/b19.css +1261 -0
- package/core/resources/html/b19/b19666.art +350 -0
- package/core/resources/html/b19/b19666.css +1409 -0
- package/core/resources/html/b19/b19666.html +481 -0
- package/core/resources/html/b19/b19title.css +120 -0
- package/core/resources/html/b19/best19.html +853 -0
- package/core/resources/html/b19/dss2-orz.html +428 -0
- package/core/resources/html/b19/dss2.art +298 -0
- package/core/resources/html/b19/dss2.css +776 -0
- package/core/resources/html/b19/res/666.jpeg +0 -0
- package/core/resources/html/chap/chap-orz.html +93 -0
- package/core/resources/html/chap/chap.art +87 -0
- package/core/resources/html/chap/chap.css +365 -0
- package/core/resources/html/chartImg/chartImg.art +169 -0
- package/core/resources/html/chartImg/chartImg.css +439 -0
- package/core/resources/html/chartImg/echarts-wordcloud.min.js +3 -0
- package/core/resources/html/chartImg/echarts.js +85796 -0
- package/core/resources/html/chartImg/img/Drag.png +0 -0
- package/core/resources/html/chartImg/img/DragHL.png +0 -0
- package/core/resources/html/chartImg/img/Flick.png +0 -0
- package/core/resources/html/chartImg/img/FlickHL.png +0 -0
- package/core/resources/html/chartImg/img/Hold.png +0 -0
- package/core/resources/html/chartImg/img/HoldHL.png +0 -0
- package/core/resources/html/chartImg/img/Hold_End.png +0 -0
- package/core/resources/html/chartImg/img/Hold_Head.png +0 -0
- package/core/resources/html/chartImg/img/Hold_HeadHL.png +0 -0
- package/core/resources/html/chartImg/img/Tap.png +0 -0
- package/core/resources/html/chartImg/img/TapHL.png +0 -0
- package/core/resources/html/chartInfo/chartInfo-orz.html +250 -0
- package/core/resources/html/chartInfo/chartInfo.art +222 -0
- package/core/resources/html/chartInfo/chartInfo.css +265 -0
- package/core/resources/html/chartInfo/echarts-wordcloud.min.js +3 -0
- package/core/resources/html/chartInfo/echarts.js +85796 -0
- package/core/resources/html/clg/clg-orz.html +218 -0
- package/core/resources/html/clg/clg.art +88 -0
- package/core/resources/html/clg/clg.css +230 -0
- package/core/resources/html/clg/demo.jpg +0 -0
- package/core/resources/html/common/common.css +319 -0
- package/core/resources/html/common/css/playerInfo.css +136 -0
- package/core/resources/html/common/font/Aldrich-Regular.ttf +0 -0
- package/core/resources/html/common/font/HIMALAYA.TTF +0 -0
- package/core/resources/html/common/font/NotoColorEmoji-Regular.ttf +0 -0
- package/core/resources/html/common/font/NotoSans-Regular.ttf +0 -0
- package/core/resources/html/common/font/NotoSansArabic.ttf +0 -0
- package/core/resources/html/common/font/NotoSansCanadianAboriginal.ttf +0 -0
- package/core/resources/html/common/font/NotoSansJP.ttf +0 -0
- package/core/resources/html/common/font/NotoSansKannada.ttf +0 -0
- package/core/resources/html/common/font/NotoSansMath-Regular.ttf +0 -0
- package/core/resources/html/common/font/NotoSansSymbols2.ttf +0 -0
- package/core/resources/html/common/font/phi.ttf +0 -0
- package/core/resources/html/common/font//345/220/236/345/274/245/346/201/260/344/277/212.ttf +0 -0
- package/core/resources/html/common/layout/default.art +324 -0
- package/core/resources/html/common/layout/elem.art +21 -0
- package/core/resources/html/common/theme/snow/snow.css +17 -0
- package/core/resources/html/common/theme/snow/snow.js +19 -0
- package/core/resources/html/common/theme/star/star.js +201 -0
- package/core/resources/html/common/theme/topText/topText.css +15 -0
- package/core/resources/html/common/theme/topText/topText.js +30 -0
- package/core/resources/html/difficultyHistory/difficultyHistory-orz.html +361 -0
- package/core/resources/html/difficultyHistory/difficultyHistory.art +102 -0
- package/core/resources/html/difficultyHistory/difficultyHistory.css +205 -0
- package/core/resources/html/guess/guess-orz.html +50 -0
- package/core/resources/html/guess/guess.art +51 -0
- package/core/resources/html/guess/guess.css +33 -0
- package/core/resources/html/help/help-orz.html +73 -0
- package/core/resources/html/help/help.art +84 -0
- package/core/resources/html/help/help.css +266 -0
- package/core/resources/html/historyB30/historyB30-orz.html +168 -0
- package/core/resources/html/historyB30/historyB30.art +143 -0
- package/core/resources/html/historyB30/historyB30.css +270 -0
- package/core/resources/html/ill/ill-orz.html +21 -0
- package/core/resources/html/ill/ill.art +23 -0
- package/core/resources/html/ill/ill.css +79 -0
- package/core/resources/html/jrrp/ShineAfter.removebg.png +0 -0
- package/core/resources/html/jrrp/jrrp-orz.html +68 -0
- package/core/resources/html/jrrp/jrrp.art +58 -0
- package/core/resources/html/jrrp/jrrp.css +251 -0
- package/core/resources/html/list/list-orz.html +35 -0
- package/core/resources/html/list/list.art +67 -0
- package/core/resources/html/list/list.css +259 -0
- package/core/resources/html/lvsco/demo.jpg +0 -0
- package/core/resources/html/lvsco/lvsco-orz.html +334 -0
- package/core/resources/html/lvsco/lvsco.art +314 -0
- package/core/resources/html/lvsco/lvsco.css +706 -0
- package/core/resources/html/market/detail.art +44 -0
- package/core/resources/html/market/market.art +86 -0
- package/core/resources/html/market/market.css +64 -0
- package/core/resources/html/newSong/newSong.art +34 -0
- package/core/resources/html/newSong/newSong.css +48 -0
- package/core/resources/html/newSong/newSong.html +23 -0
- package/core/resources/html/newnotice/newnotice.art +47 -0
- package/core/resources/html/newnotice/newnotice.css +83 -0
- package/core/resources/html/otherimg/0.png +0 -0
- package/core/resources/html/otherimg/1.png +0 -0
- package/core/resources/html/otherimg/2.png +0 -0
- package/core/resources/html/otherimg/3.png +0 -0
- package/core/resources/html/otherimg/4.png +0 -0
- package/core/resources/html/otherimg/5.png +0 -0
- package/core/resources/html/otherimg/A.png +0 -0
- package/core/resources/html/otherimg/B.png +0 -0
- package/core/resources/html/otherimg/C.png +0 -0
- package/core/resources/html/otherimg/F.png +0 -0
- package/core/resources/html/otherimg/FC.png +0 -0
- package/core/resources/html/otherimg/NEW.png +0 -0
- package/core/resources/html/otherimg/Phigros_Icon_3.0.0.png +0 -0
- package/core/resources/html/otherimg/S.png +0 -0
- package/core/resources/html/otherimg/Star1.png +0 -0
- package/core/resources/html/otherimg/Star2.png +0 -0
- package/core/resources/html/otherimg/V.png +0 -0
- package/core/resources/html/otherimg/callback.png +0 -0
- package/core/resources/html/otherimg/chapHelp.png +0 -0
- package/core/resources/html/otherimg/dan_code.png +0 -0
- package/core/resources/html/otherimg/data.png +0 -0
- package/core/resources/html/otherimg/helpDoc.png +0 -0
- package/core/resources/html/otherimg/nickSuggest.png +0 -0
- package/core/resources/html/otherimg/phi.png +0 -0
- package/core/resources/html/otherimg/phigros.png +0 -0
- package/core/resources/html/otherimg/snow1.png +0 -0
- package/core/resources/html/otherimg/snow2.png +0 -0
- package/core/resources/html/otherimg/snow3.png +0 -0
- package/core/resources/html/otherimg/snow4.png +0 -0
- package/core/resources/html/otherimg/title.png +0 -0
- package/core/resources/html/rand/rand-orz.html +62 -0
- package/core/resources/html/rand/rand.art +59 -0
- package/core/resources/html/rand/rand.css +257 -0
- package/core/resources/html/rankingList/rankingList-orz.html +456 -0
- package/core/resources/html/rankingList/rankingList.art +171 -0
- package/core/resources/html/rankingList/rankingList.css +570 -0
- package/core/resources/html/rankingList-old/rankingList-orz.html +300 -0
- package/core/resources/html/rankingList-old/rankingList.art +89 -0
- package/core/resources/html/rankingList-old/rankingList.css +265 -0
- package/core/resources/html/score/score-orz.html +625 -0
- package/core/resources/html/score/score.art +249 -0
- package/core/resources/html/score/score.css +435 -0
- package/core/resources/html/score/scoreOld-orz.html +128 -0
- package/core/resources/html/score/scoreOld.art +230 -0
- package/core/resources/html/score/scoreOld.css +475 -0
- package/core/resources/html/score/scoreRankList-orz.html +613 -0
- package/core/resources/html/score/scoreRankList.art +231 -0
- package/core/resources/html/score/scoreRankList.css +197 -0
- package/core/resources/html/setting/setting-orz.html +123 -0
- package/core/resources/html/setting/setting.art +72 -0
- package/core/resources/html/setting/setting.css +170 -0
- package/core/resources/html/setting/userSetting-orz.html +132 -0
- package/core/resources/html/setting/userSetting.art +48 -0
- package/core/resources/html/setting/userSetting.css +160 -0
- package/core/resources/html/sign/sign-orz.html +262 -0
- package/core/resources/html/sign/sign.art +163 -0
- package/core/resources/html/sign/sign.css +706 -0
- package/core/resources/html/suggest/suggest.art +271 -0
- package/core/resources/html/suggest/suggest.css +300 -0
- package/core/resources/html/table/table-orz.html +228 -0
- package/core/resources/html/table/table.art +163 -0
- package/core/resources/html/table/table.css +401 -0
- package/core/resources/html/tasks/tasks-orz.html +83 -0
- package/core/resources/html/tasks/tasks.art +118 -0
- package/core/resources/html/tasks/tasks.css +334 -0
- package/core/resources/html/update/update-orz.html +735 -0
- package/core/resources/html/update/update.art +259 -0
- package/core/resources/html/update/update.css +676 -0
- package/core/resources/html/userinfo/userinfo-old-orz.html +408 -0
- package/core/resources/html/userinfo/userinfo-old.art +233 -0
- package/core/resources/html/userinfo/userinfo-old.css +466 -0
- package/core/resources/html/userinfo/userinfo-orz.html +543 -0
- package/core/resources/html/userinfo/userinfo.art +288 -0
- package/core/resources/html/userinfo/userinfo.css +757 -0
- package/core/resources/info/DLC/arc.json +412 -0
- package/core/resources/info/DLC/chunithm.json +1172 -0
- package/core/resources/info/DLC/dynamix.json +455 -0
- package/core/resources/info/DLC/fanshi.json +132 -0
- package/core/resources/info/DLC/lanota.json +412 -0
- package/core/resources/info/DLC/maimai.json +1110 -0
- package/core/resources/info/DLC/orz.json +158 -0
- package/core/resources/info/DLC/rizline.json +40 -0
- package/core/resources/info/DLC/rotaeno.json +159 -0
- package/core/resources/info/DLC/ryceam.json +53 -0
- package/core/resources/info/avatar.txt +109 -0
- package/core/resources/info/chaplist.yaml +102 -0
- package/core/resources/info/help/api.json +83 -0
- package/core/resources/info/help.json +436 -0
- package/core/resources/info/info.csv +315 -0
- package/core/resources/info/infolist.json +1758 -0
- package/core/resources/info/jrrp.json +92 -0
- package/core/resources/info/nicklist.yaml +2373 -0
- package/core/resources/info/notesInfo.json +1 -0
- package/core/resources/info/notice.json +11 -0
- package/core/resources/info/oldInfo/100/change.csv +218 -0
- package/core/resources/info/oldInfo/100/info.json +7 -0
- package/core/resources/info/oldInfo/101/change.csv +218 -0
- package/core/resources/info/oldInfo/101/info.json +7 -0
- package/core/resources/info/oldInfo/102/change.csv +223 -0
- package/core/resources/info/oldInfo/102/info.json +7 -0
- package/core/resources/info/oldInfo/103/change.csv +224 -0
- package/core/resources/info/oldInfo/103/info.json +7 -0
- package/core/resources/info/oldInfo/104/change.csv +225 -0
- package/core/resources/info/oldInfo/104/info.json +7 -0
- package/core/resources/info/oldInfo/105/change.csv +228 -0
- package/core/resources/info/oldInfo/105/info.json +7 -0
- package/core/resources/info/oldInfo/106/change.csv +229 -0
- package/core/resources/info/oldInfo/106/info.json +7 -0
- package/core/resources/info/oldInfo/108/change.csv +233 -0
- package/core/resources/info/oldInfo/108/info.json +7 -0
- package/core/resources/info/oldInfo/109/change.csv +235 -0
- package/core/resources/info/oldInfo/109/info.json +7 -0
- package/core/resources/info/oldInfo/110/change.csv +235 -0
- package/core/resources/info/oldInfo/110/info.json +7 -0
- package/core/resources/info/oldInfo/111/change.csv +242 -0
- package/core/resources/info/oldInfo/111/info.json +7 -0
- package/core/resources/info/oldInfo/112/change.csv +242 -0
- package/core/resources/info/oldInfo/112/info.json +7 -0
- package/core/resources/info/oldInfo/113/change.csv +244 -0
- package/core/resources/info/oldInfo/113/info.json +7 -0
- package/core/resources/info/oldInfo/115/change.csv +247 -0
- package/core/resources/info/oldInfo/115/info.json +7 -0
- package/core/resources/info/oldInfo/116/change.csv +249 -0
- package/core/resources/info/oldInfo/116/info.json +7 -0
- package/core/resources/info/oldInfo/118/change.csv +252 -0
- package/core/resources/info/oldInfo/118/info.json +7 -0
- package/core/resources/info/oldInfo/119/change.csv +255 -0
- package/core/resources/info/oldInfo/119/info.json +7 -0
- package/core/resources/info/oldInfo/120/change.csv +255 -0
- package/core/resources/info/oldInfo/120/info.json +7 -0
- package/core/resources/info/oldInfo/121/change.csv +257 -0
- package/core/resources/info/oldInfo/121/info.json +7 -0
- package/core/resources/info/oldInfo/122/change.csv +260 -0
- package/core/resources/info/oldInfo/122/info.json +7 -0
- package/core/resources/info/oldInfo/123/change.csv +260 -0
- package/core/resources/info/oldInfo/123/info.json +7 -0
- package/core/resources/info/oldInfo/124/change.csv +262 -0
- package/core/resources/info/oldInfo/124/info.json +7 -0
- package/core/resources/info/oldInfo/125/change.csv +266 -0
- package/core/resources/info/oldInfo/125/info.json +7 -0
- package/core/resources/info/oldInfo/126/change.csv +269 -0
- package/core/resources/info/oldInfo/126/info.json +7 -0
- package/core/resources/info/oldInfo/127/change.csv +270 -0
- package/core/resources/info/oldInfo/127/info.json +7 -0
- package/core/resources/info/oldInfo/128/change.csv +273 -0
- package/core/resources/info/oldInfo/128/info.json +7 -0
- package/core/resources/info/oldInfo/129/change.csv +274 -0
- package/core/resources/info/oldInfo/129/info.json +7 -0
- package/core/resources/info/oldInfo/130/change.csv +275 -0
- package/core/resources/info/oldInfo/130/info.json +7 -0
- package/core/resources/info/oldInfo/131/change.csv +278 -0
- package/core/resources/info/oldInfo/131/info.json +7 -0
- package/core/resources/info/oldInfo/132/change.csv +280 -0
- package/core/resources/info/oldInfo/132/info.json +7 -0
- package/core/resources/info/oldInfo/133/change.csv +284 -0
- package/core/resources/info/oldInfo/133/info.json +7 -0
- package/core/resources/info/oldInfo/134/change.csv +286 -0
- package/core/resources/info/oldInfo/134/info.json +7 -0
- package/core/resources/info/oldInfo/135/change.csv +290 -0
- package/core/resources/info/oldInfo/135/info.json +7 -0
- package/core/resources/info/oldInfo/136/change.csv +290 -0
- package/core/resources/info/oldInfo/136/info.json +7 -0
- package/core/resources/info/oldInfo/137/change.csv +293 -0
- package/core/resources/info/oldInfo/137/info.json +7 -0
- package/core/resources/info/oldInfo/138/change.csv +295 -0
- package/core/resources/info/oldInfo/138/info.json +7 -0
- package/core/resources/info/oldInfo/139/change.csv +295 -0
- package/core/resources/info/oldInfo/139/info.json +7 -0
- package/core/resources/info/oldInfo/140/change.csv +298 -0
- package/core/resources/info/oldInfo/140/info.json +7 -0
- package/core/resources/info/oldInfo/141/change.csv +300 -0
- package/core/resources/info/oldInfo/141/info.json +7 -0
- package/core/resources/info/oldInfo/142/change.csv +302 -0
- package/core/resources/info/oldInfo/142/info.json +7 -0
- package/core/resources/info/oldInfo/143/change.csv +303 -0
- package/core/resources/info/oldInfo/143/info.json +7 -0
- package/core/resources/info/oldInfo/144/change.csv +303 -0
- package/core/resources/info/oldInfo/144/info.json +7 -0
- package/core/resources/info/oldInfo/145/change.csv +305 -0
- package/core/resources/info/oldInfo/145/info.json +7 -0
- package/core/resources/info/oldInfo/146/change.csv +305 -0
- package/core/resources/info/oldInfo/146/info.json +7 -0
- package/core/resources/info/oldInfo/148/change.csv +307 -0
- package/core/resources/info/oldInfo/148/info.json +7 -0
- package/core/resources/info/oldInfo/149/change.csv +307 -0
- package/core/resources/info/oldInfo/149/info.json +7 -0
- package/core/resources/info/oldInfo/151/change.csv +309 -0
- package/core/resources/info/oldInfo/151/info.json +7 -0
- package/core/resources/info/oldInfo/152/change.csv +312 -0
- package/core/resources/info/oldInfo/152/info.json +7 -0
- package/core/resources/info/oldInfo/153/change.csv +313 -0
- package/core/resources/info/oldInfo/153/info.json +7 -0
- package/core/resources/info/oldInfo/154/change.csv +315 -0
- package/core/resources/info/oldInfo/154/info.json +7 -0
- package/core/resources/info/oldInfo/92/change.csv +204 -0
- package/core/resources/info/oldInfo/92/info.json +7 -0
- package/core/resources/info/oldInfo/93/change.csv +206 -0
- package/core/resources/info/oldInfo/93/info.json +7 -0
- package/core/resources/info/oldInfo/94/change.csv +209 -0
- package/core/resources/info/oldInfo/94/info.json +7 -0
- package/core/resources/info/oldInfo/95/change.csv +211 -0
- package/core/resources/info/oldInfo/95/info.json +7 -0
- package/core/resources/info/oldInfo/96/change.csv +216 -0
- package/core/resources/info/oldInfo/96/info.json +7 -0
- package/core/resources/info/oldInfo/98/change.csv +216 -0
- package/core/resources/info/oldInfo/98/info.json +7 -0
- package/core/resources/info/oldInfo/99/change.csv +217 -0
- package/core/resources/info/oldInfo/99/info.json +7 -0
- package/core/resources/info/oldNotesInfo.json +1 -0
- package/core/resources/info/sentences.json +1 -0
- package/core/resources/info/spinfo.json +362 -0
- package/core/resources/info/tips.txt +278 -0
- package/core/resources/otherill//351/233/252/351/231/215SP.png +0 -0
- package/core/resources/song-select.html +535 -0
- package/core/resources/themes/README.md +24 -0
- package/core/resources/themes/milthm/A.png +0 -0
- package/core/resources/themes/milthm/B.png +0 -0
- package/core/resources/themes/milthm/C.png +0 -0
- package/core/resources/themes/milthm/F.png +0 -0
- package/core/resources/themes/milthm/FC.png +0 -0
- package/core/resources/themes/milthm/S.png +0 -0
- package/core/resources/themes/milthm/V.png +0 -0
- package/core/resources/themes/milthm/arcgrosB19.css +36 -0
- package/core/resources/themes/milthm/b19.art +464 -0
- package/core/resources/themes/milthm/b19.css +1314 -0
- package/core/resources/themes/milthm/bg.png +0 -0
- package/core/resources/themes/milthm/clg.css +37 -0
- package/core/resources/themes/milthm/difficultyHistory.css +42 -0
- package/core/resources/themes/milthm/font.ttf +0 -0
- package/core/resources/themes/milthm/help.css +36 -0
- package/core/resources/themes/milthm/historyB30.css +48 -0
- package/core/resources/themes/milthm/info.yaml +45 -0
- package/core/resources/themes/milthm/list.css +39 -0
- package/core/resources/themes/milthm/phi.png +0 -0
- package/core/resources/themes/milthm/setting.css +37 -0
- package/core/resources/themes/milthm/sign.css +81 -0
- package/core/resources/themes/milthm/suggest.css +40 -0
- package/core/resources/themes/milthm/table.css +54 -0
- package/core/resources/themes/milthm/update.css +68 -0
- package/core/tests/aliasProposalService.test.js +82 -0
- package/core/tests/apiAccountDeletion.test.js +125 -0
- package/core/tests/apiPermission.test.js +44 -0
- package/core/tests/apiVersion.test.js +55 -0
- package/core/tests/b30Analysis.test.js +38 -0
- package/core/tests/backgroundIllustration.test.js +21 -0
- package/core/tests/botApiAuthRecovery.test.js +148 -0
- package/core/tests/botSyncService.test.js +42 -0
- package/core/tests/fileWatcherRegistry.test.js +44 -0
- package/core/tests/gameRecordPayload.test.js +34 -0
- package/core/tests/guessLetter.test.js +79 -0
- package/core/tests/makeRequestHandling.test.js +118 -0
- package/core/tests/marketOverflow.test.js +31 -0
- package/core/tests/platformTemplateCache.test.js +92 -0
- package/core/tests/pluginDataThemePreference.test.js +36 -0
- package/core/tests/processCleanup.test.js +58 -0
- package/core/tests/puppeteerShutdown.test.js +17 -0
- package/core/tests/renderPressureHistory.test.js +59 -0
- package/core/tests/saveStats.test.js +26 -0
- package/core/tests/themeInstallGuard.test.js +289 -0
- package/core/tests/themeManager.test.js +625 -0
- package/core/tests/themeManagerInit.test.js +11 -0
- package/core/tests/themeMarket.test.js +855 -0
- package/core/tests/themePageRouting.test.js +431 -0
- package/core/tests/themePolicy.test.js +28 -0
- package/core/tests/themeStorageRecovery.test.js +192 -0
- package/core/tests/userCredentialModuleBoundaries.test.js +41 -0
- package/core/tests/userCredentials.test.js +285 -0
- package/core/tsconfig.json +32 -0
- package/core/types/vendor.d.ts +14 -0
- package/lib/index.cjs +358 -0
- package/lib/index.d.cts +182 -0
- package/lib/index.d.ts +182 -0
- package/lib/index.js +320 -0
- package/package.json +74 -0
- package/readme.md +3 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import autoSeekApi from '../api/autoSeekApi.js'
|
|
2
|
+
import getNotes from './getNotes.js'
|
|
3
|
+
import Config from '../../components/Config.js'
|
|
4
|
+
|
|
5
|
+
/** @typedef {'customTheme' | 'scoreStatistics' | 'onlineScore'} ApiCapability */
|
|
6
|
+
|
|
7
|
+
const capabilityConfigKeys = {
|
|
8
|
+
customTheme: 'enableCustomThemeApi',
|
|
9
|
+
scoreStatistics: 'enableScoreStatisticsApi',
|
|
10
|
+
onlineScore: 'enableOnlineScoreApi',
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/** @param {ApiCapability} capability */
|
|
14
|
+
export function isApiCapabilityConfigured(capability) {
|
|
15
|
+
return Boolean(
|
|
16
|
+
Config.getUserCfg('config', 'openPhiPluginApi')
|
|
17
|
+
&& Config.getUserCfg('config', /** @type {configName} */ (capabilityConfigKeys[capability])) !== false
|
|
18
|
+
)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** @param {ApiCapability} capability */
|
|
22
|
+
export function isApiCapabilityEnabled(capability) {
|
|
23
|
+
return autoSeekApi.openPhiPluginApi && isApiCapabilityConfigured(capability)
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @param {string | number | undefined} userId
|
|
28
|
+
* @returns {Promise<boolean>}
|
|
29
|
+
*/
|
|
30
|
+
export async function isUserApiEnabled(userId) {
|
|
31
|
+
if (!userId) return true
|
|
32
|
+
const uid = String(userId)
|
|
33
|
+
const pluginData = await getNotes.getNotesData(uid)
|
|
34
|
+
if (typeof pluginData.allowApiUsage !== 'boolean') {
|
|
35
|
+
pluginData.allowApiUsage = true
|
|
36
|
+
getNotes.putNotesData(uid, pluginData)
|
|
37
|
+
}
|
|
38
|
+
return pluginData.allowApiUsage !== false
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @param {import('../../components/baseClass.js').botEvent} e
|
|
43
|
+
*/
|
|
44
|
+
export async function getApiAccessState(e, capability = /** @type {ApiCapability} */ ('onlineScore')) {
|
|
45
|
+
const globalEnabled = !!autoSeekApi.openPhiPluginApi;
|
|
46
|
+
const capabilityEnabled = Config.getUserCfg('config', /** @type {configName} */ (capabilityConfigKeys[capability])) !== false
|
|
47
|
+
const userEnabled = capability === 'onlineScore' ? await isUserApiEnabled(e?.user_id) : true
|
|
48
|
+
return {
|
|
49
|
+
globalEnabled,
|
|
50
|
+
capability,
|
|
51
|
+
capabilityEnabled,
|
|
52
|
+
userEnabled,
|
|
53
|
+
enabled: globalEnabled && capabilityEnabled && userEnabled
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @param {import('../../components/baseClass.js').botEvent} e
|
|
59
|
+
*/
|
|
60
|
+
export async function canUseApi(e, capability = /** @type {ApiCapability} */ ('onlineScore')) {
|
|
61
|
+
return (await getApiAccessState(e, capability)).enabled
|
|
62
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
import Config from "../../components/Config.js";
|
|
2
|
+
import logger from "../../components/Logger.js";
|
|
3
|
+
import { redisPath } from "../game/constNum.js"
|
|
4
|
+
import { UserCredentials } from './userCredentials.js';
|
|
5
|
+
import userCredentialStore from './userCredentialStore.js';
|
|
6
|
+
import send from "../render/send.js";
|
|
7
|
+
import { canUseApi } from './apiPermission.js';
|
|
8
|
+
import { redis } from "../../components/platform/index.js";
|
|
9
|
+
|
|
10
|
+
/**@import {botEvent} from "../../components/baseClass.js" */
|
|
11
|
+
|
|
12
|
+
export default class getBanGroup {
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @param {string} group
|
|
16
|
+
* @param {string} fnc
|
|
17
|
+
* @returns
|
|
18
|
+
*/
|
|
19
|
+
static async redis(group, fnc) {
|
|
20
|
+
// @ts-ignore
|
|
21
|
+
return await redis.get(`${redisPath}:banGroup:${group}:${fnc}`) ? true : false
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
*
|
|
26
|
+
* @param {botEvent} e
|
|
27
|
+
* @param {allFnc} fnc
|
|
28
|
+
* @returns
|
|
29
|
+
*/
|
|
30
|
+
static async get(e, fnc) {
|
|
31
|
+
const { group_id } = e;
|
|
32
|
+
const credentials = UserCredentials.fromEvent(e)
|
|
33
|
+
if (await canUseApi(e)) {
|
|
34
|
+
if (await credentials.getUserAPIBanStatus({ ignoreUnboundError: true })) {
|
|
35
|
+
send.send_with_At(e, "当前账户被加入黑名单,详情请联系管理员(1)。")
|
|
36
|
+
return true;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
if (await credentials.getUserLoaclBanStatus()) {
|
|
40
|
+
send.send_with_At(e, "当前账户被加入黑名单,详情请联系管理员(2)。")
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
if (!group_id) {
|
|
44
|
+
return false
|
|
45
|
+
}
|
|
46
|
+
switch (fnc) {
|
|
47
|
+
case 'help':
|
|
48
|
+
case 'tkhelp':
|
|
49
|
+
return await this.redis(group_id, 'help')
|
|
50
|
+
case 'bind':
|
|
51
|
+
case 'unbind':
|
|
52
|
+
return await this.redis(group_id, 'bind')
|
|
53
|
+
case 'b19':
|
|
54
|
+
case 'p30':
|
|
55
|
+
case 'lmtAcc':
|
|
56
|
+
case 'arcgrosB19':
|
|
57
|
+
case 'update':
|
|
58
|
+
case 'info':
|
|
59
|
+
case 'list':
|
|
60
|
+
case 'singlescore':
|
|
61
|
+
case 'lvscore':
|
|
62
|
+
case 'chap':
|
|
63
|
+
case 'achievement':
|
|
64
|
+
case 'suggest':
|
|
65
|
+
case 'analyze2025SaveHistory':
|
|
66
|
+
case 'hisb30':
|
|
67
|
+
return await this.redis(group_id, 'b19')
|
|
68
|
+
case 'bestn':
|
|
69
|
+
case 'data':
|
|
70
|
+
return await this.redis(group_id, 'wb19')
|
|
71
|
+
case 'song':
|
|
72
|
+
case 'ill':
|
|
73
|
+
case 'chart':
|
|
74
|
+
case 'tag':
|
|
75
|
+
case 'addtag':
|
|
76
|
+
case 'retag':
|
|
77
|
+
case 'search':
|
|
78
|
+
case 'alias':
|
|
79
|
+
case 'randmic':
|
|
80
|
+
case 'randClg':
|
|
81
|
+
case 'table':
|
|
82
|
+
case 'comment':
|
|
83
|
+
case 'recallComment':
|
|
84
|
+
case 'myComment':
|
|
85
|
+
return await this.redis(group_id, 'song')
|
|
86
|
+
case 'rankList':
|
|
87
|
+
case 'godList':
|
|
88
|
+
return await this.redis(group_id, 'ranklist')
|
|
89
|
+
case 'comrks':
|
|
90
|
+
case 'tips':
|
|
91
|
+
case 'newSong':
|
|
92
|
+
return await this.redis(group_id, 'fnc')
|
|
93
|
+
case 'tipgame':
|
|
94
|
+
return await this.redis(group_id, 'tipgame')
|
|
95
|
+
case 'guessgame':
|
|
96
|
+
return await this.redis(group_id, 'guessgame')
|
|
97
|
+
case 'ltrgame':
|
|
98
|
+
return await this.redis(group_id, 'ltrgame')
|
|
99
|
+
case 'sign':
|
|
100
|
+
case 'send':
|
|
101
|
+
case 'tasks':
|
|
102
|
+
case 'retask':
|
|
103
|
+
case 'jrrp':
|
|
104
|
+
return await this.redis(group_id, 'sign')
|
|
105
|
+
case 'theme':
|
|
106
|
+
return await this.redis(group_id, 'setting')
|
|
107
|
+
case 'dan':
|
|
108
|
+
case 'danupdate':
|
|
109
|
+
return await this.redis(group_id, 'dan')
|
|
110
|
+
case 'auth':
|
|
111
|
+
case 'clearApiData':
|
|
112
|
+
case 'updateHistory':
|
|
113
|
+
case 'setApiToken':
|
|
114
|
+
case 'tokenList':
|
|
115
|
+
return await this.redis(group_id, 'apiSetting')
|
|
116
|
+
default:
|
|
117
|
+
return false;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import readFile from '../filesystem/getFile.js'
|
|
2
|
+
import path from 'path'
|
|
3
|
+
import { pluginDataPath } from '../filesystem/path.js'
|
|
4
|
+
import fs from 'fs'
|
|
5
|
+
import PluginData from './pluginData.js'
|
|
6
|
+
|
|
7
|
+
export default class getNotes {
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 获取并初始化用户数据
|
|
11
|
+
* @param {string} user_id
|
|
12
|
+
* @returns {Promise<PluginData>} 娱乐数据
|
|
13
|
+
*/
|
|
14
|
+
static async getNotesData(user_id) {
|
|
15
|
+
let data = await readFile.FileReader(path.join(pluginDataPath, `${user_id}_.json`))
|
|
16
|
+
if (!data) {
|
|
17
|
+
data = {
|
|
18
|
+
money: 0,
|
|
19
|
+
sign_in: "Wed Apr 03 2024 23:03:52 GMT+0800 (中国标准时间)",
|
|
20
|
+
task_time: "Wed Apr 03 2024 23:03:52 GMT+0800 (中国标准时间)",
|
|
21
|
+
task: [],
|
|
22
|
+
theme: "common"
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
if (data.plugin_data) {
|
|
26
|
+
data = data.plugin_data;
|
|
27
|
+
}
|
|
28
|
+
return new PluginData(data);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* 获取并初始化用户数据
|
|
33
|
+
* @param {string} user_id
|
|
34
|
+
* @param {PluginData} data
|
|
35
|
+
*/
|
|
36
|
+
static putNotesData(user_id, data) {
|
|
37
|
+
return readFile.SetFile(path.join(pluginDataPath, `${user_id}_.json`), data)
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* 删除用户数据
|
|
42
|
+
* @param {string} user_id
|
|
43
|
+
*/
|
|
44
|
+
static delNotesData(user_id) {
|
|
45
|
+
return fs.rmSync(path.join(pluginDataPath, `${user_id}_.json`), { recursive: true, force: true });
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* @typedef {object} taskObj 任务对象
|
|
4
|
+
* @property {idString} song 歌曲ID
|
|
5
|
+
* @property {number} reward 奖励 notes 数量
|
|
6
|
+
* @property {boolean} finished 任务是否完成
|
|
7
|
+
* @property {object} request 任务要求
|
|
8
|
+
* @property {string} request.type 任务类型 acc / score
|
|
9
|
+
* @property {levelKind} request.rank 难度
|
|
10
|
+
* @property {number} request.value 任务要求数值
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
import themeManager from '../theme/manager.js'
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 内置主题列表(兼容旧版 /theme;新代码请使用 themeManager.getThemeList())
|
|
17
|
+
* @type {{id: string, src: string}[]}
|
|
18
|
+
*/
|
|
19
|
+
export const themeList = [{ id: "default", src: "默认" }, { id: "snow", src: "寒冬" }, { id: "star", src: "使一颗心免于哀伤" }, { id: "dss2", src: "大师赛2" }]
|
|
20
|
+
|
|
21
|
+
const BUILTIN_THEME_IDS = new Set(themeList.map(theme => theme.id))
|
|
22
|
+
const THEME_ID_RE = /^[a-zA-Z0-9_-]{1,120}$/
|
|
23
|
+
|
|
24
|
+
/** @param {unknown} themeId */
|
|
25
|
+
function normalizeThemePreference(themeId) {
|
|
26
|
+
if (themeId === 'common') return 'default'
|
|
27
|
+
return typeof themeId === 'string' && THEME_ID_RE.test(themeId) ? themeId : 'default'
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export default class PluginData {
|
|
31
|
+
/**
|
|
32
|
+
* @param {any} data 初始化数据
|
|
33
|
+
*/
|
|
34
|
+
constructor(data) {
|
|
35
|
+
this.money = isNaN(data?.money) ? 0 : data.money
|
|
36
|
+
this.sign_in = data?.sign_in || "Wed Apr 03 2024 23:03:52 GMT+0800 (中国标准时间)"
|
|
37
|
+
/**
|
|
38
|
+
* 签到记录(YYYY-MM-DD),用于渲染签到日历与累计签到天数
|
|
39
|
+
* @type {string[]}
|
|
40
|
+
*/
|
|
41
|
+
this.sign_history = Array.isArray(data?.sign_history) ? data.sign_history : []
|
|
42
|
+
this.task_time = data?.task_time || "Wed Apr 03 2024 23:03:52 GMT+0800 (中国标准时间)"
|
|
43
|
+
/**@type {taskObj[]} */
|
|
44
|
+
this.task = Array.isArray(data?.task) ? data.task : []
|
|
45
|
+
|
|
46
|
+
/**@type {number} */
|
|
47
|
+
this.noticeCode = isNaN(data?.noticeCode) ? 0 : data.noticeCode
|
|
48
|
+
|
|
49
|
+
/** @type {string} 持久化的用户主题偏好;策略临时禁用或主题暂时缺失时仍保留。 */
|
|
50
|
+
this.themePreference = 'default'
|
|
51
|
+
/** @type {string} 本次运行实际可用于渲染的主题标识。 */
|
|
52
|
+
this.theme = 'default'
|
|
53
|
+
this.setThemePreference(data?.theme)
|
|
54
|
+
|
|
55
|
+
/**@type {"all" | "b30" | "top"} */
|
|
56
|
+
this.b30AvgKind = "all"
|
|
57
|
+
switch (data?.b30AvgKind) {
|
|
58
|
+
case "all":
|
|
59
|
+
case "b30":
|
|
60
|
+
case "top":
|
|
61
|
+
case "none":
|
|
62
|
+
this.b30AvgKind = data.b30AvgKind
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**@type {"red" | "gold" | "blue" | "green"} avg条的主题色*/
|
|
66
|
+
this.b30AvgColor = "blue"
|
|
67
|
+
switch (data?.b30AvgColor) {
|
|
68
|
+
case "red":
|
|
69
|
+
case "gold":
|
|
70
|
+
case "blue":
|
|
71
|
+
case "green":
|
|
72
|
+
this.b30AvgColor = data.b30AvgColor
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/**@type {boolean} 是否允许使用在线API功能 */
|
|
76
|
+
this.allowApiUsage = data?.allowApiUsage !== false
|
|
77
|
+
|
|
78
|
+
/**@type {boolean} 是否展示 B30 统计分析 */
|
|
79
|
+
this.showB30Analysis = data?.showB30Analysis !== false
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* 更新用户偏好,并根据当前本地注册表与 Bot 策略计算实际渲染主题。
|
|
84
|
+
* @param {unknown} themeId
|
|
85
|
+
*/
|
|
86
|
+
setThemePreference(themeId) {
|
|
87
|
+
const requested = normalizeThemePreference(themeId)
|
|
88
|
+
this.themePreference = requested
|
|
89
|
+
this.theme = BUILTIN_THEME_IDS.has(requested)
|
|
90
|
+
|| (themeManager.isCustomTheme(requested) && themeManager.isThemeAvailable(requested))
|
|
91
|
+
? requested
|
|
92
|
+
: 'default'
|
|
93
|
+
return this.theme
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** 保持旧版存储结构:偏好继续写入 theme,不额外落盘运行时字段。 */
|
|
97
|
+
toJSON() {
|
|
98
|
+
const { themePreference, ...data } = this
|
|
99
|
+
return { ...data, theme: themePreference }
|
|
100
|
+
}
|
|
101
|
+
}
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import { redis } from '../../components/platform/index.js'
|
|
2
|
+
import { redisPath } from '../game/constNum.js'
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 生成用户凭证类 Redis 键。
|
|
6
|
+
* @param {string} kind 凭证类型
|
|
7
|
+
* @param {string | number} value 用户 ID或凭证值
|
|
8
|
+
* @returns {string} 带插件命名空间的 Redis 键
|
|
9
|
+
*/
|
|
10
|
+
function credentialKey(kind, value) {
|
|
11
|
+
return `${redisPath}:${kind}:${String(value)}`
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
class UserCredentialStore {
|
|
15
|
+
/**
|
|
16
|
+
* 按用户 ID读取本地 sessionToken。
|
|
17
|
+
* @param {string | number} userId 平台用户 ID
|
|
18
|
+
* @returns {Promise<phigrosToken>} 已保存的 sessionToken
|
|
19
|
+
*/
|
|
20
|
+
async getSessionToken(userId) {
|
|
21
|
+
return /** @type {any} */ (redis.get(credentialKey('userToken', userId)))
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 按用户 ID保存本地 sessionToken。
|
|
26
|
+
* @param {string | number} userId 平台用户 ID
|
|
27
|
+
* @param {phigrosToken} sessionToken Phigros sessionToken
|
|
28
|
+
*/
|
|
29
|
+
async setSessionToken(userId, sessionToken) {
|
|
30
|
+
return redis.set(credentialKey('userToken', userId), sessionToken)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 删除指定用户的 sessionToken。
|
|
35
|
+
* @param {string | number} userId 平台用户 ID
|
|
36
|
+
*/
|
|
37
|
+
async deleteSessionToken(userId) {
|
|
38
|
+
return redis.del(credentialKey('userToken', userId))
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* 按用户 ID读取本地 API ID。
|
|
43
|
+
* @param {string | number} userId 平台用户 ID
|
|
44
|
+
* @returns {Promise<apiUserId>} 已保存的 API ID
|
|
45
|
+
*/
|
|
46
|
+
async getApiId(userId) {
|
|
47
|
+
return /** @type {any} */ (redis.get(credentialKey('userApiId', userId)))
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 按用户 ID保存本地 API ID。
|
|
52
|
+
* @param {string | number} userId 平台用户 ID
|
|
53
|
+
* @param {apiUserId} apiId API 用户 ID
|
|
54
|
+
*/
|
|
55
|
+
async setApiId(userId, apiId) {
|
|
56
|
+
return redis.set(credentialKey('userApiId', userId), String(apiId))
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* 删除指定用户的本地 API ID。
|
|
61
|
+
* @param {string | number} userId 平台用户 ID
|
|
62
|
+
*/
|
|
63
|
+
async deleteApiId(userId) {
|
|
64
|
+
return redis.del(credentialKey('userApiId', userId))
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* 删除指定用户的 sessionToken和 API ID。
|
|
69
|
+
* @param {string | number} userId 平台用户 ID
|
|
70
|
+
*/
|
|
71
|
+
async clearLocalCredentials(userId) {
|
|
72
|
+
return redis.del(
|
|
73
|
+
credentialKey('userToken', userId),
|
|
74
|
+
credentialKey('userApiId', userId),
|
|
75
|
+
)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* 使用 Redis SCAN分页列出全部本地用户 sessionToken,供备份和管理员批量任务使用。
|
|
80
|
+
* @returns {Promise<Map<string, phigrosToken>>} 用户 ID到 sessionToken 的映射
|
|
81
|
+
*/
|
|
82
|
+
async listSessionCredentials() {
|
|
83
|
+
/** @type {Map<string, phigrosToken>} */
|
|
84
|
+
const result = new Map()
|
|
85
|
+
const prefix = `${redisPath}:userToken:`
|
|
86
|
+
let cursor = 0
|
|
87
|
+
do {
|
|
88
|
+
const info = await redis.scan(cursor, { MATCH: `${prefix}*`, COUNT: 100 })
|
|
89
|
+
cursor = Number(info.cursor)
|
|
90
|
+
const values = await Promise.all(info.keys.map(key => redis.get(key)))
|
|
91
|
+
info.keys.forEach((key, index) => {
|
|
92
|
+
const value = values[index]
|
|
93
|
+
if (value) result.set(key.slice(prefix.length), /** @type {phigrosToken} */(value))
|
|
94
|
+
})
|
|
95
|
+
} while (cursor !== 0)
|
|
96
|
+
return result
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* 分页删除旧版派生凭据和别名通知元数据缓存。
|
|
101
|
+
* @returns {Promise<number>} 实际删除的旧缓存键数量
|
|
102
|
+
*/
|
|
103
|
+
async deleteLegacyCredentialCaches() {
|
|
104
|
+
const patterns = [`${redisPath}:apiBotBinding:*`, `${redisPath}:aliasBinding:*`]
|
|
105
|
+
let deleted = 0
|
|
106
|
+
for (const pattern of patterns) {
|
|
107
|
+
let cursor = 0
|
|
108
|
+
do {
|
|
109
|
+
const info = await redis.scan(cursor, { MATCH: pattern, COUNT: 100 })
|
|
110
|
+
cursor = Number(info.cursor)
|
|
111
|
+
if (info.keys.length) deleted += Number(await redis.del(...info.keys))
|
|
112
|
+
} while (cursor !== 0)
|
|
113
|
+
}
|
|
114
|
+
return deleted
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* 将 sessionToken 加入本地禁用列表。
|
|
119
|
+
* @param {phigrosToken} sessionToken 待禁用的 sessionToken
|
|
120
|
+
*/
|
|
121
|
+
async banSessionToken(sessionToken) {
|
|
122
|
+
return redis.set(credentialKey('banSessionToken', sessionToken), 1)
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
/**
|
|
126
|
+
* 从本地禁用列表移除 sessionToken。
|
|
127
|
+
* @param {phigrosToken} sessionToken 待恢复的 sessionToken
|
|
128
|
+
*/
|
|
129
|
+
async allowSessionToken(sessionToken) {
|
|
130
|
+
return redis.del(credentialKey('banSessionToken', sessionToken))
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* 检查 sessionToken 是否已被禁用;空值直接视为未禁用。
|
|
135
|
+
* @param {phigrosToken | null | undefined} sessionToken 待检查的 sessionToken
|
|
136
|
+
* @returns {Promise<boolean>} Redis 标记;未禁用时为假值
|
|
137
|
+
*/
|
|
138
|
+
async isSessionTokenBanned(sessionToken) {
|
|
139
|
+
if (!sessionToken) return false
|
|
140
|
+
return Boolean(await redis.get(credentialKey('banSessionToken', sessionToken)))
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* 列出全部禁用 sessionToken 的 Redis 键,仅供管理员维护功能使用。
|
|
145
|
+
* @returns {Promise<string[]>} 禁用记录键列表
|
|
146
|
+
*/
|
|
147
|
+
async listBannedSessionTokenKeys() {
|
|
148
|
+
return redis.keys(`${redisPath}:banSessionToken:*`)
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export const userCredentialStore = new UserCredentialStore()
|
|
154
|
+
export default userCredentialStore
|