karin-plugin-mys-core 1.0.16 → 1.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/apps/MiHoYoLogin.js +5 -5
- package/lib/apps/MysDevice.js +4 -4
- package/lib/apps/UIDManage.js +5 -5
- package/lib/{chunk-F42OUZOV.js → chunk-32QZ2PSX.js} +3 -3
- package/lib/{chunk-UIPRZFST.js → chunk-BLE3V6QR.js} +7 -12
- package/lib/{chunk-SXPDBSIW.js → chunk-HI6OZTI2.js} +7 -4
- package/lib/{chunk-5ZBRGVPY.js → chunk-SOLISSTT.js} +1 -1
- package/lib/core/index.d.ts +5 -1
- package/lib/core/index.js +3 -2
- package/lib/exports/config/index.d.ts +30 -8
- package/lib/exports/config/index.js +1 -1
- package/lib/exports/database/index.d.ts +4 -2
- package/lib/exports/mys/index.d.ts +2 -1
- package/lib/exports/mys/index.js +4 -4
- package/lib/mysAccountInfo-B7u5Sl8f.d.ts +14 -0
- package/lib/{mysUserInfo-BsyEENbc.d.ts → mysUserInfo-CPIjniyl.d.ts} +1 -14
- package/lib/web.config.js +21 -8
- package/package.json +1 -1
- package/resources/styles/karin-plugin-mys-core.css +1 -1
package/lib/apps/MiHoYoLogin.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ShowBindAccountCmdFunc
|
|
3
|
-
} from "../chunk-
|
|
3
|
+
} from "../chunk-SOLISSTT.js";
|
|
4
4
|
import "../chunk-S3ALDDWH.js";
|
|
5
5
|
import {
|
|
6
6
|
UserInfo,
|
|
@@ -9,11 +9,11 @@ import {
|
|
|
9
9
|
getTokenByGameToken,
|
|
10
10
|
getUserFullInfo,
|
|
11
11
|
queryQRcode
|
|
12
|
-
} from "../chunk-
|
|
13
|
-
import "../chunk-ER4WMJJ6.js";
|
|
12
|
+
} from "../chunk-32QZ2PSX.js";
|
|
14
13
|
import "../chunk-5LRGHP36.js";
|
|
15
|
-
import "../chunk-
|
|
16
|
-
import "../chunk-
|
|
14
|
+
import "../chunk-HI6OZTI2.js";
|
|
15
|
+
import "../chunk-BLE3V6QR.js";
|
|
16
|
+
import "../chunk-ER4WMJJ6.js";
|
|
17
17
|
import {
|
|
18
18
|
common_exports
|
|
19
19
|
} from "../chunk-RX4VMVAI.js";
|
package/lib/apps/MysDevice.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DeviceInfo,
|
|
3
3
|
UserInfo
|
|
4
|
-
} from "../chunk-
|
|
5
|
-
import "../chunk-ER4WMJJ6.js";
|
|
4
|
+
} from "../chunk-32QZ2PSX.js";
|
|
6
5
|
import "../chunk-5LRGHP36.js";
|
|
7
|
-
import "../chunk-
|
|
8
|
-
import "../chunk-
|
|
6
|
+
import "../chunk-HI6OZTI2.js";
|
|
7
|
+
import "../chunk-BLE3V6QR.js";
|
|
8
|
+
import "../chunk-ER4WMJJ6.js";
|
|
9
9
|
import "../chunk-RX4VMVAI.js";
|
|
10
10
|
import "../chunk-SHLPPEAY.js";
|
|
11
11
|
import "../chunk-MLKGABMK.js";
|
package/lib/apps/UIDManage.js
CHANGED
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
ShowBindAccountCmdFunc,
|
|
6
6
|
UnbindAccount,
|
|
7
7
|
UnbindUID
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-SOLISSTT.js";
|
|
9
9
|
import "../chunk-S3ALDDWH.js";
|
|
10
|
-
import "../chunk-
|
|
11
|
-
import "../chunk-ER4WMJJ6.js";
|
|
10
|
+
import "../chunk-32QZ2PSX.js";
|
|
12
11
|
import "../chunk-5LRGHP36.js";
|
|
13
|
-
import "../chunk-
|
|
14
|
-
import "../chunk-
|
|
12
|
+
import "../chunk-HI6OZTI2.js";
|
|
13
|
+
import "../chunk-BLE3V6QR.js";
|
|
14
|
+
import "../chunk-ER4WMJJ6.js";
|
|
15
15
|
import "../chunk-RX4VMVAI.js";
|
|
16
16
|
import "../chunk-SHLPPEAY.js";
|
|
17
17
|
import "../chunk-MLKGABMK.js";
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DeviceCfg
|
|
3
|
+
} from "./chunk-HI6OZTI2.js";
|
|
1
4
|
import {
|
|
2
5
|
MysAccountInfoDB,
|
|
3
6
|
MysDeviceInfoDB,
|
|
4
7
|
MysUserInfoDB
|
|
5
8
|
} from "./chunk-ER4WMJJ6.js";
|
|
6
|
-
import {
|
|
7
|
-
DeviceCfg
|
|
8
|
-
} from "./chunk-SXPDBSIW.js";
|
|
9
9
|
import {
|
|
10
10
|
common_exports
|
|
11
11
|
} from "./chunk-RX4VMVAI.js";
|
|
@@ -132,30 +132,25 @@ var Config = class {
|
|
|
132
132
|
}
|
|
133
133
|
return result;
|
|
134
134
|
}
|
|
135
|
-
/**
|
|
136
|
-
* @description 获取配置路径对应的默认配置
|
|
137
|
-
*/
|
|
138
135
|
getDef(path2) {
|
|
139
136
|
const defConfig = JSON.parse(JSON.stringify(this.#DefaultConfig));
|
|
140
|
-
return lodash2.get(defConfig, path2);
|
|
137
|
+
return path2 ? lodash2.get(defConfig, path2) : defConfig;
|
|
141
138
|
}
|
|
142
139
|
get(path2, isArray = false, def) {
|
|
143
140
|
const conf = JSON.parse(JSON.stringify(this.#ConfigCache));
|
|
144
|
-
const
|
|
141
|
+
const pathStr = String(path2);
|
|
142
|
+
const result = pathStr ? lodash2.get(conf, pathStr, def) : conf;
|
|
145
143
|
if (isArray) {
|
|
146
144
|
if (!Array.isArray(result)) {
|
|
147
|
-
logger2.error(`\u914D\u7F6E\u8DEF\u5F84 ${
|
|
148
|
-
return new EnhancedArray(this, [],
|
|
145
|
+
logger2.error(`\u914D\u7F6E\u8DEF\u5F84 ${pathStr} \u4E0D\u662F\u6570\u7EC4\u7C7B\u578B`);
|
|
146
|
+
return new EnhancedArray(this, [], pathStr);
|
|
149
147
|
}
|
|
150
|
-
return new EnhancedArray(this, result,
|
|
148
|
+
return new EnhancedArray(this, result, pathStr);
|
|
151
149
|
}
|
|
152
150
|
return result;
|
|
153
151
|
}
|
|
154
|
-
/**
|
|
155
|
-
* @param save 是否立即保存
|
|
156
|
-
*/
|
|
157
152
|
set(path2, value, save) {
|
|
158
|
-
lodash2.set(this.#ConfigCache, path2, value);
|
|
153
|
+
lodash2.set(this.#ConfigCache, String(path2), value);
|
|
159
154
|
save && this.save();
|
|
160
155
|
}
|
|
161
156
|
/**
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
Config
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-BLE3V6QR.js";
|
|
4
4
|
import {
|
|
5
5
|
dir
|
|
6
6
|
} from "./chunk-SHLPPEAY.js";
|
|
7
7
|
|
|
8
8
|
// src/core/config/config.ts
|
|
9
|
-
var
|
|
10
|
-
|
|
9
|
+
var defaultCoreConfig = {
|
|
10
|
+
proxy: {
|
|
11
|
+
github: "https://gh-proxy.org",
|
|
12
|
+
["hoyolab" /* os */]: ""
|
|
13
|
+
}
|
|
11
14
|
};
|
|
12
15
|
var defaultConfigDefine = {};
|
|
13
|
-
var CoreCfg = new Config(`${dir.name}:config`, dir.ConfigDir,
|
|
16
|
+
var CoreCfg = new Config(`${dir.name}:config`, dir.ConfigDir, defaultCoreConfig, defaultConfigDefine).watch();
|
|
14
17
|
|
|
15
18
|
// src/core/config/device.ts
|
|
16
19
|
var DefaultDevice = {
|
package/lib/core/index.d.ts
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { Config } from '../exports/config/index.js';
|
|
2
|
+
import { M as MysAccountType } from '../mysAccountInfo-B7u5Sl8f.js';
|
|
2
3
|
|
|
3
4
|
interface DefaultCoreConfigType {
|
|
4
|
-
|
|
5
|
+
proxy: {
|
|
6
|
+
github: string;
|
|
7
|
+
[MysAccountType.os]: string;
|
|
8
|
+
};
|
|
5
9
|
}
|
|
6
10
|
interface DefaultCoreConfigDefineType {
|
|
7
11
|
}
|
package/lib/core/index.js
CHANGED
|
@@ -2,8 +2,9 @@ import "../chunk-5LRGHP36.js";
|
|
|
2
2
|
import {
|
|
3
3
|
CoreCfg,
|
|
4
4
|
DeviceCfg
|
|
5
|
-
} from "../chunk-
|
|
6
|
-
import "../chunk-
|
|
5
|
+
} from "../chunk-HI6OZTI2.js";
|
|
6
|
+
import "../chunk-BLE3V6QR.js";
|
|
7
|
+
import "../chunk-ER4WMJJ6.js";
|
|
7
8
|
import "../chunk-RX4VMVAI.js";
|
|
8
9
|
import "../chunk-SHLPPEAY.js";
|
|
9
10
|
import "../chunk-MLKGABMK.js";
|
|
@@ -1,24 +1,44 @@
|
|
|
1
|
-
|
|
1
|
+
type ToString<T> = T extends string | number ? `${T}` : never;
|
|
2
|
+
type PathImpl<T, Key extends keyof T> = Key extends string | number ? T[Key] extends Record<string, any> ? T[Key] extends ArrayLike<any> ? ToString<Key> | `${ToString<Key>}.${PathImpl<T[Key], Exclude<keyof T[Key], keyof any[]>>}` : ToString<Key> | `${ToString<Key>}.${PathImpl<T[Key], keyof T[Key]>}` : ToString<Key> : never;
|
|
3
|
+
type Path<T> = PathImpl<T, keyof T> | keyof T;
|
|
4
|
+
type PathValue<T, P> = P extends keyof T ? T[P] : P extends `${infer K}.${infer Rest}` ? K extends keyof T ? PathValue<T[K], Rest> : {
|
|
5
|
+
[Key in keyof T]: ToString<Key> extends K ? PathValue<T[Key], Rest> : never;
|
|
6
|
+
}[keyof T] : never;
|
|
7
|
+
declare class Config<C extends {
|
|
8
|
+
[key: string]: any;
|
|
9
|
+
}> {
|
|
2
10
|
#private;
|
|
3
11
|
/**
|
|
4
12
|
* @param name 插件名称:配置名称
|
|
5
13
|
*/
|
|
6
|
-
constructor(name: `${string}:${string}`, ConfigDir: string, DefaultConfig: C, DefineConfig:
|
|
14
|
+
constructor(name: `${string}:${string}`, ConfigDir: string, DefaultConfig: C, DefineConfig: {
|
|
15
|
+
[key: string]: any;
|
|
16
|
+
});
|
|
7
17
|
loadConfig(): C;
|
|
8
18
|
mergeWithDefaults(userConfig: C, defaultConfig: C, DefineConfig: Record<string, any>): C;
|
|
9
19
|
/**
|
|
10
20
|
* @description 获取配置路径对应的默认配置
|
|
21
|
+
* @param path 配置路径,支持任意深度的嵌套路径,传入空字符串''可获取整个配置对象
|
|
11
22
|
*/
|
|
12
|
-
getDef
|
|
23
|
+
getDef(path: ''): C;
|
|
24
|
+
getDef<P extends Path<C>>(path: P): PathValue<C, P>;
|
|
13
25
|
/**
|
|
14
26
|
* @description 获取配置路径对应的配置
|
|
27
|
+
* @param path 配置路径,支持任意深度的嵌套路径,传入空字符串''可获取整个配置对象
|
|
28
|
+
* @param isArray 是否返回 EnhancedArray 类型
|
|
29
|
+
* @param def 默认值
|
|
15
30
|
*/
|
|
16
|
-
get
|
|
17
|
-
get<
|
|
31
|
+
get(path: '', isArray?: false, def?: C): C;
|
|
32
|
+
get<P extends Path<C>>(path: P, isArray?: false, def?: PathValue<C, P>): PathValue<C, P>;
|
|
33
|
+
get<P extends Path<C>, T = PathValue<C, P>>(path: P, isArray: true, def?: T[]): EnhancedArray<T extends any[] ? T[number] : T, C>;
|
|
18
34
|
/**
|
|
35
|
+
* @description 设置配置项的值
|
|
36
|
+
* @param path 配置路径,支持任意深度的嵌套路径
|
|
37
|
+
* @param value 要设置的值,类型会根据路径自动推断
|
|
19
38
|
* @param save 是否立即保存
|
|
20
39
|
*/
|
|
21
|
-
set
|
|
40
|
+
set(path: '', value: C, save: boolean): void;
|
|
41
|
+
set<P extends Path<C>>(path: P, value: PathValue<C, P>, save: boolean): void;
|
|
22
42
|
/**
|
|
23
43
|
* @description 立即保存配置
|
|
24
44
|
*/
|
|
@@ -26,9 +46,11 @@ declare class Config<C extends Record<string, any>> {
|
|
|
26
46
|
watch(fnc?: (self: Config<C>, oldData: C, newData: C) => Promise<void> | void): this;
|
|
27
47
|
}
|
|
28
48
|
|
|
29
|
-
declare class EnhancedArray<T
|
|
49
|
+
declare class EnhancedArray<T, C extends {
|
|
50
|
+
[key: string]: any;
|
|
51
|
+
}> extends Array<T> {
|
|
30
52
|
#private;
|
|
31
|
-
constructor(cfg: Config<
|
|
53
|
+
constructor(cfg: Config<C>, items: T[], path: string);
|
|
32
54
|
/**
|
|
33
55
|
* @param element - string | number
|
|
34
56
|
* @returns
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import { D as DatabaseType, a as DatabaseClassInstance, b as Dialect, c as DatabaseClassStatic, M as ModelAttributes, d as DatabaseReturn, e as
|
|
2
|
-
export {
|
|
1
|
+
import { D as DatabaseType, a as DatabaseClassInstance, b as Dialect, c as DatabaseClassStatic, M as ModelAttributes, d as DatabaseReturn, e as MysDeviceInfoTableType, B as BaseUserInfoTableType, f as BaseGameUIDInfoTableType } from '../../mysUserInfo-CPIjniyl.js';
|
|
2
|
+
export { j as BindUidsItemType, g as DatabaseArray, h as MysDeviceInfoDatabaseBaseType, i as MysDeviceInfoDatabaseIdFpType, U as UidPermission } from '../../mysUserInfo-CPIjniyl.js';
|
|
3
3
|
import { DataTypes, ModelAttributeColumnOptions, Model, ModelStatic } from 'sequelize';
|
|
4
|
+
import { a as MysAccountInfoTableType } from '../../mysAccountInfo-B7u5Sl8f.js';
|
|
5
|
+
export { M as MysAccountType } from '../../mysAccountInfo-B7u5Sl8f.js';
|
|
4
6
|
|
|
5
7
|
type DatabaseFn = <T extends Record<string, any>, D extends DatabaseType>() => DatabaseClassInstance<T, D>;
|
|
6
8
|
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { M as MysAccountType, a as MysAccountInfoTableType } from '../../mysAccountInfo-B7u5Sl8f.js';
|
|
2
2
|
import { SendMessage } from 'node-karin';
|
|
3
3
|
import { AxiosRequestConfig, AxiosResponse } from 'node-karin/axios';
|
|
4
|
+
import { h as MysDeviceInfoDatabaseBaseType, i as MysDeviceInfoDatabaseIdFpType, e as MysDeviceInfoTableType, B as BaseUserInfoTableType, d as DatabaseReturn, D as DatabaseType, g as DatabaseArray, U as UidPermission, f as BaseGameUIDInfoTableType } from '../../mysUserInfo-CPIjniyl.js';
|
|
4
5
|
import 'sequelize';
|
|
5
6
|
|
|
6
7
|
declare const MysApp: Readonly<{
|
package/lib/exports/mys/index.js
CHANGED
|
@@ -15,11 +15,11 @@ import {
|
|
|
15
15
|
getUserFullInfo,
|
|
16
16
|
getUserGameRolesByCookie,
|
|
17
17
|
queryQRcode
|
|
18
|
-
} from "../../chunk-
|
|
19
|
-
import "../../chunk-ER4WMJJ6.js";
|
|
18
|
+
} from "../../chunk-32QZ2PSX.js";
|
|
20
19
|
import "../../chunk-5LRGHP36.js";
|
|
21
|
-
import "../../chunk-
|
|
22
|
-
import "../../chunk-
|
|
20
|
+
import "../../chunk-HI6OZTI2.js";
|
|
21
|
+
import "../../chunk-BLE3V6QR.js";
|
|
22
|
+
import "../../chunk-ER4WMJJ6.js";
|
|
23
23
|
import "../../chunk-RX4VMVAI.js";
|
|
24
24
|
import "../../chunk-SHLPPEAY.js";
|
|
25
25
|
import "../../chunk-MLKGABMK.js";
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
declare const enum MysAccountType {
|
|
2
|
+
cn = "mihoyo",
|
|
3
|
+
os = "hoyolab"
|
|
4
|
+
}
|
|
5
|
+
interface MysAccountInfoTableType {
|
|
6
|
+
ltuid: string;
|
|
7
|
+
type: MysAccountType;
|
|
8
|
+
cookie: string;
|
|
9
|
+
stoken: string;
|
|
10
|
+
/** 绑定的设备md5 */
|
|
11
|
+
deviceMd5: string;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { MysAccountType as M, type MysAccountInfoTableType as a };
|
|
@@ -122,19 +122,6 @@ declare class DatabaseArray<T> extends Array<T> {
|
|
|
122
122
|
clear(): this;
|
|
123
123
|
}
|
|
124
124
|
|
|
125
|
-
declare const enum MysAccountType {
|
|
126
|
-
cn = "mihoyo",
|
|
127
|
-
os = "hoyolab"
|
|
128
|
-
}
|
|
129
|
-
interface MysAccountInfoTableType {
|
|
130
|
-
ltuid: string;
|
|
131
|
-
type: MysAccountType;
|
|
132
|
-
cookie: string;
|
|
133
|
-
stoken: string;
|
|
134
|
-
/** 绑定的设备md5 */
|
|
135
|
-
deviceMd5: string;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
125
|
interface MysDeviceInfoDatabaseBaseType {
|
|
139
126
|
name: string;
|
|
140
127
|
board: string;
|
|
@@ -181,4 +168,4 @@ type BaseGameUIDInfoTableType<Game extends string> = {
|
|
|
181
168
|
[P in `${Game}-uids`]: Partial<Record<string, BindUidsItemType>>;
|
|
182
169
|
};
|
|
183
170
|
|
|
184
|
-
export { type BaseUserInfoTableType as B, DatabaseType as D, type ModelAttributes as M, UidPermission as U, type DatabaseClassInstance as a, Dialect as b, type DatabaseClassStatic as c, type DatabaseReturn as d, type
|
|
171
|
+
export { type BaseUserInfoTableType as B, DatabaseType as D, type ModelAttributes as M, UidPermission as U, type DatabaseClassInstance as a, Dialect as b, type DatabaseClassStatic as c, type DatabaseReturn as d, type MysDeviceInfoTableType as e, type BaseGameUIDInfoTableType as f, DatabaseArray as g, type MysDeviceInfoDatabaseBaseType as h, type MysDeviceInfoDatabaseIdFpType as i, type BindUidsItemType as j };
|
package/lib/web.config.js
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
CoreCfg,
|
|
3
3
|
DeviceCfg
|
|
4
|
-
} from "./chunk-
|
|
5
|
-
import "./chunk-
|
|
4
|
+
} from "./chunk-HI6OZTI2.js";
|
|
5
|
+
import "./chunk-BLE3V6QR.js";
|
|
6
|
+
import "./chunk-ER4WMJJ6.js";
|
|
6
7
|
import "./chunk-RX4VMVAI.js";
|
|
7
8
|
import {
|
|
8
9
|
dir
|
|
@@ -42,13 +43,17 @@ var web_config_default = defineConfig({
|
|
|
42
43
|
components.accordion.create("accordion-config-key" /* Config */, {
|
|
43
44
|
label: "\u57FA\u7840\u8BBE\u7F6E",
|
|
44
45
|
children: [
|
|
45
|
-
components.accordion.createItem("accordion-
|
|
46
|
-
title: "
|
|
47
|
-
subtitle: "\u7528\u4E8E\u4E0B\u8F7D\u63D2\u4EF6\u8D44\u6E90",
|
|
46
|
+
components.accordion.createItem("accordion-proxy-item-key", {
|
|
47
|
+
title: "\u4EE3\u7406\u8BBE\u7F6E",
|
|
48
|
+
subtitle: "\u7528\u4E8E\u4E0B\u8F7D\u63D2\u4EF6\u8D44\u6E90\u6216api\u8BF7\u6C42",
|
|
48
49
|
children: [
|
|
49
|
-
components.input.url("
|
|
50
|
+
components.input.url("proxy-github", {
|
|
50
51
|
label: "GitHub \u4EE3\u7406\u5730\u5740",
|
|
51
|
-
defaultValue: CoreCfg.get("
|
|
52
|
+
defaultValue: CoreCfg.get("proxy.github")
|
|
53
|
+
}),
|
|
54
|
+
components.input.url(`proxy-${"hoyolab" /* os */}`, {
|
|
55
|
+
label: "Hoyolab \u7C73\u6E38\u793E API \u4EE3\u7406",
|
|
56
|
+
defaultValue: CoreCfg.get(`proxy.${"hoyolab" /* os */}`)
|
|
52
57
|
})
|
|
53
58
|
]
|
|
54
59
|
})
|
|
@@ -111,7 +116,15 @@ var web_config_default = defineConfig({
|
|
|
111
116
|
try {
|
|
112
117
|
lodash.forEach(changeConfig, (childrenValue, accordionKey) => {
|
|
113
118
|
switch (accordionKey) {
|
|
114
|
-
case "accordion-config-key" /* Config */:
|
|
119
|
+
case "accordion-config-key" /* Config */: {
|
|
120
|
+
childrenValue.forEach((children) => {
|
|
121
|
+
lodash.forEach(children, (value, childrenKey) => {
|
|
122
|
+
const { key, value: formatValue } = FormatValue(childrenKey, value);
|
|
123
|
+
CfgMap[accordionKey].set(key, formatValue, false);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
break;
|
|
127
|
+
}
|
|
115
128
|
case "accordion-device-key" /* Device */: {
|
|
116
129
|
childrenValue.forEach((children) => {
|
|
117
130
|
lodash.forEach(children, (value, childrenKey) => {
|
package/package.json
CHANGED