增加提取原始链接

This commit is contained in:
lingling 2023-03-20 18:47:58 +08:00
parent 58ab7a3f18
commit 68da8b649e
5 changed files with 128 additions and 12 deletions

View File

@ -0,0 +1,102 @@
<template>
<div class="row">
<div class="col-12">
<h6 style="text-align: center;margin: 1rem;">直连<q-icon v-show="online" title="在线" name="check_circle_outline"
style="color: green;" /> <q-icon v-show="!online" title="离线" name="highlight_off" style="color: red;" /></h6>
<q-input v-model="outtext" filled autogrow readonly />
<div style="text-align: center;margin-top: 1rem;display: flex;justify-content: space-around;">
<q-btn color="white" text-color="black" @click="copy('link')" label="复制" />
<!-- <q-btn color="white" text-color="black" @click="copy('sub')" label="复制订阅" /> -->
</div>
</div>
</div>
</template>
<script lang="ts">
import {
defineComponent,
computed,
ref,
} from 'vue';
import { copyToClipboard } from 'quasar'
import { encode, decode } from 'js-base64';
import { useQuasar } from 'quasar'
import { getdata } from 'src/api/api'
export default defineComponent({
name: 'LinkItem',
props: {
text: {
type: String
}
},
setup(props) {
const online = ref(false);
const isonline = (ip: string) => {
let http = 'http'
api.text_server(`${http}://${ip}:9000/`).then(res => {
online.value = res.data.sataus == 400
})
}
const def_link = 'ew0KICAidiI6ICIyIiwNCiAgInBzIjogIjAiLA0KICAiYWRkIjogIjE4NS4yMTguNi4xMDgiLA0KICAicG9ydCI6ICI5MDAwIiwNCiAgImlkIjogIjJlZTU3ODA2LWY2ZTQtNDgyYS1lZjA4LTczNjBjMDRjZDNlNSIsDQogICJhaWQiOiAiMCIsDQogICJzY3kiOiAiYXV0byIsDQogICJuZXQiOiAid3MiLA0KICAidHlwZSI6ICJub25lIiwNCiAgImhvc3QiOiAiIiwNCiAgInBhdGgiOiAiLyIsDQogICJ0bHMiOiAiIiwNCiAgInNuaSI6ICIiLA0KICAiYWxwbiI6ICIiDQp9'
const api = new getdata;
const $q = useQuasar()
const outtext = computed(() => {
let tmp = ''
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
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(def_link));
let obj_old = JSON.parse(decode(iterator));
let reg = new RegExp(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/);
let ip = obj_old.ps.match(reg)[0]
obj.ps = obj_old.ps
obj.add = ip
obj.port = 9000
obj.host = ''
obj.tls = ''
obj.path = '/';
isonline(ip)
tmp += 'vmess://' + encode(JSON.stringify(obj)) + '\n'
}
return tmp
})
const copy = (type: string) => {
let tmp = ''
switch (type) {
case 'sub':
tmp = `http://149.129.107.38/link.php?link=${outtext.value}`
break;
case 'link':
tmp = outtext.value
break;
default:
break;
}
copyToClipboard(tmp)
.then(() => {
// success!
$q.notify({
message: '复制成功',
color: 'positive',
position: 'top'
})
})
.catch(() => {
// fail
$q.notify({
message: '复制失败',
color: 'negative'
})
})
}
return { props, outtext, copy, online };
},
});
</script>

View File

@ -14,3 +14,20 @@ export interface server {
port: number; port: number;
tips: string; tips: string;
} }
export interface vmess {
v: string;
ps: string;
add: string;
port: number;
id: string;
aid: string;
scy: string;
net: string;
type: string;
host: string;
path: string;
tls: string;
sni: string;
alpn: string
}

View File

@ -74,16 +74,6 @@ const menuList = [
path: 'subscription', path: 'subscription',
separator: true separator: true
}, },
{
icon: 'settings',
label: 'Settings',
separator: false
},
{
icon: 'feedback',
label: 'Send Feedback',
separator: false
},
{ {
icon: 'help_outline', icon: 'help_outline',
iconColor: 'primary', iconColor: 'primary',

View File

@ -1,6 +1,6 @@
<template> <template>
<div class="row "> <div class="row ">
Help 节点旁边的图标表示节点状态 在其他加速器上面的状态
</div> </div>
</template> </template>

View File

@ -9,6 +9,12 @@
</div> </div>
</div> </div>
<div v-if="isobj"> <div v-if="isobj">
<div class="row">
<div class="col-xs-1 col-md-4"></div>
<div class="col-xs-10 col-md-4">
<OriginalLinkItem v-model:text="text"></OriginalLinkItem>
</div>
</div>
<div class="row" v-for="(item, index) in serve" :key="index"> <div class="row" v-for="(item, index) in serve" :key="index">
<div class="col-xs-1 col-md-4"></div> <div class="col-xs-1 col-md-4"></div>
<div class="col-xs-10 col-md-4"> <div class="col-xs-10 col-md-4">
@ -26,10 +32,11 @@ import { server } from 'components/models';
import { computed, defineComponent, onMounted, ref } from 'vue'; import { computed, defineComponent, onMounted, ref } from 'vue';
import { getdata } from 'src/api/api' import { getdata } from 'src/api/api'
import LinkItem from 'components/LinkItem.vue'; import LinkItem from 'components/LinkItem.vue';
import OriginalLinkItem from 'components/OriginalLinkItem.vue';
import { decode } from 'js-base64'; import { decode } from 'js-base64';
export default defineComponent({ export default defineComponent({
name: 'IndexPage', name: 'IndexPage',
components: { LinkItem }, components: { LinkItem, OriginalLinkItem },
setup() { setup() {
const serve = ref(<server[]>[]) const serve = ref(<server[]>[])
const api = new getdata; const api = new getdata;