From b0972667c46d06feb36b6dfe55413883398c8325 Mon Sep 17 00:00:00 2001 From: yutent Date: Sat, 14 Jan 2023 16:54:11 +0800 Subject: [PATCH] update --- index.html | 2 +- src/main.js | 8 ++-- src/views/remote.vue | 94 +++++++++++++++++++++++--------------------- 3 files changed, 55 insertions(+), 49 deletions(-) diff --git a/index.html b/index.html index bc72428..5ac8044 100644 --- a/index.html +++ b/index.html @@ -7,7 +7,7 @@ {{title}} - + diff --git a/src/main.js b/src/main.js index 6928844..2d58cbc 100644 --- a/src/main.js +++ b/src/main.js @@ -8,10 +8,10 @@ import { createApp } from 'vue' import '@/assets/app.scss' -import '//esm.js.io/@bytedo/wcui/dist/layer/index.js' -import '//esm.js.io/@bytedo/wcui/dist/form/switch.js' -import '//esm.js.io/@bytedo/wcui/dist/form/radio.js' -import '//esm.js.io/@bytedo/wcui/dist/form/button.js' +import '//jscdn.ink/@bytedo/wcui/dist/layer/index.js' +import '//jscdn.ink/@bytedo/wcui/dist/form/switch.js' +import '//jscdn.ink/@bytedo/wcui/dist/form/radio.js' +import '//jscdn.ink/@bytedo/wcui/dist/form/button.js' import App from './app.vue' diff --git a/src/views/remote.vue b/src/views/remote.vue index f55fd46..c798616 100644 --- a/src/views/remote.vue +++ b/src/views/remote.vue @@ -6,7 +6,9 @@
订阅地址 - 更新 + 更新
@@ -40,47 +42,50 @@ export default { let txt = '' let names = ['DIRECT'] - this.remote.list = data.split('\n').map(it => { - let tmp = decodeURIComponent(it).split('#') - let tmp2 = new URL(tmp[0]) - let protocol = tmp2.protocol.slice(0, -1) - let path = tmp2.pathname.slice(2) - let info = { name: tmp.pop().trim(), type: protocol, udp: true } + this.remote.list = data + .trim() + .split('\n') + .map(it => { + let tmp = decodeURIComponent(it).split('#') + let tmp2 = new URL(tmp[0]) + let protocol = tmp2.protocol.slice(0, -1) + let path = tmp2.pathname.slice(2) + let info = { name: tmp.pop().trim(), type: protocol, udp: true } - path = path.split(':') + path = path.split(':') - info.port = path.pop() + info.port = path.pop() - path = path[0].split('@') - info.server = path.pop() + path = path[0].split('@') + info.server = path.pop() - switch (protocol) { - case 'ss': - path = atob(path[0]).split(':') - console.log(path) - Object.assign(info, { - cipher: path[0], - password: path[1] - }) - break + switch (protocol) { + case 'ss': + path = atob(path[0]).split(':') + console.log(path) + Object.assign(info, { + cipher: path[0], + password: path[1] + }) + break - case 'trojan': - Object.assign(info, { - password: path[0], - sni: tmp2.searchParams.get('sni'), - 'skip-cert-verify': true - }) - break - } + case 'trojan': + Object.assign(info, { + password: path[0], + sni: tmp2.searchParams.get('sni'), + 'skip-cert-verify': true + }) + break + } - names.push(`"${info.name}"`) - txt += ` - { name: ${info.name}, type: ${info.type}, server: ${info.server}, port: ${ - info.port - }, password: ${info.password}, udp: true, ${info.type === 'ss' ? 'cipher' : 'sni'}: ${ - info.type === 'ss' ? info.cipher : info.sni - }}\n` - return [info.name, info.type] - }) + names.push(`"${info.name}"`) + txt += ` - { name: ${info.name}, type: ${info.type}, server: ${ + info.server + }, port: ${info.port}, password: ${info.password}, udp: true, ${ + info.type === 'ss' ? 'cipher' : 'sni' + }: ${info.type === 'ss' ? info.cipher : info.sni}}\n` + return [info.name, info.type] + }) window.foo = txt window.bar = names.join(', ') @@ -95,15 +100,16 @@ export default { return } - window - .fetch(this.remote.link) - .then(r => r.text()) - .then(r => { - r = atob(r).trim() + // window + // .fetch(this.remote.link) + // .then(r => r.text()) + // .then(r => { + // r = atob(r).trim() + let r = sessionStorage.getItem('temp') - layer.toast('订阅更新成功', 'success') - this.parseBookData(r) - }) + layer.toast('订阅更新成功', 'success') + this.parseBookData(r) + // }) } } }