fixed
parent
1d9f7fb63c
commit
e13ea89048
|
@ -7,7 +7,7 @@
|
|||
<title>{{title}}</title>
|
||||
<meta name="keywords" content="{{keywords}}">
|
||||
<meta name="description" content="{{description}}">
|
||||
<link rel="stylesheet" href="//unpkg.debianx.in/@bytedo/wcui/dist/css/reset-basic.css">
|
||||
<link rel="stylesheet" href="//esm.js.io/@bytedo/wcui/dist/css/reset-basic.css">
|
||||
<script async src="//esm.tool/es-module-shims.wasm.js"></script>
|
||||
<script type="importmap">{{importmap}}</script>
|
||||
</head>
|
||||
|
|
|
@ -8,10 +8,10 @@ import { createApp } from 'vue'
|
|||
|
||||
import '@/assets/app.scss'
|
||||
|
||||
import '//unpkg.debianx.in/@bytedo/wcui/dist/layer/index.js'
|
||||
import '//unpkg.debianx.in/@bytedo/wcui/dist/form/switch.js'
|
||||
import '//unpkg.debianx.in/@bytedo/wcui/dist/form/radio.js'
|
||||
import '//unpkg.debianx.in/@bytedo/wcui/dist/form/button.js'
|
||||
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 App from './app.vue'
|
||||
|
||||
|
|
|
@ -36,25 +36,16 @@ export default {
|
|||
},
|
||||
|
||||
methods: {
|
||||
updateRemote() {
|
||||
if (this.remote.link) {
|
||||
if (!/^(https?:)?\/\//.test(this.remote.link)) {
|
||||
return layer.toast('订阅地址格式不正确', 'error')
|
||||
}
|
||||
localStorage.setItem('remote_link', this.remote.link)
|
||||
} else {
|
||||
return
|
||||
}
|
||||
parseBookData(data = '') {
|
||||
let txt = ''
|
||||
let names = ['DIRECT']
|
||||
let r = (sessionStorage.getItem('temp') || '').trim()
|
||||
|
||||
this.remote.list = r.split('\n').map(it => {
|
||||
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(), type: protocol, udp: true }
|
||||
let info = { name: tmp.pop().trim(), type: protocol, udp: true }
|
||||
|
||||
path = path.split(':')
|
||||
|
||||
|
@ -93,20 +84,25 @@ export default {
|
|||
|
||||
window.foo = txt
|
||||
window.bar = names.join(', ')
|
||||
// // console.log(txt)
|
||||
},
|
||||
updateRemote() {
|
||||
if (this.remote.link) {
|
||||
if (!/^(https?:)?\/\//.test(this.remote.link)) {
|
||||
return layer.toast('订阅地址格式不正确', 'error')
|
||||
}
|
||||
localStorage.setItem('remote_link', this.remote.link)
|
||||
} else {
|
||||
return
|
||||
}
|
||||
|
||||
return
|
||||
window
|
||||
.fetch(this.remote.link, { cors: true })
|
||||
.fetch(this.remote.link)
|
||||
.then(r => r.text())
|
||||
.then(r => {
|
||||
r = atob(r).trim()
|
||||
sessionStorage.setItem('temp', r)
|
||||
|
||||
layer.toast('订阅更新成功', 'success')
|
||||
this.remote.list = r.split('\n').map(it => {
|
||||
let tmp = decodeURIComponent(it).split('#')
|
||||
return [tmp.pop(), tmp[0]?.split('://').shift()]
|
||||
})
|
||||
this.parseBookData(r)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue