Change DNS resolver URL

This commit is contained in:
nemunaire 2021-01-12 16:07:23 +01:00
parent 02d19a2af6
commit 5a38125ca7
4 changed files with 32 additions and 4 deletions

View File

@ -60,7 +60,7 @@
{{ $t('menu.my-sources') }}
</b-dropdown-item>
<b-dropdown-divider />
<b-dropdown-item to="/tools/client">
<b-dropdown-item to="/resolver">
{{ $t('menu.dns-resolver') }}
</b-dropdown-item>
<b-dropdown-divider />
@ -76,7 +76,7 @@
<b-navbar-nav v-else class="ml-auto">
<h-help class="mr-2" size="sm" variant="link" />
<b-button class="mr-2" variant="info" to="/tools/client">
<b-button class="mr-2" variant="info" to="/resolver">
<b-icon icon="list" aria-hidden="true" /> {{ $t('menu.dns-resolver') }}
</b-button>

View File

@ -176,6 +176,20 @@ const routes = [
return import(/* webpackChunkName: "tools-client" */ '../views/tools-client.vue')
}
},
{
path: '/resolver',
name: 'tools-resolver',
component: function () {
return import(/* webpackChunkName: "tools-client" */ '../views/tools-client.vue')
}
},
{
path: '/resolver/:domain',
name: 'tools-resolver-domain',
component: function () {
return import(/* webpackChunkName: "tools-client" */ '../views/tools-client.vue')
}
},
{
path: '/zones/:domain/records',
name: 'zone-records',

View File

@ -46,7 +46,7 @@
>
<template slot="description">
<i18n path="resolver.domain-description">
<router-link to="/tools/client/wikipedia.org" class="text-monospaced">
<router-link to="/resolver/wikipedia.org" class="text-monospaced">
wikipedia.org
</router-link>
</i18n>
@ -307,7 +307,7 @@ export default {
this.request_pending = false
})
if (this.$route.params.domain !== this.form.domain) {
this.$router.push('/tools/client/' + encodeURIComponent(this.form.domain))
this.$router.push('/resolver/' + encodeURIComponent(this.form.domain))
}
}
}

View File

@ -263,6 +263,20 @@ func init() {
fwd_request(w, r, opts.DevProxy)
}
})
api.Router().GET("/resolver/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
opts := r.Context().Value("opts").(*config.Options)
if opts.DevProxy == "" {
if data, err := Asset("htdocs/dist/index.html"); err != nil {
fmt.Fprintf(w, "{\"errmsg\":%q}", err)
} else {
w.Write(data)
}
} else {
r.URL.Path = "/"
fwd_request(w, r, opts.DevProxy)
}
})
api.Router().GET("/zones/*_", func(w http.ResponseWriter, r *http.Request, ps httprouter.Params) {
opts := r.Context().Value("opts").(*config.Options)