at least it 501s nicely
parent
2f21a23a33
commit
4de3b4a822
|
|
@ -96,6 +96,14 @@ func Main() {
|
||||||
})
|
})
|
||||||
return
|
return
|
||||||
case "/api/lastnlines":
|
case "/api/lastnlines":
|
||||||
|
if r.Method != http.MethodPut {
|
||||||
|
http.NotFound(w, r)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
var lines []string
|
||||||
|
if err := json.NewDecoder(r.Body).Decode(&lines); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
http.Error(w, "not done yet", http.StatusNotImplemented)
|
http.Error(w, "not done yet", http.StatusNotImplemented)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -70,16 +70,15 @@
|
||||||
document.getElementById("reg").innerHTML = result
|
document.getElementById("reg").innerHTML = result
|
||||||
}
|
}
|
||||||
function setLastNLines(form) {
|
function setLastNLines(form) {
|
||||||
console.log(form.elements["lastNLines"].value.split("\n"))
|
|
||||||
http("PUT", "/api/lastnlines?f="+f, (body, status) => {
|
http("PUT", "/api/lastnlines?f="+f, (body, status) => {
|
||||||
if (status == 205) {
|
if (status == 205) {
|
||||||
init()
|
init()
|
||||||
}
|
}
|
||||||
document.getElementById("lastNLinesStatus").innerHTML = `(${status}) ${body}`
|
document.getElementById("lastNLinesStatus").innerHTML = `(${status}) ${body}`
|
||||||
}, form.elements["lastNLines"].value.split("\n"))
|
}, JSON.stringify(form.elements["lastNLines"].value.split("\n")))
|
||||||
}
|
}
|
||||||
function loadLastNLines(lastNLines) {
|
function loadLastNLines(lastNLines) {
|
||||||
var result = `<form onsubmit="setLastNLines(this); return false;">`
|
var result = `<form onsubmit="setLastNLines(this); return false;" action="#">`
|
||||||
result += ` <textarea name="lastNLines">`
|
result += ` <textarea name="lastNLines">`
|
||||||
for (var k in lastNLines) {
|
for (var k in lastNLines) {
|
||||||
result += lastNLines[k] + "\n"
|
result += lastNLines[k] + "\n"
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue