File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -350,6 +350,26 @@ class BskyAppAgent extends BskyAgent {
350350 super ( {
351351 service,
352352 async fetch ( ...args ) {
353+ // PDS-local prefs methods must not carry the appview proxy header.
354+ const input = args [ 0 ] as string | URL | Request
355+ const url =
356+ typeof input === 'string'
357+ ? input
358+ : input instanceof URL
359+ ? input . href
360+ : input . url
361+ if (
362+ url &&
363+ ( url . includes ( 'app.bsky.actor.getPreferences' ) ||
364+ url . includes ( 'app.bsky.actor.putPreferences' ) )
365+ ) {
366+ const init = args [ 1 ] as RequestInit | undefined
367+ if ( init ?. headers ) {
368+ const headers = new Headers ( init . headers )
369+ headers . delete ( 'atproto-proxy' )
370+ init . headers = headers
371+ }
372+ }
353373 let success = false
354374 try {
355375 const result = await realFetch ( ...args )
You can’t perform that action at this time.
0 commit comments