2.1.0
This commit is contained in:
parent
390acc14f2
commit
3f2eecb036
4 changed files with 11 additions and 6 deletions
2
main.go
2
main.go
|
@ -6,7 +6,7 @@ import (
|
|||
"strconv"
|
||||
)
|
||||
|
||||
var version = "2.1.0p"
|
||||
var version = "2.1.0"
|
||||
|
||||
func help () {
|
||||
fmt.Println("使い方:");
|
||||
|
|
10
srv.go
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/">076</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}}
|
||||
|
|
Loading…
Reference in a new issue