Skip to content

Commit

Permalink
Added support for bluesky expandos (#5546)
Browse files Browse the repository at this point in the history
  • Loading branch information
steckums authored Jan 5, 2025
1 parent e7810ce commit 488544d
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 4 deletions.
3 changes: 2 additions & 1 deletion chrome/beta/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
"https://redditenhancementsuite.com/oauth",
"https://accounts.google.com/signin/oauth",
"https://www.dropbox.com/oauth2/authorize",
"https://login.live.com/oauth20_authorize.srf"
"https://login.live.com/oauth20_authorize.srf",
"https://embed.bsky.app/oembed"
],
"web_accessible_resources": [
{
Expand Down
3 changes: 2 additions & 1 deletion chrome/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
"https://redditenhancementsuite.com/oauth",
"https://accounts.google.com/signin/oauth",
"https://www.dropbox.com/oauth2/authorize",
"https://login.live.com/oauth20_authorize.srf"
"https://login.live.com/oauth20_authorize.srf",
"https://embed.bsky.app/oembed"
],
"web_accessible_resources": [
{
Expand Down
3 changes: 2 additions & 1 deletion firefox/beta/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
"https://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/*",
"https://www.googleapis.com/drive/v3/*",
"https://*.redd.it/*",
"https://www.flickr.com/services/oembed"
"https://www.flickr.com/services/oembed",
"https://embed.bsky.app/oembed"
],
"web_accessible_resources": [
"prompt.html",
Expand Down
3 changes: 2 additions & 1 deletion firefox/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@
"https://api.steampowered.com/ISteamRemoteStorage/GetPublishedFileDetails/*",
"https://www.googleapis.com/drive/v3/*",
"https://*.redd.it/*",
"https://www.flickr.com/services/oembed"
"https://www.flickr.com/services/oembed",
"https://embed.bsky.app/oembed"
],
"web_accessible_resources": [
"prompt.html",
Expand Down
31 changes: 31 additions & 0 deletions lib/modules/hosts/bluesky.js
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); },
};
},
});
2 changes: 2 additions & 0 deletions lib/modules/hosts/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import adultswim from './adultswim';
import archilogic from './archilogic';
import archiveis from './archiveis';
import bime from './bime';
import bluesky from './bluesky';
import clyp from './clyp';
import codepen from './codepen';
import coub from './coub';
Expand Down Expand Up @@ -91,6 +92,7 @@ export {
archilogic,
archiveis,
bime,
bluesky,
clyp,
codepen,
coub,
Expand Down

0 comments on commit 488544d

Please sign in to comment.