Skip to content

Commit

Permalink
Remove twitter external script (#5506)
Browse files Browse the repository at this point in the history
* Remove twitter external script
  • Loading branch information
benmcgarry authored Mar 24, 2024
1 parent 6bb4343 commit cc8a567
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/modules/hosts/twitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ export default new Host('twitter', {
attribution: false,
detect: ({ href }) => (/^https?:\/\/(?:mobile\.)?twitter\.com\/(?:#!\/)?[\w]+\/status\/?[\w]+/i).exec(href),
async handleLink(href, [url]) {
// we have to omit the script tag and all of the nice formatting it brings us in Firefox
// because AMO does not permit externally hosted script tags being pulled in from
// oEmbed like this...
// we have to omit the script tag and all of the nice formatting it brings us in Firefox/Chrome
// because AMO/MV3 does not permit externally hosted script tags being pulled in from
// oEmbed like this and MV3 prevents it with CSP...
const { html } = await ajax({
url: 'https://publish.twitter.com/oembed',
query: { url, omit_script: process.env.BUILD_TARGET === 'firefox' },
query: { url, omit_script: true },
type: 'json',
});

Expand Down

0 comments on commit cc8a567

Please sign in to comment.