Implement domain request failure

This commit is contained in:
Anders Pitman 2021-12-21 15:18:08 -07:00
parent 53946e878f
commit a3140efb20
3 changed files with 29 additions and 3 deletions

View File

@ -288,6 +288,24 @@ func Listen() {
http.Redirect(w, r, fmt.Sprintf("https://%s/edit-tunnel?domain=%s", adminDomain, domain), 303) http.Redirect(w, r, fmt.Sprintf("https://%s/edit-tunnel?domain=%s", adminDomain, domain), 303)
} }
} else if r.URL.Path == "/dnsapi/failure" {
r.ParseForm()
requestId := r.Form.Get("request-id")
// Ensure the request exists
_, err := db.GetDNSRequest(requestId)
if err != nil {
w.WriteHeader(500)
io.WriteString(w, err.Error())
return
}
db.DeleteDNSRequest(requestId)
http.Redirect(w, r, "/alert?message=Domain request failed", 303)
} else if hostDomain == db.GetAdminDomain() { } else if hostDomain == db.GetAdminDomain() {
if strings.HasPrefix(r.URL.Path, "/api/") { if strings.HasPrefix(r.URL.Path, "/api/") {
http.StripPrefix("/api", api).ServeHTTP(w, r) http.StripPrefix("/api", api).ServeHTTP(w, r)

View File

@ -38,6 +38,7 @@ type DNSRecord struct {
Type string `json:"type"` Type string `json:"type"`
Value string `json:"value"` Value string `json:"value"`
TTL int `json:"ttl"` TTL int `json:"ttl"`
Priority int `json:"priority"`
} }
type Tunnel struct { type Tunnel struct {

View File

@ -259,6 +259,13 @@ func (h *WebUiHandler) handleWebUiRequest(w http.ResponseWriter, r *http.Request
http.Redirect(w, r, "/tunnels", 303) http.Redirect(w, r, "/tunnels", 303)
case "/loading": case "/loading":
h.handleLoading(w, r) h.handleLoading(w, r)
case "/alert":
r.ParseForm()
message := r.Form.Get("message")
h.alertDialog(w, r, message, "/")
default: default:
if strings.HasPrefix(r.URL.Path, "/tunnels/") { if strings.HasPrefix(r.URL.Path, "/tunnels/") {