From 4b303429e2bf59887d4c749b76a5657915901170 Mon Sep 17 00:00:00 2001 From: Ivan Paramonau Date: Tue, 23 Jul 2024 21:08:27 -0400 Subject: [PATCH] facebook: apply meta fallback only to FB --- .../facebook.com/facebook.meta-fallback.js} | 7 ++++++- plugins/domains/facebook.com/facebook.thumbnail.js | 4 ++-- 2 files changed, 8 insertions(+), 3 deletions(-) rename plugins/{custom/meta-fallback.js => domains/facebook.com/facebook.meta-fallback.js} (71%) diff --git a/plugins/custom/meta-fallback.js b/plugins/domains/facebook.com/facebook.meta-fallback.js similarity index 71% rename from plugins/custom/meta-fallback.js rename to plugins/domains/facebook.com/facebook.meta-fallback.js index 56aee1333..e87a84b94 100644 --- a/plugins/custom/meta-fallback.js +++ b/plugins/domains/facebook.com/facebook.meta-fallback.js @@ -2,6 +2,11 @@ export default { provides: 'meta', + re: [ + 'facebook.post', + 'facebook.video' + ], + getData: function(url, __statusCode, options, cb) { return __statusCode !== 429 && __statusCode !== 403 &&__statusCode !== 508 @@ -12,7 +17,7 @@ export default { : cb(null, { meta: {}, - message: `${options.provider || 'Publisher'} is rate-limiting. Meta disabled.` + message: `Facebook is rate-limiting. Meta disabled.` }) } }; \ No newline at end of file diff --git a/plugins/domains/facebook.com/facebook.thumbnail.js b/plugins/domains/facebook.com/facebook.thumbnail.js index 03fd2f83d..051acf814 100644 --- a/plugins/domains/facebook.com/facebook.thumbnail.js +++ b/plugins/domains/facebook.com/facebook.thumbnail.js @@ -12,7 +12,7 @@ export default { 'facebook.video' ], - mixins: ['meta-fallback'], + mixins: ['facebook.meta-fallback'], getLink: function(url, __allowFBThumbnail, options, meta) { @@ -72,6 +72,6 @@ export default { tests: [{ noFeeds: true, skipMethods: ['getData', 'getLink'], - skipMixins: ['meta-fallback'] + skipMixins: ['facebook.meta-fallback'] }] }; \ No newline at end of file