karin-plugin-mys-core 1.0.10 → 1.0.12

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 (154) hide show
  1. package/README.md +1 -1
  2. package/lib/apps/MiHoYoLogin.js +6 -38
  3. package/lib/apps/MysDevice.js +5 -37
  4. package/lib/apps/UIDManage.js +6 -38
  5. package/lib/{chunk-JT3SU5UU.js → chunk-A5FZEOIN.js} +78 -6
  6. package/lib/{chunk-4BTKE3LO.js → chunk-HTL64YH2.js} +300 -178
  7. package/lib/chunk-IASM5MM5.js +639 -0
  8. package/lib/{chunk-5DXIT7UB.js → chunk-RX4VMVAI.js} +0 -5
  9. package/lib/{chunk-MQ52BX7O.js → chunk-SZHK7OGF.js} +9 -13
  10. package/lib/chunk-UIPRZFST.js +184 -0
  11. package/lib/exports/config/index.d.ts +56 -1
  12. package/lib/exports/config/index.js +3 -9
  13. package/lib/exports/database/index.d.ts +78 -12
  14. package/lib/exports/database/index.js +12 -40
  15. package/lib/exports/mys/index.d.ts +379 -14
  16. package/lib/exports/mys/index.js +9 -43
  17. package/lib/exports/render/index.d.ts +38 -4
  18. package/lib/exports/render/index.js +3 -8
  19. package/lib/exports/utils/index.d.ts +45 -2
  20. package/lib/exports/utils/index.js +1 -4
  21. package/lib/{exports/database/types/dbs/base.d.ts → mysUserInfo-BsyEENbc.d.ts} +60 -1
  22. package/package.json +1 -1
  23. package/resources/image/frame-logo.webp +0 -0
  24. package/resources/image/launcher-icon//345/216/237/347/245/236.webp +0 -0
  25. package/resources/image/launcher-icon//345/264/251/345/235/2173.webp +0 -0
  26. package/resources/image/launcher-icon//345/264/251/345/235/217/345/255/246/345/233/2552.webp +0 -0
  27. package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/345/233/240/347/274/230/347/262/276/347/201/265.webp +0 -0
  28. package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/346/230/237/347/251/271/351/223/201/351/201/223.webp +0 -0
  29. package/resources/image/launcher-icon//346/230/237/345/270/203/350/260/267/345/234/260.webp +0 -0
  30. package/resources/image/launcher-icon//346/234/252/345/256/232/344/272/213/344/273/266/347/260/277.webp +0 -0
  31. package/resources/image/launcher-icon//347/273/235/345/214/272/351/233/266.webp +0 -0
  32. package/resources/image/mys-core-logo.webp +0 -0
  33. package/resources/image/mys-logo.webp +0 -0
  34. package/resources/styles/karin-plugin-mys-core.css +4 -4
  35. package/lib/chunk-2BVJS5VE.js +0 -49
  36. package/lib/chunk-3ERB3ILC.js +0 -0
  37. package/lib/chunk-3JN5WYUN.js +0 -135
  38. package/lib/chunk-7KEG6SDX.js +0 -0
  39. package/lib/chunk-7VAWV6ZE.js +0 -0
  40. package/lib/chunk-ARLTXJFJ.js +0 -0
  41. package/lib/chunk-CFS2WFOO.js +0 -0
  42. package/lib/chunk-DMJ5OQR6.js +0 -73
  43. package/lib/chunk-EDNBKOMS.js +0 -30
  44. package/lib/chunk-FBWSEBAW.js +0 -0
  45. package/lib/chunk-FOAQZIZ2.js +0 -0
  46. package/lib/chunk-G5W5WAY5.js +0 -64
  47. package/lib/chunk-G7TMVDGP.js +0 -68
  48. package/lib/chunk-HJ6HX5HB.js +0 -29
  49. package/lib/chunk-I7XZONDN.js +0 -13
  50. package/lib/chunk-JRH4JC43.js +0 -0
  51. package/lib/chunk-JVJQKRJ4.js +0 -89
  52. package/lib/chunk-K5U2O3HH.js +0 -0
  53. package/lib/chunk-KQVWWGRH.js +0 -31
  54. package/lib/chunk-LBLGKL3W.js +0 -77
  55. package/lib/chunk-LJSDSOY6.js +0 -0
  56. package/lib/chunk-LYTNREAI.js +0 -0
  57. package/lib/chunk-MPZP23EX.js +0 -219
  58. package/lib/chunk-MWYDWDR4.js +0 -0
  59. package/lib/chunk-PMFOX5HA.js +0 -80
  60. package/lib/chunk-PYTECG57.js +0 -0
  61. package/lib/chunk-SEWEEPJN.js +0 -0
  62. package/lib/chunk-SHW6FHIB.js +0 -10
  63. package/lib/chunk-T7W4DXRM.js +0 -0
  64. package/lib/chunk-TTN7NFCA.js +0 -109
  65. package/lib/chunk-W4DBT7AD.js +0 -0
  66. package/lib/chunk-WCX7WZAQ.js +0 -0
  67. package/lib/chunk-Z5I6A73Y.js +0 -0
  68. package/lib/chunk-ZTOR2DXG.js +0 -38
  69. package/lib/common-BlI5Gsw_.d.ts +0 -35
  70. package/lib/define-B9r20dK6.d.ts +0 -130
  71. package/lib/exports/config/array.d.ts +0 -1
  72. package/lib/exports/config/array.js +0 -7
  73. package/lib/exports/config/config.d.ts +0 -56
  74. package/lib/exports/config/config.js +0 -12
  75. package/lib/exports/database/database.d.ts +0 -30
  76. package/lib/exports/database/database.js +0 -22
  77. package/lib/exports/database/dbs/base.d.ts +0 -25
  78. package/lib/exports/database/dbs/base.js +0 -19
  79. package/lib/exports/database/dbs/index.d.ts +0 -4
  80. package/lib/exports/database/dbs/index.js +0 -29
  81. package/lib/exports/database/dbs/sqlite3.d.ts +0 -27
  82. package/lib/exports/database/dbs/sqlite3.js +0 -23
  83. package/lib/exports/database/dbs/table.d.ts +0 -20
  84. package/lib/exports/database/dbs/table.js +0 -25
  85. package/lib/exports/database/tables/index.d.ts +0 -9
  86. package/lib/exports/database/tables/index.js +0 -40
  87. package/lib/exports/database/tables/mysAccountInfo.d.ts +0 -9
  88. package/lib/exports/database/tables/mysAccountInfo.js +0 -27
  89. package/lib/exports/database/tables/mysDeviceInfo.d.ts +0 -9
  90. package/lib/exports/database/tables/mysDeviceInfo.js +0 -27
  91. package/lib/exports/database/tables/mysUserInfo.d.ts +0 -9
  92. package/lib/exports/database/tables/mysUserInfo.js +0 -27
  93. package/lib/exports/database/types/database.d.ts +0 -6
  94. package/lib/exports/database/types/database.js +0 -1
  95. package/lib/exports/database/types/dbs/base.js +0 -11
  96. package/lib/exports/database/types/dbs/index.d.ts +0 -2
  97. package/lib/exports/database/types/dbs/index.js +0 -12
  98. package/lib/exports/database/types/index.d.ts +0 -6
  99. package/lib/exports/database/types/index.js +0 -24
  100. package/lib/exports/database/types/tables/index.d.ts +0 -5
  101. package/lib/exports/database/types/tables/index.js +0 -13
  102. package/lib/exports/database/types/tables/mysAccountInfo.d.ts +0 -14
  103. package/lib/exports/database/types/tables/mysAccountInfo.js +0 -7
  104. package/lib/exports/database/types/tables/mysDeviceInfo.d.ts +0 -19
  105. package/lib/exports/database/types/tables/mysDeviceInfo.js +0 -1
  106. package/lib/exports/database/types/tables/mysUserInfo.d.ts +0 -32
  107. package/lib/exports/database/types/tables/mysUserInfo.js +0 -7
  108. package/lib/exports/mys/api/apis.d.ts +0 -82
  109. package/lib/exports/mys/api/apis.js +0 -56
  110. package/lib/exports/mys/api/app.d.ts +0 -60
  111. package/lib/exports/mys/api/app.js +0 -32
  112. package/lib/exports/mys/api/define.d.ts +0 -6
  113. package/lib/exports/mys/api/define.js +0 -42
  114. package/lib/exports/mys/api/index.d.ts +0 -11
  115. package/lib/exports/mys/api/index.js +0 -63
  116. package/lib/exports/mys/types/api/define.d.ts +0 -6
  117. package/lib/exports/mys/types/api/define.js +0 -1
  118. package/lib/exports/mys/types/api/index.d.ts +0 -6
  119. package/lib/exports/mys/types/api/index.js +0 -2
  120. package/lib/exports/mys/types/index.d.ts +0 -12
  121. package/lib/exports/mys/types/index.js +0 -6
  122. package/lib/exports/mys/types/user/game.d.ts +0 -23
  123. package/lib/exports/mys/types/user/game.js +0 -1
  124. package/lib/exports/mys/types/user/index.d.ts +0 -12
  125. package/lib/exports/mys/types/user/index.js +0 -3
  126. package/lib/exports/mys/types/user/userInfo.d.ts +0 -42
  127. package/lib/exports/mys/types/user/userInfo.js +0 -1
  128. package/lib/exports/mys/user/deviceInfo.d.ts +0 -11
  129. package/lib/exports/mys/user/deviceInfo.js +0 -30
  130. package/lib/exports/mys/user/game.d.ts +0 -40
  131. package/lib/exports/mys/user/game.js +0 -9
  132. package/lib/exports/mys/user/index.d.ts +0 -14
  133. package/lib/exports/mys/user/index.js +0 -52
  134. package/lib/exports/mys/user/userInfo.d.ts +0 -53
  135. package/lib/exports/mys/user/userInfo.js +0 -44
  136. package/lib/exports/render/render.d.ts +0 -38
  137. package/lib/exports/render/render.js +0 -12
  138. package/lib/exports/utils/common.d.ts +0 -1
  139. package/lib/exports/utils/common.js +0 -15
  140. package/lib/exports/utils/types/common.d.ts +0 -11
  141. package/lib/exports/utils/types/common.js +0 -1
  142. package/lib/exports/utils/types/index.d.ts +0 -1
  143. package/lib/exports/utils/types/index.js +0 -2
  144. package/resources/image/frame-logo.png +0 -0
  145. package/resources/image/launcher-icon//345/216/237/347/245/236.png +0 -0
  146. package/resources/image/launcher-icon//345/264/251/345/235/2173.png +0 -0
  147. package/resources/image/launcher-icon//345/264/251/345/235/217/345/255/246/345/233/2552.png +0 -0
  148. package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/345/233/240/347/274/230/347/262/276/347/201/265.png +0 -0
  149. package/resources/image/launcher-icon//345/264/251/345/235/217/357/274/232/346/230/237/347/251/271/351/223/201/351/201/223.png +0 -0
  150. package/resources/image/launcher-icon//346/230/237/345/270/203/350/260/267/345/234/260.png +0 -0
  151. package/resources/image/launcher-icon//346/234/252/345/256/232/344/272/213/344/273/266/347/260/277.png +0 -0
  152. package/resources/image/launcher-icon//347/273/235/345/214/272/351/233/266.png +0 -0
  153. package/resources/image/mys-core-logo.png +0 -0
  154. package/resources/image/mys-logo.png +0 -0
