forked from zZPiglet/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
chavy.boxjs.html
2947 lines (2933 loc) · 121 KB
/
chavy.boxjs.html
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>
<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/[email protected]/css/materialdesignicons.min.css" rel="stylesheet" />
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/vuetify.min.css" rel="stylesheet" />
<script src="https://cdn.jsdelivr.net/npm/sortablejs@latest/Sortable.min.js"></script>
<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;
}
.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-bottom-navigation button.v-btn:before {
background-color: transparent;
}
.v-speed-dial {
margin-bottom: calc(48px + constant(safe-area-inset-bottom));
margin-bottom: calc(48px + env(safe-area-inset-bottom));
}
.container.container--fluid {
padding-bottom: 68px;
}
.appicon {
user-select: none;
-webkit-user-select: none;
}
</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)"
>
</v-select>
<v-text-field
v-else
label="HTTP-API (Surge)"
v-model="box.usercfgs.httpapi"
hint="Surge http-api 地址."
placeholder="[email protected]:6166"
persistent-hint
@change="saveUserCfgs"
:rules="[(val)=> /.*?@.*?:[0-9]+/.test(val) || '格式错误: [email protected]:6166']"
>
</v-text-field>
</v-list-item-content>
</v-list-item>
<v-list-item>
<v-list-item-content>
<v-select
:items="[{text: 'English', value: 'en-US'}, {text: '简体中文', value: 'zh-CN'}]"
hide-details
label="Language"
v-model="box.usercfgs.lang"
>
</v-select>
</v-list-item-content>
</v-list-item>
<v-list-item>
<v-list-item-content>
<v-select
:items="[{text: $t('prefs.appearances.auto'), value: 'auto'}, {text: $t('prefs.appearances.dark'), value: 'dark'}, {text: $t('prefs.appearances.light'), value: 'light'}]"
:label="$t('prefs.appearance')"
hide-details
v-model="box.usercfgs.theme"
>
</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
:items="bgimgs"
:label="$t('prefs.background')"
@change="saveUserCfgs"
hide-details
item-text="name"
item-value="url"
v-model="box.usercfgs.bgimg"
>
</v-select>
</v-list-item-content>
</v-list-item>
<v-list-item class="mt-4">
<v-switch
:hide-details="isDarkMode"
:hint="$t('prefs.iconDesc')"
:label="$t('prefs.icon')"
:persistent-hint="true"
@change="saveUserCfgs"
class="mt-0"
dense
v-model="box.usercfgs.isTransparentIcons"
>
</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
:hint="$t('prefs.bgModeDesc')"
:label="$t('prefs.bgMode')"
:persistent-hint="true"
@change="saveUserCfgs"
class="mt-0"
dense
v-model="isWallpaperMode"
>
</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
:hint="$t('prefs.hideTopBarDesc')"
:label="$t('prefs.hideTopBar')"
:persistent-hint="true"
@change="saveUserCfgs"
class="mt-0"
dense
v-model="box.usercfgs.isHidedSearchBar"
>
</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
:hint="$t('prefs.autoTopBarDesc')"
:label="$t('prefs.autoTopBar')"
:persistent-hint="true"
@change="saveUserCfgs"
class="mt-0"
dense
v-model="isAutoSearchBar"
>
</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
:hint="$t('prefs.hideBottomBarDesc')"
:label="$t('prefs.hideBottomBar')"
:persistent-hint="true"
@change="saveUserCfgs"
class="mt-0"
dense
v-model="box.usercfgs.isHidedNaviBottom"
>
</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
:hint="$t('prefs.autoBottomBarDesc')"
:label="$t('prefs.autoBottomBar')"
:persistent-hint="true"
@change="saveUserCfgs"
class="mt-0"
dense
v-model="isAutoNaviBottom"
>
</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
:hint="$t('prefs.muteModeDesc')"
:label="$t('prefs.muteMode')"
@change="saveUserCfgs"
class="mt-0"
dense
persistent-hint
v-model="box.usercfgs.isMute"
></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
:hint="$t('prefs.hideHelpDesc')"
:label="$t('prefs.hideHelp')"
@change="saveUserCfgs"
class="mt-0"
dense
persistent-hint
v-model="box.usercfgs.isHideHelp"
></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
:hint="$t('prefs.hideBoxJsDesc')"
:label="$t('prefs.hideBoxJs')"
@change="saveUserCfgs"
class="mt-0"
dense
persistent-hint
v-model="box.usercfgs.isHideBoxIcon"
></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
:hint="$t('prefs.hideProfileTitleDesc')"
:label="$t('prefs.hideProfileTitle')"
@change="saveUserCfgs"
class="mt-0"
dense
persistent-hint
v-model="box.usercfgs.isHideMyTitle"
></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
:hint="$t('prefs.hideCoddingDesc')"
:label="$t('prefs.hideCodding')"
dense
class="mt-0"
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
:hint="$t('prefs.hideReloadDesc')"
:label="$t('prefs.hideReload')"
@change="saveUserCfgs"
class="mt-0"
dense
persistent-hint
v-model="box.usercfgs.isHideRefresh"
></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
:hint="$t('prefs.debugModeDesc')"
:label="$t('prefs.debugMode')"
@change="saveUserCfgs"
class="mt-0"
dense
persistent-hint
v-model="box.usercfgs.isDebugWeb"
></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
:hint="$t('prefs.debugPageDesc')"
:label="$t('prefs.debugPage')"
@change="saveUserCfgs"
clearable
persistent-hint
placeholder="http://ip:port/boxjs.html"
v-model="box.usercfgs.debugger_web"
>
</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
changeWallpaper()
}
}
}"
>
<v-row no-gutters v-show="!isHidedAppIcons" class="align-self-start" id="appList">
<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 appicon" @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> {{ $t('apps.fav') }} ({{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>{{ $t('base.sort.up') }}</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>{{ $t('base.sort.dn') }}</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>{{ $t('apps.unStar') }}</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> {{ $t('apps.sysApps') }} ({{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">{{ $t('subs.add') }}</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>{{ $t('subs.moreSubs') }}
</v-btn>
</template>
<v-card v-else>
<v-list dense nav>
<v-subheader inset dense>
{{ $t('subs.appSubs') }} ({{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">{{ $t('subs.errData') }}</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>
{{ $t('subs.updated') }}: {{ timeago.format(sub.updateTime, timeagoLang.replace('-', '_')) }}
</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>
<template v-if="sub.onInstall">
<v-list-item @click="openInstall(sub.raw.id)">
<v-list-item-title>{{ $t('subs.install') }}</v-list-item-title>
</v-list-item>
<v-divider></v-divider>
</template>
<v-list-item @click="open(sub.repo)">
<v-list-item-title>{{ $t('subs.repo') }}</v-list-item-title>
</v-list-item>
<v-list-item @click="copy(sub.url)">
<v-list-item-title>{{ $t('base.cmd.cp') }}</v-list-item-title>
</v-list-item>
<v-list-item @click="share(sub.url)">
<v-list-item-title>{{ $t('base.cmd.share') }}</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>{{ $t('base.sort.up') }}</v-list-item-title>
</v-list-item>
<v-list-item v-if="subIdx + 1 < appSubs.length" @click="moveSub(subIdx, 1)">
<v-list-item-title>{{ $t('base.sort.dn') }}</v-list-item-title>
</v-list-item>
<v-divider></v-divider>
<v-list-item @click="delSub(subIdx)">
<v-list-item-title class="text-uppercase red--text">{{ $t('base.cmd.del') }}</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>{{ $t('subs.addDialog.title') }}</v-card-title>
<v-divider></v-divider>
<v-card-text>
<v-textarea
:label="$t('subs.addDialog.url')"
:hint="$t('subs.addDialog.urlDesc')"
autofocus
clearable
persistent-hint
rows="3"
v-model="ui.addAppSubDialog.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"> {{$t('base.dialog.close')}} </v-btn>
<v-btn text small color="primary" @click="addAppSub(ui.addAppSubDialog.url)" :loading="isLoading">
{{$t('base.dialog.save')}}
</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-dialog persistent v-model="ui.installConfirmDialog.show">
<v-card>
<v-card-title>{{ ui.installConfirmDialog.title }}</v-card-title>
<v-card-text> {{ ui.installConfirmDialog.message }}</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn text small color="grey" @click="ui.installConfirmDialog.show = false"> {{$t('base.dialog.close')}} </v-btn>
<v-btn text small color="primary" @click="install(ui.installConfirmDialog.url)" :loading="isLoading">
{{$t('base.dialog.ok')}}
</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 : $t('profile.leaveName')}}
<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>{{ $t('profile.editor.title') }}</v-card-title>
<v-divider></v-divider>
<v-card-text>
<v-text-field
:hint="$t('profile.editor.nameDesc')"
:label="$t('profile.editor.name')"
v-model="box.usercfgs.name"
></v-text-field>
<v-text-field
:hint="$t('profile.editor.avatarDesc')"
:label="$t('profile.editor.avatar')"
v-model="box.usercfgs.icon"
></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">{{ $t('base.dialog.close') }}</v-btn>
<v-btn text small color="primary" @click="ui.editProfileDialog.show = false" :loading="isLoading">
{{ $t('base.dialog.save') }}
</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">{{ $t('profile.datas') }}</span>
<v-chip-group>
<v-chip small>{{ $t('profile.apps') }}: {{this.apps.length}}</v-chip>
<v-chip small>{{ $t('profile.subs') }}: {{this.appSubs.length}}</v-chip>
<v-chip small>{{ $t('profile.sessions') }}: {{this.sessions.length}}</v-chip>
</v-chip-group>
</v-card-text>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn small class="mr-2" @click="switchView('viewer')"> {{ $t('profile.dataviewer')}} </v-btn>
<v-dialog v-model="ui.impGlobalBakDialog.show">
<template #activator="{ on }">
<v-btn small v-on="on">{{ $t('profile.imp') }}</v-btn>
</template>
<v-card>
<v-card-title> {{ $t('profile.impDialog.title') }} </v-card-title>
<v-divider></v-divider>
<v-card-text>
<v-textarea
:hint="$t('profile.impDialog.impDataDesc')"
:label="$t('profile.impDialog.impData')"
autofocus
clearable
rows="3"
v-model="ui.impGlobalBakDialog.impval"
></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">{{ $t('base.dialog.close') }}</v-btn>
<v-btn text small color="primary" text @click="impGlobalBak" :loading="isLoading">{{ $t('profile.imp') }}</v-btn>
</v-card-actions>
</v-card>
</v-dialog>
<v-btn small @click="saveGlobalBak">{{ $t('profile.bak') }}</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 === 'viewer'">
<v-card class="mb-4">
<v-subheader>
{{ $t('viewer.dataViewer') }}
<v-spacer></v-spacer>
<v-btn color="primary" small @click="copy(ui.viewer.key)"> {{ $t('base.cmd.cp') }} </v-btn>
</v-subheader>
<v-card-text>
<v-text-field
:hint="$t('viewer.dataKeyDesc')"
:label="$t('viewer.dataKey')"
persistent-hint
placeholder="boxjs_host"
v-model="ui.viewer.key"
>
</v-text-field>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<!-- TODO 列出最近查询过的 key -->
<v-spacer></v-spacer>
<v-btn small text color="primary" @click="queryData">{{ $t('base.dialog.view') }}</v-btn>
</v-card-actions>
</v-card>
<v-card class="mb-4">
<v-subheader>
{{ $t('viewer.dataEditor') }}
<v-spacer></v-spacer>
<v-btn color="primary" small @click="copy(ui.viewer.val)"> {{ $t('base.cmd.cp') }} </v-btn>
</v-subheader>
<v-card-text>
<v-textarea v-model="ui.viewer.val" :row="3" :label="$t('viewer.dataVal')"> </v-textarea>
</v-card-text>
<v-divider></v-divider>
<v-card-actions>
<v-spacer></v-spacer>
<v-btn small text color="primary" @click="saveData">{{ $t('base.dialog.save') }}</v-btn>
</v-card-actions>
</v-card>
</v-container>
<!-- 代码编辑 -->
<v-container fluid v-show="view === 'coding'">
<v-card rounded="0" flat style="width: inherit">
<v-subheader>
<h2>{{ $t('codding.title') }}</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 ? 'text-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> {{ $t('appDetail.scripts') }} ({{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> {{ $t('appDetail.settings') }} ({{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"