diff --git a/main.go b/main.go index f0111de..1b7b68e 100644 --- a/main.go +++ b/main.go @@ -12,7 +12,7 @@ import ( ) //go:embed resources/* -var htmlFiles embed.FS +var resources embed.FS var accessf, clientf *os.File @@ -52,11 +52,11 @@ func okHandler(w http.ResponseWriter, r *http.Request) { return } if tmp == "/old" { - findFile(w, "files/index.html") + writeFile(w, "index.html") return } if tmp == "/install.sh" { - findFile(w, "files/install.sh") + writeFile(w, "install.sh") return } if tmp == "/me" { @@ -81,19 +81,19 @@ func okHandler(w http.ResponseWriter, r *http.Request) { return } if tmp == "/list" { - findFile(w, "files/repomap") + writeFile(w, "repomap") return } if tmp == "/test" { - findFile(w, "files/test.html") + writeFile(w, "test.html") return } if tmp == "/goReference.svg" { - findFile(w, "files/goReference.svg") + writeFile(w, "goReference.svg") return } if tmp == "/skeleton.v2.css" { - findFile(w, "files/skeleton.v2.css") + writeFile(w, "skeleton.v2.css") return } log.Warn("BAD URL =", url, "REPO URL =", repourl) @@ -101,9 +101,10 @@ func okHandler(w http.ResponseWriter, r *http.Request) { // fmt.Fprintln(w, "BAD", tmp) } -func findFile(w http.ResponseWriter, filename string) { +func writeFile(w http.ResponseWriter, filename string) { // fmt.Fprintln(w, "GOT TEST?") - pfile, err := htmlFiles.ReadFile(filename) + fullname := "resources/" + filename + pfile, err := resources.ReadFile(fullname) if err != nil { log.Println("ERROR:", err) // w.Write(pfile) @@ -112,11 +113,11 @@ func findFile(w http.ResponseWriter, filename string) { var repohtml string repohtml = string(pfile) - if filename == "files/goReference.svg" { + if filename == "goReference.svg" { w.Header().Set("Content-Type", "image/svg+xml") } fmt.Fprintln(w, repohtml) - log.Println("findFile() found internal file:", filename) + log.Println("writeFile() found internal file:", filename) // w.Close() /* filename = "/tmp/" + name + ".so" diff --git a/repoHTML.go b/repoHTML.go index 24b20c5..a00897b 100644 --- a/repoHTML.go +++ b/repoHTML.go @@ -65,7 +65,7 @@ func findkey(url string) (string, string) { func readconfigfile() { repoMap = make(map[string]string) - pfile, err := htmlFiles.ReadFile("files/repomap") + pfile, err := resources.ReadFile("resources/repomap") if err != nil { log.Error(err, "missing repomap in the binary") return diff --git a/resources/repomap b/resources/repomap index cbf96d9..165ca5c 100644 --- a/resources/repomap +++ b/resources/repomap @@ -13,19 +13,21 @@ go.wit.com/apps/gadgetwindow git.wit.org/jcarr/gadgetwindow A more complicated D go.wit.com/apps/autotypist git.wit.org/jcarr/autotypist Wrapper around 'git' and 'go' for these repos go.wit.com/apps/guireleaser git.wit.org/jcarr/guireleaser +go.wit.com/apps/forge git.wit.org/jcarr/submit-patchset go.wit.com/apps/go-deb git.wit.org/jcarr/go-deb Turn a GO package into a .deb package -go.wit.com/apps/control-panel-digitalocean git.wit.org/wit/control-panel-digitalocean A simple Digital Ocean Control Panel +go.wit.com/apps/control-panel-droplet git.wit.org/wit/control-panel-droplet A VM (droplet) Control Panel go.wit.com/apps/control-panel-dns git.wit.org/jcarr/control-panel-dns A DNS Control Panel -go.wit.com/apps/go-gui-toolkits git.wit.org/gui/go-gui-toolkits toolkit build helper go.wit.com/apps/control-panel-cloudflare git.wit.org/wit/control-panel-cloudflare go.wit.com/apps/control-panel-vpn git.wit.org/jcarr/control-panel-vpn +go.wit.com/apps/go-gui-toolkits git.wit.org/gui/go-gui-toolkits toolkit build helper go.wit.com/apps/go.wit.com git.wit.org/jcarr/go.wit.com # gui toolkit packages +go.wit.com/toolkits/tree git.wit.org/toolkits/tree common toolkit plugin code +go.wit.com/toolkits/andlabs git.wit.org/toolkits/andlabs Platform Native GUI (GTK on Linux and Cocoa on MacOS, Windows needs golang plugins) go.wit.com/toolkits/gocui git.wit.org/toolkits/gocui A console based GUI (like ncurses) -go.wit.com/toolkits/andlabs git.wit.org/toolkits/andlabs Platform Native GUI (GTK on Linux and Cocoa on MacOS, Winows needs plugin support) go.wit.com/toolkits/nocui git.wit.org/toolkits/nocui A minimum toolkit plugin using STDIN/STDOUT -go.wit.com/toolkits/tree git.wit.org/toolkits/tree Common plugin code to talk to the GUI +go.wit.com/toolkits/pixelgl git.wit.org/jcarr/pixelgl an experiment with opengl (no widgets yet) go.wit.com/toolkits/debian git.wit.org/toolkits/debian make a .deb of the toolkit plugin binaries # log/ (modified for the gui)