Ignore spam filters for admin users in channel
We have a chatbot active in our channel that people can ask questions and get responses back.
The problem is this is now being picked up as spam messages if the bot sends duplicate messages.
As suggested by @MadLittleMods,
Example
Glenn ten Cate @blabla1337 Jul 29 20:53 @skfchatbot what is hsts?
...
skfchatbot @skfchatbot Jul 29 20:53 Description for HSTS preload is : HTTP StrictTransportSecurity (HSTS) allows sites to specify that they should be accessedvia a secure connection only. The problem is, a user's first request to a site employingHSTS may not be over HTTPS. A preload list will allow us to ship Firefox with somepreset HSTS sites that, from the first time they're accessed in the browser, will requirea secure connection.
Glenn ten Cate @blabla1337 Jul 29 20:53 @skfchatbot tell me how to fix hsts
...
skfchatbot @skfchatbot Jul 29 20:53 Solution for HSTS preload is : In order to be included on the HSTS preload list, your site must:1. Have a valid certificate (which must expire before 2016 if it uses SHA1).2. Redirect all HTTP traffic to HTTPS—i.e. be HTTPS only.3. Serve all subdomains over HTTPS, specifically including the www subdomain if a DNSrecord for that subdomain exists.4. Serve an HSTS header on the base domain: Expiry must be at least eighteen weeks (10886400 seconds). The includeSubdomains token must be specified. The preload token must be specified. If you are serving a redirect, that redirect must have the HSTS header, not the page it redirects to.For more details on HSTS, please see RFC 6797. Note that the preload flag in the HSTSheader is required to confirm and authenticate your submission to the preload list.An example valid HSTS header: StrictTransportSecurity: maxage=10886400; includeSubDomains; preloadAdding your website to the list:https://www.chromium.org/hsts Source:https://wiki.mozilla.org/Privacy/Features/HSTS_Preload_List
Relevant code
- New messages come to the
chat-service
and get passed throughchat-spam-detection.js
,modules/chats/lib/chat-service.js#L152
-
chat-spam-detection.js
->chatSpamDetection.detect(user, message)
- In the
chat-service
, we can pass thetroupe
/room tochatSpamDetection.detect(user, message, troupe)
as an optional parameter - In
chat-spam-detection
, we canvar policyFactory = require('gitter-web-permissions/lib/policy-factory'); policyFactory.createPolicyForRoomId(user, troupe.id).then(function(policy) { if(policy.canAdmin()) { return false; } }).then(...