@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.
Files changed (629) hide show
  1. package/LICENSE +22 -0
  2. package/core/.github/ISSUE_TEMPLATE/bug.yaml +133 -0
  3. package/core/.github/ISSUE_TEMPLATE/config.yml +1 -0
  4. package/core/.github/ISSUE_TEMPLATE/enhancement.yml +44 -0
  5. package/core/.vscode/c_cpp_properties.json +18 -0
  6. package/core/.vscode/launch.json +24 -0
  7. package/core/.vscode/settings.json +59 -0
  8. package/core/CHANGELOG.md +184 -0
  9. package/core/LICENSE +674 -0
  10. package/core/README.md +330 -0
  11. package/core/README_en.md +285 -0
  12. package/core/apps/Dan.js +129 -0
  13. package/core/apps/RankList.js +322 -0
  14. package/core/apps/aliasProposal.js +223 -0
  15. package/core/apps/apiSetting.js +592 -0
  16. package/core/apps/b19.js +1329 -0
  17. package/core/apps/botClient.js +64 -0
  18. package/core/apps/chart.js +692 -0
  19. package/core/apps/guessGame/guessIll.js +821 -0
  20. package/core/apps/guessGame/guessLetter.js +831 -0
  21. package/core/apps/guessGame/guessTips.js +254 -0
  22. package/core/apps/guessGame/letterGameUtils.js +74 -0
  23. package/core/apps/guessGame.js +214 -0
  24. package/core/apps/help.js +117 -0
  25. package/core/apps/manage.js +288 -0
  26. package/core/apps/market.js +243 -0
  27. package/core/apps/money.js +1064 -0
  28. package/core/apps/phisong.js +1418 -0
  29. package/core/apps/session.js +664 -0
  30. package/core/apps/setting.js +468 -0
  31. package/core/apps/update.js +541 -0
  32. package/core/apps/user.js +968 -0
  33. package/core/components/Config.js +249 -0
  34. package/core/components/Data.js +304 -0
  35. package/core/components/FileWatcherRegistry.js +102 -0
  36. package/core/components/Logger.js +11 -0
  37. package/core/components/ProcessCleanup.js +113 -0
  38. package/core/components/Version.js +56 -0
  39. package/core/components/YamlReader.js +157 -0
  40. package/core/components/baseClass.js +287 -0
  41. package/core/components/common.js +47 -0
  42. package/core/components/index.js +13 -0
  43. package/core/components/platform/index.js +79 -0
  44. package/core/components/platform/koishi.js +800 -0
  45. package/core/components/platform/koishiDatabaseRedis.js +391 -0
  46. package/core/components/platform/memoryRedis.js +209 -0
  47. package/core/components/platform/types.d.ts +272 -0
  48. package/core/components/platform/yunzai.js +604 -0
  49. package/core/components/segment.js +4 -0
  50. 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
  51. package/core/config/default_config/banGroup.yaml +14 -0
  52. package/core/config/default_config/config.yaml +159 -0
  53. package/core/config/default_config/nickconfig.yaml +6 -0
  54. package/core/config/default_config/otherinfo.yaml +51 -0
  55. package/core/guoba.support.js +597 -0
  56. package/core/index.js +85 -0
  57. package/core/lib/AES.js +40 -0
  58. package/core/lib/Base64.js +22 -0
  59. package/core/lib/ByteReader.js +168 -0
  60. package/core/lib/GameProgress.js +37 -0
  61. package/core/lib/GameRecord.js +47 -0
  62. package/core/lib/GameSettings.js +24 -0
  63. package/core/lib/GameUser.js +19 -0
  64. package/core/lib/Level.js +6 -0
  65. package/core/lib/LevelRecord.js +9 -0
  66. package/core/lib/PhigrosUser.js +135 -0
  67. package/core/lib/SaveManager.js +117 -0
  68. package/core/lib/Summary.js +47 -0
  69. package/core/lib/TapTap/CompleteQRCodeData.js +27 -0
  70. package/core/lib/TapTap/LCHelper.js +81 -0
  71. package/core/lib/TapTap/TapTapHelper.js +170 -0
  72. package/core/lib/TapTap/getQRcode.js +61 -0
  73. package/core/lib/Util.js +30 -0
  74. package/core/lib/getQRcode.js +73 -0
  75. package/core/lib/http.js +105 -0
  76. package/core/model/README.md +3 -0
  77. package/core/model/api/aliasProposalService.js +151 -0
  78. package/core/model/api/apiVersion.js +67 -0
  79. package/core/model/api/autoSeekApi.js +165 -0
  80. package/core/model/api/botApiAuth.js +208 -0
  81. package/core/model/api/botSyncService.js +78 -0
  82. package/core/model/api/gameRecordPayload.js +24 -0
  83. package/core/model/api/makeRequest.js +1004 -0
  84. package/core/model/api/makeRequestFnc.js +17 -0
  85. package/core/model/api/phiApiClient.js +53 -0
  86. package/core/model/api/phiApiErrors.js +121 -0
  87. package/core/model/filesystem/getFile.js +256 -0
  88. package/core/model/filesystem/path.js +84 -0
  89. package/core/model/game/Chart.js +57 -0
  90. package/core/model/game/LevelRecordInfo.js +109 -0
  91. package/core/model/game/SongsInfo.js +46 -0
  92. package/core/model/game/b30Analysis.js +93 -0
  93. package/core/model/game/chartParser/Chart.js +23 -0
  94. package/core/model/game/chartParser/JudgeLine.js +38 -0
  95. package/core/model/game/chartParser/base/JudgeLineEvent.js +99 -0
  96. package/core/model/game/chartParser/base/Note.js +44 -0
  97. package/core/model/game/chartParser/base/SpeedEvent.js +25 -0
  98. package/core/model/game/chartParser/base/baseType.js +2 -0
  99. package/core/model/game/constNum.js +215 -0
  100. package/core/model/game/fCompute.js +711 -0
  101. package/core/model/game/getChartTag.js +140 -0
  102. package/core/model/game/getComment.js +132 -0
  103. package/core/model/game/getInfo.js +1069 -0
  104. package/core/model/game/getRksRank.js +77 -0
  105. package/core/model/game/markdown.js +77 -0
  106. package/core/model/integrations/Vika.js +103 -0
  107. package/core/model/integrations/getInfoFromTap.js +80 -0
  108. package/core/model/render/getPic.js +79 -0
  109. package/core/model/render/picmodle.js +496 -0
  110. package/core/model/render/progress-bar.js +44 -0
  111. package/core/model/render/puppeteer.js +431 -0
  112. package/core/model/render/renderPressureHistory.js +71 -0
  113. package/core/model/render/send.js +94 -0
  114. package/core/model/save/Save.js +953 -0
  115. package/core/model/save/analyzeSaveHistory.js +413 -0
  116. package/core/model/save/getBackup.js +328 -0
  117. package/core/model/save/getSave.js +90 -0
  118. package/core/model/save/getSaveFromApi.js +46 -0
  119. package/core/model/save/saveHistory.js +586 -0
  120. package/core/model/save/scoreHistory.js +101 -0
  121. package/core/model/theme/catalog.js +192 -0
  122. package/core/model/theme/installGuard.js +275 -0
  123. package/core/model/theme/installLock.js +174 -0
  124. package/core/model/theme/installer.js +398 -0
  125. package/core/model/theme/manager.js +408 -0
  126. package/core/model/theme/marketClient.js +294 -0
  127. package/core/model/theme/paths.js +42 -0
  128. package/core/model/theme/policy.js +54 -0
  129. package/core/model/theme/recovery.js +167 -0
  130. package/core/model/theme/useService.js +187 -0
  131. package/core/model/type/aliasProposal.d.ts +45 -0
  132. package/core/model/type/type.js +420 -0
  133. package/core/model/user/apiPermission.js +62 -0
  134. package/core/model/user/getBanGroup.js +120 -0
  135. package/core/model/user/getNotes.js +48 -0
  136. package/core/model/user/pluginData.js +101 -0
  137. package/core/model/user/userCredentialStore.js +154 -0
  138. package/core/model/user/userCredentials.js +860 -0
  139. package/core/package.json +60 -0
  140. package/core/resources/0608badSave/save.json +1 -0
  141. package/core/resources/LICENSE +201 -0
  142. package/core/resources/html/analyzeSaveHistory/analyzeSaveHistory.art +220 -0
  143. package/core/resources/html/analyzeSaveHistory/analyzeSaveHistory.css +345 -0
  144. package/core/resources/html/analyzeSaveHistory/analyzeSaveHistory.html +434 -0
  145. package/core/resources/html/arcgrosB19/arcgros.png +0 -0
  146. package/core/resources/html/arcgrosB19/arcgrosB19-orz.html +276 -0
  147. package/core/resources/html/arcgrosB19/arcgrosB19.art +168 -0
  148. package/core/resources/html/arcgrosB19/arcgrosB19.css +637 -0
  149. package/core/resources/html/atlas/atlas-orz.html +313 -0
  150. package/core/resources/html/atlas/atlas.art +194 -0
  151. package/core/resources/html/atlas/atlas.css +695 -0
  152. package/core/resources/html/avatar/-SURREALISM-.png +0 -0
  153. package/core/resources/html/avatar/Alkaid.png +0 -0
  154. package/core/resources/html/avatar/Aphasia.png +0 -0
  155. package/core/resources/html/avatar/Artificial Existence.png +0 -0
  156. package/core/resources/html/avatar/Bonus Time.png +0 -0
  157. package/core/resources/html/avatar/Burn.png +0 -0
  158. package/core/resources/html/avatar/Cereris1.png +0 -0
  159. package/core/resources/html/avatar/Cereris2.png +0 -0
  160. package/core/resources/html/avatar/Cereris3.png +0 -0
  161. package/core/resources/html/avatar/Christmas -2019.png +0 -0
  162. package/core/resources/html/avatar/Cipher1.png +0 -0
  163. package/core/resources/html/avatar/Class Memories.png +0 -0
  164. package/core/resources/html/avatar/Credits.png +0 -0
  165. package/core/resources/html/avatar/Dash.png +0 -0
  166. package/core/resources/html/avatar/Dlyrotz.png +0 -0
  167. package/core/resources/html/avatar/Doppelganger1.png +0 -0
  168. package/core/resources/html/avatar/Doppelganger2.png +0 -0
  169. package/core/resources/html/avatar/Drop it.png +0 -0
  170. package/core/resources/html/avatar/Energy Synergy Matrix1.png +0 -0
  171. package/core/resources/html/avatar/Energy Synergy Matrix2.png +0 -0
  172. package/core/resources/html/avatar/Energy Synergy Matrix3.png +0 -0
  173. package/core/resources/html/avatar/Engine x Start!! (melody mix).png +0 -0
  174. package/core/resources/html/avatar/Engine x Start!! extra 1 -by cycats.png +0 -0
  175. package/core/resources/html/avatar/Eradication Catastrophe.png +0 -0
  176. package/core/resources/html/avatar/FULi AUTO SHOOTER extra 1 -by cycats.png +0 -0
  177. package/core/resources/html/avatar/FULi AUTO SHOOTER.png +0 -0
  178. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/264-Special1.png +0 -0
  179. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/264-Special2.png +0 -0
  180. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2641.png +0 -0
  181. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2642.png +0 -0
  182. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2643.png +0 -0
  183. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2644.png +0 -0
  184. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2645.png +0 -0
  185. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2646.png +0 -0
  186. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2647.png +0 -0
  187. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2648.png +0 -0
  188. package/core/resources/html/avatar/Feast/350/277/234/344/270/234/344/271/213/345/256/2649.png +0 -0
  189. package/core/resources/html/avatar/Find_Me.png +0 -0
  190. package/core/resources/html/avatar/Geopelia 1 -by cycats.png +0 -0
  191. package/core/resources/html/avatar/Geopelia 2 -by cycats.png +0 -0
  192. package/core/resources/html/avatar/Geopelia 3 -by /344/275/225/345/221/265.png +0 -0
  193. package/core/resources/html/avatar/Geopelia in WEPLAY -by /346/265/267/344/272/247.png +0 -0
  194. package/core/resources/html/avatar/Gino-AprilFool.png +0 -0
  195. package/core/resources/html/avatar/Glaciaxion.png +0 -0
  196. package/core/resources/html/avatar/HumaN.png +0 -0
  197. package/core/resources/html/avatar/Indelible Scar.png +0 -0
  198. package/core/resources/html/avatar/Introduction.png +0 -0
  199. package/core/resources/html/avatar/Khronostasis Katharsis.png +0 -0
  200. package/core/resources/html/avatar/MARENOL.png +0 -0
  201. package/core/resources/html/avatar/Marenol extra 1 -by /345/226/265n/350/221/265.png +0 -0
  202. package/core/resources/html/avatar/Non-Melodic Ragez (MUG Edit).png +0 -0
  203. package/core/resources/html/avatar/Non-Melodic Ragez extra 1 -by cycats.png +0 -0
  204. package/core/resources/html/avatar/Oblivion +0 -0
  205. package/core/resources/html/avatar/OblivionPHIN.png +0 -0
  206. package/core/resources/html/avatar/Para.png +0 -0
  207. package/core/resources/html/avatar/Pixel Rebelz1.png +0 -0
  208. package/core/resources/html/avatar/Pixel Rebelz2.png +0 -0
  209. package/core/resources/html/avatar/Pixel Rebelz3.png +0 -0
  210. package/core/resources/html/avatar/RIPPER extra 1 -by cycats.png +0 -0
  211. package/core/resources/html/avatar/RIPPER extra 2 -by /344/275/225/345/221/265.png +0 -0
  212. package/core/resources/html/avatar/Sein.png +0 -0
  213. package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-Special.png +0 -0
  214. package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-Special2.png +0 -0
  215. package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-/346/231/256/351/200/232.png +0 -0
  216. package/core/resources/html/avatar/ShineAfter-/346/260/264/351/235/222-/346/233/262/347/273/230Ver.png +0 -0
  217. package/core/resources/html/avatar/ShineAfter-/351/270/240-Special.png +0 -0
  218. package/core/resources/html/avatar/ShineAfter-/351/270/240-/346/231/256/351/200/232.png +0 -0
  219. package/core/resources/html/avatar/ShineAfter-/351/270/240-/346/233/262/347/273/230Ver.png +0 -0
  220. package/core/resources/html/avatar/ShineAfter-/351/270/240/345/222/214/346/260/264/351/235/222-Special.png +0 -0
  221. package/core/resources/html/avatar/Snow Desert.png +0 -0
  222. package/core/resources/html/avatar/Sparkle New Life.png +0 -0
  223. package/core/resources/html/avatar/Sultan Rage.png +0 -0
  224. package/core/resources/html/avatar/Winter /342/206/221cube/342/206/223.png +0 -0
  225. package/core/resources/html/avatar/Xenolith.png +0 -0
  226. package/core/resources/html/avatar/[PRAW].png +0 -0
  227. package/core/resources/html/avatar/dB doll.png +0 -0
  228. package/core/resources/html/avatar/ripper.png +0 -0
  229. package/core/resources/html/avatar//343/202/202/343/201/272/343/202/202/343/201/2721.png +0 -0
  230. package/core/resources/html/avatar//343/202/202/343/201/272/343/202/202/343/201/2722.png +0 -0
  231. package/core/resources/html/avatar//344/270/207/345/220/250/345/214/277/345/220/215/344/277/241.png +0 -0
  232. 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
  233. package/core/resources/html/avatar//344/272/221/345/245/263/345/255/251.png +0 -0
  234. package/core/resources/html/avatar//345/205/211.png +0 -0
  235. package/core/resources/html/avatar//345/274/200/345/277/203/347/227/2051.png +0 -0
  236. package/core/resources/html/avatar//345/274/200/345/277/203/347/227/2052.png +0 -0
  237. 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
  238. package/core/resources/html/avatar//346/267/267/344/271/261-Confusion.png +0 -0
  239. package/core/resources/html/avatar//347/213/202/345/226/234/350/230/255/350/210/2361.png +0 -0
  240. package/core/resources/html/avatar//347/213/202/345/226/234/350/230/255/350/210/2362.png +0 -0
  241. package/core/resources/html/avatar//347/223/267/345/262/201-Special.png +0 -0
  242. package/core/resources/html/avatar//347/223/267/345/262/2011.png +0 -0
  243. package/core/resources/html/avatar//347/223/267/345/262/2012.png +0 -0
  244. package/core/resources/html/avatar//347/223/267/345/262/2013.png +0 -0
  245. package/core/resources/html/avatar//347/223/267/345/262/2014.png +0 -0
  246. package/core/resources/html/avatar//347/223/267/345/262/2015.png +0 -0
  247. package/core/resources/html/avatar//347/223/267/345/262/2016.png +0 -0
  248. package/core/resources/html/avatar//347/223/267/345/262/2017.png +0 -0
  249. package/core/resources/html/avatar//347/233/217/350/214/227-Special.png +0 -0
  250. package/core/resources/html/avatar//347/233/217/350/214/2271.png +0 -0
  251. package/core/resources/html/avatar//347/233/217/350/214/2272.png +0 -0
  252. package/core/resources/html/avatar//347/233/217/350/214/2273.png +0 -0
  253. package/core/resources/html/avatar//350/217/257/347/201/257/347/210/2611.png +0 -0
  254. package/core/resources/html/avatar//350/217/257/347/201/257/347/210/2612.png +0 -0
  255. package/core/resources/html/avatar//350/220/244/347/201/253/350/231/253/343/201/256/346/200/2501.png +0 -0
  256. package/core/resources/html/avatar//350/220/244/347/201/253/350/231/253/343/201/256/346/200/2502.png +0 -0
  257. package/core/resources/html/avatar//351/235/222/350/212/275-Special.png +0 -0
  258. package/core/resources/html/avatar//351/235/222/350/212/275.png +0 -0
  259. package/core/resources/html/avatar//351/243/216/345/261/277.png +0 -0
  260. package/core/resources/html/avatar//351/270/240-AprilFool.png +0 -0
  261. 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
  262. package/core/resources/html/b19/b19.art +490 -0
  263. package/core/resources/html/b19/b19.css +1261 -0
  264. package/core/resources/html/b19/b19666.art +350 -0
  265. package/core/resources/html/b19/b19666.css +1409 -0
  266. package/core/resources/html/b19/b19666.html +481 -0
  267. package/core/resources/html/b19/b19title.css +120 -0
  268. package/core/resources/html/b19/best19.html +853 -0
  269. package/core/resources/html/b19/dss2-orz.html +428 -0
  270. package/core/resources/html/b19/dss2.art +298 -0
  271. package/core/resources/html/b19/dss2.css +776 -0
  272. package/core/resources/html/b19/res/666.jpeg +0 -0
  273. package/core/resources/html/chap/chap-orz.html +93 -0
  274. package/core/resources/html/chap/chap.art +87 -0
  275. package/core/resources/html/chap/chap.css +365 -0
  276. package/core/resources/html/chartImg/chartImg.art +169 -0
  277. package/core/resources/html/chartImg/chartImg.css +439 -0
  278. package/core/resources/html/chartImg/echarts-wordcloud.min.js +3 -0
  279. package/core/resources/html/chartImg/echarts.js +85796 -0
  280. package/core/resources/html/chartImg/img/Drag.png +0 -0
  281. package/core/resources/html/chartImg/img/DragHL.png +0 -0
  282. package/core/resources/html/chartImg/img/Flick.png +0 -0
  283. package/core/resources/html/chartImg/img/FlickHL.png +0 -0
  284. package/core/resources/html/chartImg/img/Hold.png +0 -0
  285. package/core/resources/html/chartImg/img/HoldHL.png +0 -0
  286. package/core/resources/html/chartImg/img/Hold_End.png +0 -0
  287. package/core/resources/html/chartImg/img/Hold_Head.png +0 -0
  288. package/core/resources/html/chartImg/img/Hold_HeadHL.png +0 -0
  289. package/core/resources/html/chartImg/img/Tap.png +0 -0
  290. package/core/resources/html/chartImg/img/TapHL.png +0 -0
  291. package/core/resources/html/chartInfo/chartInfo-orz.html +250 -0
  292. package/core/resources/html/chartInfo/chartInfo.art +222 -0
  293. package/core/resources/html/chartInfo/chartInfo.css +265 -0
  294. package/core/resources/html/chartInfo/echarts-wordcloud.min.js +3 -0
  295. package/core/resources/html/chartInfo/echarts.js +85796 -0
  296. package/core/resources/html/clg/clg-orz.html +218 -0
  297. package/core/resources/html/clg/clg.art +88 -0
  298. package/core/resources/html/clg/clg.css +230 -0
  299. package/core/resources/html/clg/demo.jpg +0 -0
  300. package/core/resources/html/common/common.css +319 -0
  301. package/core/resources/html/common/css/playerInfo.css +136 -0
  302. package/core/resources/html/common/font/Aldrich-Regular.ttf +0 -0
  303. package/core/resources/html/common/font/HIMALAYA.TTF +0 -0
  304. package/core/resources/html/common/font/NotoColorEmoji-Regular.ttf +0 -0
  305. package/core/resources/html/common/font/NotoSans-Regular.ttf +0 -0
  306. package/core/resources/html/common/font/NotoSansArabic.ttf +0 -0
  307. package/core/resources/html/common/font/NotoSansCanadianAboriginal.ttf +0 -0
  308. package/core/resources/html/common/font/NotoSansJP.ttf +0 -0
  309. package/core/resources/html/common/font/NotoSansKannada.ttf +0 -0
  310. package/core/resources/html/common/font/NotoSansMath-Regular.ttf +0 -0
  311. package/core/resources/html/common/font/NotoSansSymbols2.ttf +0 -0
  312. package/core/resources/html/common/font/phi.ttf +0 -0
  313. package/core/resources/html/common/font//345/220/236/345/274/245/346/201/260/344/277/212.ttf +0 -0
  314. package/core/resources/html/common/layout/default.art +324 -0
  315. package/core/resources/html/common/layout/elem.art +21 -0
  316. package/core/resources/html/common/theme/snow/snow.css +17 -0
  317. package/core/resources/html/common/theme/snow/snow.js +19 -0
  318. package/core/resources/html/common/theme/star/star.js +201 -0
  319. package/core/resources/html/common/theme/topText/topText.css +15 -0
  320. package/core/resources/html/common/theme/topText/topText.js +30 -0
  321. package/core/resources/html/difficultyHistory/difficultyHistory-orz.html +361 -0
  322. package/core/resources/html/difficultyHistory/difficultyHistory.art +102 -0
  323. package/core/resources/html/difficultyHistory/difficultyHistory.css +205 -0
  324. package/core/resources/html/guess/guess-orz.html +50 -0
  325. package/core/resources/html/guess/guess.art +51 -0
  326. package/core/resources/html/guess/guess.css +33 -0
  327. package/core/resources/html/help/help-orz.html +73 -0
  328. package/core/resources/html/help/help.art +84 -0
  329. package/core/resources/html/help/help.css +266 -0
  330. package/core/resources/html/historyB30/historyB30-orz.html +168 -0
  331. package/core/resources/html/historyB30/historyB30.art +143 -0
  332. package/core/resources/html/historyB30/historyB30.css +270 -0
  333. package/core/resources/html/ill/ill-orz.html +21 -0
  334. package/core/resources/html/ill/ill.art +23 -0
  335. package/core/resources/html/ill/ill.css +79 -0
  336. package/core/resources/html/jrrp/ShineAfter.removebg.png +0 -0
  337. package/core/resources/html/jrrp/jrrp-orz.html +68 -0
  338. package/core/resources/html/jrrp/jrrp.art +58 -0
  339. package/core/resources/html/jrrp/jrrp.css +251 -0
  340. package/core/resources/html/list/list-orz.html +35 -0
  341. package/core/resources/html/list/list.art +67 -0
  342. package/core/resources/html/list/list.css +259 -0
  343. package/core/resources/html/lvsco/demo.jpg +0 -0
  344. package/core/resources/html/lvsco/lvsco-orz.html +334 -0
  345. package/core/resources/html/lvsco/lvsco.art +314 -0
  346. package/core/resources/html/lvsco/lvsco.css +706 -0
  347. package/core/resources/html/market/detail.art +44 -0
  348. package/core/resources/html/market/market.art +86 -0
  349. package/core/resources/html/market/market.css +64 -0
  350. package/core/resources/html/newSong/newSong.art +34 -0
  351. package/core/resources/html/newSong/newSong.css +48 -0
  352. package/core/resources/html/newSong/newSong.html +23 -0
  353. package/core/resources/html/newnotice/newnotice.art +47 -0
  354. package/core/resources/html/newnotice/newnotice.css +83 -0
  355. package/core/resources/html/otherimg/0.png +0 -0
  356. package/core/resources/html/otherimg/1.png +0 -0
  357. package/core/resources/html/otherimg/2.png +0 -0
  358. package/core/resources/html/otherimg/3.png +0 -0
  359. package/core/resources/html/otherimg/4.png +0 -0
  360. package/core/resources/html/otherimg/5.png +0 -0
  361. package/core/resources/html/otherimg/A.png +0 -0
  362. package/core/resources/html/otherimg/B.png +0 -0
  363. package/core/resources/html/otherimg/C.png +0 -0
  364. package/core/resources/html/otherimg/F.png +0 -0
  365. package/core/resources/html/otherimg/FC.png +0 -0
  366. package/core/resources/html/otherimg/NEW.png +0 -0
  367. package/core/resources/html/otherimg/Phigros_Icon_3.0.0.png +0 -0
  368. package/core/resources/html/otherimg/S.png +0 -0
  369. package/core/resources/html/otherimg/Star1.png +0 -0
  370. package/core/resources/html/otherimg/Star2.png +0 -0
  371. package/core/resources/html/otherimg/V.png +0 -0
  372. package/core/resources/html/otherimg/callback.png +0 -0
  373. package/core/resources/html/otherimg/chapHelp.png +0 -0
  374. package/core/resources/html/otherimg/dan_code.png +0 -0
  375. package/core/resources/html/otherimg/data.png +0 -0
  376. package/core/resources/html/otherimg/helpDoc.png +0 -0
  377. package/core/resources/html/otherimg/nickSuggest.png +0 -0
  378. package/core/resources/html/otherimg/phi.png +0 -0
  379. package/core/resources/html/otherimg/phigros.png +0 -0
  380. package/core/resources/html/otherimg/snow1.png +0 -0
  381. package/core/resources/html/otherimg/snow2.png +0 -0
  382. package/core/resources/html/otherimg/snow3.png +0 -0
  383. package/core/resources/html/otherimg/snow4.png +0 -0
  384. package/core/resources/html/otherimg/title.png +0 -0
  385. package/core/resources/html/rand/rand-orz.html +62 -0
  386. package/core/resources/html/rand/rand.art +59 -0
  387. package/core/resources/html/rand/rand.css +257 -0
  388. package/core/resources/html/rankingList/rankingList-orz.html +456 -0
  389. package/core/resources/html/rankingList/rankingList.art +171 -0
  390. package/core/resources/html/rankingList/rankingList.css +570 -0
  391. package/core/resources/html/rankingList-old/rankingList-orz.html +300 -0
  392. package/core/resources/html/rankingList-old/rankingList.art +89 -0
  393. package/core/resources/html/rankingList-old/rankingList.css +265 -0
  394. package/core/resources/html/score/score-orz.html +625 -0
  395. package/core/resources/html/score/score.art +249 -0
  396. package/core/resources/html/score/score.css +435 -0
  397. package/core/resources/html/score/scoreOld-orz.html +128 -0
  398. package/core/resources/html/score/scoreOld.art +230 -0
  399. package/core/resources/html/score/scoreOld.css +475 -0
  400. package/core/resources/html/score/scoreRankList-orz.html +613 -0
  401. package/core/resources/html/score/scoreRankList.art +231 -0
  402. package/core/resources/html/score/scoreRankList.css +197 -0
  403. package/core/resources/html/setting/setting-orz.html +123 -0
  404. package/core/resources/html/setting/setting.art +72 -0
  405. package/core/resources/html/setting/setting.css +170 -0
  406. package/core/resources/html/setting/userSetting-orz.html +132 -0
  407. package/core/resources/html/setting/userSetting.art +48 -0
  408. package/core/resources/html/setting/userSetting.css +160 -0
  409. package/core/resources/html/sign/sign-orz.html +262 -0
  410. package/core/resources/html/sign/sign.art +163 -0
  411. package/core/resources/html/sign/sign.css +706 -0
  412. package/core/resources/html/suggest/suggest.art +271 -0
  413. package/core/resources/html/suggest/suggest.css +300 -0
  414. package/core/resources/html/table/table-orz.html +228 -0
  415. package/core/resources/html/table/table.art +163 -0
  416. package/core/resources/html/table/table.css +401 -0
  417. package/core/resources/html/tasks/tasks-orz.html +83 -0
  418. package/core/resources/html/tasks/tasks.art +118 -0
  419. package/core/resources/html/tasks/tasks.css +334 -0
  420. package/core/resources/html/update/update-orz.html +735 -0
  421. package/core/resources/html/update/update.art +259 -0
  422. package/core/resources/html/update/update.css +676 -0
  423. package/core/resources/html/userinfo/userinfo-old-orz.html +408 -0
  424. package/core/resources/html/userinfo/userinfo-old.art +233 -0
  425. package/core/resources/html/userinfo/userinfo-old.css +466 -0
  426. package/core/resources/html/userinfo/userinfo-orz.html +543 -0
  427. package/core/resources/html/userinfo/userinfo.art +288 -0
  428. package/core/resources/html/userinfo/userinfo.css +757 -0
  429. package/core/resources/info/DLC/arc.json +412 -0
  430. package/core/resources/info/DLC/chunithm.json +1172 -0
  431. package/core/resources/info/DLC/dynamix.json +455 -0
  432. package/core/resources/info/DLC/fanshi.json +132 -0
  433. package/core/resources/info/DLC/lanota.json +412 -0
  434. package/core/resources/info/DLC/maimai.json +1110 -0
  435. package/core/resources/info/DLC/orz.json +158 -0
  436. package/core/resources/info/DLC/rizline.json +40 -0
  437. package/core/resources/info/DLC/rotaeno.json +159 -0
  438. package/core/resources/info/DLC/ryceam.json +53 -0
  439. package/core/resources/info/avatar.txt +109 -0
  440. package/core/resources/info/chaplist.yaml +102 -0
  441. package/core/resources/info/help/api.json +83 -0
  442. package/core/resources/info/help.json +436 -0
  443. package/core/resources/info/info.csv +315 -0
  444. package/core/resources/info/infolist.json +1758 -0
  445. package/core/resources/info/jrrp.json +92 -0
  446. package/core/resources/info/nicklist.yaml +2373 -0
  447. package/core/resources/info/notesInfo.json +1 -0
  448. package/core/resources/info/notice.json +11 -0
  449. package/core/resources/info/oldInfo/100/change.csv +218 -0
  450. package/core/resources/info/oldInfo/100/info.json +7 -0
  451. package/core/resources/info/oldInfo/101/change.csv +218 -0
  452. package/core/resources/info/oldInfo/101/info.json +7 -0
  453. package/core/resources/info/oldInfo/102/change.csv +223 -0
  454. package/core/resources/info/oldInfo/102/info.json +7 -0
  455. package/core/resources/info/oldInfo/103/change.csv +224 -0
  456. package/core/resources/info/oldInfo/103/info.json +7 -0
  457. package/core/resources/info/oldInfo/104/change.csv +225 -0
  458. package/core/resources/info/oldInfo/104/info.json +7 -0
  459. package/core/resources/info/oldInfo/105/change.csv +228 -0
  460. package/core/resources/info/oldInfo/105/info.json +7 -0
  461. package/core/resources/info/oldInfo/106/change.csv +229 -0
  462. package/core/resources/info/oldInfo/106/info.json +7 -0
  463. package/core/resources/info/oldInfo/108/change.csv +233 -0
  464. package/core/resources/info/oldInfo/108/info.json +7 -0
  465. package/core/resources/info/oldInfo/109/change.csv +235 -0
  466. package/core/resources/info/oldInfo/109/info.json +7 -0
  467. package/core/resources/info/oldInfo/110/change.csv +235 -0
  468. package/core/resources/info/oldInfo/110/info.json +7 -0
  469. package/core/resources/info/oldInfo/111/change.csv +242 -0
  470. package/core/resources/info/oldInfo/111/info.json +7 -0
  471. package/core/resources/info/oldInfo/112/change.csv +242 -0
  472. package/core/resources/info/oldInfo/112/info.json +7 -0
  473. package/core/resources/info/oldInfo/113/change.csv +244 -0
  474. package/core/resources/info/oldInfo/113/info.json +7 -0
  475. package/core/resources/info/oldInfo/115/change.csv +247 -0
  476. package/core/resources/info/oldInfo/115/info.json +7 -0
  477. package/core/resources/info/oldInfo/116/change.csv +249 -0
  478. package/core/resources/info/oldInfo/116/info.json +7 -0
  479. package/core/resources/info/oldInfo/118/change.csv +252 -0
  480. package/core/resources/info/oldInfo/118/info.json +7 -0
  481. package/core/resources/info/oldInfo/119/change.csv +255 -0
  482. package/core/resources/info/oldInfo/119/info.json +7 -0
  483. package/core/resources/info/oldInfo/120/change.csv +255 -0
  484. package/core/resources/info/oldInfo/120/info.json +7 -0
  485. package/core/resources/info/oldInfo/121/change.csv +257 -0
  486. package/core/resources/info/oldInfo/121/info.json +7 -0
  487. package/core/resources/info/oldInfo/122/change.csv +260 -0
  488. package/core/resources/info/oldInfo/122/info.json +7 -0
  489. package/core/resources/info/oldInfo/123/change.csv +260 -0
  490. package/core/resources/info/oldInfo/123/info.json +7 -0
  491. package/core/resources/info/oldInfo/124/change.csv +262 -0
  492. package/core/resources/info/oldInfo/124/info.json +7 -0
  493. package/core/resources/info/oldInfo/125/change.csv +266 -0
  494. package/core/resources/info/oldInfo/125/info.json +7 -0
  495. package/core/resources/info/oldInfo/126/change.csv +269 -0
  496. package/core/resources/info/oldInfo/126/info.json +7 -0
  497. package/core/resources/info/oldInfo/127/change.csv +270 -0
  498. package/core/resources/info/oldInfo/127/info.json +7 -0
  499. package/core/resources/info/oldInfo/128/change.csv +273 -0
  500. package/core/resources/info/oldInfo/128/info.json +7 -0
  501. package/core/resources/info/oldInfo/129/change.csv +274 -0
  502. package/core/resources/info/oldInfo/129/info.json +7 -0
  503. package/core/resources/info/oldInfo/130/change.csv +275 -0
  504. package/core/resources/info/oldInfo/130/info.json +7 -0
  505. package/core/resources/info/oldInfo/131/change.csv +278 -0
  506. package/core/resources/info/oldInfo/131/info.json +7 -0
  507. package/core/resources/info/oldInfo/132/change.csv +280 -0
  508. package/core/resources/info/oldInfo/132/info.json +7 -0
  509. package/core/resources/info/oldInfo/133/change.csv +284 -0
  510. package/core/resources/info/oldInfo/133/info.json +7 -0
  511. package/core/resources/info/oldInfo/134/change.csv +286 -0
  512. package/core/resources/info/oldInfo/134/info.json +7 -0
  513. package/core/resources/info/oldInfo/135/change.csv +290 -0
  514. package/core/resources/info/oldInfo/135/info.json +7 -0
  515. package/core/resources/info/oldInfo/136/change.csv +290 -0
  516. package/core/resources/info/oldInfo/136/info.json +7 -0
  517. package/core/resources/info/oldInfo/137/change.csv +293 -0
  518. package/core/resources/info/oldInfo/137/info.json +7 -0
  519. package/core/resources/info/oldInfo/138/change.csv +295 -0
  520. package/core/resources/info/oldInfo/138/info.json +7 -0
  521. package/core/resources/info/oldInfo/139/change.csv +295 -0
  522. package/core/resources/info/oldInfo/139/info.json +7 -0
  523. package/core/resources/info/oldInfo/140/change.csv +298 -0
  524. package/core/resources/info/oldInfo/140/info.json +7 -0
  525. package/core/resources/info/oldInfo/141/change.csv +300 -0
  526. package/core/resources/info/oldInfo/141/info.json +7 -0
  527. package/core/resources/info/oldInfo/142/change.csv +302 -0
  528. package/core/resources/info/oldInfo/142/info.json +7 -0
  529. package/core/resources/info/oldInfo/143/change.csv +303 -0
  530. package/core/resources/info/oldInfo/143/info.json +7 -0
  531. package/core/resources/info/oldInfo/144/change.csv +303 -0
  532. package/core/resources/info/oldInfo/144/info.json +7 -0
  533. package/core/resources/info/oldInfo/145/change.csv +305 -0
  534. package/core/resources/info/oldInfo/145/info.json +7 -0
  535. package/core/resources/info/oldInfo/146/change.csv +305 -0
  536. package/core/resources/info/oldInfo/146/info.json +7 -0
  537. package/core/resources/info/oldInfo/148/change.csv +307 -0
  538. package/core/resources/info/oldInfo/148/info.json +7 -0
  539. package/core/resources/info/oldInfo/149/change.csv +307 -0
  540. package/core/resources/info/oldInfo/149/info.json +7 -0
  541. package/core/resources/info/oldInfo/151/change.csv +309 -0
  542. package/core/resources/info/oldInfo/151/info.json +7 -0
  543. package/core/resources/info/oldInfo/152/change.csv +312 -0
  544. package/core/resources/info/oldInfo/152/info.json +7 -0
  545. package/core/resources/info/oldInfo/153/change.csv +313 -0
  546. package/core/resources/info/oldInfo/153/info.json +7 -0
  547. package/core/resources/info/oldInfo/154/change.csv +315 -0
  548. package/core/resources/info/oldInfo/154/info.json +7 -0
  549. package/core/resources/info/oldInfo/92/change.csv +204 -0
  550. package/core/resources/info/oldInfo/92/info.json +7 -0
  551. package/core/resources/info/oldInfo/93/change.csv +206 -0
  552. package/core/resources/info/oldInfo/93/info.json +7 -0
  553. package/core/resources/info/oldInfo/94/change.csv +209 -0
  554. package/core/resources/info/oldInfo/94/info.json +7 -0
  555. package/core/resources/info/oldInfo/95/change.csv +211 -0
  556. package/core/resources/info/oldInfo/95/info.json +7 -0
  557. package/core/resources/info/oldInfo/96/change.csv +216 -0
  558. package/core/resources/info/oldInfo/96/info.json +7 -0
  559. package/core/resources/info/oldInfo/98/change.csv +216 -0
  560. package/core/resources/info/oldInfo/98/info.json +7 -0
  561. package/core/resources/info/oldInfo/99/change.csv +217 -0
  562. package/core/resources/info/oldInfo/99/info.json +7 -0
  563. package/core/resources/info/oldNotesInfo.json +1 -0
  564. package/core/resources/info/sentences.json +1 -0
  565. package/core/resources/info/spinfo.json +362 -0
  566. package/core/resources/info/tips.txt +278 -0
  567. package/core/resources/otherill//351/233/252/351/231/215SP.png +0 -0
  568. package/core/resources/song-select.html +535 -0
  569. package/core/resources/themes/README.md +24 -0
  570. package/core/resources/themes/milthm/A.png +0 -0
  571. package/core/resources/themes/milthm/B.png +0 -0
  572. package/core/resources/themes/milthm/C.png +0 -0
  573. package/core/resources/themes/milthm/F.png +0 -0
  574. package/core/resources/themes/milthm/FC.png +0 -0
  575. package/core/resources/themes/milthm/S.png +0 -0
  576. package/core/resources/themes/milthm/V.png +0 -0
  577. package/core/resources/themes/milthm/arcgrosB19.css +36 -0
  578. package/core/resources/themes/milthm/b19.art +464 -0
  579. package/core/resources/themes/milthm/b19.css +1314 -0
  580. package/core/resources/themes/milthm/bg.png +0 -0
  581. package/core/resources/themes/milthm/clg.css +37 -0
  582. package/core/resources/themes/milthm/difficultyHistory.css +42 -0
  583. package/core/resources/themes/milthm/font.ttf +0 -0
  584. package/core/resources/themes/milthm/help.css +36 -0
  585. package/core/resources/themes/milthm/historyB30.css +48 -0
  586. package/core/resources/themes/milthm/info.yaml +45 -0
  587. package/core/resources/themes/milthm/list.css +39 -0
  588. package/core/resources/themes/milthm/phi.png +0 -0
  589. package/core/resources/themes/milthm/setting.css +37 -0
  590. package/core/resources/themes/milthm/sign.css +81 -0
  591. package/core/resources/themes/milthm/suggest.css +40 -0
  592. package/core/resources/themes/milthm/table.css +54 -0
  593. package/core/resources/themes/milthm/update.css +68 -0
  594. package/core/tests/aliasProposalService.test.js +82 -0
  595. package/core/tests/apiAccountDeletion.test.js +125 -0
  596. package/core/tests/apiPermission.test.js +44 -0
  597. package/core/tests/apiVersion.test.js +55 -0
  598. package/core/tests/b30Analysis.test.js +38 -0
  599. package/core/tests/backgroundIllustration.test.js +21 -0
  600. package/core/tests/botApiAuthRecovery.test.js +148 -0
  601. package/core/tests/botSyncService.test.js +42 -0
  602. package/core/tests/fileWatcherRegistry.test.js +44 -0
  603. package/core/tests/gameRecordPayload.test.js +34 -0
  604. package/core/tests/guessLetter.test.js +79 -0
  605. package/core/tests/makeRequestHandling.test.js +118 -0
  606. package/core/tests/marketOverflow.test.js +31 -0
  607. package/core/tests/platformTemplateCache.test.js +92 -0
  608. package/core/tests/pluginDataThemePreference.test.js +36 -0
  609. package/core/tests/processCleanup.test.js +58 -0
  610. package/core/tests/puppeteerShutdown.test.js +17 -0
  611. package/core/tests/renderPressureHistory.test.js +59 -0
  612. package/core/tests/saveStats.test.js +26 -0
  613. package/core/tests/themeInstallGuard.test.js +289 -0
  614. package/core/tests/themeManager.test.js +625 -0
  615. package/core/tests/themeManagerInit.test.js +11 -0
  616. package/core/tests/themeMarket.test.js +855 -0
  617. package/core/tests/themePageRouting.test.js +431 -0
  618. package/core/tests/themePolicy.test.js +28 -0
  619. package/core/tests/themeStorageRecovery.test.js +192 -0
  620. package/core/tests/userCredentialModuleBoundaries.test.js +41 -0
  621. package/core/tests/userCredentials.test.js +285 -0
  622. package/core/tsconfig.json +32 -0
  623. package/core/types/vendor.d.ts +14 -0
  624. package/lib/index.cjs +358 -0
  625. package/lib/index.d.cts +182 -0
  626. package/lib/index.d.ts +182 -0
  627. package/lib/index.js +320 -0
  628. package/package.json +74 -0
  629. package/readme.md +3 -0
