try switching log() to http writes
This commit is contained in:
parent
2de5fd7955
commit
3c1b670663
|
@ -2,6 +2,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
|
@ -11,8 +12,8 @@ import (
|
|||
"go.wit.com/log"
|
||||
)
|
||||
|
||||
func doRelease() bool {
|
||||
log.Info("doRelease() on", me.current.Name())
|
||||
func doRelease(w http.ResponseWriter) bool {
|
||||
msg(w, "doRelease() on", me.current.Name())
|
||||
// double check release version logic
|
||||
if me.release.releaseVersionB.String() != "release version "+me.release.version.String() {
|
||||
log.Warn("something went wrong with the release.version:", me.release.version.String())
|
||||
|
|
12
http.go
12
http.go
|
@ -17,14 +17,18 @@ func cleanURL(url string) string {
|
|||
}
|
||||
|
||||
// send stuff to the socket and stdout
|
||||
func msg(w http.ResponseWriter, s string) {
|
||||
log.Info(s)
|
||||
fmt.Fprintln(w, s)
|
||||
func msg(w http.ResponseWriter, a ...any) {
|
||||
if w == nil {
|
||||
log.Info(a)
|
||||
} else {
|
||||
fmt.Fprintln(w, a)
|
||||
}
|
||||
}
|
||||
|
||||
func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||
var route string
|
||||
route = cleanURL(r.URL.Path)
|
||||
log.HttpMode(w)
|
||||
|
||||
// common http args that can be set
|
||||
repoName := r.URL.Query().Get("repo")
|
||||
|
@ -62,7 +66,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
case "/doRelease":
|
||||
buttonDisable()
|
||||
if doRelease() {
|
||||
if doRelease(w) {
|
||||
buttonEnable()
|
||||
msg(w, "doRelease() worked")
|
||||
} else {
|
||||
|
|
|
@ -60,7 +60,7 @@ func createReleaseBox(box *gui.Node) {
|
|||
|
||||
me.release.releaseVersionB = me.release.grid.NewButton("release version", func() {
|
||||
buttonDisable()
|
||||
if doRelease() {
|
||||
if doRelease(nil) {
|
||||
buttonEnable()
|
||||
log.Info("doRelease() worked")
|
||||
} else {
|
||||
|
@ -146,7 +146,7 @@ func createReleaseBox(box *gui.Node) {
|
|||
// incase something, somewhere, goes wrong
|
||||
duration := repolist.TimeFunction(func() {
|
||||
for n := 0; n <= len(me.repos.View.AllRepos()); n++ {
|
||||
if doRelease() {
|
||||
if doRelease(nil) {
|
||||
log.Info("doRelease() worked")
|
||||
} else {
|
||||
if me.release.status.String() == "ALL DONE?" {
|
||||
|
|
Loading…
Reference in New Issue