move to per-script PDS modding, trust aglais as much as bsky.app

This commit is contained in:
Charlotte Som 2024-12-19 14:55:55 +00:00
parent 9f5531ca7d
commit 7694adce3f
5 changed files with 32 additions and 0 deletions

3
pds/allow-slurs.js Normal file
View file

@ -0,0 +1,3 @@
// i like saying "#tranny" -- sue me
const slurs = require("@atproto/pds/dist/handle/explicit-slurs.js")
slurs.hasExplicitSlur = () => false;

View file

@ -9,6 +9,9 @@ const pkg = require("@atproto/pds/package.json");
const slurs = require("@atproto/pds/dist/handle/explicit-slurs.js")
slurs.hasExplicitSlur = () => false;
require("./allow-slurs.js");
require("./trust-aglais.js");
const process = require("node:process")
const main = async () => {

View file

@ -13,5 +13,8 @@
},
"devDependencies": {
"@types/express": "^5.0.0"
},
"peerDependencies": {
"@atproto/oauth-provider": "^0.2.10"
}
}

View file

@ -11,6 +11,9 @@ importers:
'@atproto/common':
specifier: ^0.4.5
version: 0.4.5
'@atproto/oauth-provider':
specifier: ^0.2.10
version: 0.2.10
'@atproto/pds':
specifier: 0.4.77
version: 0.4.77

20
pds/trust-aglais.js Normal file
View file

@ -0,0 +1,20 @@
const provider = require("@atproto/pds/dist/oauth/provider.js");
const { OAuthProvider } = require("@atproto/oauth-provider");
const origProvider = provider.PdsOAuthProvider;
class OAuthProviderDetour extends origProvider {
constructor(opts) {
super(opts);
const oClientInfo = this.clientManager.hooks.onClientInfo;
this.clientManager.hooks.onClientInfo = (clientId) => {
const info = oClientInfo(clientId);
if (clientId === "https://aglais.pages.dev/oauth/client-metadata.json") {
info.isFirstParty = true;
info.isTrusted = true;
}
return info;
};
}
}
provider.PdsOAuthProvider = OAuthProviderDetour;