mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-09-15 17:46:55 +00:00
4.0.0-rc8.2
* Fixed: Appearance of Twitch emotes in locally displayed `/me` messages in chat. * Fixed: Rendering of international usernames in Clips Chat. * Changed: Tag error reports with the current site. Fix the implementation of rate-limiting in the socket server to use data from the sealed request. Load a list of acceptable origins from the config file.
This commit is contained in:
parent
7f7312188c
commit
7e6a08ad1d
8 changed files with 33 additions and 17 deletions
|
@ -53,13 +53,6 @@ const AsyncResponseCommand Command = "_async"
|
|||
|
||||
const defaultMinMemoryKB = 1024 * 24
|
||||
|
||||
// DotTwitchDotTv is the .twitch.tv suffix.
|
||||
const DotTwitchDotTv = ".twitch.tv"
|
||||
|
||||
const dotCbenniDotCom = ".cbenni.com"
|
||||
|
||||
var OriginRegexp = regexp.MustCompile("(" + DotTwitchDotTv + "|" + dotCbenniDotCom + ")" + "$")
|
||||
|
||||
// ResponseSuccess is a Reply ClientMessage with the MessageID not yet filled out.
|
||||
var ResponseSuccess = ClientMessage{Command: SuccessCommand}
|
||||
|
||||
|
@ -228,7 +221,18 @@ var SocketUpgrader = websocket.Upgrader{
|
|||
ReadBufferSize: 160,
|
||||
WriteBufferSize: 1024,
|
||||
CheckOrigin: func(r *http.Request) bool {
|
||||
return r.Header.Get("Origin") == "" || OriginRegexp.MatchString(r.Header.Get("Origin"))
|
||||
origin := r.Header.Get("Origin")
|
||||
if origin == "" || ! Configuration.UseOriginChecks {
|
||||
return true
|
||||
}
|
||||
|
||||
for _, allowedOrigin := range Configuration.AllowedOrigins {
|
||||
if strings.Contains(origin, allowedOrigin) {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
},
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue