summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff Carr <[email protected]>2024-01-12 11:55:45 -0600
committerJeff Carr <[email protected]>2024-01-12 11:55:45 -0600
commita36fe665e9515529166f64aaec4c88af6dedace2 (patch)
tree207903f6eaf64757a9853914c37ee9f5bf811510
parenta870d3bc76c701734e7e58e2b731e472b12d1a82 (diff)
repo's work
Signed-off-by: Jeff Carr <[email protected]>
-rw-r--r--main.go20
-rw-r--r--repoHTML.go11
2 files changed, 18 insertions, 13 deletions
diff --git a/main.go b/main.go
index 061ee47..7bc1123 100644
--- a/main.go
+++ b/main.go
@@ -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"
diff --git a/repoHTML.go b/repoHTML.go
index b9c9e29..51a759b 100644
--- a/repoHTML.go
+++ b/repoHTML.go
@@ -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>")