@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,625 @@
|
|
|
1
|
+
import assert from 'node:assert/strict'
|
|
2
|
+
import fs from 'node:fs'
|
|
3
|
+
import path from 'node:path'
|
|
4
|
+
import test from 'node:test'
|
|
5
|
+
import art from 'art-template'
|
|
6
|
+
import themeManager from '../model/theme/manager.js'
|
|
7
|
+
import { pluginResources } from '../model/filesystem/path.js'
|
|
8
|
+
import { migrateLegacyThemeDirectories, themesDir } from '../model/theme/paths.js'
|
|
9
|
+
|
|
10
|
+
const THEMES_DIR = themesDir
|
|
11
|
+
const RES = 'resources/'
|
|
12
|
+
|
|
13
|
+
/** 等待条件成立(用于热更新断言) */
|
|
14
|
+
/** @param {() => boolean} fn @param {number} [timeout] */
|
|
15
|
+
async function waitFor(fn, timeout = 4000) {
|
|
16
|
+
const start = Date.now()
|
|
17
|
+
while (Date.now() - start < timeout) {
|
|
18
|
+
if (fn()) return true
|
|
19
|
+
await new Promise(resolve => setTimeout(resolve, 50))
|
|
20
|
+
}
|
|
21
|
+
return fn()
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/** @param {string} theme @param {any} themeInfo @param {string} [template] */
|
|
25
|
+
function renderUserInfo(theme, themeInfo, template = 'userinfo') {
|
|
26
|
+
const source = fs.readFileSync(path.join(pluginResources, 'html', 'userinfo', `${template}.art`), 'utf8')
|
|
27
|
+
return art.render(source, {
|
|
28
|
+
_res_path: RES,
|
|
29
|
+
defaultLayout: path.join(pluginResources, 'html', 'common', 'layout', 'default.art'),
|
|
30
|
+
sys: { scale: 'style="transform:scale(1)"' },
|
|
31
|
+
theme,
|
|
32
|
+
themeInfo,
|
|
33
|
+
background: 'song.png',
|
|
34
|
+
_plugin: 'phi-plugin',
|
|
35
|
+
Version: { ver: 'test' },
|
|
36
|
+
gameuser: {
|
|
37
|
+
avatar: 'avatar1',
|
|
38
|
+
backgroundurl: 'player.png',
|
|
39
|
+
PlayerId: 'TestPlayer',
|
|
40
|
+
rks: { toFixed: () => '15.0000' },
|
|
41
|
+
ChallengeMode: '0',
|
|
42
|
+
ChallengeModeRank: '12',
|
|
43
|
+
data: '100',
|
|
44
|
+
selfIntro: '',
|
|
45
|
+
},
|
|
46
|
+
rks_history: [],
|
|
47
|
+
data_history: [],
|
|
48
|
+
rks_range: [0, 0],
|
|
49
|
+
data_range: [0, 0],
|
|
50
|
+
data_date: [],
|
|
51
|
+
rks_date: [],
|
|
52
|
+
acc_rks_data: [],
|
|
53
|
+
acc_rks_range: [0, 0],
|
|
54
|
+
acc_rks_AccRange: [],
|
|
55
|
+
userstats: [{
|
|
56
|
+
Rating: 'FC', title: 'IN', unlock: 1, tot: 1, cleared: 1, fc: 1, phi: 1,
|
|
57
|
+
real_score: 1, tot_score: 1, highest: { toFixed: () => '15.00' },
|
|
58
|
+
lowest: { toFixed: () => '14.00' },
|
|
59
|
+
}],
|
|
60
|
+
})
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
test('内置主题注册完整,milthm 作为自定义主题注册成功', () => {
|
|
64
|
+
assert.ok(themeManager.isTheme('default'))
|
|
65
|
+
assert.ok(themeManager.isTheme('snow'))
|
|
66
|
+
assert.ok(themeManager.isTheme('star'))
|
|
67
|
+
assert.ok(themeManager.isTheme('dss2'))
|
|
68
|
+
assert.ok(themeManager.isTheme('milthm'))
|
|
69
|
+
assert.ok(themeManager.isCustomTheme('milthm'))
|
|
70
|
+
assert.ok(!themeManager.isCustomTheme('default'))
|
|
71
|
+
assert.equal(themeManager.getTheme('unknown-id'), null)
|
|
72
|
+
})
|
|
73
|
+
|
|
74
|
+
test('getThemeList 内置在前自定义在后,序号连续', () => {
|
|
75
|
+
const list = themeManager.getThemeList()
|
|
76
|
+
const ids = list.map(t => t.id)
|
|
77
|
+
assert.deepEqual(ids.slice(0, 4), ['default', 'snow', 'star', 'dss2'])
|
|
78
|
+
assert.ok(ids.includes('milthm'))
|
|
79
|
+
assert.equal(list.find(t => t.id === 'milthm')?.src, 'Milthm')
|
|
80
|
+
})
|
|
81
|
+
|
|
82
|
+
test('getThemeOptions 合并内置与自定义,自定义主题序号从 4 开始', () => {
|
|
83
|
+
const options = themeManager.getThemeOptions()
|
|
84
|
+
assert.equal(Object.keys(options)[4], 'milthm')
|
|
85
|
+
assert.match(options.milthm.title, /^\[4\]Milthm$/)
|
|
86
|
+
assert.equal(options.milthm.description, '所有词语,都是雨的旋律')
|
|
87
|
+
})
|
|
88
|
+
|
|
89
|
+
test('getRenderInfo:自定义主题返回模板路径与 themeInfo,资源 url 完整', () => {
|
|
90
|
+
const info = themeManager.getRenderInfo('milthm', RES, 'b19')
|
|
91
|
+
assert.ok(info)
|
|
92
|
+
assert.match(info.tplFile ?? '', /themes[\\/]milthm[\\/]b19\.art$/)
|
|
93
|
+
assert.equal(info.themeInfo.id, 'milthm')
|
|
94
|
+
assert.equal(info.themeInfo.baseUrl, 'resources/themes/milthm/')
|
|
95
|
+
assert.equal(info.themeInfo.cssUrl, 'resources/themes/milthm/b19.css')
|
|
96
|
+
assert.equal(info.themeInfo.cssMode, 'overlay')
|
|
97
|
+
assert.equal(info.themeInfo.fontUrl, 'resources/themes/milthm/font.ttf')
|
|
98
|
+
assert.equal(info.themeInfo.backgroundUrl, 'resources/themes/milthm/bg.png')
|
|
99
|
+
assert.equal(info.themeInfo.icons.phi, 'resources/themes/milthm/phi.png')
|
|
100
|
+
assert.equal(info.themeInfo.icons.FC, 'resources/themes/milthm/FC.png')
|
|
101
|
+
assert.deepEqual(info.themeInfo.colors, { AT: '#555555', IN: '#7b5ea7', HD: '#5b9bd5', EZ: '#7ecb8a' })
|
|
102
|
+
})
|
|
103
|
+
|
|
104
|
+
test('getRenderInfo:按页面选择 CSS,缺省页面保留背景和颜色但不启用主题字体', () => {
|
|
105
|
+
const pages = [
|
|
106
|
+
'b19', 'sign', 'update', 'clg', 'arcgrosB19', 'suggest', 'table',
|
|
107
|
+
'list', 'historyB30', 'setting', 'difficultyHistory', 'help',
|
|
108
|
+
]
|
|
109
|
+
for (const page of pages) {
|
|
110
|
+
const info = themeManager.getRenderInfo('milthm', RES, `${page}/${page}`)
|
|
111
|
+
assert.ok(info)
|
|
112
|
+
assert.equal(info.themeInfo.cssUrl, `resources/themes/milthm/${page}.css`)
|
|
113
|
+
assert.equal(info.themeInfo.cssMode, 'overlay')
|
|
114
|
+
assert.equal(info.themeInfo.fontUrl, 'resources/themes/milthm/font.ttf')
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
const fallback = themeManager.getRenderInfo('milthm', RES, 'unconfiguredPage')
|
|
118
|
+
assert.ok(fallback)
|
|
119
|
+
assert.equal(fallback.themeInfo.cssUrl, undefined)
|
|
120
|
+
assert.equal(fallback.themeInfo.fontUrl, undefined)
|
|
121
|
+
assert.equal(fallback.themeInfo.backgroundUrl, 'resources/themes/milthm/bg.png')
|
|
122
|
+
assert.deepEqual(fallback.themeInfo.colors, { AT: '#555555', IN: '#7b5ea7', HD: '#5b9bd5', EZ: '#7ecb8a' })
|
|
123
|
+
})
|
|
124
|
+
|
|
125
|
+
test('仅配置背景和难度色的主题可用默认 B19 模板与图标渲染', () => {
|
|
126
|
+
const testId = '__theme_colors_only__'
|
|
127
|
+
const testDir = path.join(THEMES_DIR, testId)
|
|
128
|
+
try {
|
|
129
|
+
fs.mkdirSync(testDir, { recursive: true })
|
|
130
|
+
fs.writeFileSync(path.join(testDir, 'info.yaml'), [
|
|
131
|
+
`id: "${testId}"`,
|
|
132
|
+
'name: "Colors only"',
|
|
133
|
+
'background: "background.png"',
|
|
134
|
+
'color:',
|
|
135
|
+
' AT: "#111111"',
|
|
136
|
+
' IN: "#222222"',
|
|
137
|
+
' HD: "#333333"',
|
|
138
|
+
' EZ: "#444444"',
|
|
139
|
+
'',
|
|
140
|
+
].join('\n'))
|
|
141
|
+
fs.writeFileSync(path.join(testDir, 'background.png'), 'fixture')
|
|
142
|
+
themeManager.scan()
|
|
143
|
+
|
|
144
|
+
const info = themeManager.getRenderInfo(testId, RES, 'b19')
|
|
145
|
+
assert.ok(info)
|
|
146
|
+
assert.equal(info.themeInfo.cssUrl, undefined)
|
|
147
|
+
assert.equal(info.themeInfo.fontUrl, undefined)
|
|
148
|
+
assert.equal(info.themeInfo.icons, undefined)
|
|
149
|
+
|
|
150
|
+
const source = fs.readFileSync(path.join(pluginResources, 'html', 'b19', 'b19.art'), 'utf8')
|
|
151
|
+
const html = art.render(source, renderData(testId, info.themeInfo))
|
|
152
|
+
assert.ok(html.includes('html/b19/b19.css'))
|
|
153
|
+
assert.ok(html.includes('html/otherimg/FC.png'))
|
|
154
|
+
assert.ok(html.includes(info.themeInfo.backgroundUrl))
|
|
155
|
+
assert.ok(html.includes('--phi-theme-IN: #222222'))
|
|
156
|
+
} finally {
|
|
157
|
+
fs.rmSync(testDir, { recursive: true, force: true })
|
|
158
|
+
themeManager.scan()
|
|
159
|
+
}
|
|
160
|
+
})
|
|
161
|
+
|
|
162
|
+
test('新版页面 CSS 优先匹配完整渲染目标,再回退到 app 短键', () => {
|
|
163
|
+
const testId = '__theme_page_keys__'
|
|
164
|
+
const testDir = path.join(THEMES_DIR, testId)
|
|
165
|
+
try {
|
|
166
|
+
fs.mkdirSync(testDir, { recursive: true })
|
|
167
|
+
fs.writeFileSync(path.join(testDir, 'info.yaml'), [
|
|
168
|
+
`id: "${testId}"`,
|
|
169
|
+
'name: "Page keys"',
|
|
170
|
+
'font: "font.ttf"',
|
|
171
|
+
'css:',
|
|
172
|
+
' setting: "setting.css"',
|
|
173
|
+
' setting/userSetting: "user-setting.css"',
|
|
174
|
+
' setting/missing: "missing.css"',
|
|
175
|
+
' invalid/path/extra: "ignored.css"',
|
|
176
|
+
'',
|
|
177
|
+
].join('\n'))
|
|
178
|
+
for (const file of ['font.ttf', 'setting.css', 'user-setting.css']) {
|
|
179
|
+
fs.writeFileSync(path.join(testDir, file), 'fixture')
|
|
180
|
+
}
|
|
181
|
+
themeManager.scan()
|
|
182
|
+
|
|
183
|
+
const exact = themeManager.getRenderInfo(testId, RES, 'setting/userSetting')
|
|
184
|
+
assert.match(exact?.themeInfo.cssUrl ?? '', /\/user-setting\.css$/)
|
|
185
|
+
assert.match(exact?.themeInfo.fontUrl ?? '', /\/font\.ttf$/)
|
|
186
|
+
|
|
187
|
+
const fallback = themeManager.getRenderInfo(testId, RES, 'setting/missing')
|
|
188
|
+
assert.match(fallback?.themeInfo.cssUrl ?? '', /\/setting\.css$/)
|
|
189
|
+
|
|
190
|
+
const short = themeManager.getRenderInfo(testId, RES, 'setting')
|
|
191
|
+
assert.match(short?.themeInfo.cssUrl ?? '', /\/setting\.css$/)
|
|
192
|
+
assert.equal(themeManager.getTheme(testId)?.css?.['invalid/path/extra'], undefined)
|
|
193
|
+
} finally {
|
|
194
|
+
fs.rmSync(testDir, { recursive: true, force: true })
|
|
195
|
+
themeManager.scan()
|
|
196
|
+
}
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
test('userinfo/userinfo 后置加载精确页面样式并使用主题图标', () => {
|
|
200
|
+
const testId = '__theme_userinfo__'
|
|
201
|
+
const testDir = path.join(THEMES_DIR, testId)
|
|
202
|
+
try {
|
|
203
|
+
fs.mkdirSync(testDir, { recursive: true })
|
|
204
|
+
fs.writeFileSync(path.join(testDir, 'info.yaml'), [
|
|
205
|
+
'id: "' + testId + '"',
|
|
206
|
+
'name: "User info"',
|
|
207
|
+
'css:',
|
|
208
|
+
' userinfo/userinfo: "userinfo.css"',
|
|
209
|
+
'icon:',
|
|
210
|
+
' FC: "FC.png"',
|
|
211
|
+
'',
|
|
212
|
+
].join('\n'))
|
|
213
|
+
fs.writeFileSync(path.join(testDir, 'userinfo.css'), 'fixture')
|
|
214
|
+
fs.writeFileSync(path.join(testDir, 'FC.png'), 'fixture')
|
|
215
|
+
themeManager.scan()
|
|
216
|
+
|
|
217
|
+
const info = themeManager.getRenderInfo(testId, RES, 'userinfo/userinfo')
|
|
218
|
+
assert.ok(info)
|
|
219
|
+
assert.match(info.themeInfo.cssUrl, /__theme_userinfo__\/userinfo\.css$/)
|
|
220
|
+
assert.equal(info.themeInfo.cssMode, 'overlay')
|
|
221
|
+
assert.match(info.themeInfo.icons.FC, /__theme_userinfo__\/FC\.png$/)
|
|
222
|
+
|
|
223
|
+
const oldInfo = themeManager.getRenderInfo(testId, RES, 'userinfo/userinfo-old')
|
|
224
|
+
assert.ok(oldInfo)
|
|
225
|
+
assert.equal(oldInfo.themeInfo.cssUrl, undefined)
|
|
226
|
+
|
|
227
|
+
const html = renderUserInfo(testId, info.themeInfo)
|
|
228
|
+
assert.ok(html.includes('html/userinfo/userinfo.css'))
|
|
229
|
+
assert.ok(html.includes(info.themeInfo.cssUrl))
|
|
230
|
+
assert.ok(html.indexOf('html/userinfo/userinfo.css') < html.indexOf(info.themeInfo.cssUrl))
|
|
231
|
+
assert.ok(html.includes(info.themeInfo.icons.FC))
|
|
232
|
+
} finally {
|
|
233
|
+
fs.rmSync(testDir, { recursive: true, force: true })
|
|
234
|
+
themeManager.scan()
|
|
235
|
+
}
|
|
236
|
+
})
|
|
237
|
+
|
|
238
|
+
test('userinfo 未配置专用样式时保留原生 CSS、主题背景和主题评级图标', () => {
|
|
239
|
+
for (const template of ['userinfo', 'userinfo-old']) {
|
|
240
|
+
const target = `userinfo/${template}`
|
|
241
|
+
const info = themeManager.getRenderInfo('milthm', RES, target)
|
|
242
|
+
assert.ok(info)
|
|
243
|
+
assert.equal(info.themeInfo.cssUrl, undefined)
|
|
244
|
+
assert.equal(info.themeInfo.fontUrl, undefined)
|
|
245
|
+
assert.ok(info.themeInfo.backgroundUrl)
|
|
246
|
+
assert.ok(info.themeInfo.icons.FC)
|
|
247
|
+
|
|
248
|
+
const html = renderUserInfo('milthm', info.themeInfo, template)
|
|
249
|
+
assert.ok(html.includes(`html/userinfo/${template}.css`))
|
|
250
|
+
assert.ok(html.includes(info.themeInfo.backgroundUrl))
|
|
251
|
+
assert.ok(html.includes(info.themeInfo.icons.FC))
|
|
252
|
+
assert.ok(!html.includes('@font-face'))
|
|
253
|
+
assert.ok(!html.includes('font-family: "phi-theme"'))
|
|
254
|
+
|
|
255
|
+
const defaultIconHtml = renderUserInfo('milthm', { ...info.themeInfo, icons: {} }, template)
|
|
256
|
+
assert.ok(defaultIconHtml.includes('html/otherimg/FC.png'))
|
|
257
|
+
}
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
test('旧版字符串 css 仅替换 B19 样式,其他页面使用默认 CSS 和字体', () => {
|
|
261
|
+
const testId = '__theme_legacy_css__'
|
|
262
|
+
const testDir = path.join(THEMES_DIR, testId)
|
|
263
|
+
try {
|
|
264
|
+
fs.mkdirSync(testDir, { recursive: true })
|
|
265
|
+
fs.writeFileSync(path.join(testDir, 'info.yaml'), [
|
|
266
|
+
`id: "${testId}"`,
|
|
267
|
+
'name: "Legacy CSS"',
|
|
268
|
+
'font: "font.ttf"',
|
|
269
|
+
'background: "background.png"',
|
|
270
|
+
'css: "b19.css"',
|
|
271
|
+
'icon:',
|
|
272
|
+
' FC: "FC.png"',
|
|
273
|
+
'color:',
|
|
274
|
+
' IN: "#123456"',
|
|
275
|
+
'',
|
|
276
|
+
].join('\n'))
|
|
277
|
+
for (const file of ['font.ttf', 'background.png', 'b19.css', 'FC.png']) {
|
|
278
|
+
fs.writeFileSync(path.join(testDir, file), 'fixture')
|
|
279
|
+
}
|
|
280
|
+
themeManager.scan()
|
|
281
|
+
|
|
282
|
+
const b19 = themeManager.getRenderInfo(testId, RES, 'b19')
|
|
283
|
+
assert.ok(b19)
|
|
284
|
+
assert.match(b19.themeInfo.cssUrl, /__theme_legacy_css__\/b19\.css$/)
|
|
285
|
+
assert.equal(b19.themeInfo.cssMode, 'replace')
|
|
286
|
+
assert.match(b19.themeInfo.fontUrl, /__theme_legacy_css__\/font\.ttf$/)
|
|
287
|
+
|
|
288
|
+
const source = fs.readFileSync(path.join(pluginResources, 'html', 'b19', 'b19.art'), 'utf8')
|
|
289
|
+
const html = art.render(source, renderData(testId, b19.themeInfo))
|
|
290
|
+
assert.ok(html.includes(b19.themeInfo.cssUrl))
|
|
291
|
+
assert.ok(!html.includes('html/b19/b19.css'))
|
|
292
|
+
assert.equal(html.split(b19.themeInfo.cssUrl).length - 1, 1)
|
|
293
|
+
|
|
294
|
+
const sign = themeManager.getRenderInfo(testId, RES, 'sign')
|
|
295
|
+
assert.ok(sign)
|
|
296
|
+
assert.equal(sign.themeInfo.cssUrl, undefined)
|
|
297
|
+
assert.equal(sign.themeInfo.cssMode, undefined)
|
|
298
|
+
assert.equal(sign.themeInfo.fontUrl, undefined)
|
|
299
|
+
assert.match(sign.themeInfo.backgroundUrl, /__theme_legacy_css__\/background\.png$/)
|
|
300
|
+
assert.deepEqual(sign.themeInfo.colors, { IN: '#123456' })
|
|
301
|
+
} finally {
|
|
302
|
+
fs.rmSync(testDir, { recursive: true, force: true })
|
|
303
|
+
themeManager.scan()
|
|
304
|
+
}
|
|
305
|
+
})
|
|
306
|
+
|
|
307
|
+
test('主题资源 URL 使用实际目录名,并拒绝越界路径和符号链接', () => {
|
|
308
|
+
const dirName = '__theme actual#dir%__'
|
|
309
|
+
const testId = '__theme_different_id__'
|
|
310
|
+
const testDir = path.join(THEMES_DIR, dirName)
|
|
311
|
+
const outsideFile = path.join(THEMES_DIR, '__theme_outside.css')
|
|
312
|
+
const nestedDir = path.join(testDir, 'nested styles')
|
|
313
|
+
let symlinkCreated = false
|
|
314
|
+
try {
|
|
315
|
+
fs.mkdirSync(nestedDir, { recursive: true })
|
|
316
|
+
fs.writeFileSync(path.join(testDir, 'info.yaml'), [
|
|
317
|
+
`id: "${testId}"`,
|
|
318
|
+
'name: "Path safety"',
|
|
319
|
+
'background: "background #%.png"',
|
|
320
|
+
'css:',
|
|
321
|
+
' sign: "nested styles/valid #%.css"',
|
|
322
|
+
' update: "../__theme_outside.css"',
|
|
323
|
+
' help: "linked.css"',
|
|
324
|
+
'',
|
|
325
|
+
].join('\n'))
|
|
326
|
+
fs.writeFileSync(path.join(nestedDir, 'valid #%.css'), 'fixture')
|
|
327
|
+
fs.writeFileSync(path.join(testDir, 'background #%.png'), 'fixture')
|
|
328
|
+
fs.writeFileSync(outsideFile, 'fixture')
|
|
329
|
+
try {
|
|
330
|
+
fs.symlinkSync(outsideFile, path.join(testDir, 'linked.css'))
|
|
331
|
+
symlinkCreated = true
|
|
332
|
+
} catch { }
|
|
333
|
+
themeManager.scan()
|
|
334
|
+
|
|
335
|
+
const sign = themeManager.getRenderInfo(testId, RES, 'sign/sign')
|
|
336
|
+
const encodedDir = encodeURIComponent(dirName)
|
|
337
|
+
assert.equal(sign?.themeInfo.baseUrl, `resources/themes/${encodedDir}/`)
|
|
338
|
+
assert.equal(sign?.themeInfo.cssUrl,
|
|
339
|
+
`resources/themes/${encodedDir}/nested%20styles/valid%20%23%25.css`)
|
|
340
|
+
assert.equal(sign?.themeInfo.backgroundUrl,
|
|
341
|
+
`resources/themes/${encodedDir}/background%20%23%25.png`)
|
|
342
|
+
const cssUrl = new URL(sign?.themeInfo.cssUrl ?? '', 'file:///')
|
|
343
|
+
assert.equal(cssUrl.hash, '')
|
|
344
|
+
assert.equal(cssUrl.search, '')
|
|
345
|
+
|
|
346
|
+
const escaped = themeManager.getRenderInfo(testId, RES, 'update/update')
|
|
347
|
+
assert.equal(escaped?.themeInfo.cssUrl, undefined)
|
|
348
|
+
if (symlinkCreated) {
|
|
349
|
+
const linked = themeManager.getRenderInfo(testId, RES, 'help/help')
|
|
350
|
+
assert.equal(linked?.themeInfo.cssUrl, undefined)
|
|
351
|
+
}
|
|
352
|
+
} finally {
|
|
353
|
+
fs.rmSync(testDir, { recursive: true, force: true })
|
|
354
|
+
fs.rmSync(outsideFile, { force: true })
|
|
355
|
+
themeManager.scan()
|
|
356
|
+
}
|
|
357
|
+
})
|
|
358
|
+
|
|
359
|
+
test('主题根目录符号链接不会被注册', (t) => {
|
|
360
|
+
const testId = '__theme_linked_root__'
|
|
361
|
+
const linkedDir = path.join(THEMES_DIR, testId)
|
|
362
|
+
const externalDir = fs.mkdtempSync(path.join(path.dirname(THEMES_DIR), '__theme_external_root__'))
|
|
363
|
+
try {
|
|
364
|
+
fs.writeFileSync(path.join(externalDir, 'info.yaml'), `id: "${testId}"\nname: "Linked root"\n`)
|
|
365
|
+
try {
|
|
366
|
+
fs.symlinkSync(externalDir, linkedDir, 'dir')
|
|
367
|
+
} catch {
|
|
368
|
+
t.skip('当前环境不支持创建目录符号链接')
|
|
369
|
+
return
|
|
370
|
+
}
|
|
371
|
+
themeManager.scan()
|
|
372
|
+
assert.ok(!themeManager.isCustomTheme(testId))
|
|
373
|
+
} finally {
|
|
374
|
+
fs.rmSync(linkedDir, { recursive: true, force: true })
|
|
375
|
+
fs.rmSync(externalDir, { recursive: true, force: true })
|
|
376
|
+
themeManager.scan()
|
|
377
|
+
}
|
|
378
|
+
})
|
|
379
|
+
|
|
380
|
+
test('旧主题目录按 info.yaml.id 自动迁移到 resources/themes', () => {
|
|
381
|
+
const id = `legacymove${Date.now()}`
|
|
382
|
+
const legacyRoot = path.join(pluginResources, 'html', 'b19', 'res', 'themes')
|
|
383
|
+
const legacyDir = path.join(legacyRoot, `old-folder-${id}`)
|
|
384
|
+
const target = path.join(THEMES_DIR, id)
|
|
385
|
+
try {
|
|
386
|
+
fs.mkdirSync(legacyDir, { recursive: true })
|
|
387
|
+
fs.writeFileSync(path.join(legacyDir, 'info.yaml'), `id: "${id}"\nname: "Legacy move"\n`)
|
|
388
|
+
const moved = migrateLegacyThemeDirectories()
|
|
389
|
+
assert.equal(moved.some(item => item.from === legacyDir && item.to === target), true)
|
|
390
|
+
assert.equal(fs.existsSync(legacyDir), false)
|
|
391
|
+
assert.equal(fs.existsSync(path.join(target, 'info.yaml')), true)
|
|
392
|
+
} finally {
|
|
393
|
+
fs.rmSync(legacyDir, { recursive: true, force: true })
|
|
394
|
+
fs.rmSync(target, { recursive: true, force: true })
|
|
395
|
+
}
|
|
396
|
+
})
|
|
397
|
+
|
|
398
|
+
test('getRenderInfo:dss2 返回内置模板路径且 themeInfo 为 null,default/snow/star 返回 null', () => {
|
|
399
|
+
const dss2 = themeManager.getRenderInfo('dss2', RES)
|
|
400
|
+
assert.ok(dss2)
|
|
401
|
+
assert.match(dss2.tplFile || '', /b19[\\/]dss2\.art$/)
|
|
402
|
+
assert.equal(dss2.themeInfo, null)
|
|
403
|
+
assert.equal(themeManager.getRenderInfo('default', RES), null)
|
|
404
|
+
assert.equal(themeManager.getRenderInfo('snow', RES), null)
|
|
405
|
+
assert.equal(themeManager.getRenderInfo('star', RES), null)
|
|
406
|
+
assert.equal(themeManager.getRenderInfo('unknown', RES), null)
|
|
407
|
+
})
|
|
408
|
+
|
|
409
|
+
test('热更新:新增/修改/删除主题目录无需重启即可生效', async () => {
|
|
410
|
+
const testId = '__theme_hot_reload_test__'
|
|
411
|
+
const testDir = path.join(THEMES_DIR, testId)
|
|
412
|
+
try {
|
|
413
|
+
fs.mkdirSync(testDir, { recursive: true })
|
|
414
|
+
fs.writeFileSync(path.join(testDir, 'info.yaml'),
|
|
415
|
+
`name: "HotReload"\nid: "${testId}"\ndescription: "hot reload test"\n`)
|
|
416
|
+
assert.ok(await waitFor(() => themeManager.isCustomTheme(testId)), '新增主题未被注册')
|
|
417
|
+
|
|
418
|
+
const beforeOptions = themeManager.getThemeOptions()
|
|
419
|
+
const before = beforeOptions[testId]
|
|
420
|
+
const beforeIndex = Object.keys(beforeOptions).indexOf(testId)
|
|
421
|
+
fs.writeFileSync(path.join(testDir, 'info.yaml'),
|
|
422
|
+
`name: "HotReloadV2"\nid: "${testId}"\ndescription: "updated"\n`)
|
|
423
|
+
assert.ok(await waitFor(() => themeManager.getThemeOptions()[testId].description === 'updated'), '修改 info.yaml 未生效')
|
|
424
|
+
|
|
425
|
+
fs.rmSync(testDir, { recursive: true, force: true })
|
|
426
|
+
assert.ok(await waitFor(() => !themeManager.isCustomTheme(testId)), '删除主题未生效')
|
|
427
|
+
assert.equal(before.title, `[${beforeIndex}]HotReload`)
|
|
428
|
+
} finally {
|
|
429
|
+
fs.rmSync(testDir, { recursive: true, force: true })
|
|
430
|
+
}
|
|
431
|
+
})
|
|
432
|
+
|
|
433
|
+
test('非法主题包:缺少 info.yaml / 非法 id / 冲突 id 均被跳过且不影响注册表', async () => {
|
|
434
|
+
const noYamlDir = path.join(THEMES_DIR, '__theme_no_yaml__')
|
|
435
|
+
const badIdDir = path.join(THEMES_DIR, '__theme_bad_id__')
|
|
436
|
+
const conflictDir = path.join(THEMES_DIR, '__theme_conflict__')
|
|
437
|
+
try {
|
|
438
|
+
fs.mkdirSync(noYamlDir, { recursive: true })
|
|
439
|
+
fs.mkdirSync(badIdDir, { recursive: true })
|
|
440
|
+
fs.writeFileSync(path.join(badIdDir, 'info.yaml'), 'name: "Bad"\nid: "非法 id"\n')
|
|
441
|
+
fs.mkdirSync(conflictDir, { recursive: true })
|
|
442
|
+
fs.writeFileSync(path.join(conflictDir, 'info.yaml'), 'name: "Conflict"\nid: "dss2"\n')
|
|
443
|
+
// 等待热更新扫描
|
|
444
|
+
await new Promise(resolve => setTimeout(resolve, 500))
|
|
445
|
+
assert.ok(!themeManager.isCustomTheme('__theme_no_yaml__'))
|
|
446
|
+
assert.ok(!themeManager.isCustomTheme('__theme_bad_id__'))
|
|
447
|
+
assert.ok(!themeManager.isCustomTheme('dss2')) // 冲突 id 不覆盖内置主题
|
|
448
|
+
assert.ok(themeManager.isTheme('dss2'))
|
|
449
|
+
assert.ok(themeManager.isTheme('milthm')) // 内置与已有自定义不受影响
|
|
450
|
+
} finally {
|
|
451
|
+
for (const dir of [noYamlDir, badIdDir, conflictDir]) {
|
|
452
|
+
fs.rmSync(dir, { recursive: true, force: true })
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
})
|
|
456
|
+
|
|
457
|
+
/** 组装渲染数据(对齐 dealTpl 的 data 结构) */
|
|
458
|
+
/** @param {string} theme @param {any} themeInfo */
|
|
459
|
+
function renderData(theme, themeInfo) {
|
|
460
|
+
const song = {
|
|
461
|
+
num: 1,
|
|
462
|
+
illustration: 'ill.png',
|
|
463
|
+
rank: 'IN',
|
|
464
|
+
difficulty: { toFixed: () => '15.5' },
|
|
465
|
+
rks: { toFixed: () => '15.12' },
|
|
466
|
+
song: 'TestSong',
|
|
467
|
+
Rating: 'FC',
|
|
468
|
+
score: 1000000,
|
|
469
|
+
acc: { toFixed: () => '100.00' },
|
|
470
|
+
suggest: 'test',
|
|
471
|
+
suggestType: 2,
|
|
472
|
+
}
|
|
473
|
+
return {
|
|
474
|
+
_res_path: RES,
|
|
475
|
+
defaultLayout: path.join(pluginResources, 'html', 'common', 'layout', 'default.art'),
|
|
476
|
+
sys: { scale: 'style="transform:scale(1)"' },
|
|
477
|
+
theme,
|
|
478
|
+
themeInfo,
|
|
479
|
+
background: undefined,
|
|
480
|
+
_plugin: 'phi-plugin',
|
|
481
|
+
Version: { ver: 'test' },
|
|
482
|
+
gameuser: {
|
|
483
|
+
avatar: 'avatar1',
|
|
484
|
+
PlayerId: 'TestPlayer',
|
|
485
|
+
rks: { toFixed: () => '15.0000' },
|
|
486
|
+
ChallengeMode: '0',
|
|
487
|
+
ChallengeModeRank: '12',
|
|
488
|
+
data: '100',
|
|
489
|
+
},
|
|
490
|
+
Date: '2026-08-10',
|
|
491
|
+
stats: [{ title: 'EZ', cleared: 1, fc: 1, phi: 0 }],
|
|
492
|
+
phi: [{ ...song, num: 0 }],
|
|
493
|
+
b19_list: [song],
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
test('默认 b19.art:themeInfo 为 null 时保持原样(默认 css 与 otherimg 图标)', () => {
|
|
498
|
+
const source = fs.readFileSync(path.join(pluginResources, 'html', 'b19', 'b19.art'), 'utf8')
|
|
499
|
+
const html = art.render(source, renderData('default', null))
|
|
500
|
+
assert.ok(html.includes('html/b19/b19.css'))
|
|
501
|
+
assert.ok(html.includes('html/otherimg/FC.png'))
|
|
502
|
+
assert.ok(!html.includes('themes/milthm'))
|
|
503
|
+
})
|
|
504
|
+
|
|
505
|
+
test('默认 b19.art 主题感知:新版覆盖样式后置,图标缺失时回退默认', () => {
|
|
506
|
+
const info = themeManager.getRenderInfo('milthm', RES, 'b19')
|
|
507
|
+
assert.ok(info)
|
|
508
|
+
const source = fs.readFileSync(path.join(pluginResources, 'html', 'b19', 'b19.art'), 'utf8')
|
|
509
|
+
const html = art.render(source, renderData('milthm', info.themeInfo))
|
|
510
|
+
assert.ok(html.includes(info.themeInfo.cssUrl))
|
|
511
|
+
assert.ok(html.includes(info.themeInfo.icons.FC))
|
|
512
|
+
assert.ok(html.includes('html/b19/b19.css'))
|
|
513
|
+
assert.ok(html.indexOf('html/b19/b19.css') < html.indexOf(info.themeInfo.cssUrl))
|
|
514
|
+
// NEW 未提供图标 → 回退默认
|
|
515
|
+
const htmlNew = art.render(source, {
|
|
516
|
+
...renderData('milthm', info.themeInfo),
|
|
517
|
+
b19_list: [{ ...renderData('milthm', null).b19_list[0], Rating: 'NEW' }],
|
|
518
|
+
})
|
|
519
|
+
assert.ok(htmlNew.includes('html/otherimg/NEW.png'))
|
|
520
|
+
})
|
|
521
|
+
|
|
522
|
+
test('milthm b19.art:使用主题 css 与图标,无 snow/star/topText 分支', () => {
|
|
523
|
+
const info = themeManager.getRenderInfo('milthm', RES, 'b19')
|
|
524
|
+
assert.ok(info)
|
|
525
|
+
const source = fs.readFileSync(path.join(info.themeInfo.baseUrl.replace('resources/', pluginResources.replace(/\\/g, '/') + '/'), 'b19.art'), 'utf8')
|
|
526
|
+
const html = art.render(source, renderData('milthm', info.themeInfo))
|
|
527
|
+
assert.ok(html.includes('html/b19/b19.css'))
|
|
528
|
+
assert.ok(html.includes(info.themeInfo.cssUrl))
|
|
529
|
+
assert.ok(html.includes(info.themeInfo.icons.FC))
|
|
530
|
+
assert.ok(html.includes('phi_song'))
|
|
531
|
+
assert.ok(!html.includes('snow-box'))
|
|
532
|
+
assert.ok(!html.includes('topTextBox'))
|
|
533
|
+
assert.ok(!html.includes('id="stars"'))
|
|
534
|
+
})
|
|
535
|
+
|
|
536
|
+
test('default.art 布局:themeInfo 注入字体/难度色/背景,无 themeInfo 时与现状一致', () => {
|
|
537
|
+
const layout = path.join(pluginResources, 'html', 'common', 'layout', 'default.art')
|
|
538
|
+
const source = fs.readFileSync(layout, 'utf8')
|
|
539
|
+
const info = themeManager.getRenderInfo('milthm', RES, 'b19')
|
|
540
|
+
assert.ok(info)
|
|
541
|
+
|
|
542
|
+
const html = art.render(source, {
|
|
543
|
+
...renderData('milthm', info.themeInfo),
|
|
544
|
+
b19_list: [], phi: [],
|
|
545
|
+
})
|
|
546
|
+
assert.ok(html.includes('@font-face'))
|
|
547
|
+
assert.ok(html.includes('font-family: "phi-theme"'))
|
|
548
|
+
assert.ok(html.includes('--AT: #555555'))
|
|
549
|
+
assert.ok(html.includes('--phi-theme-AT: #555555'))
|
|
550
|
+
assert.ok(html.includes('--phi-theme-AT-dark: color-mix(in srgb, #555555 50%, black)'))
|
|
551
|
+
assert.ok(html.includes('--IN: #7b5ea7'))
|
|
552
|
+
assert.ok(html.includes('--phi-theme-IN: #7b5ea7'))
|
|
553
|
+
assert.ok(html.includes('--HD: #5b9bd5'))
|
|
554
|
+
assert.ok(html.includes('--EZ: #7ecb8a'))
|
|
555
|
+
assert.ok(html.includes(info.themeInfo.backgroundUrl))
|
|
556
|
+
assert.ok(html.includes('class="background theme-background"'))
|
|
557
|
+
assert.ok(html.includes('body > .background:not(.theme-background) { display: none; }'))
|
|
558
|
+
// 清单颜色与字体必须位于主题 CSS 之后,保证清单配置优先。
|
|
559
|
+
assert.ok(html.indexOf(info.themeInfo.cssUrl) < html.indexOf('@font-face'),
|
|
560
|
+
'主题样式应注入在 css 链接之后,以保证覆盖 common.css 默认值')
|
|
561
|
+
|
|
562
|
+
const plain = art.render(source, { ...renderData('default', null), b19_list: [], phi: [] })
|
|
563
|
+
assert.ok(!plain.includes('phi-theme'))
|
|
564
|
+
assert.ok(!plain.includes('--AT: #555555'))
|
|
565
|
+
assert.ok(plain.includes('html/otherimg/phigros.png'))
|
|
566
|
+
// star 分支不受影响
|
|
567
|
+
const star = art.render(source, { ...renderData('star', null), b19_list: [], phi: [] })
|
|
568
|
+
assert.ok(star.includes('Star1.png'))
|
|
569
|
+
})
|
|
570
|
+
|
|
571
|
+
test('默认页面 CSS 从主题别名读取难度色', () => {
|
|
572
|
+
for (const page of ['b19', 'list', 'suggest', 'difficultyHistory', 'arcgrosB19']) {
|
|
573
|
+
const css = fs.readFileSync(path.join(pluginResources, 'html', page, `${page}.css`), 'utf8')
|
|
574
|
+
for (const rank of ['AT', 'IN', 'HD', 'EZ']) {
|
|
575
|
+
assert.ok(css.includes(`--phi-theme-${rank}`), `${page} 未读取 ${rank} 主题色`)
|
|
576
|
+
}
|
|
577
|
+
}
|
|
578
|
+
const table = fs.readFileSync(path.join(pluginResources, 'html', 'table', 'table.css'), 'utf8')
|
|
579
|
+
assert.ok(table.includes('var(--phi-theme-IN, #ff5d5d)'))
|
|
580
|
+
})
|
|
581
|
+
|
|
582
|
+
test('sign.art:页面主题样式后置;未配置页面样式时使用默认字体', () => {
|
|
583
|
+
const source = fs.readFileSync(path.join(pluginResources, 'html', 'sign', 'sign.art'), 'utf8')
|
|
584
|
+
const signData = {
|
|
585
|
+
...renderData('milthm', null),
|
|
586
|
+
PlayerId: 'TestPlayer',
|
|
587
|
+
Rks: '15.0000',
|
|
588
|
+
avatar: 'avatar1',
|
|
589
|
+
ChallengeMode: '0',
|
|
590
|
+
ChallengeModeRank: '12',
|
|
591
|
+
Date: '2026-08-16',
|
|
592
|
+
Notes: 100,
|
|
593
|
+
signDays: 5,
|
|
594
|
+
lucky: 80,
|
|
595
|
+
good: [],
|
|
596
|
+
bad: [],
|
|
597
|
+
quote: 'Test quote',
|
|
598
|
+
edgeRate: Object.fromEntries(['EZ', 'HD', 'IN', 'AT'].map(rank => [
|
|
599
|
+
rank,
|
|
600
|
+
{ unlock: '50%', fc: '40%', phi: '30%' },
|
|
601
|
+
])),
|
|
602
|
+
dailyTasks: [],
|
|
603
|
+
notice: null,
|
|
604
|
+
calendar: { title: '2026 年 8 月', weekdays: [], weeks: [] },
|
|
605
|
+
}
|
|
606
|
+
|
|
607
|
+
const themed = themeManager.getRenderInfo('milthm', RES, 'sign')
|
|
608
|
+
assert.ok(themed)
|
|
609
|
+
const themedHtml = art.render(source, { ...signData, themeInfo: themed.themeInfo })
|
|
610
|
+
assert.ok(themedHtml.includes('html/sign/sign.css'))
|
|
611
|
+
assert.ok(themedHtml.includes('themes/milthm/sign.css'))
|
|
612
|
+
assert.ok(themedHtml.includes('font-family: "phi-theme"'))
|
|
613
|
+
assert.ok(themedHtml.indexOf('html/sign/sign.css') < themedHtml.indexOf('themes/milthm/sign.css'))
|
|
614
|
+
|
|
615
|
+
const fallback = themeManager.getRenderInfo('milthm', RES, 'unconfiguredPage')
|
|
616
|
+
assert.ok(fallback)
|
|
617
|
+
const fallbackHtml = art.render(source, { ...signData, themeInfo: fallback.themeInfo })
|
|
618
|
+
assert.ok(fallbackHtml.includes('html/sign/sign.css'))
|
|
619
|
+
assert.ok(fallbackHtml.includes(fallback.themeInfo.backgroundUrl))
|
|
620
|
+
assert.ok(fallbackHtml.includes('--IN: #7b5ea7'))
|
|
621
|
+
assert.ok(fallbackHtml.includes('--phi-theme-IN: #7b5ea7'))
|
|
622
|
+
assert.ok(!fallbackHtml.includes('@font-face'))
|
|
623
|
+
assert.ok(!fallbackHtml.includes('font-family: "phi-theme"'))
|
|
624
|
+
assert.ok(!fallbackHtml.includes('themes/milthm/sign.css'))
|
|
625
|
+
})
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import assert from 'node:assert/strict'
|
|
2
|
+
import test from 'node:test'
|
|
3
|
+
import themeManager from '../model/theme/manager.js'
|
|
4
|
+
|
|
5
|
+
test('theme manager initialization can reuse an already-ready watcher', async () => {
|
|
6
|
+
const initialized = await Promise.race([
|
|
7
|
+
themeManager.init(),
|
|
8
|
+
new Promise((_, reject) => setTimeout(() => reject(new Error('theme manager reinitialization timed out')), 2_000)),
|
|
9
|
+
])
|
|
10
|
+
assert.equal(initialized, themeManager)
|
|
11
|
+
})
|