mirror of
https://github.com/FrankerFaceZ/FrankerFaceZ.git
synced 2025-06-27 21:05:53 +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
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -140,13 +140,14 @@ func HTTPBackendDropBacklog(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
}
|
||||
|
||||
func rateLimitFromRequest(r *http.Request) (rate.Limiter, error) {
|
||||
if r.FormValue("rateCount") != "" {
|
||||
c, err := strconv.ParseInt(r.FormValue("rateCount"), 10, 32)
|
||||
func rateLimitFromFormData(formData *url.Values) (rate.Limiter, error) {
|
||||
rateCount := formData.get("rateCount")
|
||||
if rateCount != "" {
|
||||
c, err := strconv.ParseInt(rateCount, 10, 32)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "rateCount")
|
||||
}
|
||||
d, err := time.ParseDuration(r.FormValue("rateTime"))
|
||||
d, err := time.ParseDuration(formData.get("rateTime"))
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "rateTime")
|
||||
}
|
||||
|
@ -186,7 +187,7 @@ func HTTPBackendCachedPublish(w http.ResponseWriter, r *http.Request) {
|
|||
}
|
||||
expires = time.Unix(timeNum, 0)
|
||||
}
|
||||
rl, err := rateLimitFromRequest(r)
|
||||
rl, err := rateLimitFromFormData(formData)
|
||||
if err != nil {
|
||||
w.WriteHeader(422)
|
||||
fmt.Fprintf(w, "error parsing ratelimit: %v", err)
|
||||
|
|
|
@ -35,6 +35,12 @@ type ConfigFile struct {
|
|||
// Path to key file.
|
||||
SSLKeyFile string
|
||||
|
||||
// Origin Checking
|
||||
UseOriginChecks bool
|
||||
|
||||
// Allowed Origins
|
||||
AllowedOrigins []string
|
||||
|
||||
// Nacl keys
|
||||
OurPrivateKey []byte
|
||||
OurPublicKey []byte
|
||||
|
|
|
@ -36,7 +36,7 @@ class FrankerFaceZ extends Module {
|
|||
this.log = new Logger(null, null, null, this.raven);
|
||||
this.core_log = this.log.get('core');
|
||||
|
||||
this.log.info(`FrankerFaceZ v${VER} (build ${VER.build})`);
|
||||
this.log.info(`FrankerFaceZ v${VER} (build ${VER.build}${VER.commit ? ` - commit ${VER.commit}` : ''})`);
|
||||
|
||||
|
||||
// ========================================================================
|
||||
|
@ -100,7 +100,7 @@ class FrankerFaceZ extends Module {
|
|||
FrankerFaceZ.Logger = Logger;
|
||||
|
||||
const VER = FrankerFaceZ.version_info = {
|
||||
major: 4, minor: 0, revision: 0, extra: '-rc8.1',
|
||||
major: 4, minor: 0, revision: 0, extra: '-rc8.2',
|
||||
commit: __git_commit__,
|
||||
build: __webpack_hash__,
|
||||
toString: () =>
|
||||
|
|
|
@ -276,6 +276,7 @@ export default class RavenLogger extends Module {
|
|||
const core = this.site.getCore(),
|
||||
out = {};
|
||||
|
||||
out.flavor = this.site.constructor.name;
|
||||
out.build = __webpack_hash__;
|
||||
out.git_commit = __git_commit__;
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ export default class Line extends Module {
|
|||
id: author.id,
|
||||
login: author.login,
|
||||
displayName: author.displayName,
|
||||
isIntl: author.name && author.displayName && author.displayName.trim().toLowerCase() !== author.name,
|
||||
isIntl: author.login && author.displayName && author.displayName.trim().toLowerCase() !== author.login,
|
||||
type: 'user'
|
||||
},
|
||||
roomLogin: room && room.login,
|
||||
|
|
|
@ -750,7 +750,7 @@ export default class ChatHook extends Module {
|
|||
if ( e && e.sentByCurrentUser ) {
|
||||
try {
|
||||
e.message.user.emotes = findEmotes(
|
||||
e.message.body.slice(8, -1),
|
||||
e.message.body,
|
||||
i.ffzGetEmotes()
|
||||
);
|
||||
|
||||
|
|
|
@ -21,6 +21,10 @@
|
|||
margin-bottom: 0 !important;
|
||||
}
|
||||
|
||||
.chat-settings__content div[data-test-selector="high-contrast-selector"] {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.autocomplete-balloon {
|
||||
.autocomplete-balloon__item {
|
||||
> .tw-flex {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue