forked from gkd-kit/inspect
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsrc.diff
More file actions
11991 lines (11932 loc) · 361 KB
/
src.diff
File metadata and controls
11991 lines (11932 loc) · 361 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
diff --git a/src/App.vue b/src/App.vue
index f49320a..26ff8ab 100644
--- a/src/App.vue
+++ b/src/App.vue
@@ -2,8 +2,10 @@
import { dateZhCN, zhCN, type GlobalThemeOverrides } from 'naive-ui';
import { RouterView } from 'vue-router';
import ErrorDlg from './components/ErrorDlg.vue';
+import DialogContainer from './components/DialogContainer.vue';
import { ScrollbarWrapper } from './utils/others';
import { debounce } from 'lodash-es';
+import { useTheme } from './composables/plus/useTheme';
const themeOverrides: GlobalThemeOverrides = {
common: {
@@ -19,16 +21,20 @@ const freeActiveElement = debounce(() => {
useEventListener('click', () => {
freeActiveElement();
});
+
+const { appTheme } = useTheme();
</script>
<template>
<NConfigProvider
abstract
:locale="zhCN"
:dateLocale="dateZhCN"
+ :theme="appTheme"
:themeOverrides="themeOverrides"
>
<ErrorDlg />
<RouterView />
+ <DialogContainer />
</NConfigProvider>
<ScrollbarWrapper />
</template>
diff --git a/src/assets/svg/CacheSub.svg b/src/assets/svg/CacheSub.svg
new file mode 100644
index 0000000..dd5ffab
--- /dev/null
+++ b/src/assets/svg/CacheSub.svg
@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1771832105264" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="70551" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M930.773333 366.08h49.066667v-142.506667c0-40.32-32.853333-73.386667-73.386667-73.386666H118.613333c-40.32 0-73.386667 32.853333-73.386666 73.386666v142.506667h49.066666c17.706667 0 32.64 12.8 33.493334 28.373333 0.426667 8.32-2.56 16.213333-8.106667 22.186667-5.76 5.973333-13.44 9.386667-21.76 9.386667H45.226667v373.546666c0 40.32 32.853333 73.386667 73.386666 73.386667h136.32v-153.386667h80.64v153.386667H906.666667c40.32 0 73.386667-32.853333 73.386666-73.386667V426.026667h-52.693333c-8.32 0-16-3.413333-21.76-9.386667s-8.533333-13.866667-8.106667-22.186667c0.64-15.573333 15.786667-28.373333 33.28-28.373333z m-71.68 94.72c15.146667 15.786667 35.2 26.026667 56.746667 28.586667v310.186666c0 5.12-4.266667 9.386667-9.386667 9.386667h-60.373333v-143.786667h-64v143.786667h-45.013333v-143.786667h-64v143.786667h-45.013334v-143.786667h-64v143.786667h-45.013333v-143.786667h-64v143.786667h-55.893333v-153.386667H190.933333v153.386667H118.613333c-5.12 0-9.386667-4.266667-9.386666-9.386667V489.386667c21.546667-2.56 41.813333-12.8 56.746666-28.586667 17.92-18.773333 27.093333-43.52 25.6-69.76-2.346667-45.013333-37.546667-81.28-82.56-87.893333v-79.573334c0-5.12 4.266667-9.386667 9.386667-9.386666H906.666667c5.12 0 9.386667 4.266667 9.386666 9.386666v79.573334c-45.013333 6.613333-80 42.88-82.56 87.893333a93.013333 93.013333 0 0 0 25.6 69.76z" p-id="70552"></path><path d="M261.12 499.2h501.76v-201.6H261.12v201.6z m64-137.6h373.76v73.6H325.12v-73.6z" p-id="70553"></path></svg>
\ No newline at end of file
diff --git a/src/assets/svg/Connect.svg b/src/assets/svg/Connect.svg
new file mode 100644
index 0000000..863ba2d
--- /dev/null
+++ b/src/assets/svg/Connect.svg
@@ -0,0 +1,6 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg t="1771792788434" class="icon" viewBox="0 0 1024 1024" version="1.1"
+ xmlns="http://www.w3.org/2000/svg" p-id="59843" data-darkreader-inline-fill=""
+ xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200">
+ <path d="M357.416807 548.994566l306.228473 0 0-76.54535-306.228473 0L357.416807 548.994566zM200.461079 510.692215c0-88.038102 68.861344-156.953681 156.955728-156.953681l114.842585 0 0-72.729441-114.842585 0c-126.337383 0-229.6821 103.34574-229.6821 229.683123 0 126.335337 103.344716 229.683123 229.6821 229.683123l114.842585 0 0-72.728418-114.842585 0C269.322423 667.647943 200.461079 598.678128 200.461079 510.692215M663.64528 281.009092l-114.842585 0 0 72.729441 114.842585 0c88.034009 0 156.898423 68.915579 156.898423 156.953681 0 87.98489-68.863391 156.954705-156.898423 156.954705l-114.842585 0 0 72.728418 114.842585 0c126.33636 0 229.683123-103.347786 229.683123-229.683123C893.32738 384.354831 789.98164 281.009092 663.64528 281.009092" p-id="59844"></path>
+</svg>
\ No newline at end of file
diff --git a/src/assets/svg/Down-all.svg b/src/assets/svg/Down-all.svg
new file mode 100644
index 0000000..aeb0c69
--- /dev/null
+++ b/src/assets/svg/Down-all.svg
@@ -0,0 +1 @@
+<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"><svg t="1771831800269" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4684" xmlns:xlink="http://www.w3.org/1999/xlink" width="200" height="200"><path d="M865.3 506.3V184.1c0-64.8-52.7-117.5-117.5-117.5H281c-64.8 0-117.5 52.7-117.5 117.5v322.2c-46.4 5.8-82.4 45.5-82.4 93.5v257.8c0 52 42.3 94.2 94.2 94.2h678.2c52 0 94.2-42.3 94.2-94.2V599.8c0-47.9-36-87.6-82.4-93.5zM233.5 184.1c0-26.2 21.3-47.5 47.5-47.5h466.8c26.2 0 47.5 21.3 47.5 47.5v321.5H669.9v87.6c0 3.3-2.7 6-6 6H365c-3.3 0-6-2.7-6-6v-87.6H233.5V184.1z m644.2 673.6c0 13.4-10.9 24.2-24.2 24.2H175.3c-13.4 0-24.2-10.9-24.2-24.2V599.8c0-13.4 10.9-24.2 24.2-24.2H289v17.6c0 41.9 34.1 76 76 76h298.8c41.9 0 76-34.1 76-76v-17.6h113.6c13.4 0 24.2 10.9 24.2 24.2v257.9z" p-id="4685"></path><path d="M513.2 520.3l140.6-140.6-49.5-49.5-57.3 57.4V194.5h-70v190.6l-54.9-54.9-49.5 49.5 91.1 91.1z" p-id="4686"></path></svg>
\ No newline at end of file
diff --git a/src/assets/svg/Exe-Sel.svg b/src/assets/svg/Exe-Sel.svg
new file mode 100644
index 0000000..af39eb5
--- /dev/null
+++ b/src/assets/svg/Exe-Sel.svg
@@ -0,0 +1,30 @@
+<?xml version="1.0" standalone="no"?>
+<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
+<svg viewBox="0 0 1024 1024" width="200" height="200"
+ xmlns="http://www.w3.org/2000/svg">
+
+ <!-- 主体 -->
+ <g fill="currentColor"
+ stroke="currentColor"
+ stroke-width="12.6"
+ stroke-linejoin="round"
+ stroke-linecap="round">
+
+ <path d="M723.1 482.1L443.6 320.6c-5.6-3.3-11.5-4.7-17.3-4.7-18.1 0-34.8 14.5-34.8 34.8v322.8c0 20.3 16.6 34.8 34.8 34.8 5.8 0 11.7-1.5 17.3-4.7l279.5-161.4c23.1-13.4 23.1-46.8 0-60.1zM431.5 664.2V359.8L695.2 512 431.5 664.2z"/>
+
+ <path d="M938.1 650.7C952.3 607 960 560.4 960 512c0-247.4-200.6-448-448-448S64 264.6 64 512s200.6 448 448 448c51.5 0 100.9-8.7 146.9-24.7 34.7 29 79.4 46.4 128.1 46.4 110.5 0 200-89.5 200-200 0-50-18.4-95.9-48.9-131zM512 916c-54.6 0-107.5-10.7-157.2-31.7-48.1-20.3-91.3-49.5-128.4-86.6s-66.3-80.3-86.6-128.4C118.7 619.5 108 566.6 108 512s10.7-107.5 31.7-157.2c20.3-48.1 49.5-91.3 86.6-128.4s80.3-66.3 128.4-86.6C404.5 118.7 457.4 108 512 108s107.5 10.7 157.2 31.7c48.1 20.3 91.3 49.5 128.4 86.6s66.3 80.3 86.6 128.4C905.3 404.5 916 457.4 916 512c0 36.3-4.7 71.8-14 106.1-32.5-22.9-72.1-36.3-114.9-36.3-110.5 0-200 89.5-200 200 0 44.1 14.3 84.9 38.5 118C588.9 910.6 550.9 916 512 916z m385.3-23.9c-29.5 29.5-68.6 45.7-110.3 45.7-28.8 0-56.3-7.7-80.3-22.2-10.8-6.5-20.8-14.4-30-23.5-2.6-2.6-5-5.2-7.4-7.9-24.8-28.4-38.3-64.4-38.3-102.4 0-41.7 16.2-80.8 45.7-110.3s68.6-45.7 110.3-45.7c37 0 72.1 12.8 100.1 36.4 3.5 2.9 6.9 6 10.2 9.3 8.4 8.4 15.7 17.6 21.9 27.4 15.5 24.6 23.8 53.1 23.8 82.9 0 41.7-16.2 80.8-45.7 110.3z"/>
+
+ </g>
+
+ <!-- 右下角控制条(变细) -->
+ <g fill="currentColor"
+ stroke="currentColor"
+ stroke-width="8"
+ stroke-linejoin="round"
+ stroke-linecap="round">
+
+ <path d="M753.1 704.4v-27.6c0-8.3-6.7-15-15-15s-15 6.7-15 15v27.6c-17.5 6.2-30 22.8-30 42.4s12.5 36.3 30 42.4v97.6c0 8.3 6.7 15 15 15s15-6.7 15-15v-97.6c17.5-6.2 30-22.8 30-42.4s-12.5-36.3-30-42.4z m-15 57.4c-8.3 0-15-6.7-15-15s6.7-15 15-15 15 6.7 15 15-6.8 15-15 15zM851 774.4v-97.6c0-8.3-6.7-15-15-15s-15 6.7-15 15v97.6c-17.5 6.2-30 22.8-30 42.4s12.5 36.3 30 42.4v27.6c0 8.3 6.7 15 15 15s15-6.7 15-15v-27.6c17.5-6.2 30-22.8 30-42.4s-12.5-36.3-30-42.4z m-15 57.4c-8.3 0-15-6.7-15-15s6.7-15 15-15 15 6.7 15 15-6.7 15-15 15z"/>
+
+ </g>
+
+</svg>
\ No newline at end of file
diff --git a/src/assets/svg/Photo-edit.svg b/src/assets/svg/Photo-edit.svg
new file mode 100644
index 0000000..3ba2439
--- /dev/null
+++ b/src/assets/svg/Photo-edit.svg
@@ -0,0 +1,9 @@
+<svg
+ xmlns="http://www.w3.org/2000/svg"
+ viewBox="170 170 680 680"
+ width="24"
+ height="24"
+ fill="currentColor"
+>
+ <path d="M430.933333 610.133333l115.2-145.066666 72.533334 98.133333c34.133333-21.333333 68.266667-34.133333 106.666666-34.133333 8.533333 0 21.333333 0 34.133334 4.266666v-298.666666C755.2 200.533333 725.333333 170.666667 691.2 170.666667H234.666667C200.533333 170.666667 170.666667 200.533333 170.666667 234.666667v456.533333c0 34.133333 29.866667 64 64 64h294.4c-4.266667-8.533333-4.266667-21.333333-4.266667-34.133333 0-21.333333 4.266667-46.933333 12.8-64H234.666667L349.866667 512l81.066666 98.133333zM593.066667 793.6V853.333333h55.466666l153.6-153.6-59.733333-59.733333zM849.066667 631.466667L810.666667 597.333333c-8.533333-8.533333-17.066667-8.533333-21.333334 0l-29.866666 29.866667 59.733333 59.733333 29.866667-29.866666c4.266667-8.533333 4.266667-17.066667 0-25.6z"/>
+</svg>
\ No newline at end of file
diff --git a/src/assets/svg/Snapshot.svg b/src/assets/svg/Snapshot.svg
new file mode 100644
index 0000000..feb3c71
--- /dev/null
+++ b/src/assets/svg/Snapshot.svg
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<svg viewBox="0 0 1024 1024"
+ xmlns="http://www.w3.org/2000/svg"
+ width="200"
+ height="200"
+ fill="currentColor">
+ <path d="M128 650.688a32 32 0 0 1 31.488 26.24l0.512 5.76v170.624c0 4.736 3.072 8.704 7.296 10.176l3.392 0.512h170.624a32 32 0 0 1 5.76 63.488l-5.76 0.512H170.688a74.688 74.688 0 0 1-74.24-66.56l-0.448-8.128v-170.624a32 32 0 0 1 32-32z m768 0a32 32 0 0 1 31.488 26.24l0.512 5.76v170.624c0 38.528-29.12 70.208-66.56 74.24l-8.128 0.448h-170.624a32 32 0 0 1-5.76-63.488l5.76-0.512h170.624a10.688 10.688 0 0 0 10.176-7.296l0.512-3.392v-170.624a32 32 0 0 1 32-32zM576 288a32 32 0 0 1 26.624 14.272l33.152 49.728h110.912a32 32 0 0 1 31.488 26.24l0.512 5.76v320a32 32 0 0 1-32 32H277.312a32 32 0 0 1-32-32V384a32 32 0 0 1 32-32h110.848l33.216-49.728a32 32 0 0 1 20.288-13.632L448 288z m-17.152 64H465.088l-33.152 49.728a32 32 0 0 1-20.288 13.632l-6.336 0.64h-96v256h405.312v-256h-96a32 32 0 0 1-22.592-9.344l-3.968-4.928-33.216-49.728zM512 437.312a96 96 0 1 1 0 192 96 96 0 0 1 0-192z m0 64a32 32 0 1 0 0 64 32 32 0 0 0 0-64zM341.312 96a32 32 0 0 1 5.76 63.488l-5.76 0.512H170.688a10.688 10.688 0 0 0-10.176 7.296l-0.512 3.392v170.624a32 32 0 0 1-63.488 5.76l-0.512-5.76V170.688c0-38.528 29.12-70.208 66.56-74.24l8.128-0.448h170.624z m512 0c38.528 0 70.208 29.12 74.24 66.56l0.448 8.128v170.624a32 32 0 0 1-63.488 5.76l-0.512-5.76V170.688a10.688 10.688 0 0 0-7.296-10.176l-3.392-0.512h-170.624a32 32 0 0 1-5.76-63.488l5.76-0.512h170.624z"/>
+</svg>
\ No newline at end of file
diff --git a/src/components/ActionCard.vue b/src/components/ActionCard.vue
index 3849688..ea25121 100644
--- a/src/components/ActionCard.vue
+++ b/src/components/ActionCard.vue
@@ -11,6 +11,10 @@ import { buildEmptyFn, delay } from '@/utils/others';
import { snapshotStorage } from '@/utils/snapshot';
import { useTask } from '@/utils/task';
import { getImportUrl, getImagUrl } from '@/utils/url';
+import {
+ getCustomDomainImportUrl,
+ getOfficialImportUrl,
+} from '@/utils/plus/url';
const props = withDefaults(
defineProps<{
@@ -31,7 +35,7 @@ const props = withDefaults(
);
const router = useRouter();
-const { snapshotImportId, snapshotImageId } = useStorageStore();
+const { settingsStore, snapshotImportId, snapshotImageId } = useStorageStore();
const exportJpg = useTask(async () => exportSnapshotAsImage(props.snapshot));
const exportZip = useTask(async () => exportSnapshotAsZip(props.snapshot));
@@ -57,7 +61,11 @@ const exportZipUrl = useTask(async () => {
const importId = await exportSnapshotAsImportId(props.snapshot);
showTextDLg({
title: `分享链接`,
- content: location.origin + `/i/${importId}`,
+ content: settingsStore.shareUseOfficialImportDomain
+ ? getOfficialImportUrl(importId)
+ : getImportUrl(importId),
+ extraContent: getCustomDomainImportUrl(importId),
+ quickPick: true,
});
});
@@ -70,7 +78,9 @@ const deleteSnapshot = async () => {
const snapshotImportUrl = computed(() => {
const t = snapshotImportId[props.snapshot.id];
if (!t) return '';
- return getImportUrl(t);
+ return settingsStore.shareUseOfficialImportDomain
+ ? getOfficialImportUrl(t)
+ : getImportUrl(t);
});
const snapshotImageUrl = computed(() => {
const t = snapshotImageId[props.snapshot.id];
diff --git a/src/components/BodyScrollbar.vue b/src/components/BodyScrollbar.vue
index 0178405..37a50de 100644
--- a/src/components/BodyScrollbar.vue
+++ b/src/components/BodyScrollbar.vue
@@ -123,12 +123,11 @@ const bodyHoverd = useElementHover(document.body);
w-full
rounded-4px
transition-colors
- bg="#9093994c"
- hover:bg="#9093997f"
+ class="BodyScrollbar-bar"
:style="yStyle"
:class="{
- 'bg-#9093997f': yDragging,
- 'bg-#0000!': !bodyHoverd,
+ 'is-dragging': yDragging,
+ 'is-hidden': !bodyHoverd && !yDragging,
}"
@click.stop
/>
@@ -150,12 +149,11 @@ const bodyHoverd = useElementHover(document.body);
h-full
rounded-4px
transition-colors
- bg="#9093994c"
- hover:bg="#9093997f"
+ class="BodyScrollbar-bar"
:style="xStyle"
:class="{
- 'bg-#9093997f': xDragging,
- 'bg-#0000!': !bodyHoverd,
+ 'is-dragging': xDragging,
+ 'is-hidden': !bodyHoverd && !xDragging,
}"
@click.stop
/>
@@ -169,4 +167,16 @@ body:not(.mobile)::-webkit-scrollbar {
html:not(.mobile) {
scrollbar-width: none;
}
+.BodyScrollbar-bar {
+ background-color: var(--scrollbar-thumb-color);
+}
+.BodyScrollbar-bar:hover {
+ background-color: var(--scrollbar-thumb-hover-color);
+}
+.BodyScrollbar-bar.is-dragging {
+ background-color: var(--scrollbar-thumb-active-color);
+}
+.BodyScrollbar-bar.is-hidden {
+ background-color: var(--scrollbar-thumb-hidden-color);
+}
</style>
diff --git a/src/components/DeviceControlTools.vue b/src/components/DeviceControlTools.vue
new file mode 100644
index 0000000..68ba555
--- /dev/null
+++ b/src/components/DeviceControlTools.vue
@@ -0,0 +1,399 @@
+<script setup lang="ts">
+import DraggableCard from '@/components/DraggableCard.vue';
+import { useDeviceControlTools } from '@/composables/plus/useDeviceControlTools';
+import type { TooltipProps, TreeProps, TreeOption } from 'naive-ui';
+import { h } from 'vue';
+
+const props = withDefaults(
+ defineProps<{
+ iconSize?: string;
+ tooltipPlacement?: TooltipProps['placement'];
+ }>(),
+ { iconSize: 'var(--app-icon-size)', tooltipPlacement: 'right' },
+);
+
+const {
+ showSubsModel,
+ subsText,
+ parsedCandidates,
+ selectedCandidateKeys,
+ selectAllCandidates,
+ clearCandidateSelection,
+ invertCandidateSelection,
+ parseCandidates,
+ updateSubs,
+ showSelectorModel,
+ actionOptions,
+ clickAction,
+ execSelector,
+} = useDeviceControlTools();
+
+type CandidateTreeOption = {
+ key: string;
+ label: string;
+ children?: CandidateTreeOption[];
+ checkboxDisabled?: boolean;
+};
+
+const candidateTreeOptions = computed<CandidateTreeOption[]>(() => {
+ const appRoot: CandidateTreeOption = {
+ key: '__branch__:apps',
+ label: 'Apps',
+ children: [],
+ };
+ const globalRoot: CandidateTreeOption = {
+ key: '__branch__:global',
+ label: 'GlobalGroups',
+ checkboxDisabled: true,
+ children: [],
+ };
+ const categoryRoot: CandidateTreeOption = {
+ key: '__branch__:categories',
+ label: 'Categories',
+ checkboxDisabled: true,
+ children: [],
+ };
+ const appMap = new Map<string, CandidateTreeOption>();
+
+ const normalizeLeafLabel = (text: string) => {
+ if (text.startsWith('AppGroup: ')) {
+ const idx = text.indexOf(' / ');
+ return idx >= 0 ? text.substring(idx + 3) : text;
+ }
+ return text;
+ };
+
+ parsedCandidates.value.forEach((item) => {
+ if (item.kind === 'app') {
+ const app = item.payload.apps?.[0];
+ const appId = app?.id || '(unknown)';
+ const appName = app?.name || appId;
+ const appKey = `__branch__:app:${appId}`;
+ let appNode = appMap.get(appKey);
+ if (!appNode) {
+ appNode = {
+ key: appKey,
+ label: `${appName} (${appId})`,
+ children: [],
+ };
+ appMap.set(appKey, appNode);
+ appRoot.children!.push(appNode);
+ }
+ appNode.children!.push({
+ key: item.key,
+ label: normalizeLeafLabel(item.label),
+ });
+ return;
+ }
+ if (item.kind === 'globalGroup') {
+ globalRoot.children!.push({
+ key: item.key,
+ label: item.label.replace(/^GlobalGroup:\s*/, ''),
+ });
+ return;
+ }
+ categoryRoot.children!.push({
+ key: item.key,
+ label: item.label.replace(/^Category:\s*/, ''),
+ });
+ });
+
+ return [appRoot, globalRoot, categoryRoot].filter(
+ (node) => (node.children || []).length > 0,
+ );
+});
+
+const candidateTreeBranchToLeaves = computed(() => {
+ const map = new Map<string, string[]>();
+ const walk = (node: CandidateTreeOption): string[] => {
+ if (!node.children?.length) return [node.key];
+ const leaves = node.children.flatMap((child) => walk(child));
+ map.set(node.key, leaves);
+ return leaves;
+ };
+ candidateTreeOptions.value.forEach((node) => {
+ walk(node);
+ });
+ return map;
+});
+
+const candidateLeafKeySet = computed(
+ () => new Set(parsedCandidates.value.map((item) => item.key)),
+);
+
+const toggleLeafByLabelClick = (key: string) => {
+ if (!candidateLeafKeySet.value.has(key)) return;
+ const next = new Set(selectedCandidateKeys.value);
+ if (next.has(key)) next.delete(key);
+ else next.add(key);
+ selectedCandidateKeys.value = [...next];
+};
+
+const candidateTreeNodeProps: NonNullable<TreeProps['nodeProps']> = (info) => {
+ const option = info.option as TreeOption;
+ if (Array.isArray(option.children) && option.children.length) return {};
+ const key = String(option.key ?? '');
+ if (!key) return {};
+ return {
+ onClick: (e: MouseEvent) => {
+ e.stopPropagation();
+ toggleLeafByLabelClick(key);
+ },
+ };
+};
+
+const onCandidateTreeChecked = (keys: Array<string | number>) => {
+ const allow = new Set(parsedCandidates.value.map((item) => item.key));
+ const selected = new Set<string>();
+ keys.forEach((key) => {
+ if (typeof key !== 'string') return;
+ if (allow.has(key)) {
+ selected.add(key);
+ return;
+ }
+ const leafKeys = candidateTreeBranchToLeaves.value.get(key) || [];
+ leafKeys.forEach((leaf) => {
+ if (allow.has(leaf)) selected.add(leaf);
+ });
+ });
+ selectedCandidateKeys.value = [...selected];
+};
+
+const subsPlaceholder = `
+示例-单个应用的规则:
+{
+ id: 'cn.dxy.clinmaster',
+ name: '临床决策',
+ groups: [
+ {
+ key: 1,
+ name: '示例',
+ rules: [
+ {
+ fastQuery: true,
+ activityIds: 'cn.dxy.clinmaster.home.MainActivity',
+ matches:
+ '@[vid="iv_close"] -2 [text="立即更新"]',
+ snapshotUrls: 'https://i.gkd.li/i/25459821',
+ },
+ ],
+ },
+ ],
+}
+`.trim();
+</script>
+
+<template>
+ <NTooltip :placement="props.tooltipPlacement">
+ <template #trigger>
+ <NButton
+ text
+ :style="{ '--n-icon-size': props.iconSize, '--svg-h': props.iconSize }"
+ @click="showSubsModel = !showSubsModel"
+ >
+ <template #icon>
+ <SvgIcon name="CacheSub" style="color: var(--icon-contrast-color)" />
+ </template>
+ </NButton>
+ </template>
+ 修改内存订阅
+ </NTooltip>
+ <NTooltip :placement="props.tooltipPlacement">
+ <template #trigger>
+ <NButton
+ text
+ :style="{ '--n-icon-size': props.iconSize, '--svg-h': props.iconSize }"
+ @click="showSelectorModel = !showSelectorModel"
+ >
+ <template #icon>
+ <SvgIcon name="Exe-Sel" style="color: var(--icon-contrast-color)" />
+ </template>
+ </NButton>
+ </template>
+ 执行选择器
+ </NTooltip>
+
+ <DraggableCard
+ v-slot="{ onRef }"
+ :initialValue="{ top: 84, left: 120 }"
+ class="box-shadow-dim window-anim"
+ :show="showSubsModel"
+ >
+ <NCard
+ size="small"
+ closable
+ class="floating-panel"
+ style="width: min(720px, 80vw); max-height: 73vh"
+ :content-style="{ overflow: 'auto' }"
+ @close="showSubsModel = false"
+ >
+ <template #header>
+ <div :ref="onRef" flex items-center cursor-move>
+ <SvgIcon
+ name="CacheSub"
+ class="mr-6px"
+ style="color: var(--accent-success-color)"
+ />
+ <span>修改内存订阅</span>
+ <div flex-1 />
+ </div>
+ </template>
+ <NInput
+ v-model:value="subsText"
+ :disabled="updateSubs.loading"
+ type="textarea"
+ class="gkd_code"
+ :autosize="{ minRows: 16, maxRows: 22 }"
+ :placeholder="subsPlaceholder"
+ aria-label="订阅文本输入框"
+ />
+ <NAlert mt-10px type="info" title="导入说明">
+ 1.点击“解析”可自动清洗非法 TS/残缺文本并识别多条规则 2.若无
+ app头,快照审查页会自动补全 3.支持 TS转JSON5 语法格式
+ </NAlert>
+ <NCard
+ v-if="parsedCandidates.length"
+ mt-10px
+ size="small"
+ :bordered="true"
+ title="解析结果(树形可选导入)"
+ >
+ <div mb-8px flex justify-end gap-8px>
+ <NButton size="tiny" tertiary @click="selectAllCandidates"
+ >全选</NButton
+ >
+ <NButton size="tiny" tertiary @click="invertCandidateSelection"
+ >反选</NButton
+ >
+ <NButton size="tiny" tertiary @click="clearCandidateSelection"
+ >清空</NButton
+ >
+ </div>
+ <NTree
+ block-line
+ checkable
+ cascade
+ expand-on-click
+ :render-label="
+ ({ option }) =>
+ option.children?.length
+ ? option.label
+ : h(
+ 'span',
+ {
+ style: { cursor: 'pointer' },
+ onClick: (e: MouseEvent) => {
+ e.stopPropagation();
+ toggleLeafByLabelClick(String(option.key));
+ },
+ },
+ option.label as string,
+ )
+ "
+ :node-props="candidateTreeNodeProps"
+ :data="candidateTreeOptions"
+ :checked-keys="selectedCandidateKeys"
+ @update:checkedKeys="onCandidateTreeChecked"
+ />
+ </NCard>
+ <div
+ :class="{
+ 'mt-10px': parsedCandidates.length,
+ 'mt-5px': !parsedCandidates.length,
+ }"
+ flex
+ justify-end
+ gap-8px
+ >
+ <NButton @click="showSubsModel = false">取消</NButton>
+ <NButton
+ :loading="parseCandidates.loading"
+ :disabled="updateSubs.loading"
+ @click="parseCandidates.invoke"
+ >
+ 解析
+ </NButton>
+ <NButton
+ type="primary"
+ :loading="updateSubs.loading"
+ @click="updateSubs.invoke"
+ >
+ 确认导入
+ </NButton>
+ </div>
+ </NCard>
+ </DraggableCard>
+
+ <DraggableCard
+ v-slot="{ onRef }"
+ :initialValue="{ top: 120, left: 180 }"
+ class="box-shadow-dim window-anim"
+ :show="showSelectorModel"
+ >
+ <NCard
+ size="small"
+ closable
+ class="floating-panel"
+ style="width: min(720px, 90vw)"
+ :content-style="{ maxHeight: '70vh', overflow: 'auto' }"
+ @close="showSelectorModel = false"
+ >
+ <template #header>
+ <div :ref="onRef" flex items-center cursor-move>
+ <SvgIcon
+ name="Exe-Sel"
+ class="mr-6px"
+ style="color: var(--accent-success-color)"
+ />
+ <span>执行选择器</span>
+ <div flex-1 />
+ </div>
+ </template>
+ <NInput
+ v-model:value="clickAction.selector"
+ :disabled="execSelector.loading"
+ type="textarea"
+ class="gkd_code"
+ :autosize="{ minRows: 4, maxRows: 10 }"
+ placeholder="请输入合法选择器"
+ aria-label="选择器输入框"
+ />
+ <div h-15px />
+ <NSpace>
+ <NCheckbox v-model:checked="clickAction.quickFind">快速查询</NCheckbox>
+ <a
+ href="https://gkd.li/api/interfaces/RawCommonProps.html#quickfind"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ 查找说明
+ </a>
+ </NSpace>
+ <div h-10px />
+ <div flex gap-10px flex-items-center>
+ <NSelect
+ v-model:value="clickAction.action"
+ :options="actionOptions"
+ class="w-150px"
+ />
+ <a
+ href="https://gkd.li/api/interfaces/RawRuleProps#action"
+ target="_blank"
+ rel="noopener noreferrer"
+ >
+ 操作说明
+ </a>
+ </div>
+ <div mt-10px flex justify-end gap-8px>
+ <NButton @click="showSelectorModel = false">取消</NButton>
+ <NButton
+ type="primary"
+ :loading="execSelector.loading"
+ @click="execSelector.invoke"
+ >
+ 确认
+ </NButton>
+ </div>
+ </NCard>
+ </DraggableCard>
+</template>
diff --git a/src/components/DialogContainer.vue b/src/components/DialogContainer.vue
new file mode 100644
index 0000000..7750a86
--- /dev/null
+++ b/src/components/DialogContainer.vue
@@ -0,0 +1,198 @@
+<template>
+ <div class="dialog-container">
+ <!-- 分享链接弹窗 -->
+ <NModal
+ v-if="dialogState.shareLink.visible"
+ v-model:show="dialogState.shareLink.visible"
+ :draggable="true"
+ :show-mask="false"
+ :block-scroll="false"
+ :auto-focus="false"
+ :trap-focus="false"
+ :mask-closable="false"
+ :close-on-esc="true"
+ class="snapshot-floating-panel"
+ :width="400"
+ >
+ <template #header>
+ <div class="n-modal-header">
+ <div class="n-modal-title">
+ {{ dialogState.shareLink.options.title }}
+ </div>
+ <div class="n-modal-header__right">
+ <NButton text @click="close('shareLink')">
+ <SvgIcon name="close" />
+ </NButton>
+ </div>
+ </div>
+ </template>
+ <div class="p-10px">
+ <div class="mb-8px">
+ <div class="text-sm text-muted mb-4px">官方域名链接</div>
+ <NInput :value="officialUrl" readonly class="gkd_code" />
+ <NButton text size="small" class="mt-4px" @click="copy(officialUrl)">
+ 复制链接
+ </NButton>
+ </div>
+ <div v-if="currentOriginUrl" class="mb-8px">
+ <div class="text-sm text-muted mb-4px">自定义域链接</div>
+ <NInput :value="currentOriginUrl" readonly class="gkd_code" />
+ <NButton
+ text
+ size="small"
+ class="mt-4px"
+ @click="copy(currentOriginUrl)"
+ >
+ 复制链接
+ </NButton>
+ </div>
+ <div v-if="dialogState.shareLink.options.quickPick" class="mt-12px">
+ <NButton type="primary" block @click="copy(officialUrl)">
+ 快速复制官方链接
+ </NButton>
+ </div>
+ </div>
+ </NModal>
+
+ <!-- 风险提示弹窗 -->
+ <NModal
+ v-if="dialogState.riskNotice.visible"
+ v-model:show="dialogState.riskNotice.visible"
+ :draggable="true"
+ :show-mask="true"
+ :block-scroll="true"
+ :auto-focus="true"
+ :trap-focus="true"
+ :mask-closable="false"
+ :close-on-esc="false"
+ class="snapshot-floating-panel"
+ :width="400"
+ >
+ <template #header>
+ <div class="n-modal-header">
+ <div class="n-modal-title">生成分享链接须知</div>
+ </div>
+ </template>
+ <div class="p-10px">
+ <div class="mb-8px">
+ 所有快照上传分享链接均为公开链接,任何人均可访问。
+ </div>
+ <div class="mb-12px">
+ 请确保快照不包含隐私信息,请勿分享任何敏感信息。
+ </div>
+ <NCheckbox v-model:checked="ignoreWarn" class="mb-12px">
+ 不再提醒
+ </NCheckbox>
+ <div class="flex justify-end gap-8px">
+ <NButton @click="rejectRiskNotice">取消分享</NButton>
+ <NButton type="primary" @click="acceptRiskNotice">继续上传</NButton>
+ </div>
+ </div>
+ </NModal>
+ </div>
+</template>
+
+<script setup lang="ts">
+import { computed } from 'vue';
+import { message } from '@/utils/discrete';
+import SvgIcon from './SvgIcon.vue';
+import { getImportId } from '@/utils/url';
+import { settingsStore } from '@/store/storage';
+import { useDialogStore } from '@/store/dialog';
+import { NModal, NButton, NInput, NCheckbox } from 'naive-ui';
+
+const dialogStore = useDialogStore();
+const dialogState = computed(() => dialogStore.state);
+
+const officialUrl = computed(() => {
+ const options = dialogState.value.shareLink.options;
+ const content = options.content || '';
+ const extraContent = options.extraContent || '';
+ const importId = getImportId(content) || getImportId(extraContent);
+ return importId ? `https://i.gkd.li/i/${importId}` : content;
+});
+
+const currentOriginUrl = computed(() => {
+ const options = dialogState.value.shareLink.options;
+ const content = options.content || '';
+ const extraContent = options.extraContent || '';
+ const importId = getImportId(content) || getImportId(extraContent);
+ return options.extraContent
+ ? options.extraContent
+ : importId
+ ? `${window.location.origin}/i/${importId}`
+ : content;
+});
+
+const ignoreWarn = computed({
+ get: () => settingsStore.ignoreUploadWarn,
+ set: (value) => {
+ settingsStore.ignoreUploadWarn = value;
+ },
+});
+
+const close = (dialogName: string) => {
+ dialogStore.close(dialogName);
+};
+
+const copy = async (text: string) => {
+ if (!text) return;
+ try {
+ await navigator.clipboard.writeText(text);
+ message.success('复制成功');
+ } catch {
+ message.error('复制失败');
+ }
+};
+
+const acceptRiskNotice = () => {
+ dialogStore.resolve('riskNotice', true);
+};
+
+const rejectRiskNotice = () => {
+ dialogStore.reject('riskNotice', 'cancel');
+};
+</script>
+
+<style scoped>
+.dialog-container {
+ position: fixed;
+ top: 0;
+ left: 0;
+ width: 100vw;
+ height: 100vh;
+ z-index: 9999;
+ pointer-events: none;
+}
+
+.dialog-container > * {
+ pointer-events: auto;
+}
+
+.text-muted {
+ color: var(--text-muted-color);
+}
+
+/* 确保可拖拽区域样式正确 */
+.n-modal-header {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ padding: 12px 16px;
+ cursor: move;
+}
+
+.n-modal-title {
+ font-size: 16px;
+ font-weight: 500;
+}
+
+.n-modal-header__right {
+ flex-shrink: 0;
+}
+
+/* 确保弹窗可见 */
+.snapshot-floating-panel {
+ z-index: 10000;
+}
+</style>
diff --git a/src/components/SelectorText.vue b/src/components/SelectorText.vue
index e743e46..4794d98 100644
--- a/src/components/SelectorText.vue
+++ b/src/components/SelectorText.vue
@@ -119,47 +119,47 @@ const getDataValue = (str: string) => {
</template>
<style>
[data-name~='Unknown'] {
- background-color: red;
+ background-color: var(--selector-unknown-bg-color);
}
[data-name~='PropertySegment'] {
- color: blueviolet;
+ color: var(--selector-property-color);
}
[data-name~='PropertySegment'] [data-name='String'][data-value='@'] {
- color: rgb(98, 55, 138);
+ color: var(--selector-property-prefix-color);
}
[data-name~='ConnectOperator'] {
- color: green;
+ color: var(--selector-connect-operator-color);
}
[data-name~='ConnectExpression'] {
- color: cadetblue;
+ color: var(--selector-connect-expression-color);
}
[data-name~='ValueExpression'] {
- color: green;
+ color: var(--selector-value-expression-color);
}
[data-name~='ValueExpression'][data-name~='LiteralExpression'] {
- color: steelblue;
+ color: var(--selector-value-literal-color);
}
[data-name~='CompareOperator'] {
- color: mediumblue;
+ color: var(--selector-compare-operator-color);
}
[data-name~='LogicalOperator'] {
- color: darkgreen;
+ color: var(--selector-logical-operator-color);
}
[data-name~='SelectorLogicalOperator'] {
- color: darkgreen;
+ color: var(--selector-logical-operator-color);
}
[data-name='String'][data-value=')'],
[data-name='String'][data-value='('] {
- color: #b392f0;
+ color: var(--selector-string-bracket-color);
}
[data-name='String'][data-value=']'],
[data-name='String'][data-value='['] {
- color: #b392f0;
+ color: var(--selector-string-bracket-color);
}
[data-name='String'][data-value=','] {
- color: #5e418c;
+ color: var(--selector-string-comma-color);
}
[data-name='String'][data-value='.'] {
- color: #b392f0;
+ color: var(--selector-string-bracket-color);
}
</style>
diff --git a/src/components/SettingsModal.vue b/src/components/SettingsModal.vue
new file mode 100644
index 0000000..8dceb01
--- /dev/null
+++ b/src/components/SettingsModal.vue
@@ -0,0 +1,257 @@
+<script setup lang="ts">
+import { showTextDLg } from '@/utils/dialog';
+import { normalizeOriginText } from '@/utils/plus/url';
+import { message } from '@/utils/discrete';
+import {
+ screenshotStorage,
+ shallowSnapshotStorage,
+ snapshotStorage,
+} from '@/utils/snapshot';
+
+const props = defineProps<{
+ show: boolean;
+}>();
+
+const emit = defineEmits<{
+ (e: 'update:show', value: boolean): void;
+}>();
+
+const {
+ settingsStore,
+ snapshotViewedTime,
+ snapshotImportTime,
+ snapshotImageId,
+ snapshotImportId,
+ importSnapshotId,
+} = useStorageStore();
+const showDebugMenu = ref(false);
+
+const updateCustomDomain = () => {
+ settingsStore.shareCustomImportDomain = normalizeOriginText(
+ settingsStore.shareCustomImportDomain,
+ );
+};
+
+const triggerDebugShareDialog = () => {
+ showTextDLg({
+ title: '调试 - 链接复制窗口',
+ content: 'https://i.gkd.li/i/123456',
+ extraContent: `${window.location.origin}/i/123456`,
+ extraTitle: '当前域链接',
+ });
+};
+
+const clearRecord = (record: Record<string, any>) => {
+ Object.keys(record).forEach((k) => {
+ delete record[k];
+ });
+};
+const clearStorage = async (
+ storage: Pick<typeof snapshotStorage, 'keys' | 'removeItem'>,
+) => {
+ const keys = await storage.keys();
+ await Promise.all(keys.map((k) => storage.removeItem(k)));
+};
+const clearIndexCache = async (showMessage = true) => {
+ clearRecord(snapshotViewedTime);
+ clearRecord(snapshotImportTime);
+ clearRecord(snapshotImageId);
+ clearRecord(snapshotImportId);
+ clearRecord(importSnapshotId);
+ if (showMessage) {
+ message.success('已清理索引缓存');
+ }
+};
+const clearSnapshots = async () => {
+ await Promise.all([
+ clearStorage(snapshotStorage),
+ clearStorage(shallowSnapshotStorage),
+ clearStorage(screenshotStorage),
+ ]);
+ await clearIndexCache(false);
+ message.success('已清理快照数据');
+};
+const resetAllLocal = () => {
+ localStorage.removeItem('settings');
+ message.success('已重置设置,正在刷新');
+ setTimeout(() => {
+ location.reload();
+ }, 300);
+};
+</script>
+
+<template>
+ <NModal
+ :show="props.show"