11const $ = new Env ( 'BoxJs' )
22$ . domain = '8.8.8.8'
33
4- $ . version = '0.2.2 '
4+ $ . version = '0.3.0 '
55$ . versionType = 'beta'
66$ . KEY_sessions = 'chavy_boxjs_sessions'
77$ . KEY_versions = 'chavy_boxjs_versions'
@@ -323,7 +323,7 @@ async function getAppSubs() {
323323 const sub = usercfgs . appsubs [ subIdx ]
324324 subActs . push (
325325 new Promise ( ( resolve ) => {
326- $ . get ( { url : sub . url } , ( err , resp , data ) => {
326+ $ . get ( { url : sub . url . replace ( / [ ] | [ \r \n ] / g , '' ) } , ( err , resp , data ) => {
327327 try {
328328 const respsub = JSON . parse ( data )
329329 if ( Array . isArray ( respsub . apps ) ) {
@@ -396,8 +396,7 @@ function getSessions() {
396396async function getVersions ( ) {
397397 let vers = [ ]
398398 await new Promise ( ( resolve ) => {
399- // const verurl = 'https://github.com/chavyleung/scripts/raw/master/box/release/box.release.json'
400- const verurl = 'https://gist.github.com/chavyleung/e1f1021391143c961d925bcdc21dca24/raw/4185a281c1861ceadd870ca55a497077ae6fefc2/box.release.json'
399+ const verurl = 'https://github.com/chavyleung/scripts/raw/master/box/release/box.release.json'
401400 $ . get ( { url : verurl } , ( err , resp , data ) => {
402401 try {
403402 const _data = JSON . parse ( data )
@@ -658,7 +657,24 @@ function printHtml(data, curapp = null, curview = 'app') {
658657 </v-list>
659658 </v-menu>
660659 <v-btn icon @click="ui.curview = ui.bfview" v-else><v-icon>mdi-chevron-left</v-icon></v-btn>
661- <v-autocomplete :label="ui.curapp ? ui.curapp.name + ' ' + ui.curapp.author : 'BoxJs - v' + box.syscfgs.version" no-data-text="未实现" dense hide-details solo> </v-autocomplete>
660+ <v-autocomplete v-model="ui.autocomplete.curapp" :items="apps" :filter="appfilter" :menu-props="{ closeOnContentClick: true, overflowY: true }" :label="ui.curapp ? ui.curapp.name + ' ' + ui.curapp.author : 'BoxJs - v' + box.syscfgs.version" no-data-text="未实现" dense hide-details solo>
661+ <template v-slot:item="{ item }">
662+ <v-list-item @click="goAppSessionView(item)">
663+ <v-list-item-avatar>
664+ <img :src="item.icons[box.usercfgs.isTransparentIcons ? 0 : 1]">
665+ </v-list-item-avatar>
666+ <v-list-item-content>
667+ <v-list-item-title>{{ item.name }} ({{ item.id }})</v-list-item-title>
668+ <v-list-item-subtitle>{{ item.repo }}</v-list-item-subtitle>
669+ <v-list-item-subtitle>{{ item.author }}</v-list-item-subtitle>
670+ </v-list-item-content>
671+ <v-list-item-action>
672+ <v-btn icon v-if="item.isFav" @click.stop="onFav(item)"><v-icon color="yellow darken-2">mdi-star</v-icon></v-btn>
673+ <v-btn icon v-else @click.stop="onFav(item)"><v-icon color="grey">mdi-star-outline</v-icon></v-btn>
674+ </v-list-item-action>
675+ </v-list-item>
676+ </template>
677+ </v-autocomplete>
662678 <v-btn icon @click="ui.drawer.show = true">
663679 <v-avatar size="26">
664680 <img :src="box.syscfgs.orz3.icon" :alt="box.syscfgs.orz3.repo" />
@@ -1121,9 +1137,11 @@ function printHtml(data, curapp = null, curview = 'app') {
11211137 </v-expand-transition>
11221138 <v-bottom-sheet v-model="ui.versheet.show" hide-overlay scrollable>
11231139 <v-card flat scrollable>
1124- <v-subheader>
1140+ <v-subheader class="my-4" >
11251141 <v-btn text @click="ui.versheet.show = false, ui.updatesheet.show = true">升级教程</v-btn>
11261142 <v-spacer></v-spacer>
1143+ <v-btn text>新版本</v-btn>
1144+ <v-spacer></v-spacer>
11271145 <v-btn text @click="ui.versheet.show = false">朕, 知道了!</v-btn>
11281146 </v-subheader>
11291147 <v-card-text>
@@ -1238,6 +1256,7 @@ function printHtml(data, curapp = null, curview = 'app') {
12381256 curappTabs: { curtab: 'sessions' },
12391257 curappSessions: null,
12401258 overlay: { show: false },
1259+ autocomplete: { curapp: null },
12411260 editProfileDialog: { show: false, bak: '' },
12421261 impGlobalBakDialog: { show: false, bak: '' },
12431262 reloadConfirmDialog: { show: false, title: '操作成功', message: '是否马上刷新页面?' },
@@ -1255,6 +1274,13 @@ function printHtml(data, curapp = null, curview = 'app') {
12551274 }
12561275 },
12571276 computed: {
1277+ apps: function () {
1278+ const apps = []
1279+ apps.push(...this.box.sysapps)
1280+ this.box.appsubs.forEach((sub, subIdx) => apps.push(...sub.apps))
1281+ apps.sort((a, b) => a.id.localeCompare(b.id))
1282+ return apps
1283+ },
12581284 appcnt: function () {
12591285 let cnt = 0
12601286 cnt += Array.isArray(this.box.sysapps) ? this.box.sysapps.length : 0
@@ -1368,6 +1394,9 @@ function printHtml(data, curapp = null, curview = 'app') {
13681394 }
13691395 },
13701396 methods: {
1397+ appfilter(item, queryText, itemText) {
1398+ return item.id.includes(queryText) || item.name.includes(queryText)
1399+ },
13711400 onLink(link) {
13721401 window.open(link)
13731402 },
0 commit comments