Skip to content

Commit

Permalink
finish renaming domains list in messages
Browse files Browse the repository at this point in the history
  • Loading branch information
iparamonau committed Jan 12, 2023
1 parent 0926484 commit 9bf00d8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Iframely takes your URL and returns its metadata. If supported on the URL, we'll

This package includes specific domain parsers for most popular publishers. YouTube, Facebook, Instagram, Twitter, SoundCloud, Google Maps, TED, Twitch and many more. See `/plugins/domains` folder. In addition, we cover many domains by whitelisting media through the generic publishing protocols: [oEmbed](http://oembed.com/), [Open Graph](http://ogp.me/), [Twitter Cards](https://dev.twitter.com/docs/cards) and microformats. For the rest of URLs, you'll include have metadata and thumbnail images from those protocols. Use it to create your own URL previews.

Iframely's [whitelist file](https://iframely.com/qa/whitelist.json) is fetched from our central database. The changes are synced automatically to your instance by default. But you replace that with [your own whitelist](https://iframely.com/docs/whitelist-format) file. There should be over 1500 domains covered by the central whitelist.
Iframely's [whitelist file](https://iframely.com/qa/domains.json) is fetched from our central database. The changes are synced automatically to your instance by default. But you replace that with [your own whitelist](https://iframely.com/docs/whitelist-format) file. There should be over 1500 domains covered by the central whitelist.

## Breaking changes in version 2.0.0

Expand Down
2 changes: 1 addition & 1 deletion config.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
use_http2: true,
DEBUG: false,

WHITELIST_URL: 'https://iframely.com/qa/whitelist.json',
WHITELIST_URL: 'https://iframely.com/qa/domains.json',
WHITELIST_URL_RELOAD_PERIOD: 60 * 60 * 1000, // will reload WL every hour, if no local files are found in /whitelist folder

WHITELIST_WILDCARD: {},
Expand Down
2 changes: 1 addition & 1 deletion config.local.js.SAMPLE
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ export default {
*/

// The list of regexs to be ignored. Iframely will return 417
// At minimum, keep your localhosts blacklisted to avoid SSRF
// At minimum, keep your localhosts ignored to avoid SSRF
IGNORE_DOMAINS_RE: [
/^https?:\/\/127\.0\.0\.1/i,
/^https?:\/\/localhost/i,
Expand Down
16 changes: 8 additions & 8 deletions lib/whitelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -237,18 +237,18 @@

addWildcard();

log('Whitelist activated. Domains, including blacklisted:', Object.keys(data.domains).length);
log('Domains list activated.', Object.keys(data.domains).length, 'domains, including disabled ones');
}

function readWhitelist(filename) {

var newWhitelist;

try {
console.log('Loading whitelist:', filename);
console.log('Loading domains file:', filename);
newWhitelist = JSON.parse(fs.readFileSync(filename, 'utf8'));
} catch(ex) {
console.log("Error loading whitelist:", ex);
console.log("Error parsing domains list:", ex);
}

if (newWhitelist) {
Expand Down Expand Up @@ -293,7 +293,7 @@
if (filename && filename != currentWhitelistFilename) {
readWhitelist(filename);
} else {
console.log('No local whitelist file detected...');
console.log('No local domains file detected...');
addWildcard();
}

Expand Down Expand Up @@ -339,7 +339,7 @@

if (!currentWhitelistFilename && CONFIG.WHITELIST_URL && CONFIG.WHITELIST_URL_RELOAD_PERIOD) {

log("Loading whitelist from " + CONFIG.WHITELIST_URL);
log("Loading domains list from " + CONFIG.WHITELIST_URL);

var options = {
uri: CONFIG.WHITELIST_URL,
Expand All @@ -363,13 +363,13 @@
request(utils.prepareRequestOptions(options), function(error, r, newWhitelist) {

if (error) {
console.error('Error loading whitelist from ' + CONFIG.WHITELIST_URL + ' : ' + error);
console.error('Error loading domains list from ' + CONFIG.WHITELIST_URL + ' : ' + error);
} else if (r.statusCode === 500) {
console.error('Error loading whitelist from ' + CONFIG.WHITELIST_URL + ' : ' + newWhitelist);
console.error('Error loading domains list from ' + CONFIG.WHITELIST_URL + ' : ' + newWhitelist);
} else if (r.statusCode === 304) {
log('Whitelist respond: 304 (not modified)');
} else if (!newWhitelist || typeof newWhitelist === 'string') {
console.error('Error loading whitelist from ' + CONFIG.WHITELIST_URL + ' : incorrect data: ' + newWhitelist);
console.error('Error loading domains list from ' + CONFIG.WHITELIST_URL + ' : incorrect data: ' + newWhitelist);
} else {

whitelistLastModified = r.headers['last-modified'];
Expand Down

0 comments on commit 9bf00d8

Please sign in to comment.