Omit IP if a network type is not www or yggdrasil.
This commit is contained in:
parent
17781c5445
commit
30ffa6805b
@ -123,9 +123,13 @@ func (h *UploadHandlers) Upload(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
typ, _ := utils.NetworkType(r.Host)
|
typ, _ := utils.NetworkType(r.Host)
|
||||||
|
ip := r.Header.Get("X-Real-IP")
|
||||||
|
if typ != "www" && typ != "ygg" {
|
||||||
|
ip = ""
|
||||||
|
}
|
||||||
|
|
||||||
h.logFile.Printf("| up | %s | %s | %s | SHA256 %s | %s | %d | %s",
|
h.logFile.Printf("| up | %s | %s | %s | SHA256 %s | %s | %d | %s",
|
||||||
r.Header.Get("X-Real-IP"), typ, fHandler.Filename, fHash, fSaltedHash, fHandler.Size, r.UserAgent())
|
ip, typ, fHandler.Filename, fHash, fSaltedHash, fHandler.Size, r.UserAgent())
|
||||||
|
|
||||||
w.WriteHeader(http.StatusCreated)
|
w.WriteHeader(http.StatusCreated)
|
||||||
} else {
|
} else {
|
||||||
@ -169,10 +173,14 @@ func (h *UploadHandlers) Download(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
defer fd.Close()
|
defer fd.Close()
|
||||||
|
|
||||||
netTyp, _ := utils.NetworkType(r.Host)
|
typ, _ := utils.NetworkType(r.Host)
|
||||||
|
ip := r.Header.Get("X-Real-IP")
|
||||||
|
if typ != "www" && typ != "ygg" {
|
||||||
|
ip = ""
|
||||||
|
}
|
||||||
|
|
||||||
h.logFile.Printf("| dw | %s | %s | %s | %s | %s",
|
h.logFile.Printf("| dw | %s | %s | %s | %s | %s",
|
||||||
r.Header.Get("X-Real-IP"), netTyp, name, saltedHash, r.UserAgent())
|
ip, typ, name, saltedHash, r.UserAgent())
|
||||||
|
|
||||||
http.ServeContent(w, r, path, stat.ModTime(), fd)
|
http.ServeContent(w, r, path, stat.ModTime(), fd)
|
||||||
}
|
}
|
||||||
@ -199,10 +207,14 @@ func (h *UploadHandlers) Delete(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
netTyp, _ := utils.NetworkType(r.Host)
|
typ, _ := utils.NetworkType(r.Host)
|
||||||
|
ip := r.Header.Get("X-Real-IP")
|
||||||
|
if typ != "www" && typ != "ygg" {
|
||||||
|
ip = ""
|
||||||
|
}
|
||||||
|
|
||||||
h.logFile.Printf("| dt | %s | %s | %s | %s",
|
h.logFile.Printf("| dt | %s | %s | %s | %s",
|
||||||
r.Header.Get("X-Real-IP"), netTyp, saltedHash, r.UserAgent())
|
ip, typ, saltedHash, r.UserAgent())
|
||||||
|
|
||||||
if strings.Contains(r.UserAgent(), "curl") || strings.Contains(r.UserAgent(), "Wget") {
|
if strings.Contains(r.UserAgent(), "curl") || strings.Contains(r.UserAgent(), "Wget") {
|
||||||
fmt.Fprintln(w, "File was successfully deleted.")
|
fmt.Fprintln(w, "File was successfully deleted.")
|
||||||
|
Loading…
Reference in New Issue
Block a user