Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] Add setting to change User Agent of OEmbed calls #6753

Merged
merged 4 commits into from
Jul 27, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/rocketchat-i18n/i18n/en.i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,7 @@
"API_Drupal_URL": "Drupal Server URL",
"API_Drupal_URL_Description": "Example: https://domain.com (excluding trailing slash)",
"API_Embed": "Embed Link Previews",
"API_Embed_UserAgent": "Embed request user agent",
"API_Embed_Description": "Whether embedded link previews are enabled or not when a user posts a link to a website.",
"API_EmbedCacheExpirationDays": "Embed cache expiration days",
"API_EmbedDisabledFor": "Disable Embed for Users",
Expand Down
4 changes: 4 additions & 0 deletions packages/rocketchat-lib/server/startup/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -789,6 +789,10 @@ RocketChat.settings.addGroup('Message', function() {
type: 'boolean',
'public': true
});
this.add('API_Embed_UserAgent', 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36', {
type: 'string',
'public': true
});
this.add('API_EmbedCacheExpirationDays', 30, {
type: 'int',
'public': false
Expand Down
2 changes: 1 addition & 1 deletion packages/rocketchat-oembed/server/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ const getUrlContent = function(urlObj, redirectCount = 5, callback) {
gzip: true,
maxRedirects: redirectCount,
headers: {
'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2227.0 Safari/537.36'
'User-Agent': RocketChat.settings.get('API_Embed_UserAgent')
}
};
let headers = null;
Expand Down