karin-plugin-mys-core 1.0.6 → 1.0.8

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 (83) hide show
  1. package/lib/apps/MiHoYoLogin.js +25 -27
  2. package/lib/apps/MysDevice.js +18 -18
  3. package/lib/apps/UIDManage.js +21 -21
  4. package/lib/{chunk-BWFWWHCT.js → chunk-2BVJS5VE.js} +7 -4
  5. package/lib/{chunk-BH4S574A.js → chunk-2WGBVGJM.js} +1 -1
  6. package/lib/{chunk-Y3J3J5B2.js → chunk-3JN5WYUN.js} +31 -20
  7. package/lib/{chunk-BNSHDFFN.js → chunk-3R37ZEXD.js} +5 -5
  8. package/lib/chunk-5DXIT7UB.js +88 -0
  9. package/lib/{chunk-NUOK4VFP.js → chunk-CD2J42HG.js} +7 -2
  10. package/lib/{chunk-DJTJKSNN.js → chunk-CZD74R2W.js} +26 -19
  11. package/lib/{chunk-G547WVGV.js → chunk-DMJ5OQR6.js} +1 -1
  12. package/lib/{chunk-7ZQQ76WC.js → chunk-EDNBKOMS.js} +4 -4
  13. package/lib/{chunk-EAVXU4Q2.js → chunk-G7TMVDGP.js} +17 -6
  14. package/lib/{chunk-HTH25YE2.js → chunk-HJ6HX5HB.js} +4 -4
  15. package/lib/chunk-JT3SU5UU.js +52 -0
  16. package/lib/{chunk-EMAUATE3.js → chunk-MPZP23EX.js} +5 -3
  17. package/lib/chunk-OYGNSYOG.js +109 -0
  18. package/lib/{chunk-6PIXUPZ6.js → chunk-PMFOX5HA.js} +14 -16
  19. package/lib/{chunk-CZZETPLY.js → chunk-UTTUUWA4.js} +19 -62
  20. package/lib/common-BlI5Gsw_.d.ts +35 -0
  21. package/lib/exports/config/array.d.ts +1 -1
  22. package/lib/exports/config/array.js +1 -1
  23. package/lib/exports/config/config.d.ts +56 -1
  24. package/lib/exports/config/config.js +6 -2
  25. package/lib/exports/config/index.d.ts +1 -2
  26. package/lib/exports/config/index.js +7 -5
  27. package/lib/exports/database/database.js +7 -3
  28. package/lib/exports/database/dbs/base.d.ts +5 -3
  29. package/lib/exports/database/dbs/base.js +5 -1
  30. package/lib/exports/database/dbs/index.d.ts +1 -1
  31. package/lib/exports/database/dbs/index.js +12 -6
  32. package/lib/exports/database/dbs/sqlite3.d.ts +7 -3
  33. package/lib/exports/database/dbs/sqlite3.js +6 -2
  34. package/lib/exports/database/dbs/table.d.ts +12 -8
  35. package/lib/exports/database/dbs/table.js +12 -6
  36. package/lib/exports/database/index.d.ts +2 -2
  37. package/lib/exports/database/index.js +18 -14
  38. package/lib/exports/database/tables/index.js +14 -12
  39. package/lib/exports/database/tables/mysAccountInfo.d.ts +1 -1
  40. package/lib/exports/database/tables/mysAccountInfo.js +9 -5
  41. package/lib/exports/database/tables/mysDeviceInfo.d.ts +1 -1
  42. package/lib/exports/database/tables/mysDeviceInfo.js +9 -7
  43. package/lib/exports/database/tables/mysUserInfo.d.ts +1 -1
  44. package/lib/exports/database/tables/mysUserInfo.js +9 -5
  45. package/lib/exports/database/types/dbs/base.d.ts +17 -6
  46. package/lib/exports/database/types/index.d.ts +1 -1
  47. package/lib/exports/database/types/tables/index.d.ts +1 -1
  48. package/lib/exports/database/types/tables/mysUserInfo.d.ts +6 -5
  49. package/lib/exports/mys/api/apis.js +18 -18
  50. package/lib/exports/mys/api/app.js +11 -9
  51. package/lib/exports/mys/api/define.js +18 -18
  52. package/lib/exports/mys/api/index.js +21 -21
  53. package/lib/exports/mys/index.js +24 -24
  54. package/lib/exports/mys/user/deviceInfo.js +12 -10
  55. package/lib/exports/mys/user/game.d.ts +12 -5
  56. package/lib/exports/mys/user/game.js +1 -1
  57. package/lib/exports/mys/user/index.d.ts +3 -3
  58. package/lib/exports/mys/user/index.js +21 -21
  59. package/lib/exports/mys/user/userInfo.js +18 -18
  60. package/lib/exports/render/index.d.ts +15 -1
  61. package/lib/exports/render/index.js +9 -4
  62. package/lib/exports/render/render.js +6 -3
  63. package/lib/exports/utils/common.d.ts +1 -33
  64. package/lib/exports/utils/common.js +3 -1
  65. package/lib/exports/utils/index.d.ts +2 -1
  66. package/lib/exports/utils/index.js +4 -2
  67. package/lib/exports/{config/types/config.d.ts → utils/types/common.d.ts} +3 -4
  68. package/lib/exports/utils/types/common.js +1 -0
  69. package/lib/exports/utils/types/index.d.ts +1 -0
  70. package/lib/exports/utils/types/index.js +2 -0
  71. package/package.json +1 -1
  72. package/resources/styles/karin-plugin-mys-core.css +10 -131
  73. package/lib/array-CCexQ14j.d.ts +0 -62
  74. package/lib/chunk-BXA3VAQC.js +0 -131
  75. package/lib/chunk-LG34FPBI.js +0 -50
  76. package/lib/chunk-UX2BDLJF.js +0 -6
  77. package/lib/exports/config/types/config.js +0 -1
  78. package/lib/exports/config/types/index.d.ts +0 -1
  79. package/lib/exports/config/types/index.js +0 -2
  80. /package/lib/{chunk-2DHTKQ34.js → chunk-3ERB3ILC.js} +0 -0
  81. /package/lib/{chunk-7SZX3RBZ.js → chunk-ARLTXJFJ.js} +0 -0
  82. /package/lib/{chunk-UC6INRYV.js → chunk-PYTECG57.js} +0 -0
  83. /package/lib/{chunk-XQWTJIT4.js → chunk-T7W4DXRM.js} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  Database
