repo's work

Signed-off-by: Jeff Carr <jcarr@wit.com>
This commit is contained in:
Jeff Carr 2024-01-12 11:55:45 -06:00
parent a870d3bc76
commit a36fe665e9
2 changed files with 18 additions and 13 deletions

20
main.go
View File

@ -21,29 +21,33 @@ func okHandler(w http.ResponseWriter, r *http.Request) {
return
}
if tmp == "/test" {
findFile(w)
findFile(w, "files/repo.html")
return
}
if tmp == "/skeleton.v2.css" {
findFile(w, "files/skeleton.v2.css")
return
}
if tmp == "/gui" {
// doGui(w, "/gui/gui")
return
}
fmt.Fprintln(w, "OK")
fmt.Fprintln(w, "BAD", tmp)
}
func findFile(w http.ResponseWriter) {
fmt.Fprintln(w, "GOT TEST?")
pfile, err := htmlFiles.ReadFile("files/repo.html")
func findFile(w http.ResponseWriter, filename string) {
// fmt.Fprintln(w, "GOT TEST?")
pfile, err := htmlFiles.ReadFile(filename)
if (err != nil) {
log.Println("ERROR: err")
log.Println("ERROR:", err)
// w.Write(pfile)
return
}
var repohtml string
repohtml = string(pfile)
fmt.Fprintln(w, "GOT GUI?", repohtml)
log.Println("repo.html:", repohtml)
fmt.Fprintln(w, repohtml)
log.Println("findFile() found internal file:", filename)
// w.Close()
/*
filename = "/tmp/" + name + ".so"

View File

@ -24,18 +24,19 @@ import (
*/
func doGui(w http.ResponseWriter, gourl string, realurl string) {
fmt.Fprintln(w, "go repo =", gourl, "real url =", realurl)
realurl = "https://" + realurl
log.Info("go repo =", gourl, "real url =", realurl)
fmt.Fprintln(w, "<!DOCTYPE html>")
fmt.Fprintln(w, "<html>")
fmt.Fprintln(w, "<head>")
// fmt.Fprintln(w,
fmt.Fprintln(w, "<meta name=\"go-import\" content=\"", "go.wit.com/gui/gui", "git", "https://git.wit.org/gui/gui\">")
fmt.Fprintln(w, "<meta name=\"go-source\" content=\"", "go.wit.com/gui/gui", "https://git.wit.org/gui/gui", "https://git.wit.org/gui/tree/master{/dir}", "https://git.wit.org/gui/gui/", "tree/master{/dir}/{file}#L{line}", "\"", ">")
fmt.Fprintln(w, "<meta name=\"go-import\" content=\"", gourl, "git", realurl + "\">")
fmt.Fprintln(w, "<meta name=\"go-source\" content=\"", gourl, realurl, realurl + "/tree/master{/dir}", realurl + "tree/master{/dir}/{file}#L{line}", "\"", ">")
fmt.Fprintln(w, "<meta http-equiv=\"refresh\" content=\"0; url=", "https://git.wit.org/gui/gui", "\">")
fmt.Fprintln(w, "<meta http-equiv=\"refresh\" content=\"0; url=" + realurl + "\">")
fmt.Fprintln(w, "</head>")
fmt.Fprintln(w, "<body>")
fmt.Fprintln(w, "Nothing to see here. Please <a href=\"https://git.wit.org/gui/gui\">move along</a>.\"")
fmt.Fprintln(w, "Nothing to see here. Please <a href=\"" + realurl + "\">move along</a>.\"")
fmt.Fprintln(w, "</body>")
fmt.Fprintln(w, "</html>")