ai/at
1
0

fix social-app ios proxy registerpushtoken err

This commit is contained in:
2026-03-15 19:22:34 +09:00
parent d2dc3da0ef
commit 210b1dea0a
4 changed files with 174 additions and 78 deletions

View File

@@ -1,30 +1,6 @@
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/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'
--- a/src/lib/constants.ts 2026-03-15 19:17:45
+++ b/src/lib/constants.ts 2026-03-15 19:16:32
@@ -7,12 +7,12 @@
export const LOCAL_DEV_SERVICE =
Platform.OS === 'android' ? 'http://10.0.2.2:2583' : 'http://localhost:2583'
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_SCRIPT = `${EMBED_SERVICE}/static/embed.js`
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) =>
@@ -65,7 +41,7 @@ index 231447b4f..a44b3da05 100644
]
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 MAX_POST_LINES = 25
@@ -74,7 +50,7 @@ index 231447b4f..a44b3da05 100644
export const BSKY_FEED_OWNER_DIDS = [
BSKY_APP_ACCOUNT_DID,
@@ -138,9 +136,9 @@ export const BSKY_FEED_OWNER_DIDS = [
@@ -140,7 +138,7 @@
]
export const DISCOVER_FEED_URI =
@@ -83,9 +59,7 @@ index 231447b4f..a44b3da05 100644
export const VIDEO_FEED_URI =
'at://did:plc:z72i7hdynmk6r22z27h6tvur/app.bsky.feed.generator/thevids'
export const STAGING_VIDEO_FEED_URI =
'at://did:plc:yofh3kx63drvfljkibw5zuxo/app.bsky.feed.generator/thevids'
export const VIDEO_FEED_URIS = [VIDEO_FEED_URI, STAGING_VIDEO_FEED_URI]
@@ -209,8 +207,8 @@ export const urls = {
@@ -217,10 +215,43 @@
},
}
@@ -95,8 +69,43 @@ index 231447b4f..a44b3da05 100644
+export const PUBLIC_APPVIEW_DID = 'did:web:bsky.syu.is'
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
@@ -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 = {
@@ -107,6 +116,28 @@ index 231447b4f..a44b3da05 100644
community: `https://bsky.social/about/support/community-guidelines`,
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
index 5ead62c9d..7c80dfe15 100644
--- a/src/lib/demo.ts