diff --git a/main.go b/main.go index df2abf7..aa0eed9 100644 --- a/main.go +++ b/main.go @@ -6,7 +6,7 @@ import ( "strconv" ) -var version = "2.1.0p" +var version = "2.1.0" func help () { fmt.Println("使い方:"); diff --git a/srv.go b/srv.go index dea923f..0cd7fa4 100644 --- a/srv.go +++ b/srv.go @@ -5,6 +5,7 @@ import ( "fmt" "net/http" "encoding/json" + "strings" ) type ( @@ -15,6 +16,7 @@ type ( Dom string Lan string Ver string + Ves string } Api struct { Cod int `json:"code"` @@ -23,6 +25,10 @@ type ( Mot string `json:"origin"` New bool `json:"isnew"` } + Stat struct { + Url string `json:"url"` + Ver string `json:"version"` + } ) func serv (cnf Config, port int) { @@ -32,7 +38,7 @@ func serv (cnf Config, port int) { http.HandleFunc("/api", func(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json; charset=UTF-8") w.WriteHeader(200) - buf, _ := json.MarshalIndent(&Api{Cod: 200}, "", " ") + buf, _ := json.MarshalIndent(&Stat{Url: cnf.domain, Ver: version}, "", " ") _, _ = w.Write(buf) }) @@ -76,7 +82,7 @@ func serv (cnf Config, port int) { }) http.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) { - data := &Page{Ver: version} + data := &Page{Ver: version, Ves: strings.ReplaceAll(version, ".", "")} uri := r.URL.Path cookie, err := r.Cookie("lang") diff --git a/view/footer.html b/view/footer.html index bf3e913..56a13a4 100644 --- a/view/footer.html +++ b/view/footer.html @@ -3,8 +3,6 @@ diff --git a/view/header.html b/view/header.html index 0013fbb..7864ff3 100644 --- a/view/header.html +++ b/view/header.html @@ -16,6 +16,7 @@

- {{if eq .Lan "ja"}}トップ{{else}}Top{{end}} + {{if eq .Lan "ja"}}トップ{{else}}Top{{end}} | + urloli-{{.Ver}}

{{end}}