Binary file
@@ -952,14 +952,14 @@ video {
952
952
  line-height: 1;
953
953
  }
954
954
 
955
- .text-\[\#111\] {
955
+ .text-\[\#222\] {
956
956
  --tw-text-opacity: 1;
957
- color: rgb(17 17 17 / var(--tw-text-opacity, 1));
957
+ color: rgb(34 34 34 / var(--tw-text-opacity, 1));
958
958
  }
959
959
 
960
- .text-\[\#222\] {
960
+ .text-\[\#34bc5b\] {
961
961
  --tw-text-opacity: 1;
962
- color: rgb(34 34 34 / var(--tw-text-opacity, 1));
962
+ color: rgb(52 188 91 / var(--tw-text-opacity, 1));
963
963
  }
964
964
 
965
965
  .text-\[\#3f7dd1\] {
@@ -1,49 +0,0 @@
1
- // src/exports/mys/user/game.ts
2
- var MysGame = new class MysGame2 {
3
- #games = /* @__PURE__ */ new Map();
4
- get num() {
5
- return this.#games.size;
6
- }
7
- match(prefix) {
8
- if (!prefix || this.#games.size === 0) return void 0;
9
- for (const Game of this.#games.values()) {
10
- if (Game.prefix.test(prefix)) return Game;
11
- }
12
- return void 0;
13
- }
14
- RegisterGame(Game) {
15
- this.#games.set(Game.columnKey, Game);
16
- }
17
- async forEachGame(fn) {
18
- if (this.num === 0) return;
19
- for (const Game of this.#games.values()) {
20
- if (await fn(Game) === "break") break;
21
- }
22
- }
23
- }();
24
- var RegisterGameBase = class {
25
- game;
26
- columnKey;
27
- /** @description 游戏名称 */
28
- name;
29
- /** @description 指令前缀 */
30
- prefixs;
31
- refresh;
32
- UserInfo;
33
- constructor(game, name, prefixs, userInfo, refreshFuc) {
34
- this.game = game;
35
- this.columnKey = `${game}-uids`;
36
- this.name = name;
37
- this.prefixs = prefixs;
38
- this.UserInfo = userInfo;
39
- this.refresh = refreshFuc;
40
- }
41
- get prefix() {
42
- return new RegExp(`^(${this.prefixs.join("|")})$`, "i");
43
- }
44
- };
45
-
46
- export {
47
- MysGame,
48
- RegisterGameBase
49
- };
File without changes
@@ -1,135 +0,0 @@
1
- import {
2
- common_exports
3
- } from "./chunk-5DXIT7UB.js";
4
-
5
- // src/exports/database/dbs/base.ts
6
- import { existToMkdirSync, json, logger, rmSync } from "node-karin";
7
- import lodash from "node-karin/lodash";
8
- import fs from "fs";
9
- import path from "path";
10
- var DbBase = class {
11
- primaryKey;
12
- initBase(DataDir, modelName, modelSchema, modelSchemaDefine, type, primaryKey) {
13
- this.primaryKey = primaryKey;
14
- this.databaseType = type;
15
- this.databasePath = path.join(DataDir, modelName);
16
- if (type !== "db" /* Db */) {
17
- existToMkdirSync(this.databasePath);
18
- }
19
- this.modelName = modelName;
20
- this.modelSchema = modelSchema;
21
- this.modelSchemaDefine = modelSchemaDefine;
22
- }
23
- schemaToJSON(pk) {
24
- const primaryKey = this.model?.primaryKeyAttribute || this.primaryKey;
25
- const result = {
26
- [primaryKey]: pk
27
- };
28
- lodash.forEach(this.modelSchema, (value, key) => {
29
- if (key !== primaryKey) {
30
- const Value = typeof value.defaultValue === "function" ? value.defaultValue() : value.defaultValue;
31
- result[key] = value.JsonColumn ? JSON.parse(Value) : value.ArrayColumn ? Value.split(",") : Value;
32
- }
33
- });
34
- return result;
35
- }
36
- userPath(pk) {
37
- if (this.databaseType === "dir" /* Dir */) {
38
- return path.join(this.databasePath, pk);
39
- }
40
- return path.join(this.databasePath, `${pk}.json`);
41
- }
42
- readSync(path2, pk) {
43
- const result = json.readSync(path2);
44
- result.save = this.saveFile(pk);
45
- result.destroy = () => this.destroyPath(pk);
46
- return result;
47
- }
48
- readDirSync(pk) {
49
- const path2 = this.userPath(pk);
50
- const files = fs.readdirSync(path2);
51
- const result = {
52
- save: this.saveDir(pk),
53
- destroy: () => this.destroyPath(pk),
54
- [this.primaryKey]: pk
55
- };
56
- const filePromises = files.map(async (file) => {
57
- const data = await json.read(`${path2}/${file}`);
58
- result[data.key] = data.data;
59
- });
60
- Promise.all(filePromises).then().catch((err) => {
61
- logger.error(err);
62
- });
63
- return result;
64
- }
65
- writeDirSync(pk, data) {
66
- const path2 = this.userPath(pk);
67
- lodash.forEach(this.modelSchema, (value, key) => {
68
- if (key !== this.primaryKey) {
69
- const mergeData = common_exports.filterData(data[key], value.defaultValue, this.modelSchemaDefine[key]);
70
- json.writeSync(`${path2}/${key}.json`, {
71
- key,
72
- [this.primaryKey]: pk,
73
- data: mergeData
74
- });
75
- }
76
- });
77
- return true;
78
- }
79
- saveFile(pk) {
80
- return async (data) => {
81
- const userPath = this.userPath(pk);
82
- const mergeData = common_exports.filterData(data, this.schemaToJSON(pk), this.modelSchemaDefine);
83
- delete data[this.primaryKey];
84
- json.writeSync(userPath, mergeData);
85
- return this.readSync(userPath, pk);
86
- };
87
- }
88
- saveDir(pk) {
89
- return async (data) => {
90
- delete data[this.primaryKey];
91
- this.writeDirSync(pk, data);
92
- return this.readDirSync(pk);
93
- };
94
- }
95
- destroyPath(pk) {
96
- return new Promise((resolve) => {
97
- const userPath = this.userPath(pk);
98
- try {
99
- rmSync(userPath, { recursive: true });
100
- resolve(true);
101
- } catch (err) {
102
- logger.error(err);
103
- resolve(false);
104
- }
105
- });
106
- }
107
- saveSql(model, pk) {
108
- return async (data) => {
109
- delete data[this.model.primaryKeyAttribute];
110
- const defData = this.schemaToJSON(pk);
111
- const mergeData = {};
112
- lodash.forEach(data, (value, key) => {
113
- if (value !== void 0 && value !== null) {
114
- mergeData[key] = common_exports.filterData(value, defData[key], this.modelSchemaDefine[key]);
115
- }
116
- });
117
- const result = await model.update(mergeData);
118
- return {
119
- ...result.toJSON(),
120
- save: this.saveSql(result, pk),
121
- destroy: () => this.destroySql(pk)
122
- };
123
- };
124
- }
125
- destroySql(pk) {
126
- return new Promise((resolve) => {
127
- const result = this.model.destroy({ where: { [this.model.primaryKeyAttribute]: pk } }).then((count) => count > 0).catch(() => false);
128
- resolve(result);
129
- });
130
- }
131
- };
132
-
133
- export {
134
- DbBase
135
- };
File without changes
File without changes
File without changes
File without changes
@@ -1,73 +0,0 @@
1
- import {
2
- Sqlite3,
3
- Sqlite3Static
4
- } from "./chunk-MPZP23EX.js";
5
-
6
- // src/exports/database/database.ts
7
- import { logger } from "node-karin";
8
- import { DataTypes } from "sequelize";
9
- var Database = new class DatabaseClass {
10
- #defaultDialect = "sqlite" /* Sqlite */;
11
- #DatabaseMap = /* @__PURE__ */ new Map();
12
- default(dialect) {
13
- const db = this.#DatabaseMap.get(dialect);
14
- if (!db) {
15
- logger.error(`\u672A\u627E\u5230\u6570\u636E\u5E93: ${dialect}\uFF01\u4F7F\u7528\u9ED8\u8BA4\u6570\u636E\u5E93\u3002`);
16
- return;
17
- }
18
- this.#defaultDialect = dialect;
19
- }
20
- /** @description 添加数据库 */
21
- async Add(Db, Static) {
22
- const db = Db();
23
- if (await db.check()) {
24
- this.#DatabaseMap.set(Static.dialect, { Database: Db, Static });
25
- } else {
26
- logger.error(`${Static.dialect} check failed!`);
27
- }
28
- }
29
- get Db() {
30
- const dialect = this.#defaultDialect;
31
- const db = this.#DatabaseMap.get(dialect);
32
- if (!db) {
33
- logger.error(`\u672A\u627E\u5230\u6570\u636E\u5E93: ${dialect}\uFF01\u4F7F\u7528\u9ED8\u8BA4\u6570\u636E\u5E93\u3002`);
34
- return this.#DatabaseMap.get("sqlite" /* Sqlite */);
35
- }
36
- return db;
37
- }
38
- get details() {
39
- return Array.from(this.#DatabaseMap.entries()).map(([dialect, { Static }]) => ({
40
- dialect,
41
- desc: Static.description
42
- }));
43
- }
44
- /** @description 获取当前使用的数据库 */
45
- get() {
46
- return this.Db.Database();
47
- }
48
- get PkColumn() {
49
- return (type, option) => ({
50
- type: DataTypes[type],
51
- primaryKey: true,
52
- allowNull: false,
53
- ...option
54
- });
55
- }
56
- get Column() {
57
- return this.Db.Static.Column;
58
- }
59
- get ArrayColumn() {
60
- return this.Db.Static.ArrayColumn;
61
- }
62
- get JsonColumn() {
63
- return this.Db.Static.JsonColumn;
64
- }
65
- }();
66
- await Database.Add(
67
- () => new Sqlite3(),
68
- Sqlite3Static
69
- );
70
-
71
- export {
72
- Database
73
- };
@@ -1,30 +0,0 @@
1
- import {
2
- createTable
3
- } from "./chunk-G7TMVDGP.js";
4
- import {
5
- Database
6
- } from "./chunk-DMJ5OQR6.js";
7
- import {
8
- dir
9
- } from "./chunk-SHLPPEAY.js";
10
-
11
- // src/exports/database/tables/mysAccountInfo.ts
12
- var MysAccountInfoTable = createTable(
13
- dir.DataDir,
14
- "mys_account_info_data",
15
- "db" /* Db */
16
- );
17
- var MysAccountInfoDB = await MysAccountInfoTable.init(
18
- {
19
- ltuid: Database.PkColumn("STRING"),
20
- type: Database.Column("STRING", "mihoyo" /* cn */),
21
- cookie: Database.Column("TEXT", ""),
22
- stoken: Database.Column("STRING", ""),
23
- deviceMd5: Database.Column("STRING", "")
24
- }
25
- );
26
-
27
- export {
28
- MysAccountInfoTable,
29
- MysAccountInfoDB
30
- };
File without changes
File without changes
@@ -1,64 +0,0 @@
1
- // src/exports/mys/api/app.ts
2
- var version = { cn: "2.70.1", os: "1.5.0" };
3
- var appId = 2;
4
- var salt = {
5
- os: "6cqshh5dhw73bzxn20oexa9k516chk7s",
6
- "4X": "xV8v4Qu54lUKrEYFZkJhB8cuOh9Asafs",
7
- "6X": "t0qEgfub6cvueAPgR5m9aQWWVciEer7v",
8
- K2: "S9Hrn38d2b55PamfIR9BNA3Tx9sQTOem",
9
- LK2: "sjdNFJB7XxyDWGIAk0eTV8AOCfMJmyEo",
10
- PROD: "JwYDpKvLj6MrMqqYU6jTKF17KNO2PXoS"
11
- };
12
- var MysApp = Object.freeze({
13
- version,
14
- appId,
15
- salt
16
- });
17
- var MysHosts = Object.freeze({
18
- bbs: {
19
- ["mihoyo" /* cn */]: "https://bbs-api.miyoushe.com/",
20
- ["hoyolab" /* os */]: "https://bbs-api-os.mihoyo.com/"
21
- },
22
- web: {
23
- ["mihoyo" /* cn */]: "https://api-takumi.mihoyo.com/",
24
- ["hoyolab" /* os */]: "https://api-os-takumi.mihoyo.com/",
25
- /** new web host */
26
- miyoushe: "https://api-takumi.miyoushe.com/"
27
- },
28
- static: "https://api-takumi-static.mihoyo.com/",
29
- record: {
30
- ["mihoyo" /* cn */]: "https://api-takumi-record.mihoyo.com/",
31
- ["hoyolab" /* os */]: "https://bbs-api-os.mihoyo.com/"
32
- },
33
- hk4e: {
34
- ["mihoyo" /* cn */]: "https://hk4e-api.mihoyo.com/",
35
- ["hoyolab" /* os */]: "https://hk4e-api-os.hoyoverse.com/"
36
- },
37
- hk4eGacha: "https://public-operation-hk4e.mihoyo.com/",
38
- hk4eSdk: "https://hk4e-sdk.mihoyo.com/",
39
- napGacha: {
40
- ["mihoyo" /* cn */]: "https://public-operation-nap.mihoyo.com/",
41
- ["hoyolab" /* os */]: "https://public-operation-nap-sg.hoyoverse.com/"
42
- },
43
- publicData: {
44
- ["mihoyo" /* cn */]: "https://public-data-api.mihoyo.com/",
45
- ["hoyolab" /* os */]: "https://sg-public-data-api.hoyoverse.com/"
46
- },
47
- napAct: {
48
- ["mihoyo" /* cn */]: "https://act-nap-api.mihoyo.com/",
49
- ["hoyolab" /* os */]: "https://sg-act-nap-api.mihoyo.com/"
50
- },
51
- passport: "https://passport-api.mihoyo.com/",
52
- hk4eSg: {
53
- ["hoyolab" /* os */]: "https://sg-hk4e-api.hoyolab.com/"
54
- },
55
- publicSg: {
56
- ["hoyolab" /* os */]: "https://sg-public-api.hoyolab.com/",
57
- hoyoverse: "https://sg-public-api.hoyoverse.com/"
58
- }
59
- });
60
-
61
- export {
62
- MysApp,
63
- MysHosts
64
- };
@@ -1,68 +0,0 @@
1
- import {
2
- Database
3
- } from "./chunk-DMJ5OQR6.js";
4
-
5
- // src/exports/database/dbs/table.ts
6
- var Table = class {
7
- #dialect;
8
- #Database;
9
- #DataDir;
10
- #tableName;
11
- #type;
12
- #primaryKey;
13
- /**
14
- * @param type Db: 直接保存在sqlite数据中、 File: 保存在单个json文件中、 Dir: 保存在多个json文件的目录中、Schema中除pk外每一个键值对应一个文件 e.g tableName/user/key.json
15
- */
16
- constructor(DataDir, tableName, type, primaryKey) {
17
- this.#primaryKey = primaryKey;
18
- this.#Database = Database.get();
19
- this.#dialect = this.#Database.dialect;
20
- this.#DataDir = DataDir;
21
- this.#tableName = tableName;
22
- this.#type = type;
23
- }
24
- #cache() {
25
- return async () => {
26
- const Db = Database.get();
27
- if (Db.dialect !== this.#dialect) {
28
- this.#dialect = Db.dialect;
29
- this.#Database = Db;
30
- await this.init(this.modelSchema);
31
- }
32
- return this.initCache;
33
- };
34
- }
35
- async init(Schema, SchemaDefine = {}) {
36
- this.modelSchema = Schema;
37
- this.modelSchemaDefine = SchemaDefine;
38
- this.initCache = await this.#Database.init(
39
- this.#DataDir,
40
- this.#tableName,
41
- this.modelSchema,
42
- this.modelSchemaDefine,
43
- this.#type,
44
- this.#primaryKey
45
- );
46
- return this.#cache();
47
- }
48
- async addSchem(newSchema, SchemaDefine = {}) {
49
- this.modelSchema = Object.assign(this.modelSchema, newSchema);
50
- this.modelSchemaDefine = Object.assign(this.modelSchemaDefine, SchemaDefine);
51
- this.initCache = await this.#Database.init(
52
- this.#DataDir,
53
- this.#tableName,
54
- this.modelSchema,
55
- this.modelSchemaDefine,
56
- this.#type
57
- );
58
- return this.#cache();
59
- }
60
- };
61
- function createTable(DataDir, tableName, type, primaryKey) {
62
- return new Table(DataDir, tableName, type, primaryKey);
63
- }
64
-
65
- export {
66
- Table,
67
- createTable
68
- };
@@ -1,29 +0,0 @@
1
- import {
2
- createTable
3
- } from "./chunk-G7TMVDGP.js";
4
- import {
5
- Database
6
- } from "./chunk-DMJ5OQR6.js";
7
- import {
8
- dir
9
- } from "./chunk-SHLPPEAY.js";
10
-
11
- // src/exports/database/tables/mysUserInfo.ts
12
- var MysUserInfoTable = createTable(
13
- dir.DataDir,
14
- "mys_user_info_data",
15
- "db" /* Db */
16
- );
17
- var MysUserInfoDB = await MysUserInfoTable.init(
18
- {
19
- userId: Database.PkColumn("STRING"),
20
- ltuids: Database.ArrayColumn("ltuids"),
21
- stuids: Database.ArrayColumn("stuids"),
22
- deviceList: Database.ArrayColumn("deviceList")
23
- }
24
- );
25
-
26
- export {
27
- MysUserInfoTable,
28
- MysUserInfoDB
29
- };
@@ -1,13 +0,0 @@
1
- // src/exports/database/types/tables/mysUserInfo.ts
2
- var UidPermission = /* @__PURE__ */ ((UidPermission2) => {
3
- UidPermission2[UidPermission2["BIND"] = 0] = "BIND";
4
- UidPermission2[UidPermission2["CK"] = 1] = "CK";
5
- UidPermission2[UidPermission2["ST"] = 2] = "ST";
6
- UidPermission2[UidPermission2["CS"] = 3] = "CS";
7
- UidPermission2[UidPermission2["DEL"] = 4] = "DEL";
8
- return UidPermission2;
9
- })(UidPermission || {});
10
-
11
- export {
12
- UidPermission
13
- };
File without changes
@@ -1,89 +0,0 @@
1
- // src/exports/database/types/dbs/base.ts
2
- import { logger } from "node-karin";
3
- import lodash from "node-karin/lodash";
4
- var Dialect = /* @__PURE__ */ ((Dialect2) => {
5
- Dialect2["Sqlite"] = "sqlite";
6
- Dialect2["MySQL"] = "mysql";
7
- Dialect2["MariaDB"] = "mariadb";
8
- Dialect2["PostgreSQL"] = "postgres";
9
- Dialect2["MSSQL"] = "mssql";
10
- Dialect2["Oracle"] = "oracle";
11
- Dialect2["DB2"] = "db2";
12
- Dialect2["Snowflake"] = "snowflake";
13
- return Dialect2;
14
- })(Dialect || {});
15
- var DatabaseType = /* @__PURE__ */ ((DatabaseType2) => {
16
- DatabaseType2["File"] = "file";
17
- DatabaseType2["Dir"] = "dir";
18
- DatabaseType2["Db"] = "db";
19
- return DatabaseType2;
20
- })(DatabaseType || {});
21
- var DatabaseArray = class _DatabaseArray extends Array {
22
- constructor(items) {
23
- super();
24
- Object.setPrototypeOf(this, _DatabaseArray.prototype);
25
- if (Array.isArray(items)) {
26
- this.push(...items);
27
- }
28
- }
29
- /**
30
- * @param element - string | number
31
- * @returns
32
- */
33
- has(element) {
34
- return new Set(this).has(element);
35
- }
36
- /**
37
- * @param isEqual 是否不添加重复元素
38
- */
39
- add(element, isEqual) {
40
- if (isEqual) {
41
- const existingSet = new Set(this.map((item) => JSON.stringify(item)));
42
- if (existingSet.has(JSON.stringify(element))) return this;
43
- }
44
- this.push(element);
45
- return this;
46
- }
47
- /**
48
- * @param isEqual 是否不添加重复元素
49
- */
50
- addSome(elements, isEqual) {
51
- if (isEqual) {
52
- const existingSet = new Set(this.map((item) => JSON.stringify(item)));
53
- elements = elements.filter((element) => !existingSet.has(JSON.stringify(element)));
54
- if (elements.length === 0) return this;
55
- }
56
- this.push(...elements);
57
- return this;
58
- }
59
- /**
60
- * @param isIndex predicate是否为索引
61
- */
62
- remove(predicate, isIndex = false) {
63
- let newArr = [];
64
- if (isIndex && lodash.isNumber(predicate)) {
65
- if (predicate < 0 || predicate >= this.length) {
66
- logger.error(`DatabaseArray\u7D22\u5F15 ${predicate} \u8D85\u51FA\u8303\u56F4`);
67
- return this;
68
- }
69
- newArr = [...this.slice(0, predicate), ...this.slice(predicate + 1)];
70
- } else if (lodash.isFunction(predicate)) {
71
- newArr = this.filter((item) => !predicate(item));
72
- } else {
73
- newArr = lodash.without(this, predicate);
74
- }
75
- this.length = 0;
76
- this.push(...newArr);
77
- return this;
78
- }
79
- clear() {
80
- this.length = 0;
81
- return this;
82
- }
83
- };
84
-
85
- export {
86
- Dialect,
87
- DatabaseType,
88
- DatabaseArray
89
- };
File without changes
@@ -1,31 +0,0 @@
1
- import {
2
- MysDeviceInfoDB
3
- } from "./chunk-ZTOR2DXG.js";
4
-
5
- // src/exports/mys/user/deviceInfo.ts
6
- import md5 from "md5";
7
- var DeviceInfo = class {
8
- static async get(Md5) {
9
- return await (await MysDeviceInfoDB()).findByPk(Md5);
10
- }
11
- static async create(userId, deviceInfo) {
12
- const deviceMd5 = md5([
13
- userId,
14
- deviceInfo.deviceId || "",
15
- deviceInfo.name || "",
16
- deviceInfo.board || "",
17
- deviceInfo.model || "",
18
- deviceInfo.oaid || "",
19
- deviceInfo.version || "",
20
- deviceInfo.fingerprint || "",
21
- deviceInfo.product || ""
22
- ].join("_"));
23
- const MysDeviceInfo = await (await MysDeviceInfoDB()).findByPk(deviceMd5, true);
24
- await MysDeviceInfo.save(deviceInfo);
25
- return deviceMd5;
26
- }
27
- };
28
-
29
- export {
30
- DeviceInfo
31
- };