master
yutent 2023-01-14 16:54:11 +08:00
parent e13ea89048
commit b0972667c4
3 changed files with 55 additions and 49 deletions

View File

@ -7,7 +7,7 @@
<title>{{title}}</title>
<meta name="keywords" content="{{keywords}}">
<meta name="description" content="{{description}}">
<link rel="stylesheet" href="//esm.js.io/@bytedo/wcui/dist/css/reset-basic.css">
<link rel="stylesheet" href="//jscdn.ink/@bytedo/wcui/dist/css/reset-basic.css">
<script async src="//esm.tool/es-module-shims.wasm.js"></script>
<script type="importmap">{{importmap}}</script>
</head>

View File

@ -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'

View File

@ -6,7 +6,9 @@
<section class="field">
<span class="label">订阅地址</span>
<wc-input class="full" v-model="remote.link"></wc-input>
<wc-button type="info" :disabled="!remote.link" @click="updateRemote"></wc-button>
<wc-button type="info" :disabled="!remote.link" @click="updateRemote"
>更新</wc-button
>
</section>
<wc-scroll class="scroll">
@ -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)
// })
}
}
}