mirror of
https://github.com/jeessy2/ddns-go.git
synced 2025-10-20 15:33:46 +08:00
fix: need to parse the referer (#1204)
This commit is contained in:
@ -6,6 +6,7 @@ import (
|
||||
"fmt"
|
||||
"html/template"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"time"
|
||||
|
||||
"github.com/jeessy2/ddns-go/v6/config"
|
||||
@ -95,8 +96,10 @@ func LoginFunc(w http.ResponseWriter, r *http.Request) {
|
||||
returnError(w, util.LogStr("需在 %s 之前完成用户名密码设置,请重启ddns-go", startTime.Add(saveLimit).Format("2006-01-02 15:04:05")))
|
||||
return
|
||||
}
|
||||
|
||||
conf.NotAllowWanAccess = true
|
||||
if !util.IsPrivateNetwork(r.Header.Get("referer")) {
|
||||
u, err := url.Parse(r.Header.Get("referer"))
|
||||
if err == nil && !util.IsPrivateNetwork(u.Host) {
|
||||
conf.NotAllowWanAccess = false
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user