forked from chavyleung/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchavy.boxjs.html
More file actions
2344 lines (2339 loc) · 96.6 KB
/
chavy.boxjs.html
File metadata and controls
2344 lines (2339 loc) · 96.6 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
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<title>BoxJs</title>
<meta charset="utf-8" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black-translucent" />
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no, viewport-fit=cover" />
<link rel="Bookmark" href="https://raw.githubusercontent.com/chavyleung/scripts/master/BOXJS.png" />
<link rel="shortcut icon" href="https://raw.githubusercontent.com/chavyleung/scripts/master/BOXJS.png" />
<link rel="apple-touch-icon" href="https://raw.githubusercontent.com/chavyleung/scripts/master/BOXJS.png" />
<link href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/@mdi/font@5.x/css/materialdesignicons.min.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/vuetify@2.x/dist/vuetify.min.css" rel="stylesheet" />
<style>
#BG {
position: fixed;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 0;
background-position: center;
background-size: cover;
background-repeat: no-repeat;
background-color: transparent;
}
@media (prefers-color-scheme: light) {
body {
background-color: #fff;
}
}
@media (prefers-color-scheme: dark) {
body {
background-color: #121212;
}
}
[v-cloak] {
display: none;
}
.text-pre-wrap {
white-space: pre-wrap !important;
}
.v-navigation-drawer {
padding-top: constant(safe-area-inset-top) !important;
padding-top: env(safe-area-inset-top) !important;
}
.v-bottom-sheet.v-dialog--fullscreen {
padding-top: constant(safe-area-inset-top) !important;
padding-top: env(safe-area-inset-top) !important;
}
.v-app-bar.safe {
height: auto !important;
padding-top: constant(safe-area-inset-top) !important;
padding-top: env(safe-area-inset-top) !important;
}
.v-toolbar.safe {
height: auto !important;
padding-top: constant(safe-area-inset-top) !important;
padding-top: env(safe-area-inset-top) !important;
}
.v-toolbar__content {
padding-left: 12px !important;
padding-right: 12px !important;
}
.v-main {
margin-top: constant(safe-area-inset-top) !important;
margin-top: env(safe-area-inset-top) !important;
margin-bottom: constant(safe-area-inset-bottom) !important;
margin-bottom: env(safe-area-inset-bottom) !important;
}
.v-main .container {
height: 100%;
}
.v-bottom-navigation,
.v-bottom-sheet {
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.v-bottom-navigation {
box-sizing: content-box;
}
.v-bottom-navigation button {
box-sizing: border-box;
}
.v-speed-dial {
margin-bottom: calc(48px + constant(safe-area-inset-bottom));
margin-bottom: calc(48px + env(safe-area-inset-bottom));
}
</style>
</head>
<body>
<div id="BG"></div>
<div id="app" v-cloak>
<v-app v-if="box" :style="appViewStyle">
<v-app-bar
ref="appBar"
v-bind="appBarBind"
:class="!$refs.appBar || $refs.appBar.isActive ? 'safe' : undefined"
:value="!isHidedSearchBar"
v-touch="{ up: () => isHidedSearchBar = true }"
>
<!-- 搜索条 -->
<v-autocomplete v-bind="ui.searchBar" :label="title" @click="ui.searchDialog.show = true" hide-no-data hide-details solo>
<template #prepend-inner>
<!-- 容器切换 Surge、QuanX、Loon -->
<v-menu bottom left v-if="!isLoading && isMainView">
<template #activator="{ on }">
<v-btn v-on="on" icon class="ml-n3">
<v-avatar size="26"><img :src="env.icons[iconEnvThemeIdx]" /></v-avatar>
</v-btn>
</template>
<v-list>
<v-list-item dense v-for="(env, envIdx) in envs" :key="env.id" @click="switchEnv(env.id)">
<v-list-item-avatar size="26"><v-img :src="env.icon" /></v-list-item-avatar>
<v-list-item-title>{{env.id}}</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
<!-- 返回按钮 -->
<v-btn icon class="ml-n3" @click="back" v-else-if="!isLoading && !isMainView">
<v-icon>mdi-chevron-left</v-icon>
</v-btn>
<v-btn icon class="ml-n3" v-show="isLoading" :loading="isLoading" color="primary"></v-btn>
</template>
<template #append>
<v-btn icon class="mr-n3" @click="ui.naviDrawer.show = true">
<v-avatar size="26"><v-icon>mdi-menu</v-icon></v-avatar>
</v-btn>
</template>
</v-autocomplete>
</v-app-bar>
<v-dialog v-model="ui.searchDialog.show" fullscreen scrollable>
<v-card class="align-self-start">
<v-card-subtitle class="pa-0">
<v-toolbar v-bind="searchBarBind" class="safe">
<v-btn icon dark @click="ui.searchDialog.show = false">
<v-icon>mdi-chevron-left</v-icon>
</v-btn>
<v-text-field ref="search" v-model="ui.searchBar.input" :label="title" autofocus hide-details solo></v-text-field>
<v-btn icon @click="open(box.syscfgs.orz3.repo)">
<v-avatar size="26"><img :src="box.syscfgs.orz3.icon" /></v-avatar>
</v-btn>
</v-toolbar>
</v-card-subtitle>
<v-card-text class="px-0">
<v-list nav>
<v-list-item
v-for="(app, appIdx) in searchApps"
:key="appIdx"
@click="ui.searchDialog.show = false, switchAppView(app.id)"
dense
>
<v-list-item-avatar class="elevation-3"><img :src="app.icon" /></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title>{{`${app.name} (${app.id})`}}</v-list-item-title>
<v-list-item-subtitle>{{app.repo}}</v-list-item-subtitle>
<v-list-item-subtitle>{{app.author}}</v-list-item-subtitle>
</v-list-item-content>
<v-list-item-action>
<v-btn icon @click.stop="ui.searchDialog.show = false, favApp(app.id)">
<v-icon :color="app.favIconColor" v-text="app.favIcon" />
</v-btn>
</v-list-item-action>
</v-list-item>
</v-list>
</v-card-text>
</v-card>
</v-dialog>
<!-- 侧栏 -->
<v-navigation-drawer app v-model="ui.naviDrawer.show" height="100%" temporary right disable-route-watcher>
<v-list dense nav>
<v-list-item dense>
<v-list-item-avatar @click="open(box.syscfgs.boxjs.repo)" class="elevation-3">
<v-img :src="box.syscfgs.boxjs.icon"></v-img>
</v-list-item-avatar>
<v-row justify="start" no-gutters>
<v-col v-for="(c, cIdx) in ui.collaborators" cols="4" :key="c.id">
<a>
<v-avatar size="40" @click="open(c.repo)" class="elevation-3">
<img :src="c.icon" />
</v-avatar>
</a>
</v-col>
</v-row>
</v-list-item>
<v-divider></v-divider>
<v-list-item class="pt-1">
<v-progress-linear :active="isLoading" height="1" absolute top indeterminate></v-progress-linear>
<v-row justify="start" no-gutters>
<v-col v-for="(c, cIdx) in ui.contributors" cols="2" :key="c.id">
<v-tooltip bottom>
<template v-slot:activator="{ on, attrs }">
<a>
<v-avatar v-on="on" class="ma-1 elevation-3" size="26" @click="open(c.repo)">
<v-img :src="c.icon"></v-img>
</v-avatar>
</a>
</template>
<span>{{c.login}}</span>
</v-tooltip>
</v-col>
</v-row>
</v-list-item>
<v-divider></v-divider>
<v-list-item v-if="box.syscfgs.env === 'Surge'">
<v-list-item-content>
<v-select
v-if="box.usercfgs.httpapis"
hide-details
v-model="box.usercfgs.httpapi"
:items="box.usercfgs.httpapis.split(',')"
@change="saveUserCfgs"
label="HTTP-API (Surge TF)"
>
</v-select>
<v-text-field
v-else
label="HTTP-API (Surge TF)"
v-model="box.usercfgs.httpapi"
hint="Surge http-api 地址."
placeholder="examplekey@127.0.0.1:6166"
persistent-hint
@change="saveUserCfgs"
:rules="[(val)=> /.*?@.*?:[0-9]+/.test(val) || '格式错误: examplekey@127.0.0.1:6166']"
>
</v-text-field>
</v-list-item-content>
</v-list-item>
<v-list-item>
<v-list-item-content>
<v-select
autofocus
hide-details
v-model="box.usercfgs.theme"
:items="[{text: '跟随系统', value: 'auto'}, {text: '暗黑', value: 'dark'}, {text: '明亮', value: 'light'}]"
label="颜色主题"
>
</v-select>
</v-list-item-content>
</v-list-item>
<v-list-item class="mt-4" v-show="box.usercfgs.bgimgs">
<v-list-item-content>
<v-select
hide-details
v-model="box.usercfgs.bgimg"
:items="bgimgs"
item-text="name"
item-value="url"
@change="saveUserCfgs"
label="背景图片"
>
</v-select>
</v-list-item-content>
</v-list-item>
<v-list-item class="mt-4">
<v-switch
dense
class="mt-0"
label="透明图标"
v-model="box.usercfgs.isTransparentIcons"
@change="saveUserCfgs"
:hide-details="isDarkMode"
:persistent-hint="true"
hint="明亮主题下强制使用彩色图标"
>
</v-switch>
<v-spacer></v-spacer>
<v-btn fab small text @click="open(box.syscfgs.orz3.repo)">
<v-avatar size="32"><img :src="box.syscfgs.orz3.icon" /></v-avatar>
</v-btn>
</v-list-item>
<v-list-item class="mt-4">
<v-switch
dense
class="mt-0"
label="壁纸模式"
v-model="isWallpaperMode"
@change="saveUserCfgs"
:persistent-hint="true"
hint="同时隐藏顶栏、底栏、图标"
>
</v-switch>
<v-spacer></v-spacer>
<v-btn fab small text>
<v-avatar size="32"><v-icon>mdi-image</v-icon></v-avatar>
</v-btn>
</v-list-item>
<v-list-item class="mt-4">
<v-switch
dense
class="mt-0"
label="隐藏顶栏"
v-model="box.usercfgs.isHidedSearchBar"
@change="saveUserCfgs"
:persistent-hint="true"
hint="主屏幕下滑可恢复显示"
>
</v-switch>
<v-spacer></v-spacer>
<v-btn fab small text>
<v-avatar size="32"><v-icon>mdi-dock-top</v-icon></v-avatar>
</v-btn>
</v-list-item>
<v-list-item class="mt-4">
<v-switch
dense
class="mt-0"
label="自动顶栏"
v-model="isAutoSearchBar"
@change="saveUserCfgs"
:persistent-hint="true"
hint="顶栏跟随主屏滚动"
>
</v-switch>
<v-spacer></v-spacer>
<v-btn fab small text>
<v-avatar size="32"><v-icon>mdi-format-align-top</v-icon></v-avatar>
</v-btn>
</v-list-item>
<v-list-item class="mt-4">
<v-switch
dense
class="mt-0"
label="隐藏底栏"
v-model="box.usercfgs.isHidedNaviBottom"
@change="saveUserCfgs"
:persistent-hint="true"
hint="隐藏后只能在侧栏恢复"
>
</v-switch>
<v-spacer></v-spacer>
<v-btn fab small text>
<v-avatar size="32"><v-icon>mdi-dock-bottom</v-icon></v-avatar>
</v-btn>
</v-list-item>
<v-list-item class="mt-4">
<v-switch
dense
class="mt-0"
label="自动底栏"
v-model="isAutoNaviBottom"
@change="saveUserCfgs"
:persistent-hint="true"
hint="底栏跟随主屏滚动"
>
</v-switch>
<v-spacer></v-spacer>
<v-btn fab small text>
<v-avatar size="32"><v-icon>mdi-format-align-bottom</v-icon></v-avatar>
</v-btn>
</v-list-item>
<!-- <v-list-item class="mt-4">
<v-switch
dense
class="mt-0"
label="透明主题"
v-model="box.usercfgs.isTransparent"
@change="saveUserCfgs"
:persistent-hint="true"
hint="使界面更多元素透明 (beta)"
>
</v-switch>
<v-spacer></v-spacer>
<v-btn fab small text>
<v-avatar size="32"><v-icon>mdi-invert-colors</v-icon></v-avatar>
</v-btn>
</v-list-item> -->
<v-list-item class="mt-4">
<v-switch
dense
class="mt-0"
label="勿扰模式"
hint="不再发出系统通知 (仍记日志)"
persistent-hint
v-model="box.usercfgs.isMute"
@change="saveUserCfgs"
></v-switch>
<v-spacer></v-spacer>
<v-btn fab small text>
<v-avatar size="32"><v-icon>mdi-volume-off</v-icon></v-avatar>
</v-btn>
</v-list-item>
<v-list-item class="mt-4">
<v-switch
dense
class="mt-0"
label="隐藏帮助按钮"
hint="隐藏悬浮按钮中的帮忙"
persistent-hint
v-model="box.usercfgs.isHideHelp"
@change="saveUserCfgs"
></v-switch>
<v-spacer></v-spacer>
<v-btn fab small text @click="open(box.syscfgs.boxjs.repo)">
<v-avatar size="32"><v-icon>mdi-help</v-icon></v-avatar>
</v-btn>
</v-list-item>
<v-list-item class="mt-4">
<v-switch
dense
class="mt-0"
label="隐藏悬浮按钮"
hint="右下角悬浮按钮"
persistent-hint
v-model="box.usercfgs.isHideBoxIcon"
@change="saveUserCfgs"
></v-switch>
<v-spacer></v-spacer>
<v-btn fab small text @click="open(box.syscfgs.boxjs.repo)">
<v-avatar size="32">
<img :src="box.syscfgs.boxjs.icons[iconThemeIdx]" />
</v-avatar>
</v-btn>
</v-list-item>
<v-list-item class="mt-4">
<v-switch
dense
class="mt-0"
label="隐藏我的标题"
hint="底栏`我的`二字 (只显示图标)"
persistent-hint
v-model="box.usercfgs.isHideMyTitle"
@change="saveUserCfgs"
></v-switch>
<v-spacer></v-spacer>
<v-btn fab small text>
<v-avatar v-if="box.usercfgs.icon" size="32">
<img :src="box.usercfgs.icon" />
</v-avatar>
<v-icon v-else size="32">mdi-face-profile</v-icon>
</v-btn>
</v-list-item>
<v-list-item class="mt-4">
<v-switch
dense
class="mt-0"
label="隐藏编码按钮"
hint="脚本编辑器的入口"
persistent-hint
v-model="box.usercfgs.isHideCoding"
@change="saveUserCfgs"
></v-switch>
<v-spacer></v-spacer>
<v-btn fab small text>
<v-avatar size="32"><v-icon>mdi-code-tags</v-icon></v-avatar>
</v-btn>
</v-list-item>
<v-list-item class="mt-4">
<v-switch
dense
class="mt-0"
label="隐藏刷新按钮"
hint="双击悬浮按钮也可刷新页面"
persistent-hint
v-model="box.usercfgs.isHideRefresh"
@change="saveUserCfgs"
></v-switch>
<v-spacer></v-spacer>
<v-btn fab small text>
<v-avatar size="32"><v-icon>mdi-refresh</v-icon></v-avatar>
</v-btn>
</v-list-item>
<v-list-item class="mt-4">
<v-switch
dense
class="mt-0"
label="调试模式 (页面)"
hint="每次访问都获取最新的页面"
persistent-hint
v-model="box.usercfgs.isDebugWeb"
@change="saveUserCfgs"
></v-switch>
<v-spacer></v-spacer>
<v-btn fab small text>
<v-avatar size="32"><v-icon>mdi-language-html5</v-icon></v-avatar>
</v-btn>
</v-list-item>
<v-list-item v-if="box.usercfgs.isDebugWeb">
<v-list-item-content>
<v-text-field
clearable
label="调试页面地址"
v-model="box.usercfgs.debugger_web"
hint="设置页面源码的获取地址"
placeholder="http://ip:port/boxjs.html"
persistent-hint
@change="saveUserCfgs"
>
</v-text-field>
</v-list-item-content>
</v-list-item>
<v-list-item class="mt-4"></v-list-item>
</v-list>
</v-navigation-drawer>
<!-- 主页 -->
<v-main class="appBarBind.app ? 'safe' : ''" v-scroll="onScroll">
<v-snackbar top app v-model="ui.snackbar.show" v-bind="ui.snackbar">{{ui.snackbar.msg}}</v-snackbar>
<!-- 主页 -->
<v-container
fluid
v-show="view === ''"
v-touch="{
up: () => {
if (isWallpaperMode) {
clearWallpaper()
setWallpaper()
}
},
down: () => {
if (isWallpaperMode) {
isWallpaperMode = !isWallpaperMode
}
}
}"
>
<v-row no-gutters v-show="!isHidedAppIcons" class="align-self-start">
<v-col cols="3" md="2" v-for="(app, appIdx) in favApps" :key="app.id" class="d-flex justify-space-around">
<div class="ma-2" @click="switchAppView(app.id)">
<v-card v-if="isDarkMode" style="border-radius: 12px;">
<v-img style="border-radius: 12px;" :aspect-ratio="1" width="54" height="54" contain v-ripple :src="app.icon"></v-img>
</v-card>
<v-img
v-else
style="border-radius: 12px;"
:aspect-ratio="1"
width="54"
height="54"
contain
v-ripple
class="elevation-3"
:src="app.icon"
></v-img>
<p class="text-center ma-0">
<span class="d-inline-block text-truncate font-weight-bold" :style="appIconFontStyle">
{{app.name}}
</span>
</p>
</div>
</v-col>
</v-row>
</v-container>
<!-- 应用列表 -->
<v-container fluid v-show="view === 'app' && !curapp">
<!-- 收藏应用 -->
<v-expansion-panels multiple class="mb-4" v-if="favApps.length > 0" v-model="box.usercfgs.favapppanel">
<v-expansion-panel>
<v-expansion-panel-header>
收藏应用 ({{favApps.length}})
</v-expansion-panel-header>
<v-expansion-panel-content>
<v-list dense nav class="ma-n4">
<template v-for="(app, appIdx) in favApps">
<v-list-item dense @click="switchAppView(app.id)" :key="app.id">
<v-list-item-avatar class="elevation-3"><v-img :src="app.icon" /></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title>{{app.name}} ({{app.id}})</v-list-item-title>
<v-list-item-subtitle>{{app.repo}}</v-list-item-subtitle>
<v-list-item-subtitle>{{app.author}}</v-list-item-subtitle>
</v-list-item-content>
<v-list-item-action>
<v-menu bottom left>
<template #activator="{ on }">
<v-btn icon v-on="on"><v-icon>mdi-dots-vertical</v-icon></v-btn>
</template>
<v-list>
<v-list-item dense v-if="appIdx > 0" @click="moveFav(appIdx, -1)">
<v-list-item-title>上移</v-list-item-title>
</v-list-item>
<v-list-item dense v-if="appIdx + 1 < favApps.length" @click="moveFav(appIdx, 1)">
<v-list-item-title>下移</v-list-item-title>
</v-list-item>
<v-divider v-if="favApps.length > 1"></v-divider>
<v-list-item dense @click="favApp(app.id)">
<v-list-item-title>取消收藏</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</v-list-item-action>
</v-list-item>
<!-- <v-divider inset v-if="favApps.length !== appIdx + 1"></v-divider> -->
</template>
</v-list>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
<!-- 订阅应用 -->
<v-expansion-panels multiple class="mb-4" v-if="appSubs.length > 0" v-model="box.usercfgs.subapppanel">
<v-expansion-panel v-for="(sub, subIdx) in appSubs" :key="sub.id" v-if="!sub.isErr">
<v-expansion-panel-header>
{{sub.name}} ({{sub.apps.length}})
</v-expansion-panel-header>
<v-expansion-panel-content>
<v-list dense nav class="ma-n4">
<template v-for="(app, appIdx) in sub.apps">
<v-list-item dense @click="switchAppView(app.id)" :key="app.id">
<v-list-item-avatar class="elevation-3"><v-img :src="app.icon" /></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title>{{app.name}} ({{app.id}})</v-list-item-title>
<v-list-item-subtitle>{{app.repo}}</v-list-item-subtitle>
<v-list-item-subtitle>{{app.author}}</v-list-item-subtitle>
</v-list-item-content>
<v-list-item-action>
<v-btn icon @click.stop="favApp(app.id)">
<v-icon :color="app.favIconColor" v-text="app.favIcon" />
</v-btn>
</v-list-item-action>
</v-list-item>
<!-- <v-divider inset v-if="sub.apps.length !== appIdx + 1"></v-divider> -->
</template>
</v-list>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
<!-- 内置应用 -->
<v-expansion-panels multiplev-if="sysApps.length > 0" v-model="box.usercfgs.sysapppanel">
<v-expansion-panel>
<v-expansion-panel-header>
内置应用 ({{sysApps.length}})
</v-expansion-panel-header>
<v-expansion-panel-content>
<v-list dense nav class="ma-n4">
<template v-for="(app, appIdx) in sysApps">
<v-list-item dense @click="switchAppView(app.id)" :key="app.id">
<v-list-item-avatar class="elevation-3"><v-img :src="app.icon" /></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title>{{app.name}} ({{app.id}})</v-list-item-title>
<v-list-item-subtitle>{{app.repo}}</v-list-item-subtitle>
<v-list-item-subtitle>{{app.author}}</v-list-item-subtitle>
</v-list-item-content>
<v-list-item-action>
<v-btn icon @click.stop="favApp(app.id)">
<v-icon :color="app.favIconColor" v-text="app.favIcon" />
</v-btn>
</v-list-item-action>
</v-list-item>
<!-- <v-divider inset v-if="sysApps.length !== appIdx + 1"></v-divider> -->
</template>
</v-list>
</v-expansion-panel-content>
</v-expansion-panel>
</v-expansion-panels>
</v-container>
<!-- 订阅列表 -->
<v-container fluid v-show="view === 'sub'">
<template v-if="appSubs.length === 0">
<v-btn block class="primary" @click="addAppSubDialog = true">添加订阅</v-btn>
<v-btn block class="primary" @click="open('https://chavyleung.gitbook.io/boxjs/awesome/subscriptions')">
<v-icon class="mr-2">mdi-cloud</v-icon>进来看看
</v-btn>
</template>
<v-card v-else>
<v-list dense nav>
<v-subheader inset dense>
应用订阅 ({{appSubs.length}})
<v-spacer></v-spacer>
<v-btn icon @click="open('https://chavyleung.gitbook.io/boxjs/awesome/subscriptions')">
<v-icon>mdi-cloud-circle</v-icon>
</v-btn>
<v-btn icon @click="reloadAppSub()">
<v-icon>mdi-refresh-circle</v-icon>
</v-btn>
<v-btn icon>
<v-icon color="primary" @click="addAppSubDialog = true">mdi-plus-circle</v-icon>
</v-btn>
</v-subheader>
<template v-for="(sub, subIdx) in appSubs">
<v-list-item dense two-line @click="reloadAppSub(sub)" :key="sub.id">
<v-list-item-avatar v-if="sub.icon"><v-img :src="sub.icon" /></v-list-item-avatar>
<v-list-item-avatar v-else color="primary"><v-icon dark>mdi-account</v-icon></v-list-item-avatar>
<v-list-item-content>
<v-list-item-title>
{{sub.name}} ({{sub.apps.length}})
<v-chip v-if="sub.isErr" color="pink" dark x-small class="ml-1 mb-1">格式错误</v-chip>
</v-list-item-title>
<v-list-item-subtitle>{{sub.repo ? sub.repo : sub.url}}</v-list-item-subtitle>
<v-list-item-subtitle>{{sub.author ? sub.author : '@anonymous'}}</v-list-item-subtitle>
<v-list-item-subtitle>
更新于: {{timeago.format(sub.updateTime, 'zh_CN')}}
</v-list-item-subtitle>
</v-list-item-content>
<v-list-item-action>
<v-menu bottom left>
<template #activator="{ on }">
<v-btn icon v-on="on"><v-icon>mdi-dots-vertical</v-icon></v-btn>
</template>
<v-list dense>
<v-list-item @click="open(sub.repo)">
<v-list-item-title>仓库</v-list-item-title>
</v-list-item>
<v-list-item @click="copy(sub.url)">
<v-list-item-title>复制</v-list-item-title>
</v-list-item>
<v-divider></v-divider>
<v-list-item v-if="subIdx > 0" @click="moveSub(subIdx, -1)">
<v-list-item-title>上移</v-list-item-title>
</v-list-item>
<v-list-item v-if="subIdx + 1 < appSubs.length" @click="moveSub(subIdx, 1)">
<v-list-item-title>下移</v-list-item-title>
</v-list-item>
<v-divider></v-divider>
<v-list-item @click="delSub(subIdx)">
<v-list-item-title>删除</v-list-item-title>
</v-list-item>
</v-list>
</v-menu>
</v-list-item-action>
</v-list-item>
<!-- <v-divider inset v-if="appSubs.length !== subIdx + 1"></v-divider> -->
</template>
</v-list>
</v-card>
<v-dialog v-model="addAppSubDialog" scrollable>
<v-card>
<v-card-title>添加订阅</v-card-title>
<v-divider></v-divider>
<v-card-text>
<v-textarea
rows="3"
clearable
autofocus
persistent-hint
v-model="ui.addAppSubDialog.url"
label="订阅地址 (URL)"
hint="请粘贴 URL 格式的订阅地址!"
></v-textarea>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn text small color="grey" @click="addAppSubDialog = false">取消</v-btn>
<v-btn text small color="primary" @click="addAppSub(ui.addAppSubDialog.url)" :loading="isLoading">添加</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-container>
<!-- 我的 -->
<v-container fluid v-show="view === 'my'">
<v-card class="mx-auto">
<v-card-title class="headline">
{{box.usercfgs.name ? box.usercfgs.name : '大侠, 留个名字吧!'}}
<v-spacer></v-spacer>
<v-dialog v-model="ui.editProfileDialog.show">
<template #activator="{ on }">
<v-btn icon v-on="on"><v-icon>mdi-cog-outline</v-icon></v-btn>
</template>
<v-card>
<v-card-title>个人资料</v-card-title>
<v-divider></v-divider>
<v-card-text>
<v-text-field label="昵称" v-model="box.usercfgs.name" hint="少侠请留名!"></v-text-field>
<v-text-field label="头像 (选填)" v-model="box.usercfgs.icon" hint="头像链接, 建议直接从 GitHub 获取!"></v-text-field>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn text small color="grey" @click="ui.editProfileDialog.show = false">取消</v-btn>
<v-btn text small color="primary" @click="ui.editProfileDialog.show = false" :loading="isLoading">保存</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
</v-card-title>
<v-divider class="mx-4"></v-divider>
<v-card-text>
<span class="subheading">我的数据</span>
<v-chip-group>
<v-chip small>应用: {{this.apps.length}}</v-chip>
<v-chip small>订阅: {{this.appSubs.length}}</v-chip>
<v-chip small>会话: {{this.sessions.length}}</v-chip>
</v-chip-group>
</v-card-text>
<v-card-actions>
<!-- <v-btn text small color="red" @click="">抹掉数据</v-btn> -->
<v-spacer></v-spacer>
<v-dialog v-model="ui.impGlobalBakDialog.show">
<template #activator="{ on }">
<v-btn small v-on="on">导入</v-btn>
</template>
<v-card>
<v-card-title>
导入备份
</v-card-title>
<v-divider></v-divider>
<v-card-text>
<v-textarea
rows="3"
clearable
autofocus
v-model="ui.impGlobalBakDialog.impval"
label="备份内容"
hint="请粘贴全局备份内容!"
></v-textarea>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn text small color="grey" text @click="ui.impGlobalBakDialog.show = false">取消</v-btn>
<v-btn text small color="primary" text @click="impGlobalBak" :loading="isLoading">导入</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-btn small @click="saveGlobalBak">备份</v-btn>
</v-card-actions>
</v-card>
<v-card class="mt-4" v-if="box.globalbaks">
<template v-for="(bak, bakIdx) in box.globalbaks">
<v-divider v-if="bakIdx>0"></v-divider>
<v-list-item dense @click="switchBakView(bak.id)">
<v-list-item-content>
<v-list-item-title>{{bak.name}}</v-list-item-title>
<v-list-item-subtitle>{{dayjs(bak.createTime).format('YYYY-MM-DD HH:mm:ss')}}</v-list-item-subtitle>
<v-list-item-subtitle>
<v-chip x-small class="mr-2" v-for="(tag, tagIdx) in bak.tags" :key="tagIdx">{{tag}}</v-chip>
</v-list-item-subtitle>
</v-list-item-content>
<v-list-item-action>
<v-btn icon><v-icon>mdi-chevron-right</v-icon></v-btn>
</v-list-item-action>
</v-list-item>
</template>
</v-card>
</v-container>
<!-- 代码编辑 -->
<v-container fluid v-show="view === 'coding'">
<v-card rounded="0" flat style="width: inherit;">
<v-subheader>
<h2>脚本编辑器</h2>
<v-spacer></v-spacer>
<v-btn icon @click="runTxtScript" :loading="isLoading">
<v-icon color="primary">mdi-play-circle</v-icon>
</v-btn>
</v-subheader>
</v-card>
<div class="pa-0" id="container" style="width: inherit; height: inherit;"></div>
</v-container>
<!-- 应用详情 -->
<v-container fluid v-if="view === 'app' && !!curapp">
<v-subheader>
<h2 :style="appTitleStyle">{{curapp.name}}</h2>
<v-spacer></v-spacer>
<v-btn v-if="curapp.script" icon :loading="isLoading" @click="runRemoteScript(curapp.script, curapp.script_timeout)">
<v-icon color="primary">mdi-play-circle</v-icon>
</v-btn>
</v-subheader>
<v-card class="mb-4" v-if="curapp.desc || curapp.descs || curapp.desc_html || curapp.descs_html">
<v-card-subtitle>
<p v-if="curapp.desc" v-text="curapp.desc" class="text-pre-wrap"></p>
<p
v-for="(desc, descIdx) in curapp.descs"
v-text="desc"
:class="curapp.descs.length === descIdx + 1 ? 'curapptext-pre-wrap' : 'mb-0 text-pre-wrap'"
></p>
<p v-if="curapp.desc_html" v-html="curapp.desc_html"></p>
<div v-for="(desc_html, desc_htmlIdx) in curapp.descs_html" v-html="desc_html"></div>
</v-card-subtitle>
</v-card>
<v-card class="mb-4">
<template v-if="curapp.scripts">
<v-subheader>
应用脚本 ({{curapp.scripts.length}})
</v-subheader>
<v-list dense>
<v-list-item v-for="(script, scriptIdx) in curapp.scripts" :key="scriptIdx">
<v-list-item-title>
{{scriptIdx + 1}}. {{script.name}}
</v-list-item-title>
<v-btn icon :loading="isLoading" @click.stop="runRemoteScript(script.script, script.script_timeout)">
<v-icon>mdi-play-circle</v-icon>
</v-btn>
</v-list-item>
</v-list>
</template>
</v-card>
<v-card class="mb-4">
<template v-if="curapp.settings">
<v-subheader>
应用设置 ({{curapp.settings.length}})
</v-subheader>
<v-form class="pl-4 pr-4 pb-4">
<template v-for="(setting, settingIdx) in curapp.settings">
<v-slider
v-model="setting.val"
v-bind="setting"
class="mt-4"
dense
persistent-hint
:label="setting.name"
:hint="setting.desc"
thumb-label="always"
v-if="setting.type === 'slider'"
></v-slider>
<v-switch
v-model="setting.val"
class="mt-2"
persistent-hint
dense
:label="setting.name"
:hint="setting.desc"
v-else-if="setting.type === 'boolean'"
></v-switch>
<v-textarea
v-model="setting.val"
v-bind="setting"
class="mt-4"
:row="3"
:label="setting.name"
:hint="setting.desc"
v-else-if="setting.type === 'textarea'"
></v-textarea>
<v-radio-group
v-model="setting.val"
v-bind="setting"
persistent-hint
class="mt-0"
:hint="setting.desc"
v-else-if="setting.type === 'radios'"
>
<v-subheader class="mb-n4 pa-0">{{setting.name}}</v-subheader>
<v-radio
:class="itemIdx === 0 ? 'mt-2' : ''"
v-for="(item, itemIdx) in setting.items"
:label="item.label"
:value="item.key"
:key="item.key"
></v-radio>
</v-radio-group>
<template v-else-if="setting.type === 'checkboxes'">
<v-subheader class="mb-n8 pa-0">{{setting.name}}</v-subheader>
<v-item-group class="mt-4 pt-1">
<v-checkbox
v-model="setting.val"
class="mt-0"
persistent-hint
:hide-details="itemIdx + 1 !== setting.items.length"
:hint="setting.desc"
:label="item.label"
:value="item.key"
v-for="(item, itemIdx) in setting.items"
:key="item.key"
multiple
></v-checkbox>
</v-item-group>
</template>
<template v-else-if="setting.type === 'colorpicker'">
<v-subheader class="mb-n2 pa-0">{{setting.name}}</v-subheader>
<v-color-picker
v-model="setting.val"
v-bind="setting"
class="mt-2 mb-4"
persistent-hint
:hint="setting.desc"
:hide-canvas="!setting.canvas"
:dot-size="30"
mode="hexa"
light
></v-color-picker>
</template>
<div class="mt-4" v-else-if="setting.type === 'number'">
<v-text-field
v-model="setting.val"
v-bind="setting"
type="number"
:label="setting.name"
:hint="setting.desc"
></v-text-field>
</div>
<div class="mt-4" v-else>
<v-text-field v-model="setting.val" v-bind="setting" :label="setting.name" :hint="setting.desc"></v-text-field>
</div>
</template>
</v-form>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn small text color="primary" @click="saveAppSettings">保存设置</v-btn>
</v-card-actions>
</template>
</v-card>
<v-card class="mx-auto" v-if="curapp.datas && curapp.datas.length > 0">
<v-subheader>
当前会话
<a class="ml-2">{{curapp.curSession ? curapp.curSession.name : ''}}</a>
<v-spacer></v-spacer>
<v-menu bottom left>
<template #activator="{ on }">
<v-btn icon v-on="on"><v-icon>mdi-dots-vertical</v-icon></v-btn>
</template>
<v-list dense>
<v-list-item @click="copy(JSON.stringify(curapp))">
<v-list-item-title>复制会话</v-list-item-title>
</v-list-item>
<v-dialog v-model="ui.impAppDatasDialog.show">
<template #activator="{ on }">
<v-list-item v-on="on">
<v-list-item-title>导入会话</v-list-item-title>
</v-list-item>
</template>
<v-card>
<v-card-title>
导入会话