@@ -0,0 +1,125 @@
1
+ import assert from 'node:assert/strict'
2
+ import test from 'node:test'
3
+ import { phihelp } from '../apps/apiSetting.js'
4
+ import { phisstk } from '../apps/session.js'
5
+ import getBanGroup from '../model/user/getBanGroup.js'
6
+ import makeRequestFnc from '../model/api/makeRequestFnc.js'
7
+ import send from '../model/render/send.js'
8
+ import { UserCredentials } from '../model/user/userCredentials.js'
9
+
10
+ const event = (msg = '') => ({
11
+ msg,
12
+ user_id: 'test-user',
13
+ self_id: 'test-bot',
14
+ isGroup: false,
15
+ isPrivate: true,
16
+ })
17
+
18
+ test('clearApiData requires confirmation and authenticates deletion with SSTK', async () => {
19
+ const originals = {
20
+ getBan: getBanGroup.get,
21
+ getToken: UserCredentials.prototype.getSessionToken,
22
+ deleteLocalSave: UserCredentials.prototype.deleteApiCachedSave,
23
+ makePlatform: makeRequestFnc.makePlatform,
24
+ clear: UserCredentials.prototype.deleteApiAccount,
25
+ send: send.send_with_At,
26
+ }
27
+ /** @type {any[]} */ const messages = []
28
+ /** @type {any[]} */ const contexts = []
29
+ /** @type {any[]} */ const finished = []
30
+ /** @type {any[]} */ const clearRequests = []
31
+
32
+ getBanGroup.get = async () => false
33
+ UserCredentials.prototype.getSessionToken = /** @type {any} */ (async () => 'sstk-value')
34
+ UserCredentials.prototype.deleteApiCachedSave = async () => true
35
+ makeRequestFnc.makePlatform = /** @type {any} */ (() => ({ platform: 'test', platform_id: 'test-user', _local_user_id: 'test-user' }))
36
+ UserCredentials.prototype.deleteApiAccount = /** @type {any} */ (async function () {
37
+ clearRequests.push({ ...(await this.platformParams()), token: await this.getSessionToken() })
38
+ return { message: 'ok' }
39
+ })
40
+ send.send_with_At = /** @type {any} */ ((/** @type {any} */ _e, /** @type {any} */ message) => messages.push(message))
41
+
42
+ try {
43
+ const command = new phihelp()
44
+ command.checkApiEnabled = async () => true
45
+ command.setContext = (...args) => contexts.push(args)
46
+ command.finish = (...args) => finished.push(args)
47
+
48
+ assert.equal(await command.clearApiData(/** @type {any} */ (event('/phi clearApiData'))), true)
49
+ assert.equal(clearRequests.length, 0)
50
+ assert.equal(contexts[0][0], 'confirmClearApiData')
51
+ assert.match(messages[0], /永久清除云端账号及全部数据/)
52
+
53
+ command.e = /** @type {any} */ (event('确认'))
54
+ assert.equal(await command.confirmClearApiData(), true)
55
+ assert.deepEqual(clearRequests, [{
56
+ platform: 'test',
57
+ platform_id: 'test-user',
58
+ _local_user_id: 'test-user',
59
+ token: 'sstk-value',
60
+ }])
61
+ assert.equal(finished[0][0], 'confirmClearApiData')
62
+ assert.match(messages.at(-1), /账号已注销/)
63
+ } finally {
64
+ getBanGroup.get = originals.getBan
65
+ UserCredentials.prototype.getSessionToken = originals.getToken
66
+ UserCredentials.prototype.deleteApiCachedSave = originals.deleteLocalSave
67
+ makeRequestFnc.makePlatform = originals.makePlatform
68
+ UserCredentials.prototype.deleteApiAccount = originals.clear
69
+ send.send_with_At = originals.send
70
+ }
71
+ })
72
+
73
+ test('clearApiData cancellation does not call the API', async () => {
74
+ const originalSend = send.send_with_At
75
+ const originalDeleteAccount = UserCredentials.prototype.deleteApiAccount
76
+ let requested = false
77
+
78
+ UserCredentials.prototype.deleteApiAccount = /** @type {any} */ (async () => {
79
+ requested = true
80
+ return null
81
+ })
82
+ send.send_with_At = /** @type {any} */ (async () => undefined)
83
+
84
+ try {
85
+ const command = new phihelp()
86
+ command.e = /** @type {any} */ (event('取消'))
87
+ command.finish = () => undefined
88
+
89
+ assert.equal(await command.confirmClearApiData(), true)
90
+ assert.equal(requested, false)
91
+ } finally {
92
+ UserCredentials.prototype.deleteApiAccount = originalDeleteAccount
93
+ send.send_with_At = originalSend
94
+ }
95
+ })
96
+
97
+ test('unbind always describes a local-only operation', async () => {
98
+ const originals = {
99
+ getBan: getBanGroup.get,
100
+ getCredentials: UserCredentials.prototype.getLocalCredentials,
101
+ send: send.send_with_At,
102
+ }
103
+ /** @type {any[]} */ const messages = []
104
+
105
+ getBanGroup.get = async () => false
106
+ send.send_with_At = /** @type {any} */ ((/** @type {any} */ _e, /** @type {any} */ message) => messages.push(message))
107
+
108
+ try {
109
+ const command = new phisstk()
110
+ command.setContext = () => undefined
111
+
112
+ UserCredentials.prototype.getLocalCredentials = /** @type {any} */ (async () => ({ sessionToken: 'sstk-value', apiId: '123' }))
113
+ assert.equal(await command.unbind(/** @type {any} */ (event('/phi unbind'))), true)
114
+ assert.match(messages.at(-1), /只会清除当前 Bot 本地保存的绑定、存档和历史/)
115
+ assert.match(messages.at(-1), /不会修改 API 数据/)
116
+
117
+ UserCredentials.prototype.getLocalCredentials = /** @type {any} */ (async () => ({ sessionToken: 'sstk-value', apiId: null }))
118
+ assert.equal(await command.unbind(/** @type {any} */ (event('/phi unbind'))), true)
119
+ assert.match(messages.at(-1), /不会修改 API 数据/)
120
+ } finally {
121
+ getBanGroup.get = originals.getBan
122
+ UserCredentials.prototype.getLocalCredentials = originals.getCredentials
123
+ send.send_with_At = originals.send
124
+ }
125
+ })
@@ -0,0 +1,44 @@
1
+ import assert from 'node:assert/strict'
2
+ import test from 'node:test'
3
+ import Config from '../components/Config.js'
4
+ import autoSeekApi from '../model/api/autoSeekApi.js'
5
+ import getNotes from '../model/user/getNotes.js'
6
+ import { getApiAccessState, isApiCapabilityConfigured } from '../model/user/apiPermission.js'
7
+
8
+ test('API capability switches are subordinate to the master switch', () => {
9
+ const originalGetUserCfg = Config.getUserCfg
10
+ let master = true
11
+ let customTheme = true
12
+ Config.getUserCfg = /** @type {any} */ ((/** @type {string} */ _name, /** @type {string} */ key) => {
13
+ if (key === 'openPhiPluginApi') return master
14
+ if (key === 'enableCustomThemeApi') return customTheme
15
+ return true
16
+ })
17
+ try {
18
+ assert.equal(isApiCapabilityConfigured('customTheme'), true)
19
+ customTheme = false
20
+ assert.equal(isApiCapabilityConfigured('customTheme'), false)
21
+ customTheme = true
22
+ master = false
23
+ assert.equal(isApiCapabilityConfigured('customTheme'), false)
24
+ } finally {
25
+ Config.getUserCfg = originalGetUserCfg
26
+ }
27
+ })
28
+
29
+ test('score statistics do not require user consent while online score does', async () => {
30
+ const originalGetUserCfg = Config.getUserCfg
31
+ const originalGetNotesData = getNotes.getNotesData
32
+ const originalOpen = autoSeekApi.openPhiPluginApi
33
+ Config.getUserCfg = /** @type {any} */ (() => true)
34
+ getNotes.getNotesData = async () => /** @type {any} */ ({ allowApiUsage: false })
35
+ autoSeekApi.openPhiPluginApi = true
36
+ try {
37
+ assert.equal((await getApiAccessState(/** @type {any} */ ({ user_id: 'user' }), 'scoreStatistics')).enabled, true)
38
+ assert.equal((await getApiAccessState(/** @type {any} */ ({ user_id: 'user' }), 'onlineScore')).enabled, false)
39
+ } finally {
40
+ Config.getUserCfg = originalGetUserCfg
41
+ getNotes.getNotesData = originalGetNotesData
42
+ autoSeekApi.openPhiPluginApi = originalOpen
43
+ }
44
+ })
@@ -0,0 +1,55 @@
1
+ import assert from 'node:assert/strict'
2
+ import test from 'node:test'
3
+ import {
4
+ compareApiVersion,
5
+ isApiVersionBlocked,
6
+ parseApiVersion,
7
+ setApiVersionBlocked,
8
+ SUPPORTED_API_VERSION,
9
+ } from '../model/api/apiVersion.js'
10
+ import { AutoSeekApi } from '../model/api/autoSeekApi.js'
11
+
12
+ test('API protocol version parser accepts only complete semantic versions', () => {
13
+ assert.deepEqual(parseApiVersion('v1.2.3'), {
14
+ major: 1,
15
+ minor: 2,
16
+ patch: 3,
17
+ normalized: '1.2.3',
18
+ })
19
+ assert.equal(parseApiVersion('1.2'), null)
20
+ assert.equal(parseApiVersion('latest'), null)
21
+ })
22
+
23
+ test('API protocol compatibility follows major and minor version policy', () => {
24
+ assert.equal(compareApiVersion(SUPPORTED_API_VERSION).status, 'compatible')
25
+ assert.equal(compareApiVersion('1.0.9').status, 'minor_mismatch')
26
+ assert.equal(compareApiVersion('1.1.0').status, 'compatible')
27
+ assert.equal(compareApiVersion('2.0.0').status, 'major_mismatch')
28
+ assert.equal(compareApiVersion(undefined).status, 'invalid')
29
+ })
30
+
31
+ test('API connectivity state is blocked only for incompatible or invalid protocol versions', () => {
32
+ setApiVersionBlocked(false)
33
+ const api = new AutoSeekApi()
34
+
35
+ assert.equal(api.validateApiVersion('1.0.0'), true)
36
+ assert.equal(api.isVersionBlocked(), false)
37
+
38
+ assert.equal(api.validateApiVersion('1.0.9'), true)
39
+ assert.equal(api.isVersionBlocked(), false)
40
+
41
+ assert.equal(api.validateApiVersion('1.1.0'), true)
42
+ assert.equal(api.isVersionBlocked(), false)
43
+
44
+ api.openPhiPluginApi = true
45
+ api.seekingApi = true
46
+ assert.equal(api.validateApiVersion('2.0.0'), false)
47
+ assert.equal(api.openPhiPluginApi, false)
48
+ assert.equal(api.seekingApi, false)
49
+ assert.equal(api.isVersionBlocked(), true)
50
+
51
+ assert.equal(api.validateApiVersion('invalid'), false)
52
+ assert.equal(api.isVersionBlocked(), true)
53
+ assert.equal(isApiVersionBlocked(), true)
54
+ setApiVersionBlocked(false)
55
+ })
@@ -0,0 +1,38 @@
1
+ import assert from 'node:assert/strict'
2
+ import test from 'node:test'
3
+ import {
4
+ buildRksHistogram,
5
+ getB30AnalysisRecords,
6
+ } from '../model/game/b30Analysis.js'
7
+
8
+ /** @param {string} id @param {string} rank @param {number} rks @returns {any} */
9
+ const record = (id, rank, rks) => ({ id, rank, rks })
10
+
11
+ test('uses P3 and B27 for the local RKS histogram', () => {
12
+ const records = getB30AnalysisRecords({
13
+ phi: [record('song-a', 'IN', 16), record('song-b', 'AT', 15.8), record('legacy-song', 'LEGACY', 15.7)],
14
+ b19_list: [record('song-a', 'IN', 15.7), record('song-a', 'HD', 15.5), ...Array.from({ length: 30 }, (_, i) => record(`song-${i}`, 'IN', 15 - i / 100))],
15
+ })
16
+ assert.equal(records.filter(item => item.kind === 'phi').length, 3)
17
+ assert.equal(records.filter(item => item.kind === 'best').length, 27)
18
+ assert.deepEqual(records.slice(0, 4).map(item => item.slot), ['P1', 'P2', 'P3', 'B1'])
19
+ })
20
+
21
+ test('builds a slot-based histogram with a horizontal average marker', () => {
22
+ const records = [
23
+ { ...record('a', 'IN', 15), kind: 'phi', slot: 'P1' },
24
+ { ...record('b', 'IN', 15.5), kind: 'best', slot: 'B1' },
25
+ { ...record('c', 'IN', 16), kind: 'best', slot: 'B2' },
26
+ ]
27
+
28
+ const histogram = buildRksHistogram(records)
29
+ assert.equal(histogram.count, 3)
30
+ assert.equal(histogram.average, 15.5)
31
+ assert.ok(histogram.averagePosition > 0 && histogram.averagePosition < 100)
32
+ assert.deepEqual(histogram.slots.map(slot => slot.label), ['P1', 'B1', 'B2'])
33
+ assert.deepEqual(histogram.slots.map(slot => slot.rks), [15, 15.5, 16])
34
+ assert.ok(histogram.ticks.length >= 3)
35
+
36
+ const singleValue = buildRksHistogram([{ ...record('only', 'LEGACY', 15.5), kind: 'best', slot: 'B1' }])
37
+ assert.ok(Math.abs(singleValue.averagePosition - 50) < 1e-9)
38
+ })
@@ -0,0 +1,21 @@
1
+ import assert from 'node:assert/strict'
2
+ import test from 'node:test'
3
+ import fCompute from '../model/game/fCompute.js'
4
+ import getInfo from '../model/game/getInfo.js'
5
+
6
+ test('SP个人背景曲绘通过内部ID解析', async () => {
7
+ await getInfo.init()
8
+
9
+ assert.equal(getInfo.SongGetId(/** @type {songString} */ ('Introduction')), 'Introduction.0')
10
+ assert.equal(
11
+ getInfo.SongGetId(/** @type {songString} */ ('Oblivion:PHIN')),
12
+ 'OblivionPHIN.Daily天利vsEndCat终猫ftAiSSw夜輪.0'
13
+ )
14
+
15
+ const result = fCompute.getBackground('Introduction')
16
+ if (!result) assert.fail('Introduction背景解析失败')
17
+
18
+ const background = result.replace(/\\/g, '/')
19
+ assert.match(background, /\/SP\/Introduction\.png$/)
20
+ assert.doesNotMatch(background, /\/otherimg\/phigros\.png$/)
21
+ })
@@ -0,0 +1,148 @@
1
+ import assert from 'node:assert/strict'
2
+ import test from 'node:test'
3
+ import Config from '../components/Config.js'
4
+ import { BotApiAuth } from '../model/api/botApiAuth.js'
5
+ import {
6
+ PhiApiError,
7
+ classifyApiConnectionError,
8
+ getPhiApiUserMessage,
9
+ hasPhiApiUserMessage,
10
+ isApiConnectionError,
11
+ isFatalBotIdentityError,
12
+ } from '../model/api/phiApiErrors.js'
13
+ import { setApiVersionBlocked } from '../model/api/apiVersion.js'
14
+
15
+ test('API connection failures retain a specific stable error code', () => {
16
+ const cases = [
17
+ ['ECONNABORTED', 'api_timeout'],
18
+ ['ETIMEDOUT', 'api_timeout'],
19
+ ['ENOTFOUND', 'api_dns_error'],
20
+ ['EAI_AGAIN', 'api_dns_error'],
21
+ ['ECONNREFUSED', 'api_connection_refused'],
22
+ ['CERT_HAS_EXPIRED', 'api_tls_error'],
23
+ ['ECONNRESET', 'api_network_error'],
24
+ ]
25
+
26
+ for (const [nativeCode, expected] of cases) {
27
+ const error = classifyApiConnectionError(Object.assign(new Error(nativeCode), { code: nativeCode }))
28
+ assert.equal(error.code, expected)
29
+ assert.equal(isApiConnectionError(error), true)
30
+ }
31
+ })
32
+
33
+ test('BotApiAuth exposes only Bot identity and direct API transport responsibilities', () => {
34
+ const auth = new BotApiAuth()
35
+ for (const method of ['bind', 'ensureBinding', 'invalidateBinding', 'readCachedBinding', 'saveBinding', 'requestHeaders']) {
36
+ assert.equal(typeof /** @type {any} */ (auth)[method], 'undefined')
37
+ }
38
+ assert.equal(typeof auth.getClientId, 'function')
39
+ assert.equal(typeof auth.signedRequest, 'function')
40
+ })
41
+
42
+ test('Bot authentication requests are stopped after an incompatible API version is detected', async () => {
43
+ const auth = new BotApiAuth()
44
+ setApiVersionBlocked(true)
45
+ try {
46
+ await assert.rejects(
47
+ auth.initialize(),
48
+ (/** @type {any} */ error) => error.code === 'api_version_incompatible',
49
+ )
50
+ await assert.rejects(
51
+ auth.signedRequest('/bot-clients/self', undefined, 'GET'),
52
+ (/** @type {any} */ error) => error.code === 'api_version_incompatible',
53
+ )
54
+ } finally {
55
+ setApiVersionBlocked(false)
56
+ }
57
+ })
58
+
59
+ test('user-facing API errors explain the actual failure and next action', () => {
60
+ assert.match(getPhiApiUserMessage(new PhiApiError('', 0, 'api_timeout')), /超时/)
61
+ assert.match(getPhiApiUserMessage(new PhiApiError('', 0, 'api_dns_error')), /解析API地址/)
62
+ assert.match(getPhiApiUserMessage(new PhiApiError('', 401, 'bot_client_unknown')), /重置API Bot身份/)
63
+ assert.match(getPhiApiUserMessage(new PhiApiError('', 404, 'binding_not_found')), /sessionToken绑定/)
64
+ const privateBindingMessage = getPhiApiUserMessage(new PhiApiError('', 403, 'user_id_binding_disabled'))
65
+ assert.match(privateBindingMessage, /bind <sessionToken>/)
66
+ assert.match(privateBindingMessage, /bind qrcode/)
67
+ assert.equal(hasPhiApiUserMessage(new PhiApiError('', 500, 'internal_error')), false)
68
+ })
69
+
70
+ test('temporary identity verification failures are retried instead of cached forever', async () => {
71
+ const originalGetUserCfg = Config.getUserCfg
72
+ Config.getUserCfg = /** @type {any} */ ((/** @type {any} */ _name, /** @type {string} */ style) => /** @type {Record<string, any>} */ ({
73
+ apiBotClientId: 'issued-client-id',
74
+ apiBotClientSecret: 'issued-secret',
75
+ apiBotSecretVersion: 1,
76
+ })[style])
77
+
78
+ const auth = new BotApiAuth()
79
+ let requests = 0
80
+ auth.signedRequest = async () => {
81
+ requests += 1
82
+ if (requests === 1) throw new PhiApiError('timeout', 0, 'api_timeout')
83
+ return { clientId: 'issued-client-id' }
84
+ }
85
+
86
+ try {
87
+ await assert.rejects(auth.initialize(), (/** @type {any} */ error) => error.code === 'api_timeout')
88
+ const identity = await auth.initialize()
89
+ assert.equal(identity.clientId, 'issued-client-id')
90
+ assert.equal(requests, 2)
91
+ } finally {
92
+ Config.getUserCfg = originalGetUserCfg
93
+ }
94
+ })
95
+
96
+ test('invalid issued credentials remain stopped until the identity changes', async () => {
97
+ const originalGetUserCfg = Config.getUserCfg
98
+ Config.getUserCfg = /** @type {any} */ ((/** @type {any} */ _name, /** @type {string} */ style) => /** @type {Record<string, any>} */ ({
99
+ apiBotClientId: 'revoked-client-id',
100
+ apiBotClientSecret: 'revoked-secret',
101
+ apiBotSecretVersion: 1,
102
+ })[style])
103
+
104
+ const auth = new BotApiAuth()
105
+ let requests = 0
106
+ auth.signedRequest = async () => {
107
+ requests += 1
108
+ throw new PhiApiError('revoked', 403, 'bot_client_revoked')
109
+ }
110
+
111
+ try {
112
+ await assert.rejects(auth.initialize(), (/** @type {any} */ error) => isFatalBotIdentityError(error))
113
+ await assert.rejects(auth.initialize(), (/** @type {any} */ error) => error.code === 'bot_client_revoked')
114
+ assert.equal(requests, 1)
115
+ } finally {
116
+ Config.getUserCfg = originalGetUserCfg
117
+ }
118
+ })
119
+
120
+ test('a missing Bot identity is registered on reconnect and concurrent recovery is single-flight', async () => {
121
+ const originalGetUserCfg = Config.getUserCfg
122
+ Config.getUserCfg = /** @type {any} */ ((/** @type {any} */ _name, /** @type {string} */ style) => /** @type {Record<string, any>} */ ({
123
+ apiBotClientId: '',
124
+ apiBotClientSecret: '',
125
+ apiBotSecretVersion: 0,
126
+ })[style])
127
+
128
+ const auth = new BotApiAuth()
129
+ let registrations = 0
130
+ auth.register = async () => {
131
+ registrations += 1
132
+ await new Promise(resolve => setTimeout(resolve, 5))
133
+ auth.ready = true
134
+ return { clientId: 'new-client-id', secret: 'secret', secretVersion: 1, claimUrl: undefined, claimExpiresAt: undefined }
135
+ }
136
+
137
+ try {
138
+ const [first, second] = await Promise.all([
139
+ auth.recoverAfterReconnect('v1.0.0'),
140
+ auth.recoverAfterReconnect('v1.0.0'),
141
+ ])
142
+ assert.equal(first.clientId, 'new-client-id')
143
+ assert.equal(second.clientId, 'new-client-id')
144
+ assert.equal(registrations, 1)
145
+ } finally {
146
+ Config.getUserCfg = originalGetUserCfg
147
+ }
148
+ })
@@ -0,0 +1,42 @@
1
+ import assert from 'node:assert/strict'
2
+ import test from 'node:test'
3
+ import { BotSyncService } from '../model/api/botSyncService.js'
4
+ import makeRequest from '../model/api/makeRequest.js'
5
+ import { setPlatformAdapter } from '../components/platform/index.js'
6
+
7
+ test('Bot sync acknowledges a message only after private delivery succeeds', async () => {
8
+ const service = new BotSyncService()
9
+ const originalSync = makeRequest.syncBot
10
+ /** @type {any[]} */
11
+ const requests = []
12
+ let delivered = 0
13
+ makeRequest.syncBot = async body => {
14
+ requests.push(body)
15
+ return {
16
+ ok: true,
17
+ serverTime: new Date().toISOString(),
18
+ nextSyncAfterSeconds: 60,
19
+ reporting: { renderPressure: false },
20
+ messages: requests.length === 1 ? [{
21
+ id: '00000000-0000-4000-8000-000000000001',
22
+ type: 'test',
23
+ schemaVersion: 1,
24
+ target: { platform: 'yunzai', platformId: '10001' },
25
+ text: '审核结果',
26
+ payload: {},
27
+ createdAt: new Date().toISOString(),
28
+ expiresAt: new Date(Date.now() + 60_000).toISOString(),
29
+ }] : [],
30
+ }
31
+ }
32
+ setPlatformAdapter({ relpyPrivate: async () => { delivered += 1; return { message_id: 'sent' } } })
33
+ try {
34
+ await service.sync()
35
+ assert.equal(delivered, 1)
36
+ assert.deepEqual(requests[0].acknowledgedMessageIds, [])
37
+ await service.sync()
38
+ assert.deepEqual(requests[1].acknowledgedMessageIds, ['00000000-0000-4000-8000-000000000001'])
39
+ } finally {
40
+ makeRequest.syncBot = originalSync
41
+ }
42
+ })
@@ -0,0 +1,44 @@
1
+ import assert from 'node:assert/strict'
2
+ import fs from 'node:fs/promises'
3
+ import os from 'node:os'
4
+ import path from 'node:path'
5
+ import test from 'node:test'
6
+ import { FileWatcherRegistry } from '../components/FileWatcherRegistry.js'
7
+
8
+ test('reuses a watcher while replacing stale hot-reload callbacks', async () => {
9
+ const directory = await fs.mkdtemp(path.join(os.tmpdir(), 'phi-watcher-'))
10
+ const file = path.join(directory, 'config.yaml')
11
+ const registry = new FileWatcherRegistry()
12
+ await fs.writeFile(file, 'value: 1\n')
13
+
14
+ try {
15
+ let staleCalls = 0
16
+ const firstLease = registry.watch('config', file, () => staleCalls++)
17
+ await firstLease.ready
18
+
19
+ /** @type {() => void} */
20
+ let resolveChanged = () => {}
21
+ const changed = new Promise(resolve => { resolveChanged = () => resolve(undefined) })
22
+ const secondLease = registry.watch('config', file, resolveChanged)
23
+ assert.equal(secondLease.watcher, firstLease.watcher)
24
+ await secondLease.ready
25
+ void firstLease.close()
26
+ await fs.writeFile(file, 'value: 2\n')
27
+ await changed
28
+
29
+ assert.equal(staleCalls, 0)
30
+
31
+ const replacementFile = path.join(directory, 'replacement.yaml')
32
+ await fs.writeFile(replacementFile, 'value: 3\n')
33
+ const replacementLease = registry.watch('config', replacementFile, () => {})
34
+ assert.notEqual(replacementLease.watcher, firstLease.watcher)
35
+ await firstLease.close()
36
+ assert.equal(registry.entries.get('config')?.watcher, replacementLease.watcher)
37
+
38
+ await registry.closeAll()
39
+ assert.equal(registry.entries.size, 0)
40
+ } finally {
41
+ await registry.closeAll()
42
+ await fs.rm(directory, { recursive: true, force: true })
43
+ }
44
+ })
@@ -0,0 +1,34 @@
1
+ import assert from 'node:assert/strict'
2
+ import test from 'node:test'
3
+ import { buildGameRecordPayload } from '../model/api/gameRecordPayload.js'
4
+
5
+ test('buildGameRecordPayload strips derived fields and LEGACY records', () => {
6
+ const payload = buildGameRecordPayload({
7
+ 'Glaciaxion.SunsetRay.0': [
8
+ {
9
+ score: 1_000_000,
10
+ acc: 100,
11
+ fc: 1,
12
+ id: 'Glaciaxion.SunsetRay.0',
13
+ rank: 'EZ',
14
+ Rating: 'phi',
15
+ rks: 12.5,
16
+ song: 'Glaciaxion',
17
+ illustration: 'https://example.com/cover.png',
18
+ },
19
+ null,
20
+ { score: 987_654, acc: 98.7654, fc: false, rank: 'IN' },
21
+ null,
22
+ { score: 900_000, acc: 95, fc: true, rank: 'LEGACY' },
23
+ ],
24
+ })
25
+
26
+ assert.deepEqual(payload, {
27
+ 'Glaciaxion.SunsetRay.0': [
28
+ { score: 1_000_000, acc: 100, fc: true },
29
+ null,
30
+ { score: 987_654, acc: 98.7654, fc: false },
31
+ null,
32
+ ],
33
+ })
34
+ })
@@ -0,0 +1,79 @@
1
+ import assert from 'node:assert/strict'
2
+ import test from 'node:test'
3
+
4
+ import {
5
+ LETTER_HIDDEN_CHAR,
6
+ allGuessed,
7
+ encryptSongName,
8
+ getRevealCandidates,
9
+ hasHiddenCharacters,
10
+ revealCharacter
11
+ } from '../apps/guessGame/letterGameUtils.js'
12
+
13
+ test('literal star remains a valid tip candidate without being confused with the mask', () => {
14
+ const title = '7 colors*'
15
+ const blur = `7 colors${LETTER_HIDDEN_CHAR}`
16
+ const game = { ansList: [title], blurlist: [blur] }
17
+
18
+ assert.deepEqual(getRevealCandidates(game), ['*'])
19
+
20
+ const revealed = revealCharacter(title, blur, '*')
21
+ assert.equal(revealed, title)
22
+ assert.equal(hasHiddenCharacters(revealed), false)
23
+ })
24
+
25
+ test('mask and reveal operations use Unicode code points consistently', () => {
26
+ const title = 'A😀*'
27
+ const encrypted = encryptSongName(title)
28
+
29
+ assert.equal(Array.from(encrypted).length, Array.from(title).length)
30
+ assert.deepEqual(getRevealCandidates({ ansList: [title], blurlist: [encrypted] }), ['A', '😀', '*'])
31
+
32
+ const emojiRevealed = revealCharacter(title, encrypted, '😀')
33
+ assert.deepEqual(Array.from(emojiRevealed), [LETTER_HIDDEN_CHAR, '😀', LETTER_HIDDEN_CHAR])
34
+ })
35
+
36
+ test('empty and completed games have no reveal candidates', () => {
37
+ assert.deepEqual(getRevealCandidates({ ansList: ['done'], blurlist: [null] }), [])
38
+ assert.deepEqual(getRevealCandidates({ ansList: [], blurlist: [] }), [])
39
+ })
40
+
41
+ test('repeated tips always finish titles containing literal stars', () => {
42
+ const titles = [
43
+ '7 colors*',
44
+ 'Altair (feat. *spiLa*)',
45
+ 'cocoro*cosmetic',
46
+ 'strawberry*passion'
47
+ ]
48
+ const game = /** @type {{letterNum: number, ansList: string[], blurlist: (string|null)[]}} */ ({
49
+ letterNum: titles.length,
50
+ ansList: titles,
51
+ blurlist: titles.map(encryptSongName)
52
+ })
53
+ const maximumSteps = titles.reduce((total, title) => total + Array.from(title).length, 0)
54
+ let steps = 0
55
+
56
+ while (!allGuessed(game)) {
57
+ const symbol = getRevealCandidates(game)[0]
58
+ assert.notEqual(symbol, undefined)
59
+
60
+ game.blurlist = game.blurlist.map((blur, index) => {
61
+ if (!blur) return null
62
+ const revealed = revealCharacter(titles[index], blur, symbol)
63
+ return hasHiddenCharacters(revealed) ? revealed : null
64
+ })
65
+ steps++
66
+ assert.ok(steps <= maximumSteps)
67
+ }
68
+
69
+ assert.deepEqual(getRevealCandidates(game), [])
70
+ })
71
+
72
+ test('completion requires every configured slot to be an explicit null', () => {
73
+ assert.equal(allGuessed(/** @type {any} */ ({ letterNum: 2, blurlist: [null, null] })), true)
74
+
75
+ const sparse = new Array(2)
76
+ sparse[0] = null
77
+ assert.equal(allGuessed(/** @type {any} */ ({ letterNum: 2, blurlist: sparse })), false)
78
+ assert.equal(allGuessed(/** @type {any} */ ({ letterNum: 2, blurlist: [null] })), false)
79
+ })