From e6e9b548cbe027416d5c3924cf4c131d2dd4fe1f Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 12 Jan 2024 13:52:55 -0600 Subject: [PATCH] 90% there Signed-off-by: Jeff Carr --- files/repomap | 11 ++++++++--- indexHtml.go | 45 +++++++++++++++++++++++++++++++++++++++------ main.go | 3 ++- repoHTML.go | 5 +++-- 4 files changed, 52 insertions(+), 12 deletions(-) diff --git a/files/repomap b/files/repomap index 1fd1ccc..6a74e52 100644 --- a/files/repomap +++ b/files/repomap @@ -1,5 +1,9 @@ +# log/ (needed for the gui) + go.wit.com/log git.wit.org/wit/log +# gui/ packages + go.wit.com/gui git.wit.org/wit/gui-old/ go.wit.com/gui/gui git.wit.org/gui/gui go.wit.com/gui/widget git.wit.org/gui/widget @@ -9,6 +13,8 @@ go.wit.com/gui/gadgets git.wit.org/gui/gadgets go.wit.com/gui/digitalocean git.wit.org/gui/digitalocean go.wit.com/gui/cloudflare git.wit.org/gui/cloudflare +# Applications + go.wit.com/apps/control-panel-dns git.wit.org/jcarr/control-panel-dns go.wit.com/apps/control-panel-digitalocean git.wit.org/wit/control-panel-digitalocean go.wit.com/apps/control-panel-cloudflare git.wit.org/wit/control-panel-cloudflare @@ -16,8 +22,7 @@ go.wit.com/apps/control-panel-vpn git.wit.org/wit/control-panel-vpn go.wit.com/apps/myrepos git.wit.org/jcarr/myrepos go.wit.com/apps/go.wit.com git.wit.org/jcarr/go.wit.com +# Support packages + go.wit.com/dev/alexflint/go-arg/ git.wit.org/wit/go-arg go.wit.com/shell -git.wit.org/wit/wit-debian-gui/ -git.wit.org/jcarr/wit-new-machine -git.wit.org/jcarr/personal-gui diff --git a/indexHtml.go b/indexHtml.go index fcf9815..e025ea3 100644 --- a/indexHtml.go +++ b/indexHtml.go @@ -2,7 +2,10 @@ package main import ( "fmt" + "strings" "net/http" + + "go.wit.com/log" ) /* @@ -58,7 +61,7 @@ func indexBodyStart(w http.ResponseWriter) { fmt.Fprintln(w, "
") fmt.Fprintln(w, "
") fmt.Fprintln(w, " ") - fmt.Fprintln(w, " ") +// fmt.Fprintln(w, " ") fmt.Fprintln(w, " ") fmt.Fprintln(w, " ") fmt.Fprintln(w, " ") @@ -66,16 +69,46 @@ func indexBodyStart(w http.ResponseWriter) { fmt.Fprintln(w, " ") fmt.Fprintln(w, " ") fmt.Fprintln(w, " ") - fmt.Fprintln(w, " ") +// fmt.Fprintln(w, " ") fmt.Fprintln(w, " ") fmt.Fprintln(w, "") } -func indexBodyRepo(w http.ResponseWriter, repourl string) { - fmt.Fprintln(w, " ") +func insertHTMLnote(w http.ResponseWriter, i int, parts []string) { + log.Info("comment # line:", i, strings.Join(parts, " ")) + fmt.Fprintln(w, " ") +} + +func indexBodyScanConfig(w http.ResponseWriter) { + log.Info("indexBodyScanConfig() START") + for i, line := range configfile { + // log.Info("config file line:", i, line) + fields := strings.Fields(line) + if (len(fields) == 0) { + continue + } + if (fields[0] == "#") { + insertHTMLnote(w, i, fields[0:]) + // log.Info("comment # line:", i, line) + continue + } + if (len(fields) == 2) { + log.Info("short file line:", i, line) + gourl := fields[0] + giturl := fields[1] + indexBodyRepo(w, gourl, giturl, "") + continue + } + log.Info("config file line:", i, line) + } + log.Info("indexBodyScanConfig() END") +} + +func indexBodyRepo(w http.ResponseWriter, gourl string, giturl string, github string) { + // fmt.Fprintln(w, " ") fmt.Fprintln(w, " ") - fmt.Fprintln(w, " ") - fmt.Fprintln(w, " ") + fmt.Fprintln(w, " ") + fmt.Fprintln(w, " ") fmt.Fprintln(w, " ") fmt.Fprintln(w, " ") fmt.Fprintln(w, " ") diff --git a/main.go b/main.go index bab0a3b..20bfa8f 100644 --- a/main.go +++ b/main.go @@ -27,7 +27,8 @@ func okHandler(w http.ResponseWriter, r *http.Request) { if tmp == "/new" { indexHeader(w) indexBodyStart(w) - indexBodyRepo(w, "go.wit.com/gui/gui") + indexBodyScanConfig(w) + indexBodyRepo(w, "go.wit.com/gui/gui", "go.wit.com/gui/gui", "install gitea") indexBodyEnd(w) return } diff --git a/repoHTML.go b/repoHTML.go index 51a759b..f1426e5 100644 --- a/repoHTML.go +++ b/repoHTML.go @@ -52,6 +52,7 @@ func doGui(w http.ResponseWriter, gourl string, realurl string) { } var repoMap map[string]string +var configfile []string var keysSorted []string func findkey(url string) (string, string) { @@ -70,8 +71,8 @@ func readconfigfile() { log.Error(err, "missing repomap in the binary") return } - lines := strings.Split(string(pfile), "\n") - for _, line := range lines { + configfile = strings.Split(string(pfile), "\n") + for _, line := range configfile { fields := strings.Fields(line) if (len(fields) < 2) { continue
Packagego getgithub mirrorDocumentation
log/ (needed for the gui)
", strings.Join(parts, " "), "
log/ (needed for the gui)
log go.wit.com/log", gourl, " ", gourl, " git.wit.org/wit/log github.com/wit-go/log \"Go