Compare commits
No commits in common. "main" and "v2" have entirely different histories.
1 changed files with 8 additions and 8 deletions
14
main.go
14
main.go
|
|
@ -17,7 +17,7 @@ import (
|
||||||
"strings"
|
"strings"
|
||||||
)
|
)
|
||||||
|
|
||||||
const VERSION = "v5"
|
const VERSION = "v2"
|
||||||
|
|
||||||
var (
|
var (
|
||||||
flagVerbose bool
|
flagVerbose bool
|
||||||
|
|
@ -49,11 +49,7 @@ func main() {
|
||||||
http.HandleFunc("/sites", actionSites)
|
http.HandleFunc("/sites", actionSites)
|
||||||
|
|
||||||
log.Println("Listen on [::]:5123")
|
log.Println("Listen on [::]:5123")
|
||||||
err := http.ListenAndServe("[::]:5123", nil)
|
http.ListenAndServe("[::]:5123", nil)
|
||||||
if err != nil {
|
|
||||||
log.Println(err)
|
|
||||||
os.Exit(1)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func replaceTilde(str string) string { // {{{
|
func replaceTilde(str string) string { // {{{
|
||||||
|
|
@ -73,7 +69,10 @@ func replaceTilde(str string) string { // {{{
|
||||||
func pageIndex(w http.ResponseWriter, r *http.Request) { // {{{
|
func pageIndex(w http.ResponseWriter, r *http.Request) { // {{{
|
||||||
var tmpl *template.Template
|
var tmpl *template.Template
|
||||||
var err error
|
var err error
|
||||||
|
if false {
|
||||||
tmpl, err = template.ParseFS(fs, "static/html/index.html")
|
tmpl, err = template.ParseFS(fs, "static/html/index.html")
|
||||||
|
}
|
||||||
|
tmpl, err = template.ParseFiles("static/html/index.html")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.Write([]byte(err.Error()))
|
w.Write([]byte(err.Error()))
|
||||||
return
|
return
|
||||||
|
|
@ -88,7 +87,8 @@ func pageIndex(w http.ResponseWriter, r *http.Request) { // {{{
|
||||||
func pageCSS(w http.ResponseWriter, r *http.Request) { // {{{
|
func pageCSS(w http.ResponseWriter, r *http.Request) { // {{{
|
||||||
w.Header().Add("Content-Type", "text/css")
|
w.Header().Add("Content-Type", "text/css")
|
||||||
|
|
||||||
data, err := fs.ReadFile("static/css/main.css")
|
//data, err := fs.ReadFile("static/css/main.css")
|
||||||
|
data, err := os.ReadFile("static/css/main.css")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.Write([]byte(err.Error()))
|
w.Write([]byte(err.Error()))
|
||||||
return
|
return
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue