From d6be7a5d2c2dea77694095edbad1252336270141 Mon Sep 17 00:00:00 2001 From: Ian Gulliver Date: Sat, 23 Nov 2024 06:35:38 -0800 Subject: [PATCH] Shorten url param --- main.go | 6 +++--- static/index.html | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/main.go b/main.go index e726f2b..766785b 100644 --- a/main.go +++ b/main.go @@ -56,8 +56,8 @@ func (ph *PHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { log.Printf("%s %s", r.RemoteAddr, r.Form.Encode()) - msg := r.Form.Get("msg") - if msg == "" { + m := r.Form.Get("m") + if m == "" { err = ph.tmpl.Execute(w, ph.envs()) if err != nil { http.Error(w, fmt.Sprintf("execute %s: %s\n", ph.tmpl.Name(), err), http.StatusBadRequest) @@ -72,7 +72,7 @@ func (ph *PHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { RoutingKey: ph.routingKey, EventAction: "trigger", Payload: PDPayload{ - Summary: msg, + Summary: m, Source: r.RemoteAddr, Severity: "critical", }, diff --git a/static/index.html b/static/index.html index ce4f57f..1352058 100644 --- a/static/index.html +++ b/static/index.html @@ -61,9 +61,9 @@ function error(err1, err2) { } async function page() { - const msg = document.getElementById('message').value; + const m = document.getElementById('message').value; - if (msg == '') { + if (m == '') { error('Please fill in Message', ''); return; } @@ -71,7 +71,7 @@ async function page() { clearAlerts(); const params = new URLSearchParams({ - msg: msg, + m: m, }); const resp = await fetch( @@ -189,7 +189,7 @@ async function page() {