api,frontend: add Akismet spam flagging integration

This commit is contained in:
Adhityaa Chandrasekar
2018-12-19 22:57:02 -05:00
parent d1318daaca
commit 9fcf67d667
8 changed files with 102 additions and 19 deletions

View File

@@ -43,3 +43,16 @@ func bodyMarshal(w http.ResponseWriter, x map[string]interface{}) error {
w.Write(resp)
return nil
}
func getIp(r *http.Request) string {
ip := r.RemoteAddr
if r.Header.Get("X-Forwarded-For") != "" {
ip = r.Header.Get("X-Forwarded-For")
}
return ip
}
func getUserAgent(r *http.Request) string {
return r.Header.Get("User-Agent")
}