90% there

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-12 13:52:55 -06:00
parent e34f8f5734
commit e6e9b548cb
4 changed files with 52 additions and 12 deletions

View File

@ -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

View File

@ -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, " <div class=\"container\">")
fmt.Fprintln(w, " <div class=\"row\">")
fmt.Fprintln(w, " <table class=\"u-full-width\">")
fmt.Fprintln(w, " <thead>")
// fmt.Fprintln(w, " <thead>")
fmt.Fprintln(w, " <tr>")
fmt.Fprintln(w, " <th>Package</th>")
fmt.Fprintln(w, " <th>go get</th>")
@ -66,16 +69,46 @@ func indexBodyStart(w http.ResponseWriter) {
fmt.Fprintln(w, " <th>github mirror</th>")
fmt.Fprintln(w, " <th>Documentation</th>")
fmt.Fprintln(w, " </tr>")
fmt.Fprintln(w, " </thead>")
// fmt.Fprintln(w, " </thead>")
fmt.Fprintln(w, " <tbody>")
fmt.Fprintln(w, "")
}
func indexBodyRepo(w http.ResponseWriter, repourl string) {
fmt.Fprintln(w, " <tr> <td><h5>log/ (needed for the gui)</h5></td> <td></td> <td></td> <td></td> <td></td> </tr>")
func insertHTMLnote(w http.ResponseWriter, i int, parts []string) {
log.Info("comment # line:", i, strings.Join(parts, " "))
fmt.Fprintln(w, " <tr> <td><h5>", strings.Join(parts, " "), "</h5></td> <td></td> <td></td> <td></td> <td></td> </tr>")
}
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, " <tr> <td><h5>log/ (needed for the gui)</h5></td> <td></td> <td></td> <td></td> <td></td> </tr>")
fmt.Fprintln(w, " <tr>")
fmt.Fprintln(w, " <td>log</td>")
fmt.Fprintln(w, " <td> <a href=\"//go.wit.com/log\">go.wit.com/log</a></td>")
fmt.Fprintln(w, " <td>", gourl, "</td>")
fmt.Fprintln(w, " <td> <a href=\"//", gourl, "\">", gourl, "</a></td>")
fmt.Fprintln(w, " <td> <a href=\"//git.wit.org/wit/log\">git.wit.org/wit/log</a></td>")
fmt.Fprintln(w, " <td> <a href=\"//github.com/wit-go/log\">github.com/wit-go/log</a></td>")
fmt.Fprintln(w, " <td> <a href=\"//pkg.go.dev/go.wit.com/log\"> <img src=\"goReference.svg\" alt=\"Go Reference\" /> </a> </td>")

View File

@ -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
}

View File

@ -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