3
- } from "./chunk-G547WVGV.js";
3
+ } from "./chunk-DMJ5OQR6.js";
4
4
 
5
5
  // src/exports/database/dbs/table.ts
6
6
  var Table = class {
@@ -9,10 +9,12 @@ var Table = class {
9
9
  #DataDir;
10
10
  #tableName;
11
11
  #type;
12
+ #primaryKey;
12
13
  /**
13
14
  * @param type Db: 直接保存在sqlite数据中、 File: 保存在单个json文件中、 Dir: 保存在多个json文件的目录中、Schema中除pk外每一个键值对应一个文件 e.g tableName/user/key.json
14
15
  */
15
- constructor(DataDir, tableName, type) {
16
+ constructor(DataDir, tableName, type, primaryKey) {
17
+ this.#primaryKey = primaryKey;
16
18
  this.#Database = Database.get();
17
19
  this.#dialect = this.#Database.dialect;
18
20
  this.#DataDir = DataDir;
@@ -30,28 +32,37 @@ var Table = class {
30
32
  return this.initCache;
31
33
  };
32
34
  }
33
- async init(Schema) {
35
+ async init(Schema, SchemaDefine = {}) {
34
36
  this.modelSchema = Schema;
37
+ this.modelSchemaDefine = SchemaDefine;
35
38
  this.initCache = await this.#Database.init(
36
39
  this.#DataDir,
37
40
  this.#tableName,
38
41
  this.modelSchema,
39
- this.#type
42
+ this.modelSchemaDefine,
43
+ this.#type,
44
+ this.#primaryKey
40
45
  );
41
46
  return this.#cache();
42
47
  }
43
- async addSchem(newSchema) {
48
+ async addSchem(newSchema, SchemaDefine = {}) {
44
49
  this.modelSchema = Object.assign(this.modelSchema, newSchema);
50
+ this.modelSchemaDefine = Object.assign(this.modelSchemaDefine, SchemaDefine);
45
51
  this.initCache = await this.#Database.init(
46
52
  this.#DataDir,
47
53
  this.#tableName,
48
54
  this.modelSchema,
55
+ this.modelSchemaDefine,
49
56
  this.#type
50
57
  );
51
58
  return this.#cache();
52
59
  }
53
60
  };
61
+ function createTable(DataDir, tableName, type, primaryKey) {
62
+ return new Table(DataDir, tableName, type, primaryKey);
63
+ }
54
64
 
55
65
  export {
56
- Table
66
+ Table,
67
+ createTable
57
68
  };
@@ -1,15 +1,15 @@
1
1
  import {
2
- Table
3
- } from "./chunk-EAVXU4Q2.js";
2
+ createTable
3
+ } from "./chunk-G7TMVDGP.js";
4
4
  import {
5
5
  Database
6
- } from "./chunk-G547WVGV.js";
6
+ } from "./chunk-DMJ5OQR6.js";
7
7
  import {
8
8
  dir
9
9
  } from "./chunk-SHLPPEAY.js";
10
10
 
11
11
  // src/exports/database/tables/mysUserInfo.ts
