From f8ae1dee50c18b4d33036ed48c48d2111b35fe85 Mon Sep 17 00:00:00 2001 From: Jeff Carr Date: Fri, 12 Jan 2024 12:26:05 -0600 Subject: [PATCH] almost completely working Signed-off-by: Jeff Carr --- https.go | 6 +- indexHtml.go | 253 +++++++++++++++++++++++++++++++++++++++++++++++++++ main.go | 15 ++- 3 files changed, 267 insertions(+), 7 deletions(-) create mode 100644 indexHtml.go diff --git a/https.go b/https.go index 33a1099..00fca19 100644 --- a/https.go +++ b/https.go @@ -6,10 +6,10 @@ import ( ) func https() { - http.HandleFunc("/", okHandler) + // http.HandleFunc("/", okHandler) - certPath := "/etc/letsencrypt/live/yourdomain.com/fullchain.pem" - keyPath := "/etc/letsencrypt/live/yourdomain.com/privkey.pem" + certPath := "/etc/letsencrypt/live/go.wit.com/fullchain.pem" + keyPath := "/etc/letsencrypt/live/go.wit.com/privkey.pem" err := http.ListenAndServeTLS(":443", certPath, keyPath, nil) if err != nil { diff --git a/indexHtml.go b/indexHtml.go new file mode 100644 index 0000000..5af15bf --- /dev/null +++ b/indexHtml.go @@ -0,0 +1,253 @@ +package main + +import ( + "fmt" + "net/http" +) + +/* +func indexHtml(w http.ResponseWriter) { + realurl = "https://" + realurl + + log.Info("go repo =", gourl, "real url =", realurl) + fmt.Fprintln(w, "") + fmt.Fprintln(w, "") + fmt.Fprintln(w, "") + // fmt.Fprintln(w, + fmt.Fprintln(w, "") + fmt.Fprintln(w, "") + + fmt.Fprintln(w, "") + fmt.Fprintln(w, "") + fmt.Fprintln(w, "") + fmt.Fprintln(w, "Nothing to see here. Please move along.\"") + fmt.Fprintln(w, "") + fmt.Fprintln(w, "") +} +*/ + +/* + indexHeader(w) + indexBodyStart(w) + indexBodyEnd(w) +*/ + +func indexHeader(w http.ResponseWriter) { + fmt.Fprintln(w, "") + fmt.Fprintln(w, "") + fmt.Fprintln(w, " ") + fmt.Fprintln(w, " ") + fmt.Fprintln(w, " ") + fmt.Fprintln(w, " ") + fmt.Fprintln(w, "") +} + +func indexBodyStart(w http.ResponseWriter) { + // fmt.Fprintln(w, " + fmt.Fprintln(w, " ") + fmt.Fprintln(w, "
") + fmt.Fprintln(w, "
") + fmt.Fprintln(w, " ") + fmt.Fprintln(w, " ") + fmt.Fprintln(w, " ") + fmt.Fprintln(w, " ") + fmt.Fprintln(w, " ") + fmt.Fprintln(w, " ") + fmt.Fprintln(w, " ") + fmt.Fprintln(w, " ") + fmt.Fprintln(w, " ") + fmt.Fprintln(w, " ") + fmt.Fprintln(w, " ") + fmt.Fprintln(w, "") +} + +func indexBodyEnd(w http.ResponseWriter) { + // fmt.Fprintln(w, " + fmt.Fprintln(w, " ") + fmt.Fprintln(w, "
Packagego getAuthoritative sources (IPv6 only)github mirrorDocumentation
") + fmt.Fprintln(w, "
") + fmt.Fprintln(w, "
") + fmt.Fprintln(w, " ") + fmt.Fprintln(w, " ") +} +/* + + +
log/ (needed for the gui)
+ + log + go.wit.com/log + git.wit.org/wit/log + github.com/wit-go/log + Go Reference + + + + +
gui/ packages
+ + gui/gui + go.wit.com/gui/gui + git.wit.org/gui/gui + github.com/wit-go/gui + Go Reference + + + gui/widget + go.wit.com/gui/widget + git.wit.org/gui/widget + github.com/wit-go/widget + Go Reference + + + gui/gadgets + go.wit.com/gui/gadgets + git.wit.org/gui/gadgets + github.com/wit-go/gadgets + Go Reference + + + gui/toolkits + go.wit.com/gui/toolkits + git.wit.org/gui/toolkits + github.com/wit-go/toolkits + Go Reference + + + gui/debugger + go.wit.com/gui/debugger + git.wit.org/gui/debugger + github.com/wit-go/debugger + Go Reference + + + gui/examples + go.wit.com/gui/examples + git.wit.org/gui/examples + github.com/wit-go/examples + + + + gui/digitalocean + go.wit.com/gui/digitalocean + git.wit.org/gui/digitalocean + + Go Reference + + + gui/cloudflare + go.wit.com/gui/cloudflare + git.wit.org/gui/cloudflare + + Go Reference + + + +
Applications
+ + control-panel-dns + go.wit.com/apps/control-panel-dns + git.wit.org/jcarr/control-panel-dns + + Go Reference + + + control-panel-digitalocean + go.wit.com/apps/control-panel-digitalocean + git.wit.org/wit/control-panel-digitalocean + + Go Reference + + + control-panel-cloudflare + go.wit.com/apps/control-panel-cloudflare + git.wit.org/wit/control-panel-cloudflare + + Go Reference + + + + + +
Support packages
+ + + arg + go.wit.com/arg + git.wit.org/wit/arg + github.com/wit-go/go-arg + Go Reference + + + spew + go.wit.com/spew + git.wit.org/wit/spew + github.com/wit-go/spew + Go Reference + + + dnssec + go.wit.com/dnssec + git.wit.org/wit/dnssec + github.com/wit-go/dnssec + Go Reference + + + + shell + go.wit.com/shell + git.wit.org/wit/shell + github.com/wit-go/shell + Go Reference + + + + + + + + + + + + + +*/ diff --git a/main.go b/main.go index 7bc1123..ddc7bf6 100644 --- a/main.go +++ b/main.go @@ -20,6 +20,16 @@ func okHandler(w http.ResponseWriter, r *http.Request) { doGui(w, url, repourl) return } + if tmp == "/" { + findFile(w, "files/index.html") + return + } + if tmp == "/new" { + indexHeader(w) + indexBodyStart(w) + indexBodyEnd(w) + return + } if tmp == "/test" { findFile(w, "files/repo.html") return @@ -28,10 +38,6 @@ func okHandler(w http.ResponseWriter, r *http.Request) { findFile(w, "files/skeleton.v2.css") return } - if tmp == "/gui" { - // doGui(w, "/gui/gui") - return - } fmt.Fprintln(w, "BAD", tmp) } @@ -68,6 +74,7 @@ func main() { */ readconfigfile() http.HandleFunc("/", okHandler) + https() err := http.ListenAndServe(":80", nil) if err != nil { log.Println("Error starting server:", err)