it totally works
Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
parent
7fd58e60ae
commit
f47585ff55
|
@ -25,4 +25,5 @@ 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
|
||||
go.wit.com/shell git.wit.org/wit/shell
|
||||
go.wit.com/spew github.com/wit-go/spew
|
||||
|
|
15
main.go
15
main.go
|
@ -5,19 +5,25 @@ import (
|
|||
"go.wit.com/log"
|
||||
"net/http"
|
||||
"embed"
|
||||
"strings"
|
||||
)
|
||||
|
||||
//go:embed files/*
|
||||
var htmlFiles embed.FS
|
||||
|
||||
func okHandler(w http.ResponseWriter, r *http.Request) {
|
||||
dumpClient(r)
|
||||
// dumpClient(r)
|
||||
var tmp string
|
||||
tmp = r.URL.String()
|
||||
url, repourl := findkey(tmp)
|
||||
log.Info("url =", url, "repo url =", repourl)
|
||||
parts := strings.Split(tmp, "?")
|
||||
log.Warn("client sent url =", tmp)
|
||||
log.Warn("parts are:", parts)
|
||||
requrl := parts[0]
|
||||
|
||||
url, repourl := findkey(requrl)
|
||||
log.Warn("URL =", url, "REPO URL =", repourl, "REQUEST URL =", requrl)
|
||||
if repourl != "" {
|
||||
doGui(w, url, repourl)
|
||||
repoHTML(w, url, repourl)
|
||||
return
|
||||
}
|
||||
if tmp == "/" {
|
||||
|
@ -40,6 +46,7 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
|
|||
findFile(w, "files/skeleton.v2.css")
|
||||
return
|
||||
}
|
||||
log.Warn("BAD URL =", url, "REPO URL =", repourl)
|
||||
fmt.Fprintln(w, "BAD", tmp)
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import (
|
|||
</html>
|
||||
*/
|
||||
|
||||
func doGui(w http.ResponseWriter, gourl string, realurl string) {
|
||||
func repoHTML(w http.ResponseWriter, gourl string, realurl string) {
|
||||
realurl = "https://" + realurl
|
||||
log.Info("go repo =", gourl, "real url =", realurl)
|
||||
fmt.Fprintln(w, "<!DOCTYPE html>")
|
||||
|
|
Loading…
Reference in New Issue