update qr-code with singbox

This commit is contained in:
Alireza Ahmadi
2024-06-30 22:30:34 +02:00
parent a41140190f
commit 7d441723ba
+58 -14
View File
@@ -9,19 +9,46 @@
</v-row> </v-row>
</v-card-title> </v-card-title>
<v-divider></v-divider> <v-divider></v-divider>
<v-card-text> <v-card-text style="overflow-y: auto; padding: 0">
<v-row> <v-tabs
<v-col style="text-align: center;" @click="copyToClipboard(clientSub)"> v-model="tab"
<v-chip>{{ $t('setting.sub') }}</v-chip> density="compact"
<QrcodeVue :value="clientSub" :size="300" :margin="1" style="border-radius: 1rem;" /> fixed-tabs
</v-col> align-tabs="center"
</v-row> >
<v-row v-for="l in clientLinks"> <v-tab value="sub">{{ $t('setting.sub') }}</v-tab>
<v-col style="text-align: center;" @click="copyToClipboard(l.uri)"> <v-tab value="link">{{ $t('client.links') }}</v-tab>
<v-chip>{{ l.remark?? "-" }}</v-chip><br /> </v-tabs>
<QrcodeVue :value="l.uri" :size="300" :margin="1" style="border-radius: 1rem;" /> <v-window v-model="tab" style="margin-top: 10px;">
</v-col> <v-window-item value="sub">
</v-row> <v-row>
<v-col style="text-align: center;">
<v-chip>{{ $t('setting.sub') }}</v-chip><br />
<QrcodeVue :value="clientSub" :size="size" @click="copyToClipboard(clientSub)" :margin="1" style="border-radius: 1rem;" />
</v-col>
</v-row>
<v-row>
<v-col style="text-align: center;">
<v-chip>{{ $t('setting.jsonSub') }}</v-chip><br />
<QrcodeVue :value="clientSub + '?format=json'" :size="size" @click="copyToClipboard(clientSub + '?format=json')" :margin="1" style="border-radius: 1rem;" />
</v-col>
</v-row>
<v-row>
<v-col style="text-align: center;">
<v-chip>SING-BOX</v-chip><br />
<QrcodeVue :value="singbox" :size="size" @click="copyToClipboard(singbox)" :margin="1" style="border-radius: .8rem;" />
</v-col>
</v-row>
</v-window-item>
<v-window-item value="link">
<v-row v-for="l in clientLinks">
<v-col style="text-align: center;">
<v-chip>{{ l.remark?? $t('client.' + l.type) }}</v-chip><br />
<QrcodeVue :value="l.uri" :size="size" @click="copyToClipboard(l.uri)" :margin="1" style="border-radius: .5rem;" />
</v-col>
</v-row>
</v-window-item>
</v-window>
</v-card-text> </v-card-text>
</v-card> </v-card>
</v-dialog> </v-dialog>
@@ -35,9 +62,10 @@ import { i18n } from '@/locales'
import { push } from 'notivue' import { push } from 'notivue'
export default { export default {
props: ['index'], props: ['index', 'visible'],
data() { data() {
return { return {
tab: "sub",
} }
}, },
methods: { methods: {
@@ -81,10 +109,26 @@ export default {
clientSub() { clientSub() {
return Data().subURI + this.client.name return Data().subURI + this.client.name
}, },
singbox() {
const url = Data().subURI + this.client.name + "?format=json"
return "sing-box://import-remote-profile?url=" + encodeURIComponent(url) + "#" + this.client.name
},
clientLinks() { clientLinks() {
return this.client.links?? [] return this.client.links?? []
},
size() {
if (window.innerWidth > 380) return 300
if (window.innerWidth > 330) return 280
return 250
} }
}, },
watch: {
visible(v) {
if (v) {
this.tab = "sub"
}
},
},
components: { QrcodeVue } components: { QrcodeVue }
} }
</script> </script>