show yatwiki version in Server header
This commit is contained in:
parent
9687f90cf5
commit
a9a6b51a3f
5
Makefile
5
Makefile
@ -9,7 +9,10 @@ SOURCES:=Makefile \
|
|||||||
cmd $(wildcard cmd/yatwiki-server/*.go) \
|
cmd $(wildcard cmd/yatwiki-server/*.go) \
|
||||||
$(wildcard *.go)
|
$(wildcard *.go)
|
||||||
|
|
||||||
GOFLAGS := -ldflags='-s -w' -gcflags='-trimpath=$(GOPATH)' -asmflags='-trimpath=$(GOPATH)'
|
GOFLAGS:=-a \
|
||||||
|
-ldflags "-s -w -X code.ivysaur.me/yatwiki.SERVER_HEADER=YATWiki/$(VERSION)" \
|
||||||
|
-gcflags '-trimpath=$(GOPATH)' \
|
||||||
|
-asmflags '-trimpath=$(GOPATH)'
|
||||||
|
|
||||||
#
|
#
|
||||||
# Phony targets
|
# Phony targets
|
||||||
|
@ -14,6 +14,8 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var SERVER_HEADER string = "YATWiki/0.0.0-devel"
|
||||||
|
|
||||||
type WikiServer struct {
|
type WikiServer struct {
|
||||||
db *WikiDB
|
db *WikiDB
|
||||||
opts *ServerOptions
|
opts *ServerOptions
|
||||||
@ -79,7 +81,7 @@ func (this *WikiServer) Close() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (this *WikiServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
func (this *WikiServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||||
w.Header().Set("Server", "YATWiki3")
|
w.Header().Set("Server", SERVER_HEADER)
|
||||||
|
|
||||||
if len(this.bans) > 0 {
|
if len(this.bans) > 0 {
|
||||||
remoteIP := RemoteAddrToIPAddress(r.RemoteAddr)
|
remoteIP := RemoteAddrToIPAddress(r.RemoteAddr)
|
||||||
|
Loading…
Reference in New Issue
Block a user