Skip to content

Instantly share code, notes, and snippets.

@PSingletary
Forked from mary-ext/bsky-annoyances.txt
Created February 14, 2025 06:22
Show Gist options
  • Save PSingletary/eafb9b0eb4c2033148ffb7acbfc48740 to your computer and use it in GitHub Desktop.
Save PSingletary/eafb9b0eb4c2033148ffb7acbfc48740 to your computer and use it in GitHub Desktop.
custom scriptlet for removing Bluesky's annoyances
bsky.app##+js(user-bsky-annoyances.js)
main.bsky.dev##+js(user-bsky-annoyances.js)
const _fetch = globalThis.fetch;
globalThis.fetch = function (req, init) {
if (req instanceof Request) {
const url = new URL(req.url);
switch (url.pathname) {
// remove trending topics
case '/xrpc/app.bsky.unspecced.getTrendingTopics':
return Response.json({ suggested: [], topics: [] });
// remove follow suggestions
case '/xrpc/app.bsky.actor.getSuggestions':
return Response.json({ actors: [] });
// remove feed interaction tracking
case '/xrpc/app.bsky.feed.sendInteractions':
return req.clone().json().then((data) => {
data.interactions = data.interactions.filter((evt) => {
switch (evt.event) {
// requestLess and requestMore is a user-explicit action
case 'app.bsky.feed.defs#requestLess':
case 'app.bsky.feed.defs#requestMore':
return true;
}
return false;
});
// nothing to send, don't bother contacting
if (data.interactions.length === 0) {
return Response.json({});
}
req = new Request(req, { body: JSON.stringify(data) });
return _fetch.call(this, req);
});
}
} else if (req === 'https://bsky.app/ipcc') {
// remove regional moderation (germany, brazil)
return Response.json({ countryCode: 'US' });
}
return _fetch.call(this, req, init);
};
const _open = XMLHttpRequest.prototype.open;
XMLHttpRequest.prototype.open = function (method, url, isAsync, user, password) {
// remove video session tracking
{
// `video.bsky.app` is a middleware that adds session tracking,
// the actual files lives on `video.cdn.bsky.app`
url = url.replace('://video.bsky.app/watch/', '://video.cdn.bsky.app/hls/');
}
return _open.call(this, method, url, isAsync, user, password);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment