fix social-app ios proxy registerpushtoken err
This commit is contained in:
@@ -1,30 +1,6 @@
|
|||||||
diff --git a/src/lib/api/feed/home.ts b/src/lib/api/feed/home.ts
|
--- a/src/lib/constants.ts 2026-03-15 19:17:45
|
||||||
index 7a0d72d91..93554dc3e 100644
|
+++ b/src/lib/constants.ts 2026-03-15 19:16:32
|
||||||
--- a/src/lib/api/feed/home.ts
|
@@ -7,12 +7,12 @@
|
||||||
+++ b/src/lib/api/feed/home.ts
|
|
||||||
@@ -45,7 +45,7 @@ export class HomeFeedAPI implements FeedAPI {
|
|
||||||
this.following = new FollowingFeedAPI({agent})
|
|
||||||
this.discover = new CustomFeedAPI({
|
|
||||||
agent,
|
|
||||||
- feedParams: {feed: PROD_DEFAULT_FEED('whats-hot')},
|
|
||||||
+ feedParams: {feed: PROD_DEFAULT_FEED('app')},
|
|
||||||
})
|
|
||||||
this.userInterests = userInterests
|
|
||||||
}
|
|
||||||
@@ -54,7 +54,7 @@ export class HomeFeedAPI implements FeedAPI {
|
|
||||||
this.following = new FollowingFeedAPI({agent: this.agent})
|
|
||||||
this.discover = new CustomFeedAPI({
|
|
||||||
agent: this.agent,
|
|
||||||
- feedParams: {feed: PROD_DEFAULT_FEED('whats-hot')},
|
|
||||||
+ feedParams: {feed: PROD_DEFAULT_FEED('app')},
|
|
||||||
userInterests: this.userInterests,
|
|
||||||
})
|
|
||||||
this.usingDiscover = false
|
|
||||||
diff --git a/src/lib/constants.ts b/src/lib/constants.ts
|
|
||||||
index 231447b4f..a44b3da05 100644
|
|
||||||
--- a/src/lib/constants.ts
|
|
||||||
+++ b/src/lib/constants.ts
|
|
||||||
@@ -7,12 +7,12 @@ import {BLUESKY_PROXY_DID, CHAT_PROXY_DID} from '#/env'
|
|
||||||
export const LOCAL_DEV_SERVICE =
|
export const LOCAL_DEV_SERVICE =
|
||||||
Platform.OS === 'android' ? 'http://10.0.2.2:2583' : 'http://localhost:2583'
|
Platform.OS === 'android' ? 'http://10.0.2.2:2583' : 'http://localhost:2583'
|
||||||
export const STAGING_SERVICE = 'https://staging.bsky.dev'
|
export const STAGING_SERVICE = 'https://staging.bsky.dev'
|
||||||
@@ -42,7 +18,7 @@ index 231447b4f..a44b3da05 100644
|
|||||||
export const EMBED_SERVICE = 'https://embed.bsky.app'
|
export const EMBED_SERVICE = 'https://embed.bsky.app'
|
||||||
export const EMBED_SCRIPT = `${EMBED_SERVICE}/static/embed.js`
|
export const EMBED_SCRIPT = `${EMBED_SERVICE}/static/embed.js`
|
||||||
export const BSKY_DOWNLOAD_URL = 'https://bsky.app/download'
|
export const BSKY_DOWNLOAD_URL = 'https://bsky.app/download'
|
||||||
@@ -79,19 +79,17 @@ export function IS_PROD_SERVICE(url?: string) {
|
@@ -81,19 +81,17 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PROD_DEFAULT_FEED = (rkey: string) =>
|
export const PROD_DEFAULT_FEED = (rkey: string) =>
|
||||||
@@ -65,7 +41,7 @@ index 231447b4f..a44b3da05 100644
|
|||||||
]
|
]
|
||||||
|
|
||||||
export const POST_IMG_MAX = {
|
export const POST_IMG_MAX = {
|
||||||
@@ -129,7 +127,7 @@ export const LANG_DROPDOWN_HITSLOP = {top: 10, bottom: 10, left: 4, right: 4}
|
@@ -131,7 +129,7 @@
|
||||||
export const BACK_HITSLOP = HITSLOP_30
|
export const BACK_HITSLOP = HITSLOP_30
|
||||||
export const MAX_POST_LINES = 25
|
export const MAX_POST_LINES = 25
|
||||||
|
|
||||||
@@ -74,7 +50,7 @@ index 231447b4f..a44b3da05 100644
|
|||||||
|
|
||||||
export const BSKY_FEED_OWNER_DIDS = [
|
export const BSKY_FEED_OWNER_DIDS = [
|
||||||
BSKY_APP_ACCOUNT_DID,
|
BSKY_APP_ACCOUNT_DID,
|
||||||
@@ -138,9 +136,9 @@ export const BSKY_FEED_OWNER_DIDS = [
|
@@ -140,7 +138,7 @@
|
||||||
]
|
]
|
||||||
|
|
||||||
export const DISCOVER_FEED_URI =
|
export const DISCOVER_FEED_URI =
|
||||||
@@ -83,9 +59,7 @@ index 231447b4f..a44b3da05 100644
|
|||||||
export const VIDEO_FEED_URI =
|
export const VIDEO_FEED_URI =
|
||||||
'at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/thevids'
|
'at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/thevids'
|
||||||
export const STAGING_VIDEO_FEED_URI =
|
export const STAGING_VIDEO_FEED_URI =
|
||||||
'at://did:plc:yofh3kx63drvfljkibw5zuxo/app.bsky.feed.generator/thevids'
|
@@ -217,10 +215,43 @@
|
||||||
export const VIDEO_FEED_URIS = [VIDEO_FEED_URI, STAGING_VIDEO_FEED_URI]
|
|
||||||
@@ -209,8 +207,8 @@ export const urls = {
|
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -95,8 +69,43 @@ index 231447b4f..a44b3da05 100644
|
|||||||
+export const PUBLIC_APPVIEW_DID = 'did:web:bsky.syu.is'
|
+export const PUBLIC_APPVIEW_DID = 'did:web:bsky.syu.is'
|
||||||
export const PUBLIC_STAGING_APPVIEW_DID = 'did:web:api.staging.bsky.dev'
|
export const PUBLIC_STAGING_APPVIEW_DID = 'did:web:api.staging.bsky.dev'
|
||||||
|
|
||||||
|
+// Official Bluesky appview DID (for non-self-hosted accounts)
|
||||||
|
+export const OFFICIAL_APPVIEW_DID = 'did:web:api.bsky.app'
|
||||||
|
+export const OFFICIAL_CHAT_DID = 'did:web:api.bsky.chat'
|
||||||
|
+
|
||||||
|
+export function isSelfHostedService(url?: string) {
|
||||||
|
+ return !!url?.includes('syu.is')
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+export function getAppviewDid(serviceUrl?: string) {
|
||||||
|
+ return isSelfHostedService(serviceUrl)
|
||||||
|
+ ? PUBLIC_APPVIEW_DID
|
||||||
|
+ : OFFICIAL_APPVIEW_DID
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+export function getProxyHeader(serviceUrl?: string): ProxyHeaderValue {
|
||||||
|
+ return `${getAppviewDid(serviceUrl)}#bsky_appview` as ProxyHeaderValue
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+export function getNotifServiceHeaders(serviceUrl?: string) {
|
||||||
|
+ return {
|
||||||
|
+ 'atproto-proxy': `${getAppviewDid(serviceUrl)}#bsky_notif`,
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+export function getDmServiceHeaders(serviceUrl?: string) {
|
||||||
|
+ const chatDid = isSelfHostedService(serviceUrl)
|
||||||
|
+ ? CHAT_PROXY_DID
|
||||||
|
+ : OFFICIAL_CHAT_DID
|
||||||
|
+ return {
|
||||||
|
+ 'atproto-proxy': `${chatDid}#bsky_chat`,
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
export const DEV_ENV_APPVIEW = `http://localhost:2584` // always the same
|
export const DEV_ENV_APPVIEW = `http://localhost:2584` // always the same
|
||||||
@@ -236,8 +234,8 @@ export const BLUESKY_MOD_SERVICE_HEADERS = {
|
export const DEV_ENV_APPVIEW_DID = `did:plc:dw4kbjf5mn7nhenabiqpkyh3` // always the same
|
||||||
|
|
||||||
|
@@ -248,8 +279,8 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
export const webLinks = {
|
export const webLinks = {
|
||||||
@@ -107,6 +116,28 @@ index 231447b4f..a44b3da05 100644
|
|||||||
community: `https://bsky.social/about/support/community-guidelines`,
|
community: `https://bsky.social/about/support/community-guidelines`,
|
||||||
communityDeprecated: `https://bsky.social/about/support/community-guidelines-deprecated`,
|
communityDeprecated: `https://bsky.social/about/support/community-guidelines-deprecated`,
|
||||||
}
|
}
|
||||||
|
diff --git a/src/lib/api/feed/home.ts b/src/lib/api/feed/home.ts
|
||||||
|
index 7a0d72d91..93554dc3e 100644
|
||||||
|
--- a/src/lib/api/feed/home.ts
|
||||||
|
+++ b/src/lib/api/feed/home.ts
|
||||||
|
@@ -45,7 +45,7 @@ export class HomeFeedAPI implements FeedAPI {
|
||||||
|
this.following = new FollowingFeedAPI({agent})
|
||||||
|
this.discover = new CustomFeedAPI({
|
||||||
|
agent,
|
||||||
|
- feedParams: {feed: PROD_DEFAULT_FEED('whats-hot')},
|
||||||
|
+ feedParams: {feed: PROD_DEFAULT_FEED('app')},
|
||||||
|
})
|
||||||
|
this.userInterests = userInterests
|
||||||
|
}
|
||||||
|
@@ -54,7 +54,7 @@ export class HomeFeedAPI implements FeedAPI {
|
||||||
|
this.following = new FollowingFeedAPI({agent: this.agent})
|
||||||
|
this.discover = new CustomFeedAPI({
|
||||||
|
agent: this.agent,
|
||||||
|
- feedParams: {feed: PROD_DEFAULT_FEED('whats-hot')},
|
||||||
|
+ feedParams: {feed: PROD_DEFAULT_FEED('app')},
|
||||||
|
userInterests: this.userInterests,
|
||||||
|
})
|
||||||
|
this.usingDiscover = false
|
||||||
diff --git a/src/lib/demo.ts b/src/lib/demo.ts
|
diff --git a/src/lib/demo.ts b/src/lib/demo.ts
|
||||||
index 5ead62c9d..7c80dfe15 100644
|
index 5ead62c9d..7c80dfe15 100644
|
||||||
--- a/src/lib/demo.ts
|
--- a/src/lib/demo.ts
|
||||||
|
|||||||
@@ -1,3 +1,58 @@
|
|||||||
|
--- a/src/state/session/agent.ts 2026-03-15 19:17:45
|
||||||
|
+++ b/src/state/session/agent.ts 2026-03-15 19:17:18
|
||||||
|
@@ -18,6 +18,8 @@
|
||||||
|
BLUESKY_PROXY_HEADER,
|
||||||
|
BSKY_SERVICE,
|
||||||
|
DISCOVER_SAVED_FEED,
|
||||||
|
+ getProxyHeader,
|
||||||
|
+ isSelfHostedService,
|
||||||
|
IS_PROD_SERVICE,
|
||||||
|
PUBLIC_BSKY_SERVICE,
|
||||||
|
TIMELINE_SAVED_FEED,
|
||||||
|
@@ -47,7 +49,9 @@
|
||||||
|
configureModerationForGuest() // Side effect but only relevant for tests
|
||||||
|
|
||||||
|
const agent = new BskyAppAgent({service: PUBLIC_BSKY_SERVICE})
|
||||||
|
- agent.configureProxy(BLUESKY_PROXY_HEADER.get())
|
||||||
|
+ if (!isSelfHostedService(PUBLIC_BSKY_SERVICE)) {
|
||||||
|
+ agent.configureProxy(BLUESKY_PROXY_HEADER.get())
|
||||||
|
+ }
|
||||||
|
return agent
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -77,7 +81,9 @@
|
||||||
|
// after session is attached
|
||||||
|
const aa = prefetchAgeAssuranceData({agent})
|
||||||
|
|
||||||
|
- agent.configureProxy(BLUESKY_PROXY_HEADER.get())
|
||||||
|
+ if (!isSelfHostedService(storedAccount.service)) {
|
||||||
|
+ agent.configureProxy(getProxyHeader(storedAccount.service))
|
||||||
|
+ }
|
||||||
|
|
||||||
|
return agent.prepare({
|
||||||
|
resolvers: [gates, moderation, aa],
|
||||||
|
@@ -116,7 +122,9 @@
|
||||||
|
const moderation = configureModerationForAccount(agent, account)
|
||||||
|
const aa = prefetchAgeAssuranceData({agent})
|
||||||
|
|
||||||
|
- agent.configureProxy(BLUESKY_PROXY_HEADER.get())
|
||||||
|
+ if (!isSelfHostedService(service)) {
|
||||||
|
+ agent.configureProxy(getProxyHeader(service))
|
||||||
|
+ }
|
||||||
|
|
||||||
|
return agent.prepare({
|
||||||
|
resolvers: [gates, moderation, aa],
|
||||||
|
@@ -288,7 +296,9 @@
|
||||||
|
logger.error(e, {message: `session: failed snoozeEmailConfirmationPrompt`})
|
||||||
|
}
|
||||||
|
|
||||||
|
- agent.configureProxy(BLUESKY_PROXY_HEADER.get())
|
||||||
|
+ if (!isSelfHostedService(service)) {
|
||||||
|
+ agent.configureProxy(getProxyHeader(service))
|
||||||
|
+ }
|
||||||
|
|
||||||
|
return agent.prepare({
|
||||||
|
resolvers: [gates, moderation, aa],
|
||||||
diff --git a/src/App.native.tsx b/src/App.native.tsx
|
diff --git a/src/App.native.tsx b/src/App.native.tsx
|
||||||
index 2c4d6fa41..b69e2b18d 100644
|
index 2c4d6fa41..b69e2b18d 100644
|
||||||
--- a/src/App.native.tsx
|
--- a/src/App.native.tsx
|
||||||
@@ -29,47 +84,3 @@ index f325539c7..3e2c7b3eb 100644
|
|||||||
CopyrightPolicy: '/support/copyright',
|
CopyrightPolicy: '/support/copyright',
|
||||||
// hashtags
|
// hashtags
|
||||||
Hashtag: '/hashtag/:tag',
|
Hashtag: '/hashtag/:tag',
|
||||||
diff --git a/src/state/session/agent.ts b/src/state/session/agent.ts
|
|
||||||
index 5c8ce3b97..ee85beb08 100644
|
|
||||||
--- a/src/state/session/agent.ts
|
|
||||||
+++ b/src/state/session/agent.ts
|
|
||||||
@@ -47,7 +47,8 @@ export function createPublicAgent() {
|
|
||||||
configureModerationForGuest() // Side effect but only relevant for tests
|
|
||||||
|
|
||||||
const agent = new BskyAppAgent({service: PUBLIC_BSKY_SERVICE})
|
|
||||||
- agent.configureProxy(BLUESKY_PROXY_HEADER.get())
|
|
||||||
+ // Disable proxy for self-hosted environments
|
|
||||||
+ // agent.configureProxy(BLUESKY_PROXY_HEADER.get())
|
|
||||||
return agent
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -88,7 +89,8 @@ export async function createAgentAndResume(
|
|
||||||
// after session is attached
|
|
||||||
const aa = prefetchAgeAssuranceData({agent})
|
|
||||||
|
|
||||||
- agent.configureProxy(BLUESKY_PROXY_HEADER.get())
|
|
||||||
+ // Disable proxy for self-hosted environments
|
|
||||||
+ // agent.configureProxy(BLUESKY_PROXY_HEADER.get())
|
|
||||||
|
|
||||||
return agent.prepare({
|
|
||||||
resolvers: [gates, moderation, aa],
|
|
||||||
@@ -127,7 +129,8 @@ export async function createAgentAndLogin(
|
|
||||||
const moderation = configureModerationForAccount(agent, account)
|
|
||||||
const aa = prefetchAgeAssuranceData({agent})
|
|
||||||
|
|
||||||
- agent.configureProxy(BLUESKY_PROXY_HEADER.get())
|
|
||||||
+ // Disable proxy for self-hosted environments
|
|
||||||
+ // agent.configureProxy(BLUESKY_PROXY_HEADER.get())
|
|
||||||
|
|
||||||
return agent.prepare({
|
|
||||||
resolvers: [gates, moderation, aa],
|
|
||||||
@@ -299,7 +302,8 @@ export async function createAgentAndCreateAccount(
|
|
||||||
logger.error(e, {message: `session: failed snoozeEmailConfirmationPrompt`})
|
|
||||||
}
|
|
||||||
|
|
||||||
- agent.configureProxy(BLUESKY_PROXY_HEADER.get())
|
|
||||||
+ // Disable proxy for self-hosted environments
|
|
||||||
+ // agent.configureProxy(BLUESKY_PROXY_HEADER.get())
|
|
||||||
|
|
||||||
return agent.prepare({
|
|
||||||
resolvers: [gates, moderation, aa],
|
|
||||||
|
|||||||
53
ios/patching/047-social-app-ios-dynamic-service.patch
Normal file
53
ios/patching/047-social-app-ios-dynamic-service.patch
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
--- a/src/lib/notifications/notifications.ts 2026-03-15 19:17:45
|
||||||
|
+++ b/src/lib/notifications/notifications.ts 2026-03-15 19:17:38
|
||||||
|
@@ -6,8 +6,8 @@
|
||||||
|
import debounce from 'lodash.debounce'
|
||||||
|
|
||||||
|
import {
|
||||||
|
- BLUESKY_NOTIF_SERVICE_HEADERS,
|
||||||
|
- PUBLIC_APPVIEW_DID,
|
||||||
|
+ getAppviewDid,
|
||||||
|
+ getNotifServiceHeaders,
|
||||||
|
PUBLIC_STAGING_APPVIEW_DID,
|
||||||
|
} from '#/lib/constants'
|
||||||
|
import {logger as notyLogger} from '#/lib/notifications/util'
|
||||||
|
@@ -39,7 +39,7 @@
|
||||||
|
const payload: AppBskyNotificationRegisterPush.InputSchema = {
|
||||||
|
serviceDid: currentAccount.service?.includes('staging')
|
||||||
|
? PUBLIC_STAGING_APPVIEW_DID
|
||||||
|
- : PUBLIC_APPVIEW_DID,
|
||||||
|
+ : getAppviewDid(currentAccount.service),
|
||||||
|
platform: Platform.OS,
|
||||||
|
token: token.data,
|
||||||
|
appId: 'xyz.blueskyweb.app',
|
||||||
|
@@ -49,7 +49,7 @@
|
||||||
|
notyLogger.debug(`registerPushToken: registering`, {...payload})
|
||||||
|
|
||||||
|
await agent.app.bsky.notification.registerPush(payload, {
|
||||||
|
- headers: BLUESKY_NOTIF_SERVICE_HEADERS,
|
||||||
|
+ headers: getNotifServiceHeaders(currentAccount.service),
|
||||||
|
})
|
||||||
|
|
||||||
|
notyLogger.debug(`registerPushToken: success`)
|
||||||
|
@@ -301,17 +301,18 @@
|
||||||
|
const token = await getPushToken()
|
||||||
|
if (token) {
|
||||||
|
for (const agent of agents) {
|
||||||
|
+ const serviceUrl = agent.serviceUrl.toString()
|
||||||
|
await agent.app.bsky.notification.unregisterPush(
|
||||||
|
{
|
||||||
|
- serviceDid: agent.serviceUrl.hostname.includes('staging')
|
||||||
|
+ serviceDid: serviceUrl.includes('staging')
|
||||||
|
? PUBLIC_STAGING_APPVIEW_DID
|
||||||
|
- : PUBLIC_APPVIEW_DID,
|
||||||
|
+ : getAppviewDid(serviceUrl),
|
||||||
|
platform: Platform.OS,
|
||||||
|
token: token.data,
|
||||||
|
appId: 'xyz.blueskyweb.app',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
- headers: BLUESKY_NOTIF_SERVICE_HEADERS,
|
||||||
|
+ headers: getNotifServiceHeaders(serviceUrl),
|
||||||
|
},
|
||||||
|
)
|
||||||
|
notyLogger.debug(`Push token unregistered for ${agent.session?.handle}`)
|
||||||
@@ -48,6 +48,7 @@ PATCH_FILES_IOS=(
|
|||||||
"041-social-app-ios-splash-custom.patch" # signin-button + splash-video (merged 044)
|
"041-social-app-ios-splash-custom.patch" # signin-button + splash-video (merged 044)
|
||||||
"045-social-app-ios-composer-cancel.patch"
|
"045-social-app-ios-composer-cancel.patch"
|
||||||
"046-social-app-ios-null-url-guards.patch"
|
"046-social-app-ios-null-url-guards.patch"
|
||||||
|
"047-social-app-ios-dynamic-service.patch" # Dynamic proxy/notif per account (syu.is vs bsky.social)
|
||||||
)
|
)
|
||||||
|
|
||||||
function ios-env() {
|
function ios-env() {
|
||||||
|
|||||||
Reference in New Issue
Block a user