diff options
| author | Jeff Carr <[email protected]> | 2024-02-26 21:48:51 -0600 |
|---|---|---|
| committer | Jeff Carr <[email protected]> | 2024-02-26 21:48:51 -0600 |
| commit | 5cf2867741ad690f32672ee8427191a3a7145016 (patch) | |
| tree | 06bbc0d6c0f42c7c7ab703ed630c3d151dc212b8 /main.go | |
| parent | 89610b4a7ba3b8f18812a6fe9356671ed0feacb2 (diff) | |
rename to forge, rename to resourcesv0.21.1
Signed-off-by: Jeff Carr <[email protected]>
Diffstat (limited to 'main.go')
| -rw-r--r-- | main.go | 23 |
1 files changed, 12 insertions, 11 deletions
@@ -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" |
