diff --git a/.gitignore b/.gitignore index 553e134..c1ddca6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ node_modules # Quasar core related directories .quasar /dist +/public/res # Cordova related directories and files /src-cordova/node_modules diff --git a/public/img/clash.png b/public/img/clash.png new file mode 100644 index 0000000..a963e0a Binary files /dev/null and b/public/img/clash.png differ diff --git a/public/img/v2ray.png b/public/img/v2ray.png new file mode 100644 index 0000000..d69a2a3 Binary files /dev/null and b/public/img/v2ray.png differ diff --git a/public/img/v2rayNG.png b/public/img/v2rayNG.png new file mode 100644 index 0000000..f584b11 Binary files /dev/null and b/public/img/v2rayNG.png differ diff --git a/src/components/LinkItem.vue b/src/components/LinkItem.vue index 5038146..25fee20 100644 --- a/src/components/LinkItem.vue +++ b/src/components/LinkItem.vue @@ -4,10 +4,10 @@
{{ props.serve.tips }}
- +
- +
@@ -36,12 +36,8 @@ export default defineComponent({ }, setup(props) { const online = ref(false); - const isonline = () => { - // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - let obj = JSON.parse(decode(props.text!.replace('vmess://', ''))); + const isonline = (ip: string) => { let http = props.serve.istls == 0 ? 'http' : 'https' - let reg = new RegExp(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/); - let ip = obj.ps.match(reg)[0]; api.text_server(`${http}://${props.serve.ip}:${props.serve.port}/${ip}`).then(res => { online.value = res.data.sataus == 400 }) @@ -49,18 +45,29 @@ export default defineComponent({ const api = new getdata; const $q = useQuasar() const outtext = computed(() => { - // eslint-disable-next-line vue/no-side-effects-in-computed-properties - online.value = false + let tmp = '' // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - let obj = JSON.parse(decode(props.text!.replace('vmess://', ''))); - obj.add = props.serve.ip - obj.port = props.serve.port - obj.host = props.serve.host - obj.tls = props.serve.istls == 0 ? '' : 'tls' - let reg = new RegExp(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/); - obj.path = '/' + obj.ps.match(reg)[0]; - isonline() - return 'vmess://' + encode(JSON.stringify(obj)) + let text = props.text!.replace(/\ +/g, ''); + text = text.replace(/[\r\n]/g, ''); + let arr = text.split('vmess://'); + for (let iterator of arr) { + if (!(iterator.length > 0)) continue + // eslint-disable-next-line vue/no-side-effects-in-computed-properties + online.value = false + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + let obj = JSON.parse(decode(iterator)); + obj.add = props.serve.ip + obj.port = props.serve.port + obj.host = props.serve.host + obj.tls = props.serve.istls == 0 ? '' : 'tls' + let reg = new RegExp(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/); + obj.path = '/' + obj.ps.match(reg)[0]; + let ip = obj.ps.match(reg)[0] + isonline(ip) + tmp += 'vmess://' + encode(JSON.stringify(obj)) + '\n' + } + + return tmp }) const copy = (type: string) => { let tmp = '' diff --git a/src/layouts/MainLayout.vue b/src/layouts/MainLayout.vue index 63d0d1c..6576695 100644 --- a/src/layouts/MainLayout.vue +++ b/src/layouts/MainLayout.vue @@ -65,11 +65,13 @@ const menuList = [ { icon: 'file_download', label: '下载程序', + path: 'download', separator: false }, { - icon: 'error', - label: 'Spam', + icon: 'share', + label: '生成订阅', + path: 'subscription', separator: true }, { @@ -85,6 +87,7 @@ const menuList = [ { icon: 'help_outline', iconColor: 'primary', + path: 'help', label: '帮助', separator: false } diff --git a/src/pages/CreateLink.vue b/src/pages/CreateLink.vue index 26e49b1..8cb2be4 100644 --- a/src/pages/CreateLink.vue +++ b/src/pages/CreateLink.vue @@ -35,20 +35,28 @@ export default defineComponent({ return reg.test(ip); } + // eslint-disable-next-line @typescript-eslint/no-unused-vars watch(() => text.value, (newValue, oldValue) => { //直接监听 let obj = JSON.parse(decode(def_link)) - console.log(newValue) - if (!is_ip(newValue)) { - outlink.value = 'erroe ip' - return + let array = newValue.split(/[\s\n]/) + for (let index = 0; index < array.length; index++) { + if (!is_ip(array[index])) { + outlink.value = 'erroe ip' + return + } + + } + outlink.value = '' + for (let index = 0; index < array.length; index++) { + api.get_country(array[index]).then(res => { + let name = res.data.country == '中国' ? res.data.province : res.data.country + obj.ps = name + array[index] + obj.add = array[index] + outlink.value += 'vmess://' + encode(JSON.stringify(obj)) + '\n' + }) + } - api.get_country(newValue).then(res => { - let name = res.data.country == '中国' ? res.data.province : res.data.country - obj.ps = name + newValue - obj.add = newValue - outlink.value = 'vmess://' + encode(JSON.stringify(obj)) - }) }) return { diff --git a/src/pages/Download.vue b/src/pages/Download.vue new file mode 100644 index 0000000..7666983 --- /dev/null +++ b/src/pages/Download.vue @@ -0,0 +1,88 @@ + + + + + diff --git a/src/pages/Help.vue b/src/pages/Help.vue new file mode 100644 index 0000000..d922e28 --- /dev/null +++ b/src/pages/Help.vue @@ -0,0 +1,84 @@ + + + + + diff --git a/src/pages/IndexPage.vue b/src/pages/IndexPage.vue index 1af3bd8..7ecf345 100644 --- a/src/pages/IndexPage.vue +++ b/src/pages/IndexPage.vue @@ -44,24 +44,34 @@ export default defineComponent({ }) const isobj = computed(() => { try { - // eslint-disable-next-line vue/no-side-effects-in-computed-properties - online.value = false - let obj = JSON.parse(decode(text.value.replace('vmess://', ''))); - if (obj.id != '2ee57806-f6e4-482a-ef08-7360c04cd3e5' || obj.net != 'ws') { + if (text.value.length <= 0) { return false } - isonline() + let texttmp = text.value!.replace(/\ +/g, ''); + texttmp = texttmp.replace(/[\r\n]/g, ''); + let arr = texttmp.split('vmess://'); + for (let iterator of arr) { + // eslint-disable-next-line vue/no-side-effects-in-computed-properties + online.value = false + if (iterator.length > 0) { + let obj = JSON.parse(decode(iterator)); + if (obj.id != '2ee57806-f6e4-482a-ef08-7360c04cd3e5' || obj.net != 'ws') { + return false + } + let reg = new RegExp(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/); + let ip = obj.ps.match(reg)[0]; + isonline(ip) + } + + } } catch (error) { - console.log(error); + return false } return true }) - const isonline = () => { - let obj = JSON.parse(decode(text.value?.replace('vmess://', ''))); - let reg = new RegExp(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/); - let ip = obj.ps.match(reg)[0]; + const isonline = (ip: string) => { api.text_server(`http://${ip}:9000/`).then(res => { online.value = res.data.sataus == 400 }) diff --git a/src/pages/Subscription.vue b/src/pages/Subscription.vue new file mode 100644 index 0000000..f6afa94 --- /dev/null +++ b/src/pages/Subscription.vue @@ -0,0 +1,52 @@ + + + + + diff --git a/src/router/routes.ts b/src/router/routes.ts index b23c8dd..a330577 100644 --- a/src/router/routes.ts +++ b/src/router/routes.ts @@ -4,7 +4,7 @@ const routes: RouteRecordRaw[] = [ { path: '/', component: () => import('layouts/MainLayout.vue'), - children: [{ path: '', name: 'home', component: () => import('pages/IndexPage.vue') }, { path: 'createlink', name: 'createlink', component: () => import('pages/CreateLink.vue') }], + children: [{ path: '', name: 'home', component: () => import('pages/IndexPage.vue') }, { path: 'createlink', name: 'createlink', component: () => import('pages/CreateLink.vue') }, { path: 'download', name: 'download', component: () => import('pages/Download.vue') }, { path: 'help', name: 'help', component: () => import('pages/Help.vue') }, { path: 'subscription', name: 'subscription', component: () => import('pages/Subscription.vue') }], }, // Always leave this as last one,