12
- var MysUserInfoTable = new Table(
12
+ var MysUserInfoTable = createTable(
13
13
  dir.DataDir,
14
14
  "mys_user_info_data",
15
15
  "db" /* Db */
@@ -0,0 +1,52 @@
1
+ import {
2
+ dir
3
+ } from "./chunk-SHLPPEAY.js";
4
+
5
+ // src/exports/render/index.ts
6
+ import React2 from "react";
7
+
8
+ // src/exports/render/layout/DefaultLayout.tsx
9
+ import { config } from "node-karin";
10
+ import React from "react";
11
+ var DefaultLayoutComponent = ({
12
+ children,
13
+ bgColor,
14
+ mysPlugin
15
+ }) => {
16
+ const karinVersion = config.pkg().version;
17
+ return /* @__PURE__ */ React.createElement(
18
+ "div",
19
+ {
20
+ className: `relative flex w-[600px] flex-col pb-10 font-hywh text-black ${bgColor}`,
21
+ id: "container"
22
+ },
23
+ children,
24
+ /* @__PURE__ */ React.createElement("div", { className: "absolute bottom-0 left-0 flex w-full items-center justify-center gap-4 px-4 py-2.5 text-sm" }, mysPlugin && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement(
25
+ "img",
26
+ {
27
+ src: `${mysPlugin.logoPath}`,
28
+ alt: "Mys Plugin Logo",
29
+ className: "h-6 w-6 rounde"
30
+ }
31
+ ), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", { className: "text-[5px] font-bold leading-none text-black" }, "KARIN-MYS-PLUGIN"), /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline gap-0.5" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold" }, mysPlugin.name), /* @__PURE__ */ React.createElement("strong", { className: "text-xs font-bold text-[#f2c06f]" }, "v", mysPlugin.version)))), /* @__PURE__ */ React.createElement("div", { className: "h-8 w-px bg-gray-600" })), /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement(
32
+ "img",
33
+ {
34
+ src: `${dir.pluginDir}/resources/image/mys-core-logo.png`,
35
+ alt: "MysCore Logo",
36
+ className: "h-6 w-6 rounded-sm"
37
+ }
38
+ ), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", { className: "text-[5px] font-bold leading-none text-black" }, "KARIN-PLUGIN"), /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline gap-0.5" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold" }, "MysCore"), /* @__PURE__ */ React.createElement("strong", { className: "text-xs font-bold text-[#f2c06f]" }, "v", dir.version)))), /* @__PURE__ */ React.createElement("div", { className: "h-8 w-px bg-gray-600" }), /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement(
39
+ "img",
40
+ {
41
+ src: `${dir.pluginDir}/resources/image/frame-logo.png`,
42
+ alt: "Karin Logo",
43
+ className: "h-6 w-6 rounded-sm"
44
+ }
45
+ ), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", { className: "text-[5px] font-bold leading-none text-black" }, "IS DRIVEN BY"), /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline gap-1.5" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold" }, "Karin"), /* @__PURE__ */ React.createElement("strong", { className: "text-[10px] font-bold text-[#f2c06f]" }, "v", karinVersion)))))
46
+ );
47
+ };
48
+
49
+ export {
50
+ DefaultLayoutComponent,
51
+ React2 as React
52
+ };
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  DbBase
3
- } from "./chunk-Y3J3J5B2.js";
3
+ } from "./chunk-3JN5WYUN.js";
4
4
  import {
5
5
  DatabaseArray
6
6
  } from "./chunk-JVJQKRJ4.js";
@@ -30,8 +30,8 @@ var Sqlite3 = class extends DbBase {
30
30
  return false;
31
31
  }
32
32
  }
33
- async init(DataDir, modelName, modelSchema, type) {
34
- this.initBase(DataDir, modelName, modelSchema, type);
33
+ async init(DataDir, modelName, modelSchema, modelSchemaDefine, type, primaryKey) {
34
+ this.initBase(DataDir, modelName, modelSchema, modelSchemaDefine, type, primaryKey);
35
35
  if (this.databaseType === "db" /* Db */) {
36
36
  this.model = sequelize.define(this.modelName, this.modelSchema, {
37
37
  timestamps: false,
@@ -179,6 +179,7 @@ var Sqlite3Static = new class Sqlite3Static2 {
179
179
  }
180
180
  ArrayColumn(key, fn) {
181
181
  return {
182
+ ArrayColumn: true,
182
183
  type: DataTypes.STRING,
183
184
  defaultValue: [].join(","),
184
185
  get() {
@@ -193,6 +194,7 @@ var Sqlite3Static = new class Sqlite3Static2 {
193
194
  }
194
195
  JsonColumn(key, def) {
195
196
  return {
197
+ JsonColumn: true,
196
198
  type: DataTypes.STRING,
197
199
  defaultValue: JSON.stringify(def),
198
200
  get() {
@@ -0,0 +1,109 @@
1
+ import {
2
+ EnhancedArray
3
+ } from "./chunk-PMFOX5HA.js";
4
+ import {
5
+ common_exports
6
+ } from "./chunk-5DXIT7UB.js";
7
+
8
+ // src/exports/config/config.ts
9
+ import { existsSync, existToMkdirSync, logger, requireFileSync, watch, writeJsonSync } from "node-karin";
10
+ import lodash from "node-karin/lodash";
11
+ import path from "path";
12
+ var Config = class {
13
+ #cfgName;
14
+ /**
15
+ * @description 配置缓存
16
+ */
17
+ #ConfigCache = null;
18
+ /**
19
+ * @description 默认配置
20
+ */
21
+ #DefaultConfig;
22
+ #DefineConfig;
23
+ /**
24
+ * @description 配置保存路径
25
+ */
26
+ #ConfigPath;
27
+ /**
28
+ * @param name 插件名称:配置名称
29
+ */
30
+ constructor(name, ConfigDir, DefaultConfig, DefineConfig) {
31
+ this.#cfgName = name;
32
+ const splitName = name.split(":");
33
+ if (!splitName[1]) {
34
+ throw new Error("\u914D\u7F6E\u540D\u79F0\u683C\u5F0F\u9519\u8BEF\uFF0C\u5E94\u4E3A \u63D2\u4EF6\u540D\u79F0:\u914D\u7F6E\u540D\u79F0");
35
+ }
36
+ this.#ConfigPath = path.join(ConfigDir, `${splitName[1]}.json`);
37
+ this.#DefaultConfig = DefaultConfig;
38
+ this.#DefineConfig = DefineConfig;
39
+ existToMkdirSync(ConfigDir);
40
+ !existsSync(this.#ConfigPath) && writeJsonSync(this.#ConfigPath, DefaultConfig, true);
41
+ this.loadConfig();
42
+ }
43
+ loadConfig() {
44
+ const config = requireFileSync(this.#ConfigPath);
45
+ const mergedConfig = this.mergeWithDefaults(config, this.#DefaultConfig, this.#DefineConfig);
46
+ this.#ConfigCache = mergedConfig;
47
+ return mergedConfig;
48
+ }
49
+ mergeWithDefaults(userConfig, defaultConfig, DefineConfig) {
50
+ const filteredUserConfig = common_exports.filterData(userConfig, defaultConfig, DefineConfig);
51
+ const result = lodash.merge({}, defaultConfig, filteredUserConfig);
52
+ if (!lodash.isEqual(result, userConfig)) {
53
+ try {
54
+ writeJsonSync(this.#ConfigPath, result);
55
+ } catch (err) {
56
+ logger.error(err);
57
+ }
58
+ }
59
+ return result;
60
+ }
61
+ /**
62
+ * @description 获取配置路径对应的默认配置
63
+ */
64
+ getDef(path2) {
65
+ const defConfig = JSON.parse(JSON.stringify(this.#DefaultConfig));
66
+ return lodash.get(defConfig, path2);
67
+ }
68
+ get(path2, isArray = false, def) {
69
+ const conf = JSON.parse(JSON.stringify(this.#ConfigCache));
70
+ const result = path2 ? lodash.get(conf, path2, def) : conf;
71
+ if (isArray) {
72
+ if (!Array.isArray(result)) {
73
+ logger.error(`\u914D\u7F6E\u8DEF\u5F84 ${path2} \u4E0D\u662F\u6570\u7EC4\u7C7B\u578B`);
74
+ return new EnhancedArray(this, [], path2);
75
+ }
76
+ return new EnhancedArray(this, result, path2);
77
+ }
78
+ return result;
79
+ }
80
+ /**
81
+ * @param save 是否立即保存
82
+ */
83
+ set(path2, value, save) {
84
+ lodash.set(this.#ConfigCache, path2, value);
85
+ save && this.save();
86
+ }
87
+ /**
88
+ * @description 立即保存配置
89
+ */
90
+ save() {
91
+ try {
92
+ logger.debug(`[${this.#cfgName}] \u4FDD\u5B58\u914D\u7F6E`, this.#ConfigCache);
93
+ writeJsonSync(this.#ConfigPath, this.#ConfigCache);
94
+ } catch (err) {
95
+ logger.error(err);
96
+ }
97
+ }
98
+ watch(fnc) {
99
+ watch(this.#ConfigPath, async (oldData, newData) => {
100
+ fnc && await fnc(this, oldData, newData);
101
+ this.loadConfig();
102
+ });
103
+ return this;
104
+ }
105
+ };
106
+
107
+ export {
108
+ Config
109
+ };
@@ -47,30 +47,28 @@ var EnhancedArray = class _EnhancedArray extends Array {
47
47
  this.#cfg.set(this.#keyPath, this.slice(), save);
48
48
  return this;
49
49
  }
50
- remove(predicate, save, isIndex = false) {
51
- if (isIndex && lodash.isNumber(predicate)) {
52
- if (predicate < 0 || predicate >= this.length) {
53
- logger.error(`\u7D22\u5F15 ${predicate} \u8D85\u51FA\u8303\u56F4 [0, ${this.length - 1}]`);
54
- return this;
55
- }
56
- lodash.pullAt(this, predicate);
57
- } else if (lodash.isFunction(predicate)) {
58
- lodash.remove(this, predicate);
59
- } else {
60
- lodash.pull(this, predicate);
50
+ /** @description 删除指定索引 */
51
+ pullAt(idx, save) {
52
+ if (idx < 0 || idx >= this.length) {
53
+ logger.error(`\u7D22\u5F15 ${idx} \u8D85\u51FA\u8303\u56F4 [0, ${this.length - 1}]`);
54
+ return this;
61
55
  }
56
+ lodash.pullAt(this, idx);
62
57
  this.#cfg.set(this.#keyPath, this.slice(), save);
63
58
  return this;
64
59
  }
65
- /**
66
- * @param predicate - 要删除的元素数组
67
- * @param save - 是否立即保存
68
- */
69
- removeSome(elements, save) {
60
+ /** @description 删除指定元素 */
61
+ pullAll(elements, save) {
70
62
  lodash.pullAll(this, elements);
71
63
  this.#cfg.set(this.#keyPath, this.slice(), save);
72
64
  return this;
73
65
  }
66
+ /** @description 使用条件函数删除元素 */
67
+ remove(predicate, save) {
68
+ lodash.remove(this, predicate);
69
+ this.#cfg.set(this.#keyPath, this.slice(), save);
70
+ return this;
71
+ }
74
72
  clear() {
75
73
  this.length = 0;
76
74
  return this;
@@ -1,89 +1,46 @@
1
+ import {
2
+ DefaultLayoutComponent,
3
+ React
4
+ } from "./chunk-JT3SU5UU.js";
1
5
  import {
2
6
  ReactRender
3
- } from "./chunk-NUOK4VFP.js";
7
+ } from "./chunk-CD2J42HG.js";
4
8
  import {
5
9
  UserInfo
6
- } from "./chunk-DJTJKSNN.js";
10
+ } from "./chunk-CZD74R2W.js";
7
11
  import {
8
12
  MysGame
9
- } from "./chunk-BWFWWHCT.js";
13
+ } from "./chunk-2BVJS5VE.js";
10
14
  import {
11
15
  dir
12
16
  } from "./chunk-SHLPPEAY.js";
13
17
 
14
- // src/template/layout/DefaultLayout.tsx
15
- import React from "react";
16
-
17
- // src/template/render.ts
18
- var Render = new ReactRender(dir, {});
19
-
20
- // src/template/layout/DefaultLayout.tsx
21
- var DefaultLayoutComponent = ({
22
- children,
23
- bgColor,
24
- mysPlugin
25
- }) => {
26
- const { plugin, karin: karin2 } = Render;
27
- return /* @__PURE__ */ React.createElement(
28
- "div",
29
- {
30
- className: `relative flex w-[600px] flex-col pb-10 font-[HYWenHei-55W] text-black ${bgColor}`,
31
- id: "container",
32
- style: { fontFamily: "HYWenHei-55W, sans-serif" }
33
- },
34
- children,
35
- /* @__PURE__ */ React.createElement("div", { className: "absolute bottom-0 left-0 flex w-full items-center justify-center gap-4 px-4 py-2.5 text-sm" }, mysPlugin && /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement(
36
- "img",
37
- {
38
- src: `${mysPlugin.logoPath}`,
39
- alt: "Mys Plugin Logo",
40
- className: "h-6 w-6 rounde"
41
- }
42
- ), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", { className: "text-[5px] font-bold leading-none text-black" }, "KARIN-MYS-PLUGIN"), /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline gap-0.5" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold" }, mysPlugin.name), /* @__PURE__ */ React.createElement("strong", { className: "text-xs font-bold text-[#f2c06f]" }, "v", mysPlugin.version)))), /* @__PURE__ */ React.createElement("div", { className: "h-8 w-px bg-gray-600" })), /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement(
43
- "img",
44
- {
45
- src: `${plugin.resources.default}/image/mys-core-logo.png`,
46
- alt: "MysCore Logo",
47
- className: "h-6 w-6 rounded-sm"
48
- }
49
- ), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", { className: "text-[5px] font-bold leading-none text-black" }, "KARIN-PLUGIN"), /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline gap-0.5" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold" }, "MysCore"), /* @__PURE__ */ React.createElement("strong", { className: "text-xs font-bold text-[#f2c06f]" }, "v", plugin.version)))), /* @__PURE__ */ React.createElement("div", { className: "h-8 w-px bg-gray-600" }), /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, /* @__PURE__ */ React.createElement(
50
- "img",
51
- {
52
- src: `${plugin.resources.default}/image/frame-logo.png`,
53
- alt: "Karin Logo",
54
- className: "h-6 w-6 rounded-sm"
55
- }
56
- ), /* @__PURE__ */ React.createElement("div", { className: "flex flex-col" }, /* @__PURE__ */ React.createElement("span", { className: "text-[5px] font-bold leading-none text-black" }, "IS DRIVEN BY"), /* @__PURE__ */ React.createElement("div", { className: "flex items-baseline gap-1.5" }, /* @__PURE__ */ React.createElement("span", { className: "font-semibold" }, "Karin"), /* @__PURE__ */ React.createElement("strong", { className: "text-[10px] font-bold text-[#f2c06f]" }, "v", karin2.version)))))
57
- );
58
- };
59
-
60
- // src/template/ShowBindAccount/ShowBindAccount.tsx
61
- import React2 from "react";
18
+ // src/template/ShowBindAccount.tsx
62
19
  var ShowBindAccountComponent = ({
63
20
  User,
64
21
  AccountList
65
22
  }) => {
66
23
  const plugin = Render.plugin;
67
- return /* @__PURE__ */ React2.createElement(DefaultLayoutComponent, { bgColor: "bg-[#f6f0e6]" }, /* @__PURE__ */ React2.createElement("div", { className: "px-[18px] pb-9 pt-5" }, /* @__PURE__ */ React2.createElement(
24
+ return /* @__PURE__ */ React.createElement(DefaultLayoutComponent, { bgColor: "bg-[#f6f0e6]" }, /* @__PURE__ */ React.createElement("div", { className: "px-[18px] pb-9 pt-5" }, /* @__PURE__ */ React.createElement(
68
25
  "div",
69
26
  {
70
27
  className: "absolute -top-2.5 right-0 z-[5] h-[72px] w-[150px] bg-contain bg-center bg-no-repeat opacity-50",
71
28
  style: { backgroundImage: `url('${plugin.resources.default}/image/mys-logo.png')` }
72
29
  }
73
- ), /* @__PURE__ */ React2.createElement("div", { className: "mb-3 flex items-center gap-2.5" }, /* @__PURE__ */ React2.createElement("img", { className: "h-10 w-10 flex-none rounded-full object-cover", src: User.avatar, alt: "avatar" }), /* @__PURE__ */ React2.createElement("span", { className: "min-w-0 overflow-anywhere break-words text-sm text-[#222]" }, User.nickname, " (", User.userId, ")")), AccountList && AccountList.length > 0 ? AccountList.map((account, idx) => /* @__PURE__ */ React2.createElement(
30
+ ), /* @__PURE__ */ React.createElement("div", { className: "mb-3 flex items-center gap-2.5" }, /* @__PURE__ */ React.createElement("img", { className: "h-10 w-10 flex-none rounded-full object-cover", src: User.avatar, alt: "avatar" }), /* @__PURE__ */ React.createElement("span", { className: "min-w-0 overflow-anywhere break-words text-sm text-[#222]" }, User.nickname, " (", User.userId, ")")), AccountList && AccountList.length > 0 ? AccountList.map((account, idx) => /* @__PURE__ */ React.createElement(
74
31
  "div",
75
32
  {
76
33
  className: "mb-3 flex flex-col gap-1.5 rounded-lg border border-black/[0.06] bg-white p-3 shadow-[0_2px_6px_rgba(0,0,0,0.04)]",
77
34
  key: account.ltuid
78
35
  },
79
- /* @__PURE__ */ React2.createElement("div", { className: "relative flex items-center justify-between gap-2" }, /* @__PURE__ */ React2.createElement("span", { className: "flex text-sm font-semibold text-[#3f7dd1]" }, "MYS UID (", idx + 1, ")\uFF1A", account.ltuid), /* @__PURE__ */ React2.createElement("div", { className: "flex items-center gap-2" }, account.permission >= 1 && /* @__PURE__ */ React2.createElement("span", { className: "inline-block rounded-xl bg-gradient-to-b from-[#34bc5b] to-[#2ea94b] px-2 py-1 text-xs font-semibold text-white shadow-[0_1px_0_rgba(0,0,0,0.06)_inset]" }, "cookie"), account.permission >= 2 && /* @__PURE__ */ React2.createElement("span", { className: "inline-block rounded-xl bg-gradient-to-b from-[#f6d86a] to-[#f1c40f] px-2 py-1 text-xs font-semibold text-black/85" }, "stoken"))),
80
- account.bindUids.map((bindUid, bindIdx) => /* @__PURE__ */ React2.createElement(
36
+ /* @__PURE__ */ React.createElement("div", { className: "relative flex items-center justify-between gap-2" }, /* @__PURE__ */ React.createElement("span", { className: "flex text-sm font-semibold text-[#3f7dd1]" }, "MYS UID (", idx + 1, ")\uFF1A", account.ltuid), /* @__PURE__ */ React.createElement("div", { className: "flex items-center gap-2" }, account.permission >= 1 && /* @__PURE__ */ React.createElement("span", { className: "inline-block rounded-xl bg-gradient-to-b from-[#34bc5b] to-[#2ea94b] px-2 py-1 text-xs font-semibold text-white shadow-[0_1px_0_rgba(0,0,0,0.06)_inset]" }, "cookie"), account.permission >= 2 && /* @__PURE__ */ React.createElement("span", { className: "inline-block rounded-xl bg-gradient-to-b from-[#f6d86a] to-[#f1c40f] px-2 py-1 text-xs font-semibold text-black/85" }, "stoken"))),
37
+ account.bindUids.map((bindUid, bindIdx) => /* @__PURE__ */ React.createElement(
81
38
  "div",
82
39
  {
83
40
  className: `flex items-center gap-3 rounded-md px-1 py-1.5 ${bindIdx > 0 ? "relative pt-3 before:absolute before:left-[5%] before:right-0 before:top-0 before:h-px before:w-[90%] before:rounded-sm before:bg-[#3f7dd1]" : ""}`,
84
41
  key: bindUid.gameName
85
42
  },
86
- /* @__PURE__ */ React2.createElement(
43
+ /* @__PURE__ */ React.createElement(
87
44
  "img",
88
45
  {
89
46
  className: "flex w-10 items-center justify-center rounded-[10px]",
@@ -91,7 +48,7 @@ var ShowBindAccountComponent = ({
91
48
  alt: bindUid.gameName
92
49
  }
93
50
  ),
94
- /* @__PURE__ */ React2.createElement("div", { className: "grid flex-auto grid-cols-3 gap-2" }, bindUid.uids.map((info) => /* @__PURE__ */ React2.createElement(
51
+ /* @__PURE__ */ React.createElement("div", { className: "grid flex-auto grid-cols-3 gap-2" }, bindUid.uids.map((info) => /* @__PURE__ */ React.createElement(
95
52
  "span",
96
53
  {
97
54
  key: info.uid,
@@ -100,11 +57,11 @@ var ShowBindAccountComponent = ({
100
57
  info.uid
101
58
  )))
102
59
  ))
103
- )) : /* @__PURE__ */ React2.createElement("div", { className: "my-3 px-5 py-5 text-center font-semibold text-[#6b6b6b]" }, "\u6682\u672A\u7ED1\u5B9A\u8D26\u53F7")));
60
+ )) : /* @__PURE__ */ React.createElement("div", { className: "my-3 px-5 py-5 text-center font-semibold text-[#6b6b6b]" }, "\u6682\u672A\u7ED1\u5B9A\u8D26\u53F7")));
104
61
  };
105
62
 
106
- // src/template/ShowBindDevice/ShowBindDevice.tsx
107
- import React3 from "react";
63
+ // src/template/index.ts
64
+ var Render = new ReactRender(dir, {});
108
65
 
109
66
  // src/apps/UIDManage.ts
110
67
  import karin, { handler, segment } from "node-karin";
@@ -121,7 +78,7 @@ var BindUID = karin.command(
121
78
  }
122
79
  const userInfo = await Game.UserInfo.create(e.userId);
123
80
  const bindUids = userInfo.bind_uids;
124
- if (!(uid in bindUids)) {
81
+ if (!bindUids[uid]) {
125
82
  bindUids[uid] = { perm: 0 /* BIND */, ltuid: "" };
126
83
  }
127
84
  await userInfo.saveUserInfo({
@@ -161,7 +118,7 @@ var UnbindUID = karin.command(
161
118
  }
162
119
  delUid = filterUids[idx - 1][0];
163
120
  }
164
- if (delUid in bindUids) {
121
+ if (bindUids[delUid]) {
165
122
  if (bindUids[delUid].perm === 0 /* BIND */) {
166
123
  delete bindUids[delUid];
167
124
  } else {
@@ -0,0 +1,35 @@
1
+ /**
2
+ * @description 生成随机字符串
3
+ * @param length - 字符串长度
4
+ */
5
+ declare const randomString: (length: number, type: "Lower" | "Upper" | "All") => string;
6
+ /**
7
+ * @description 生成设备guid
8
+ */
9
+ declare const getDeviceGuid: () => string;
10
+ /**
11
+ * @description 将字符串解析为key-value键值对
12
+ * @param Str - 字符串
13
+ * @param sep - 分隔符
14
+ */
15
+ declare const StrToObj: <D extends {
16
+ [key: string]: string;
17
+ }>(Str: string, sep: string | RegExp) => Partial<D>;
18
+ /**
19
+ * @description 将key-value键值对解析为字符串
20
+ * @param obj - key-value键值对
21
+ * @param sep - 分隔符
22
+ */
23
+ declare const ObjToStr: (obj: Record<string, string | number>, sep: string) => string;
24
+ declare function filterData(user: any, defaults: any, Define: any): any;
25
+
26
+ declare const common_ObjToStr: typeof ObjToStr;
27
+ declare const common_StrToObj: typeof StrToObj;
28
+ declare const common_filterData: typeof filterData;
29
+ declare const common_getDeviceGuid: typeof getDeviceGuid;
30
+ declare const common_randomString: typeof randomString;
31
+ declare namespace common {
32
+ export { common_ObjToStr as ObjToStr, common_StrToObj as StrToObj, common_filterData as filterData, common_getDeviceGuid as getDeviceGuid, common_randomString as randomString };
33
+ }
34
+
35
+ export { ObjToStr as O, StrToObj as S, common as c, filterData as f, getDeviceGuid as g, randomString as r };
@@ -1 +1 @@
1
- export { E as EnhancedArray } from '../../array-CCexQ14j.js';
1
+ export { E as EnhancedArray } from './config.js';
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  EnhancedArray
3
- } from "../../chunk-6PIXUPZ6.js";
3
+ } from "../../chunk-PMFOX5HA.js";
4
4
  import "../../chunk-MLKGABMK.js";
5
5
  export {
6
6
  EnhancedArray
@@ -1 +1,56 @@
1
- export { C as Config } from '../../array-CCexQ14j.js';
1
+ declare class Config<C extends Record<string, any>> {
2
+ #private;
3
+ /**
4
+ * @param name 插件名称:配置名称
5
+ */
6
+ constructor(name: `${string}:${string}`, ConfigDir: string, DefaultConfig: C, DefineConfig: Record<string, any>);
7
+ loadConfig(): C;
8
+ mergeWithDefaults(userConfig: C, defaultConfig: C, DefineConfig: Record<string, any>): C;
9
+ /**
10
+ * @description 获取配置路径对应的默认配置
11
+ */
12
+ getDef<T>(path: string): T;
13
+ /**
14
+ * @description 获取配置路径对应的配置
15
+ */
16
+ get<T>(path: string, isArray?: false, def?: T): T;
17
+ get<T>(path: string, isArray: true, def?: T[]): EnhancedArray<T>;
18
+ /**
19
+ * @param save 是否立即保存
20
+ */
21
+ set<T>(path: string, value: T, save: boolean): void;
22
+ /**
23
+ * @description 立即保存配置
24
+ */
25
+ save(): void;
26
+ watch(fnc?: (self: Config<C>, oldData: C, newData: C) => Promise<void> | void): this;
27
+ }
28
+
29
+ declare class EnhancedArray<T> extends Array<T> {
30
+ #private;
31
+ constructor(cfg: Config<any>, items: T[], path: string);
32
+ /**
33
+ * @param element - string | number
34
+ * @returns
35
+ */
36
+ has(element: T & (string | number)): boolean;
37
+ /**
38
+ * @param isEqual 是否不添加重复元素
39
+ * @param save 是否立即保存
40
+ */
41
+ add(element: T, isEqual: boolean, save: boolean): this;
42
+ /**
43
+ * @param isEqual 是否不添加重复元素
44
+ * @param save 是否立即保存
45
+ */
46
+ addSome(elements: T[], isEqual: boolean, save: boolean): this;
47
+ /** @description 删除指定索引 */
48
+ pullAt(idx: number, save: boolean): this;
49
+ /** @description 删除指定元素 */
50
+ pullAll(elements: T[], save: boolean): this;
51
+ /** @description 使用条件函数删除元素 */
52
+ remove(predicate: (item: T) => boolean, save: boolean): this;
53
+ clear(): this;
54
+ }
55
+
56
+ export { Config, EnhancedArray as E };
@@ -1,7 +1,11 @@
1
1
  import {
2
2
  Config
3
- } from "../../chunk-BXA3VAQC.js";
4
- import "../../chunk-6PIXUPZ6.js";
3
+ } from "../../chunk-OYGNSYOG.js";
4
+ import "../../chunk-PMFOX5HA.js";
5
+ import "../../chunk-ARLTXJFJ.js";
6
+ import "../../chunk-PYTECG57.js";
7
+ import "../../chunk-T7W4DXRM.js";
8
+ import "../../chunk-5DXIT7UB.js";
5
9
  import "../../chunk-MLKGABMK.js";
6
10
  export {
7
11
  Config
@@ -1,2 +1 @@
1
- export { C as Config, E as EnhancedArray } from '../../array-CCexQ14j.js';
2
- export { ConfigDefine, ConfigDefineArray } from './types/config.js';
1
+ export { Config, E as EnhancedArray } from './config.js';
@@ -1,12 +1,14 @@
1
- import "../../chunk-XQWTJIT4.js";
2
- import "../../chunk-7SZX3RBZ.js";
3
- import "../../chunk-2DHTKQ34.js";
1
+ import "../../chunk-3ERB3ILC.js";
4
2
  import {
5
3
  Config
6
- } from "../../chunk-BXA3VAQC.js";
4
+ } from "../../chunk-OYGNSYOG.js";
7
5
  import {
8
6
  EnhancedArray
9
- } from "../../chunk-6PIXUPZ6.js";
7
+ } from "../../chunk-PMFOX5HA.js";
8
+ import "../../chunk-ARLTXJFJ.js";
9
+ import "../../chunk-PYTECG57.js";
10
+ import "../../chunk-T7W4DXRM.js";
11
+ import "../../chunk-5DXIT7UB.js";
10
12
  import "../../chunk-MLKGABMK.js";
11
13
  export {
12
14
  Config,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  Database
3
- } from "../../chunk-G547WVGV.js";
4
- import "../../chunk-EMAUATE3.js";
5
- import "../../chunk-Y3J3J5B2.js";
3
+ } from "../../chunk-DMJ5OQR6.js";
4
+ import "../../chunk-MPZP23EX.js";
5
+ import "../../chunk-3JN5WYUN.js";
6
6
  import "../../chunk-7KEG6SDX.js";
7
7
  import "../../chunk-FBWSEBAW.js";
8
8
  import "../../chunk-JVJQKRJ4.js";
@@ -11,6 +11,10 @@ import "../../chunk-SHW6FHIB.js";
11
11
  import "../../chunk-K5U2O3HH.js";
12
12
  import "../../chunk-I7XZONDN.js";
13
13
  import "../../chunk-JRH4JC43.js";
14
+ import "../../chunk-ARLTXJFJ.js";
15
+ import "../../chunk-PYTECG57.js";
16
+ import "../../chunk-T7W4DXRM.js";
17
+ import "../../chunk-5DXIT7UB.js";
14
18
  import "../../chunk-SHLPPEAY.js";
15
19
  import "../../chunk-MLKGABMK.js";
16
20
  export {