このコミットが含まれているのは:
守矢諏訪子 2023-05-13 14:17:07 +09:00
コミット 3f2eecb036
4個のファイルの変更11行の追加6行の削除

ファイルの表示

@ -6,7 +6,7 @@ import (
"strconv"
)
var version = "2.1.0p"
var version = "2.1.0"
func help () {
fmt.Println("使い方:");

10
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")

ファイルの表示

@ -3,8 +3,6 @@
<p class="footer">
<a href="https://gitler.moe/suwako/urloli"><img src="/static/git.png" alt="Git" /></a> |
<a href="https://076.moe/"></a>
<br />
urloli-{{.Ver}}
</p>
</body>
</html>

ファイルの表示

@ -16,6 +16,7 @@
</h1>
<div class="body">
<p>
<a href="/">{{if eq .Lan "ja"}}トップ{{else}}Top{{end}}</a>
<a href="/">{{if eq .Lan "ja"}}トップ{{else}}Top{{end}}</a> |
<a href="https://technicalsuwako.moe/blog/urloli-{{.Ves}}/">urloli-{{.Ver}}</a>
</p>
{{end}}