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.
- package/lib/apps/MiHoYoLogin.js +25 -27
- package/lib/apps/MysDevice.js +18 -18
- package/lib/apps/UIDManage.js +21 -21
- package/lib/{chunk-BWFWWHCT.js → chunk-2BVJS5VE.js} +7 -4
- package/lib/{chunk-BH4S574A.js → chunk-2WGBVGJM.js} +1 -1
- package/lib/{chunk-Y3J3J5B2.js → chunk-3JN5WYUN.js} +31 -20
- package/lib/{chunk-BNSHDFFN.js → chunk-3R37ZEXD.js} +5 -5
- package/lib/chunk-5DXIT7UB.js +88 -0
- package/lib/{chunk-NUOK4VFP.js → chunk-CD2J42HG.js} +7 -2
- package/lib/{chunk-DJTJKSNN.js → chunk-CZD74R2W.js} +26 -19
- package/lib/{chunk-G547WVGV.js → chunk-DMJ5OQR6.js} +1 -1
- package/lib/{chunk-7ZQQ76WC.js → chunk-EDNBKOMS.js} +4 -4
- package/lib/{chunk-EAVXU4Q2.js → chunk-G7TMVDGP.js} +17 -6
- package/lib/{chunk-HTH25YE2.js → chunk-HJ6HX5HB.js} +4 -4
- package/lib/chunk-JT3SU5UU.js +52 -0
- package/lib/{chunk-EMAUATE3.js → chunk-MPZP23EX.js} +5 -3
- package/lib/chunk-OYGNSYOG.js +109 -0
- package/lib/{chunk-6PIXUPZ6.js → chunk-PMFOX5HA.js} +14 -16
- package/lib/{chunk-CZZETPLY.js → chunk-UTTUUWA4.js} +19 -62
- package/lib/common-BlI5Gsw_.d.ts +35 -0
- package/lib/exports/config/array.d.ts +1 -1
- package/lib/exports/config/array.js +1 -1
- package/lib/exports/config/config.d.ts +56 -1
- package/lib/exports/config/config.js +6 -2
- package/lib/exports/config/index.d.ts +1 -2
- package/lib/exports/config/index.js +7 -5
- package/lib/exports/database/database.js +7 -3
- package/lib/exports/database/dbs/base.d.ts +5 -3
- package/lib/exports/database/dbs/base.js +5 -1
- package/lib/exports/database/dbs/index.d.ts +1 -1
- package/lib/exports/database/dbs/index.js +12 -6
- package/lib/exports/database/dbs/sqlite3.d.ts +7 -3
- package/lib/exports/database/dbs/sqlite3.js +6 -2
- package/lib/exports/database/dbs/table.d.ts +12 -8
- package/lib/exports/database/dbs/table.js +12 -6
- package/lib/exports/database/index.d.ts +2 -2
- package/lib/exports/database/index.js +18 -14
- package/lib/exports/database/tables/index.js +14 -12
- package/lib/exports/database/tables/mysAccountInfo.d.ts +1 -1
- package/lib/exports/database/tables/mysAccountInfo.js +9 -5
- package/lib/exports/database/tables/mysDeviceInfo.d.ts +1 -1
- package/lib/exports/database/tables/mysDeviceInfo.js +9 -7
- package/lib/exports/database/tables/mysUserInfo.d.ts +1 -1
- package/lib/exports/database/tables/mysUserInfo.js +9 -5
- package/lib/exports/database/types/dbs/base.d.ts +17 -6
- package/lib/exports/database/types/index.d.ts +1 -1
- package/lib/exports/database/types/tables/index.d.ts +1 -1
- package/lib/exports/database/types/tables/mysUserInfo.d.ts +6 -5
- package/lib/exports/mys/api/apis.js +18 -18
- package/lib/exports/mys/api/app.js +11 -9
- package/lib/exports/mys/api/define.js +18 -18
- package/lib/exports/mys/api/index.js +21 -21
- package/lib/exports/mys/index.js +24 -24
- package/lib/exports/mys/user/deviceInfo.js +12 -10
- package/lib/exports/mys/user/game.d.ts +12 -5
- package/lib/exports/mys/user/game.js +1 -1
- package/lib/exports/mys/user/index.d.ts +3 -3
- package/lib/exports/mys/user/index.js +21 -21
- package/lib/exports/mys/user/userInfo.js +18 -18
- package/lib/exports/render/index.d.ts +15 -1
- package/lib/exports/render/index.js +9 -4
- package/lib/exports/render/render.js +6 -3
- package/lib/exports/utils/common.d.ts +1 -33
- package/lib/exports/utils/common.js +3 -1
- package/lib/exports/utils/index.d.ts +2 -1
- package/lib/exports/utils/index.js +4 -2
- package/lib/exports/{config/types/config.d.ts → utils/types/common.d.ts} +3 -4
- package/lib/exports/utils/types/common.js +1 -0
- package/lib/exports/utils/types/index.d.ts +1 -0
- package/lib/exports/utils/types/index.js +2 -0
- package/package.json +1 -1
- package/resources/styles/karin-plugin-mys-core.css +10 -131
- package/lib/array-CCexQ14j.d.ts +0 -62
- package/lib/chunk-BXA3VAQC.js +0 -131
- package/lib/chunk-LG34FPBI.js +0 -50
- package/lib/chunk-UX2BDLJF.js +0 -6
- package/lib/exports/config/types/config.js +0 -1
- package/lib/exports/config/types/index.d.ts +0 -1
- package/lib/exports/config/types/index.js +0 -2
- /package/lib/{chunk-2DHTKQ34.js → chunk-3ERB3ILC.js} +0 -0
- /package/lib/{chunk-7SZX3RBZ.js → chunk-ARLTXJFJ.js} +0 -0
- /package/lib/{chunk-UC6INRYV.js → chunk-PYTECG57.js} +0 -0
- /package/lib/{chunk-XQWTJIT4.js → chunk-T7W4DXRM.js} +0 -0
|
@@ -554,40 +554,6 @@ video {
|
|
|
554
554
|
display: none;
|
|
555
555
|
}
|
|
556
556
|
|
|
557
|
-
.container {
|
|
558
|
-
width: 100%;
|
|
559
|
-
}
|
|
560
|
-
|
|
561
|
-
@media (min-width: 640px) {
|
|
562
|
-
.container {
|
|
563
|
-
max-width: 640px;
|
|
564
|
-
}
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
@media (min-width: 768px) {
|
|
568
|
-
.container {
|
|
569
|
-
max-width: 768px;
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
@media (min-width: 1024px) {
|
|
574
|
-
.container {
|
|
575
|
-
max-width: 1024px;
|
|
576
|
-
}
|
|
577
|
-
}
|
|
578
|
-
|
|
579
|
-
@media (min-width: 1280px) {
|
|
580
|
-
.container {
|
|
581
|
-
max-width: 1280px;
|
|
582
|
-
}
|
|
583
|
-
}
|
|
584
|
-
|
|
585
|
-
@media (min-width: 1536px) {
|
|
586
|
-
.container {
|
|
587
|
-
max-width: 1536px;
|
|
588
|
-
}
|
|
589
|
-
}
|
|
590
|
-
|
|
591
557
|
.absolute {
|
|
592
558
|
position: absolute;
|
|
593
559
|
}
|
|
@@ -600,14 +566,6 @@ video {
|
|
|
600
566
|
top: -0.625rem;
|
|
601
567
|
}
|
|
602
568
|
|
|
603
|
-
.bottom-0 {
|
|
604
|
-
bottom: 0px;
|
|
605
|
-
}
|
|
606
|
-
|
|
607
|
-
.left-0 {
|
|
608
|
-
left: 0px;
|
|
609
|
-
}
|
|
610
|
-
|
|
611
569
|
.right-0 {
|
|
612
570
|
right: 0px;
|
|
613
571
|
}
|
|
@@ -641,14 +599,6 @@ video {
|
|
|
641
599
|
height: 2.5rem;
|
|
642
600
|
}
|
|
643
601
|
|
|
644
|
-
.h-6 {
|
|
645
|
-
height: 1.5rem;
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
.h-8 {
|
|
649
|
-
height: 2rem;
|
|
650
|
-
}
|
|
651
|
-
|
|
652
602
|
.h-\[72px\] {
|
|
653
603
|
height: 72px;
|
|
654
604
|
}
|
|
@@ -657,26 +607,10 @@ video {
|
|
|
657
607
|
width: 2.5rem;
|
|
658
608
|
}
|
|
659
609
|
|
|
660
|
-
.w-6 {
|
|
661
|
-
width: 1.5rem;
|
|
662
|
-
}
|
|
663
|
-
|
|
664
610
|
.w-\[150px\] {
|
|
665
611
|
width: 150px;
|
|
666
612
|
}
|
|
667
613
|
|
|
668
|
-
.w-\[600px\] {
|
|
669
|
-
width: 600px;
|
|
670
|
-
}
|
|
671
|
-
|
|
672
|
-
.w-full {
|
|
673
|
-
width: 100%;
|
|
674
|
-
}
|
|
675
|
-
|
|
676
|
-
.w-px {
|
|
677
|
-
width: 1px;
|
|
678
|
-
}
|
|
679
|
-
|
|
680
614
|
.min-w-0 {
|
|
681
615
|
min-width: 0px;
|
|
682
616
|
}
|
|
@@ -701,10 +635,6 @@ video {
|
|
|
701
635
|
align-items: center;
|
|
702
636
|
}
|
|
703
637
|
|
|
704
|
-
.items-baseline {
|
|
705
|
-
align-items: baseline;
|
|
706
|
-
}
|
|
707
|
-
|
|
708
638
|
.justify-center {
|
|
709
639
|
justify-content: center;
|
|
710
640
|
}
|
|
@@ -713,10 +643,6 @@ video {
|
|
|
713
643
|
justify-content: space-between;
|
|
714
644
|
}
|
|
715
645
|
|
|
716
|
-
.gap-0\.5 {
|
|
717
|
-
gap: 0.125rem;
|
|
718
|
-
}
|
|
719
|
-
|
|
720
646
|
.gap-1\.5 {
|
|
721
647
|
gap: 0.375rem;
|
|
722
648
|
}
|
|
@@ -733,10 +659,6 @@ video {
|
|
|
733
659
|
gap: 0.75rem;
|
|
734
660
|
}
|
|
735
661
|
|
|
736
|
-
.gap-4 {
|
|
737
|
-
gap: 1rem;
|
|
738
|
-
}
|
|
739
|
-
|
|
740
662
|
.overflow-visible {
|
|
741
663
|
overflow: visible;
|
|
742
664
|
}
|
|
@@ -765,10 +687,6 @@ video {
|
|
|
765
687
|
border-radius: 0.375rem;
|
|
766
688
|
}
|
|
767
689
|
|
|
768
|
-
.rounded-sm {
|
|
769
|
-
border-radius: 0.125rem;
|
|
770
|
-
}
|
|
771
|
-
|
|
772
690
|
.rounded-xl {
|
|
773
691
|
border-radius: 0.75rem;
|
|
774
692
|
}
|
|
@@ -790,11 +708,6 @@ video {
|
|
|
790
708
|
background-color: rgb(0 0 0 / 0.06);
|
|
791
709
|
}
|
|
792
710
|
|
|
793
|
-
.bg-gray-600 {
|
|
794
|
-
--tw-bg-opacity: 1;
|
|
795
|
-
background-color: rgb(75 85 99 / var(--tw-bg-opacity, 1));
|
|
796
|
-
}
|
|
797
|
-
|
|
798
711
|
.bg-white {
|
|
799
712
|
--tw-bg-opacity: 1;
|
|
800
713
|
background-color: rgb(255 255 255 / var(--tw-bg-opacity, 1));
|
|
@@ -859,11 +772,6 @@ video {
|
|
|
859
772
|
padding-right: 0.5rem;
|
|
860
773
|
}
|
|
861
774
|
|
|
862
|
-
.px-4 {
|
|
863
|
-
padding-left: 1rem;
|
|
864
|
-
padding-right: 1rem;
|
|
865
|
-
}
|
|
866
|
-
|
|
867
775
|
.px-5 {
|
|
868
776
|
padding-left: 1.25rem;
|
|
869
777
|
padding-right: 1.25rem;
|
|
@@ -884,20 +792,11 @@ video {
|
|
|
884
792
|
padding-bottom: 0.375rem;
|
|
885
793
|
}
|
|
886
794
|
|
|
887
|
-
.py-2\.5 {
|
|
888
|
-
padding-top: 0.625rem;
|
|
889
|
-
padding-bottom: 0.625rem;
|
|
890
|
-
}
|
|
891
|
-
|
|
892
795
|
.py-5 {
|
|
893
796
|
padding-top: 1.25rem;
|
|
894
797
|
padding-bottom: 1.25rem;
|
|
895
798
|
}
|
|
896
799
|
|
|
897
|
-
.pb-10 {
|
|
898
|
-
padding-bottom: 2.5rem;
|
|
899
|
-
}
|
|
900
|
-
|
|
901
800
|
.pb-9 {
|
|
902
801
|
padding-bottom: 2.25rem;
|
|
903
802
|
}
|
|
@@ -914,22 +813,10 @@ video {
|
|
|
914
813
|
text-align: center;
|
|
915
814
|
}
|
|
916
815
|
|
|
917
|
-
.font-\[HYWenHei-55W\] {
|
|
918
|
-
font-family: HYWenHei-55W;
|
|
919
|
-
}
|
|
920
|
-
|
|
921
|
-
.text-\[10px\] {
|
|
922
|
-
font-size: 10px;
|
|
923
|
-
}
|
|
924
|
-
|
|
925
816
|
.text-\[13px\] {
|
|
926
817
|
font-size: 13px;
|
|
927
818
|
}
|
|
928
819
|
|
|
929
|
-
.text-\[5px\] {
|
|
930
|
-
font-size: 5px;
|
|
931
|
-
}
|
|
932
|
-
|
|
933
820
|
.text-sm {
|
|
934
821
|
font-size: 0.875rem;
|
|
935
822
|
line-height: 1.25rem;
|
|
@@ -940,18 +827,10 @@ video {
|
|
|
940
827
|
line-height: 1rem;
|
|
941
828
|
}
|
|
942
829
|
|
|
943
|
-
.font-bold {
|
|
944
|
-
font-weight: 700;
|
|
945
|
-
}
|
|
946
|
-
|
|
947
830
|
.font-semibold {
|
|
948
831
|
font-weight: 600;
|
|
949
832
|
}
|
|
950
833
|
|
|
951
|
-
.leading-none {
|
|
952
|
-
line-height: 1;
|
|
953
|
-
}
|
|
954
|
-
|
|
955
834
|
.text-\[\#111\] {
|
|
956
835
|
--tw-text-opacity: 1;
|
|
957
836
|
color: rgb(17 17 17 / var(--tw-text-opacity, 1));
|
|
@@ -972,16 +851,6 @@ video {
|
|
|
972
851
|
color: rgb(107 107 107 / var(--tw-text-opacity, 1));
|
|
973
852
|
}
|
|
974
853
|
|
|
975
|
-
.text-\[\#f2c06f\] {
|
|
976
|
-
--tw-text-opacity: 1;
|
|
977
|
-
color: rgb(242 192 111 / var(--tw-text-opacity, 1));
|
|
978
|
-
}
|
|
979
|
-
|
|
980
|
-
.text-black {
|
|
981
|
-
--tw-text-opacity: 1;
|
|
982
|
-
color: rgb(0 0 0 / var(--tw-text-opacity, 1));
|
|
983
|
-
}
|
|
984
|
-
|
|
985
854
|
.text-black\/60 {
|
|
986
855
|
color: rgb(0 0 0 / 0.6);
|
|
987
856
|
}
|
|
@@ -1011,6 +880,16 @@ video {
|
|
|
1011
880
|
box-shadow: var(--tw-ring-offset-shadow, 0 0 #0000), var(--tw-ring-shadow, 0 0 #0000), var(--tw-shadow);
|
|
1012
881
|
}
|
|
1013
882
|
|
|
883
|
+
@font-face {
|
|
884
|
+
font-family: 'HYWenHei-55W';
|
|
885
|
+
|
|
886
|
+
src: url('../../resources/fonts/HYWenHei-55W.ttf') format('truetype');
|
|
887
|
+
|
|
888
|
+
font-weight: normal;
|
|
889
|
+
|
|
890
|
+
font-style: normal;
|
|
891
|
+
}
|
|
892
|
+
|
|
1014
893
|
.before\:absolute::before {
|
|
1015
894
|
content: var(--tw-content);
|
|
1016
895
|
position: absolute;
|
package/lib/array-CCexQ14j.d.ts
DELETED
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
declare class Config<C extends Record<string, any>> {
|
|
2
|
-
#private;
|
|
3
|
-
/**
|
|
4
|
-
* @param name 插件名称:配置名称
|
|
5
|
-
*/
|
|
6
|
-
constructor(name: `${string}:${string}`, ConfigPath: string, DefaultConfig: C, DefineConfig: Record<string, any>);
|
|
7
|
-
loadConfig(): C;
|
|
8
|
-
mergeWithDefaults(userConfig: Record<string, any>, defaultConfig: Record<string, any>, IgnoreConfig: 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
|
-
/**
|
|
48
|
-
* @param predicate - 要删除的元素、删除条件函数或索引
|
|
49
|
-
* @param save - 是否立即保存
|
|
50
|
-
* @param isIndex - 当 predicate 为数字时,是否将其视为索引
|
|
51
|
-
*/
|
|
52
|
-
remove(predicate: T & number, save: boolean, isIndex: true): this;
|
|
53
|
-
remove(predicate: T | ((item: T) => boolean), save: boolean): this;
|
|
54
|
-
/**
|
|
55
|
-
* @param predicate - 要删除的元素数组
|
|
56
|
-
* @param save - 是否立即保存
|
|
57
|
-
*/
|
|
58
|
-
removeSome(elements: T[], save: boolean): this;
|
|
59
|
-
clear(): this;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
export { Config as C, EnhancedArray as E };
|
package/lib/chunk-BXA3VAQC.js
DELETED
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
EnhancedArray
|
|
3
|
-
} from "./chunk-6PIXUPZ6.js";
|
|
4
|
-
|
|
5
|
-
// src/exports/config/config.ts
|
|
6
|
-
import { existsSync, logger, requireFileSync, watch, writeJsonSync } from "node-karin";
|
|
7
|
-
import lodash from "node-karin/lodash";
|
|
8
|
-
var Config = class {
|
|
9
|
-
#cfgName;
|
|
10
|
-
/**
|
|
11
|
-
* @description 配置缓存
|
|
12
|
-
*/
|
|
13
|
-
#ConfigCache = null;
|
|
14
|
-
/**
|
|
15
|
-
* @description 默认配置
|
|
16
|
-
*/
|
|
17
|
-
#DefaultConfig;
|
|
18
|
-
#DefineConfig;
|
|
19
|
-
/**
|
|
20
|
-
* @description 配置保存路径
|
|
21
|
-
*/
|
|
22
|
-
#ConfigPath;
|
|
23
|
-
/**
|
|
24
|
-
* @param name 插件名称:配置名称
|
|
25
|
-
*/
|
|
26
|
-
constructor(name, ConfigPath, DefaultConfig, DefineConfig) {
|
|
27
|
-
this.#cfgName = name;
|
|
28
|
-
this.#ConfigPath = ConfigPath;
|
|
29
|
-
this.#DefaultConfig = DefaultConfig;
|
|
30
|
-
this.#DefineConfig = DefineConfig;
|
|
31
|
-
!existsSync(ConfigPath) && writeJsonSync(ConfigPath, DefaultConfig);
|
|
32
|
-
this.loadConfig();
|
|
33
|
-
}
|
|
34
|
-
loadConfig() {
|
|
35
|
-
const config = requireFileSync(this.#ConfigPath);
|
|
36
|
-
const mergedConfig = this.mergeWithDefaults(config, this.#DefaultConfig, this.#DefineConfig);
|
|
37
|
-
this.#ConfigCache = mergedConfig;
|
|
38
|
-
return mergedConfig;
|
|
39
|
-
}
|
|
40
|
-
mergeWithDefaults(userConfig, defaultConfig, IgnoreConfig) {
|
|
41
|
-
const filterUserConfig = (user, defaults, Ignore) => {
|
|
42
|
-
if (Array.isArray(user) && Array.isArray(defaults)) {
|
|
43
|
-
if (Ignore?.defaultConfigItem) {
|
|
44
|
-
const filtered = [];
|
|
45
|
-
const required = Ignore.defaultConfigItem.required;
|
|
46
|
-
user.forEach((value, key) => {
|
|
47
|
-
if (required && lodash.isPlainObject(value)) {
|
|
48
|
-
const hasAllRequired = required.every((requiredKey) => requiredKey in value && value[requiredKey] !== void 0 && value[requiredKey] !== null && value[requiredKey] !== "");
|
|
49
|
-
if (!hasAllRequired) return;
|
|
50
|
-
}
|
|
51
|
-
filtered[key] = filterUserConfig(value, Ignore.defaultConfigItem.defaultConfig, Ignore.defaultConfigItem.defaultConfig);
|
|
52
|
-
});
|
|
53
|
-
return filtered;
|
|
54
|
-
}
|
|
55
|
-
return user;
|
|
56
|
-
} else if (lodash.isPlainObject(user) && lodash.isPlainObject(defaults)) {
|
|
57
|
-
const filtered = {};
|
|
58
|
-
const mergedValue = lodash.merge({}, defaults, user);
|
|
59
|
-
if (Ignore?.defaultConfig) {
|
|
60
|
-
lodash.forEach(user, (value, key) => {
|
|
61
|
-
const mergedValue2 = lodash.merge(Array.isArray(value) ? [] : {}, Ignore.defaultConfig, value);
|
|
62
|
-
filtered[key] = filterUserConfig(mergedValue2, Ignore.defaultConfig, Array.isArray(value) ? Ignore : Ignore[key]);
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
lodash.forEach(defaults, (value, key) => {
|
|
66
|
-
filtered[key] = filterUserConfig(mergedValue[key], value, Ignore?.[key]);
|
|
67
|
-
});
|
|
68
|
-
return filtered;
|
|
69
|
-
}
|
|
70
|
-
return user;
|
|
71
|
-
};
|
|
72
|
-
const filteredUserConfig = filterUserConfig(userConfig, defaultConfig, IgnoreConfig);
|
|
73
|
-
const result = lodash.merge({}, defaultConfig, filteredUserConfig);
|
|
74
|
-
if (!lodash.isEqual(result, userConfig)) {
|
|
75
|
-
try {
|
|
76
|
-
writeJsonSync(this.#ConfigPath, result);
|
|
77
|
-
} catch (err) {
|
|
78
|
-
logger.error(err);
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return result;
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* @description 获取配置路径对应的默认配置
|
|
85
|
-
*/
|
|
86
|
-
getDef(path) {
|
|
87
|
-
const defConfig = JSON.parse(JSON.stringify(this.#DefaultConfig));
|
|
88
|
-
return lodash.get(defConfig, path);
|
|
89
|
-
}
|
|
90
|
-
get(path, isArray = false, def) {
|
|
91
|
-
const conf = JSON.parse(JSON.stringify(this.#ConfigCache));
|
|
92
|
-
const result = path ? lodash.get(conf, path, def) : conf;
|
|
93
|
-
if (isArray) {
|
|
94
|
-
if (!Array.isArray(result)) {
|
|
95
|
-
logger.error(`\u914D\u7F6E\u8DEF\u5F84 ${path} \u4E0D\u662F\u6570\u7EC4\u7C7B\u578B`);
|
|
96
|
-
return new EnhancedArray(this, [], path);
|
|
97
|
-
}
|
|
98
|
-
return new EnhancedArray(this, result, path);
|
|
99
|
-
}
|
|
100
|
-
return result;
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* @param save 是否立即保存
|
|
104
|
-
*/
|
|
105
|
-
set(path, value, save) {
|
|
106
|
-
lodash.set(this.#ConfigCache, path, value);
|
|
107
|
-
save && this.save();
|
|
108
|
-
}
|
|
109
|
-
/**
|
|
110
|
-
* @description 立即保存配置
|
|
111
|
-
*/
|
|
112
|
-
save() {
|
|
113
|
-
try {
|
|
114
|
-
logger.debug(`[${this.#cfgName}] \u4FDD\u5B58\u914D\u7F6E`, this.#ConfigCache);
|
|
115
|
-
writeJsonSync(this.#ConfigPath, this.#ConfigCache);
|
|
116
|
-
} catch (err) {
|
|
117
|
-
logger.error(err);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
watch(fnc) {
|
|
121
|
-
watch(this.#ConfigPath, async (oldData, newData) => {
|
|
122
|
-
fnc && await fnc(this, oldData, newData);
|
|
123
|
-
this.loadConfig();
|
|
124
|
-
});
|
|
125
|
-
return this;
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
|
|
129
|
-
export {
|
|
130
|
-
Config
|
|
131
|
-
};
|
package/lib/chunk-LG34FPBI.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
__export
|
|
3
|
-
} from "./chunk-MLKGABMK.js";
|
|
4
|
-
|
|
5
|
-
// src/exports/utils/common.ts
|
|
6
|
-
var common_exports = {};
|
|
7
|
-
__export(common_exports, {
|
|
8
|
-
ObjToStr: () => ObjToStr,
|
|
9
|
-
StrToObj: () => StrToObj,
|
|
10
|
-
getDeviceGuid: () => getDeviceGuid,
|
|
11
|
-
randomString: () => randomString
|
|
12
|
-
});
|
|
13
|
-
import lodash from "node-karin/lodash";
|
|
14
|
-
var randomString = (length, type) => {
|
|
15
|
-
let str = "0123456789";
|
|
16
|
-
if (type === "Lower" || type === "All") {
|
|
17
|
-
str += "abcdefghijklmnopqrstuvwxyz";
|
|
18
|
-
}
|
|
19
|
-
if (type === "Upper" || type === "All") {
|
|
20
|
-
str += "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
21
|
-
}
|
|
22
|
-
return lodash.sampleSize(str, length).join("");
|
|
23
|
-
};
|
|
24
|
-
var getDeviceGuid = () => {
|
|
25
|
-
function S4() {
|
|
26
|
-
return ((1 + Math.random()) * 65536 | 0).toString(16).substring(1);
|
|
27
|
-
}
|
|
28
|
-
return S4() + S4() + "-" + S4() + "-" + S4() + "-" + S4() + "-" + S4() + S4() + S4();
|
|
29
|
-
};
|
|
30
|
-
var StrToObj = (Str, sep) => {
|
|
31
|
-
const strObj = {};
|
|
32
|
-
Str.split(sep).forEach((item) => {
|
|
33
|
-
const [key, value] = item.split("=");
|
|
34
|
-
if (key) {
|
|
35
|
-
strObj[key] = value || "";
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
return strObj;
|
|
39
|
-
};
|
|
40
|
-
var ObjToStr = (obj, sep) => {
|
|
41
|
-
return Object.entries(obj).filter(([k, v]) => v).map(([k, v]) => `${k}=${v}`).join(sep) + sep;
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
export {
|
|
45
|
-
randomString,
|
|
46
|
-
getDeviceGuid,
|
|
47
|
-
StrToObj,
|
|
48
|
-
ObjToStr,
|
|
49
|
-
common_exports
|
|
50
|
-
};
|
package/lib/chunk-UX2BDLJF.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import "../../../chunk-2DHTKQ34.js";
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { ConfigDefine, ConfigDefineArray } from './config.js';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|