-
-
Notifications
You must be signed in to change notification settings - Fork 881
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for bluesky expandos (#5546)
- Loading branch information
Showing
6 changed files
with
41 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/* @flow */ | ||
|
||
import $ from 'jquery'; | ||
import { Host } from '../../core/host'; | ||
import { ajax } from '../../environment'; | ||
|
||
export default new Host('bluesky', { | ||
name: 'bluesky', | ||
logo: 'https://bsky.app/static/favicon.png', | ||
permissions: ['https://embed.bsky.app/oembed'], | ||
domains: ['bsky.app'], | ||
detect: ({ href }) => (/^^https?:\/\/(bsky)\.app\/profile\/[\w.-]+\/post+/i).exec(href), | ||
async handleLink(href) { | ||
const post = await ajax({ | ||
url: 'https://embed.bsky.app/oembed', | ||
query: { url: href }, | ||
type:'json', | ||
}); | ||
|
||
// Script requires element to be attached to document when starting | ||
const $dummy = $('<div>'); | ||
|
||
return { | ||
type: 'GENERIC_EXPANDO', | ||
muted: true, | ||
expandoClass: 'selftext', | ||
generate: () => $dummy[0], | ||
onAttach: () => { $dummy.html(post.html); }, | ||
}; | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters