Browse Source

Add clash.doh support

develop
CareyWong 5 years ago
parent
commit
e2936b995f
  1. 48
      src/views/Subconverter.vue

48
src/views/Subconverter.vue

@ -75,10 +75,10 @@
<el-form-item label-width="0px"> <el-form-item label-width="0px">
<el-row type="flex"> <el-row type="flex">
<el-col> <el-col>
<el-checkbox v-model="form.nodeList" label="输出为 Node List" border></el-checkbox>
<el-checkbox v-model="form.emoji" label="Emoji" border></el-checkbox> <el-checkbox v-model="form.emoji" label="Emoji" border></el-checkbox>
<el-checkbox v-model="form.nodeList" label="输出为 Node List" border></el-checkbox>
</el-col> </el-col>
<el-popover placement="left" v-model="form.extraset"> <el-popover placement="bottom" v-model="form.extraset">
<el-row> <el-row>
<el-checkbox v-model="form.udp" label="启用 UDP"></el-checkbox> <el-checkbox v-model="form.udp" label="启用 UDP"></el-checkbox>
</el-row> </el-row>
@ -99,10 +99,13 @@
</el-row> </el-row>
<el-button slot="reference">更多选项</el-button> <el-button slot="reference">更多选项</el-button>
</el-popover> </el-popover>
<el-popover placement="left" style="margin-left: 20px"> <el-popover placement="bottom" style="margin-left: 20px">
<el-row> <el-row>
<el-checkbox v-model="form.tpl.surge.doh" label="Surge.DoH"></el-checkbox> <el-checkbox v-model="form.tpl.surge.doh" label="Surge.DoH"></el-checkbox>
</el-row> </el-row>
<el-row>
<el-checkbox v-model="form.tpl.clash.doh" label="Clash.DoH"></el-checkbox>
</el-row>
<el-button slot="reference">模板定制功能</el-button> <el-button slot="reference">模板定制功能</el-button>
</el-popover> </el-popover>
</el-row> </el-row>
@ -227,9 +230,12 @@ const tgBotLink = "https://t.me/CareyWong_bot";
export default { export default {
data() { data() {
return { return {
backendVersion: '', backendVersion: "",
advanced: "2", advanced: "2",
// PC
isPC: true,
options: { options: {
clientTypes: { clientTypes: {
Clash: "clash", Clash: "clash",
@ -345,7 +351,10 @@ export default {
// tpl // tpl
tpl: { tpl: {
surge: { surge: {
doh: false, // dns 使 DoH doh: false // dns 使 DoH
},
clash: {
doh: false
} }
} }
}, },
@ -363,6 +372,7 @@ export default {
}, },
created() { created() {
document.title = "Subscription Converter"; document.title = "Subscription Converter";
this.isPC = this.$getOS().isPc;
}, },
mounted() { mounted() {
this.form.clientType = "clash"; this.form.clientType = "clash";
@ -389,7 +399,14 @@ export default {
} }
const url = "clash://install-config?url="; 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() { surgeInstall() {
if (this.customSubUrl === "") { if (this.customSubUrl === "") {
@ -460,7 +477,10 @@ export default {
this.form.sort.toString(); this.form.sort.toString();
if (this.form.tpl.surge.doh === true) { 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() { getBackendVersion() {
this.$axios.get(defaultBackend.substring(0, defaultBackend.length - 5) + '/version').then(res => { this.$axios
this.backendVersion = res.data.replace(/backend\n$/gm, ''); .get(
this.backendVersion = this.backendVersion.replace('subconverter', ''); defaultBackend.substring(0, defaultBackend.length - 5) + "/version"
}) )
} .then(res => {
this.backendVersion = res.data.replace(/backend\n$/gm, "");
this.backendVersion = this.backendVersion.replace("subconverter", "");
});
},
} }
}; };
</script> </script>

Loading…
Cancel
Save