From e2936b995f6856c911cdd72b483545b6dc24f01a Mon Sep 17 00:00:00 2001 From: CareyWong Date: Thu, 23 Apr 2020 20:34:16 +0800 Subject: [PATCH] Add clash.doh support --- src/views/Subconverter.vue | 48 ++++++++++++++++++++++++++++---------- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/src/views/Subconverter.vue b/src/views/Subconverter.vue index d64dd63..91d555d 100644 --- a/src/views/Subconverter.vue +++ b/src/views/Subconverter.vue @@ -75,10 +75,10 @@ - + - + @@ -99,10 +99,13 @@ 更多选项 - + + + + 模板定制功能 @@ -227,9 +230,12 @@ const tgBotLink = "https://t.me/CareyWong_bot"; export default { data() { return { - backendVersion: '', + backendVersion: "", advanced: "2", + // 是否为 PC 端 + isPC: true, + options: { clientTypes: { Clash: "clash", @@ -345,7 +351,10 @@ export default { // tpl 定制功能 tpl: { surge: { - doh: false, // dns 查询是否使用 DoH + doh: false // dns 查询是否使用 DoH + }, + clash: { + doh: false } } }, @@ -363,6 +372,7 @@ export default { }, created() { document.title = "Subscription Converter"; + this.isPC = this.$getOS().isPc; }, mounted() { this.form.clientType = "clash"; @@ -389,7 +399,14 @@ export default { } const url = "clash://install-config?url="; - window.open(url + encodeURIComponent(this.curtomShortSubUrl !== '' ? this.curtomShortSubUrl : this.customSubUrl)); + window.open( + url + + encodeURIComponent( + this.curtomShortSubUrl !== "" + ? this.curtomShortSubUrl + : this.customSubUrl + ) + ); }, surgeInstall() { if (this.customSubUrl === "") { @@ -460,7 +477,10 @@ export default { this.form.sort.toString(); if (this.form.tpl.surge.doh === true) { - this.customSubUrl += "&surge.doh=true" + this.customSubUrl += "&surge.doh=true"; + } + if (this.form.tpl.clash.doh === true) { + this.customSubUrl += "&clash.doh=true"; } } @@ -571,11 +591,15 @@ export default { }; }, getBackendVersion() { - this.$axios.get(defaultBackend.substring(0, defaultBackend.length - 5) + '/version').then(res => { - this.backendVersion = res.data.replace(/backend\n$/gm, ''); - this.backendVersion = this.backendVersion.replace('subconverter', ''); - }) - } + this.$axios + .get( + defaultBackend.substring(0, defaultBackend.length - 5) + "/version" + ) + .then(res => { + this.backendVersion = res.data.replace(/backend\n$/gm, ""); + this.backendVersion = this.backendVersion.replace("subconverter", ""); + }); + }, } };