11const $ = new Env ( 'BoxJs' )
22
3- $ . version = '0.6.15 '
3+ $ . version = '0.6.16 '
44$ . versionType = 'beta'
55$ . KEY_sessions = 'chavy_boxjs_sessions'
66$ . KEY_versions = 'chavy_boxjs_versions'
@@ -95,6 +95,7 @@ function getSystemApps() {
9595 {
9696 id : 'BoxSetting' ,
9797 name : '偏好设置' ,
98+ descs : [ '可设置 http-api 地址 & 超时时间 (Surge TF)' , '可设置明暗两种主题下的主色调' ] ,
9899 keys : [ '@chavy_boxjs_userCfgs.httpapi' , '@chavy_boxjs_userCfgs.color_dark_primary' , '@chavy_boxjs_userCfgs.color_light_primary' ] ,
99100 settings : [
100101 { id : '@chavy_boxjs_userCfgs.httpapis' , name : 'HTTP-API (Surge TF)' , val : '' , type : 'textarea' , placeholder : ',examplekey@127.0.0.1:6166' , autoGrow : true , rows : 2 , desc : '示例: ,examplekey@127.0.0.1:6166! 注意: 以逗号开头, 逗号分隔多个地址, 可加回车' } ,
@@ -109,6 +110,7 @@ function getSystemApps() {
109110 {
110111 id : 'BoxSwitcher' ,
111112 name : '会话切换' ,
113+ desc : '打开静默运行后, 切换会话将不再发出系统通知 \n注: 不影响日志记录' ,
112114 keys : [ ] ,
113115 settings : [ { id : 'CFG_BoxSwitcher_isSilent' , name : '静默运行' , val : false , type : 'boolean' , desc : '切换会话时不发出系统通知!' } ] ,
114116 author : '@chavyleung' ,
@@ -510,7 +512,7 @@ async function handleHome() {
510512 const box = await getBoxData ( )
511513 $ . html = printHtml ( JSON . stringify ( box ) )
512514 if ( box . usercfgs . isDebugFormat ) {
513- console . log ( printHtml ( `'\${data}'` , `'\${curapp }'` , `\${curview}` ) )
515+ console . log ( printHtml ( `'\${data}'` , `'\${appId }'` , `\${curview}` ) )
514516 } else if ( box . usercfgs . isDebugData ) {
515517 console . log ( $ . html )
516518 }
@@ -528,9 +530,9 @@ async function handleApp(appId) {
528530 if ( curapp . script && $ . isSurge ( ) ) {
529531 await $ . getScript ( curapp . script ) . then ( ( script ) => ( curapp . script_text = script ) )
530532 }
531- $ . html = printHtml ( JSON . stringify ( box ) , JSON . stringify ( curapp ) , 'appsession' )
533+ $ . html = printHtml ( JSON . stringify ( box ) , appId )
532534 if ( box . usercfgs . isDebugFormat ) {
533- console . log ( printHtml ( `'\${data}'` , `'\${curapp }'` , `\${curview}` ) )
535+ console . log ( printHtml ( `'\${data}'` , `'\${appId }'` , `\${curview}` ) )
534536 } else if ( box . usercfgs . isDebugData ) {
535537 console . log ( $ . html )
536538 }
@@ -540,7 +542,7 @@ async function handleSub() {
540542 const box = await getBoxData ( )
541543 $ . html = printHtml ( JSON . stringify ( box ) , null , 'sub' )
542544 if ( box . usercfgs . isDebugFormat ) {
543- console . log ( printHtml ( `'\${data}'` , `'\${curapp }'` , `\${curview}` ) )
545+ console . log ( printHtml ( `'\${data}'` , `'\${appId }'` , `\${curview}` ) )
544546 } else if ( box . usercfgs . isDebugData ) {
545547 console . log ( $ . html )
546548 }
@@ -550,7 +552,7 @@ async function handleMy() {
550552 const box = await getBoxData ( )
551553 $ . html = printHtml ( JSON . stringify ( box ) , null , 'my' )
552554 if ( box . usercfgs . isDebugFormat ) {
553- console . log ( printHtml ( `'\${data}'` , `'\${curapp }'` , `\${curview}` ) )
555+ console . log ( printHtml ( `'\${data}'` , `'\${appId }'` , `\${curview}` ) )
554556 } else if ( box . usercfgs . isDebugData ) {
555557 console . log ( $ . html )
556558 }
@@ -711,7 +713,7 @@ function printRevertHtml() {
711713 `
712714}
713715
714- function printHtml ( data , curapp = null , curview = 'app' ) {
716+ function printHtml ( data , appId = '' , curview = 'app' ) {
715717 return `
716718 <!DOCTYPE html>
717719 <html lang="zh-CN">
@@ -735,6 +737,9 @@ function printHtml(data, curapp = null, curview = 'app') {
735737 padding-top: constant(safe-area-inset-top) !important;
736738 padding-top: env(safe-area-inset-top);
737739 }
740+ .text-pre-wrap {
741+ white-space: pre-wrap !important;
742+ }
738743 .v-app-bar,
739744 .v-navigation-drawer__content {
740745 box-sizing: content-box;
@@ -1044,6 +1049,14 @@ function printHtml(data, curapp = null, curview = 'app') {
10441049 <v-spacer></v-spacer>
10451050 <v-btn v-if="ui.curapp.script" icon @click="onRunScript(ui.curapp.script, ui.curapp.script_timeout)"><v-icon color="primary">mdi-play-circle</v-icon></v-btn>
10461051 </v-subheader>
1052+ <v-card flat class="mx-auto mb-4" color="transparent" v-if="ui.curapp.desc || ui.curapp.descs || ui.curapp.desc_html || ui.curapp.descs_html">
1053+ <v-card-text class="py-2">
1054+ <p v-if="ui.curapp.desc" v-text="ui.curapp.desc" class="body-2 text-pre-wrap"></p>
1055+ <p v-for="(desc, descIdx) in ui.curapp.descs" v-text="desc" :class="ui.curapp.descs.length === descIdx + 1 ? 'body-2 text-pre-wrap' : 'mb-0 body-2 text-pre-wrap'"></p>
1056+ <p v-if="ui.curapp.desc_html" v-html="ui.curapp.desc_html"></p>
1057+ <div v-for="(desc_html, desc_htmlIdx) in ui.curapp.descs_html" v-html="desc_html"></div>
1058+ </v-card-text>
1059+ </v-card>
10471060 <v-card class="mx-auto mb-4">
10481061 <template v-if="Array.isArray(ui.curapp.scripts)">
10491062 <v-subheader>
@@ -1554,6 +1567,7 @@ function printHtml(data, curapp = null, curview = 'app') {
15541567 <script src="https://cdn.jsdelivr.net/npm/uuid@latest/dist/umd/uuidv4.min.js"></script>
15551568 <script src="https://cdn.jsdelivr.net/npm/vue-clipboard2@0.3.1/dist/vue-clipboard.min.js"></script>
15561569 <script>
1570+ const boxdat = ${ data }
15571571 new Vue({
15581572 el: '#app',
15591573 vuetify: new Vuetify({ theme: { dark: true } }),
@@ -1563,7 +1577,8 @@ function printHtml(data, curapp = null, curview = 'app') {
15631577 scrollY: 0,
15641578 bfview: 'app',
15651579 curview: '${ curview } ',
1566- curapp: ${ curapp } ,
1580+ appId: '${ appId } ',
1581+ curapp: null,
15671582 curappTabs: { curtab: 'sessions' },
15681583 curappSessions: null,
15691584 overlay: { show: false, val: 60 },
@@ -1589,7 +1604,7 @@ function printHtml(data, curapp = null, curview = 'app') {
15891604 drawer: { show: false },
15901605 icons: ['https://raw.githubusercontent.com/Orz-3/mini/master/appstore.png', 'https://raw.githubusercontent.com/Orz-3/task/master/appstore.png']
15911606 },
1592- box: ${ data }
1607+ box: boxdat
15931608 }
15941609 },
15951610 computed: {
@@ -2144,7 +2159,8 @@ function printHtml(data, curapp = null, curview = 'app') {
21442159 this.getContributors()
21452160 this.ui.navi.show = true
21462161 this.ui.box.show = true
2147- if (this.ui.curapp) {
2162+ if (this.ui.appId) {
2163+ this.ui.curapp = this.apps.find(app => app.id === this.ui.appId)
21482164 this.goAppSessionView(this.ui.curapp)
21492165 }
21502166 if (this.ui.curview === 'sub') {
0 commit comments