From d785bfbb5f0f6b3162a18c1c20d06e6333f93da6 Mon Sep 17 00:00:00 2001 From: syui Date: Mon, 2 Mar 2026 17:29:54 +0900 Subject: [PATCH] test social-app ios bsky proxy --- ...047-social-app-ios-conditional-proxy.patch | 62 +++++++++++++++++++ ios/setup.zsh | 1 + 2 files changed, 63 insertions(+) create mode 100644 ios/patching/047-social-app-ios-conditional-proxy.patch diff --git a/ios/patching/047-social-app-ios-conditional-proxy.patch b/ios/patching/047-social-app-ios-conditional-proxy.patch new file mode 100644 index 0000000..4c2d5e6 --- /dev/null +++ b/ios/patching/047-social-app-ios-conditional-proxy.patch @@ -0,0 +1,62 @@ +--- a/src/state/session/agent.ts ++++ b/src/state/session/agent.ts +@@ -43,12 +43,18 @@ + + export type ProxyHeaderValue = `${Did}#${AtprotoServiceType}` + ++// Default Bluesky proxy DID for non-self-hosted accounts (bsky.social etc.) ++const DEFAULT_BSKY_PROXY: ProxyHeaderValue = 'did:web:api.bsky.app#bsky_appview' ++ ++function shouldUseProxy(serviceUrl: string): boolean { ++ return !serviceUrl.startsWith(BSKY_SERVICE) ++} ++ + export function createPublicAgent() { + configureModerationForGuest() // Side effect but only relevant for tests + + const agent = new BskyAppAgent({service: PUBLIC_BSKY_SERVICE}) +- // Disable proxy for self-hosted environments +- // agent.configureProxy(BLUESKY_PROXY_HEADER.get()) ++ // Self-hosted public agent doesn't need proxy + return agent + } + +@@ -91,8 +97,10 @@ + // after session is attached + const aa = prefetchAgeAssuranceData({agent}) + +- // Disable proxy for self-hosted environments +- // agent.configureProxy(BLUESKY_PROXY_HEADER.get()) ++ // Enable proxy only for non-self-hosted accounts (e.g. bsky.social) ++ if (shouldUseProxy(storedAccount.service)) { ++ agent.configureProxy(DEFAULT_BSKY_PROXY) ++ } + + return agent.prepare({ + resolvers: [gates, moderation, aa], +@@ -131,8 +139,10 @@ + const moderation = configureModerationForAccount(agent, account) + const aa = prefetchAgeAssuranceData({agent}) + +- // Disable proxy for self-hosted environments +- // agent.configureProxy(BLUESKY_PROXY_HEADER.get()) ++ // Enable proxy only for non-self-hosted accounts (e.g. bsky.social) ++ if (shouldUseProxy(service)) { ++ agent.configureProxy(DEFAULT_BSKY_PROXY) ++ } + + return agent.prepare({ + resolvers: [gates, moderation, aa], +@@ -304,8 +314,10 @@ + logger.error(e, {message: `session: failed snoozeEmailConfirmationPrompt`}) + } + +- // Disable proxy for self-hosted environments +- // agent.configureProxy(BLUESKY_PROXY_HEADER.get()) ++ // Enable proxy only for non-self-hosted accounts (e.g. bsky.social) ++ if (shouldUseProxy(service)) { ++ agent.configureProxy(DEFAULT_BSKY_PROXY) ++ } + + return agent.prepare({ + resolvers: [gates, moderation, aa], diff --git a/ios/setup.zsh b/ios/setup.zsh index c970b1f..edd1297 100755 --- a/ios/setup.zsh +++ b/ios/setup.zsh @@ -54,6 +54,7 @@ PATCH_FILES_IOS=( "044-social-app-ios-splash-video.patch" "045-social-app-ios-composer-cancel.patch" "046-social-app-ios-null-url-guards.patch" + "047-social-app-ios-conditional-proxy.patch" ) function ios-env() {