From 9a85f98c13c6eee524efe1d90973fe94ce46761c Mon Sep 17 00:00:00 2001 From: Nate Isern Alvarez Date: Sat, 21 Dec 2024 02:43:14 +0000 Subject: [PATCH] Update API endpoints and constants to point to Mention service --- bskyweb/cmd/embedr/main.go | 2 +- src/lib/api/feed/custom.ts | 4 ++-- src/lib/api/index.ts | 11 +++++++---- src/lib/constants.ts | 10 +++++----- src/view/screens/Home.tsx | 4 ++-- 5 files changed, 17 insertions(+), 14 deletions(-) diff --git a/bskyweb/cmd/embedr/main.go b/bskyweb/cmd/embedr/main.go index 9f75ed6..4f8465c 100644 --- a/bskyweb/cmd/embedr/main.go +++ b/bskyweb/cmd/embedr/main.go @@ -36,7 +36,7 @@ func run(args []string) { &cli.StringFlag{ Name: "appview-host", Usage: "method, hostname, and port of PDS instance", - Value: "https://public.api.bsky.app", + Value: "https://mention.earth/api", EnvVars: []string{"ATP_APPVIEW_HOST"}, }, &cli.StringFlag{ diff --git a/src/lib/api/feed/custom.ts b/src/lib/api/feed/custom.ts index dbb0246..b210bca 100644 --- a/src/lib/api/feed/custom.ts +++ b/src/lib/api/feed/custom.ts @@ -120,7 +120,7 @@ async function loggedOutFetch({ // manually construct fetch call so we can add the `lang` cache-busting param let res = await fetch( - `https://api.bsky.app/xrpc/app.bsky.feed.getFeed?feed=${feed}${ + `http://localhost:3000/api/posts?feed=${feed}${ cursor ? `&cursor=${cursor}` : '' }&limit=${limit}&lang=${contentLangs}`, { @@ -140,7 +140,7 @@ async function loggedOutFetch({ // no data, try again with language headers removed res = await fetch( - `https://api.bsky.app/xrpc/app.bsky.feed.getFeed?feed=${feed}${ + `https://mention.earth/api/posts?feed=${feed}${ cursor ? `&cursor=${cursor}` : '' }&limit=${limit}`, {method: 'GET', headers: {'Accept-Language': '', ...labelersHeader}}, diff --git a/src/lib/api/index.ts b/src/lib/api/index.ts index 75b9938..db0dad5 100644 --- a/src/lib/api/index.ts +++ b/src/lib/api/index.ts @@ -203,10 +203,13 @@ async function resolveRT(agent: BskyAgent, richtext: RichText) { async function resolveReply(agent: BskyAgent, replyTo: string) { const replyToUrip = new AtUri(replyTo) - const parentPost = await agent.getPost({ - repo: replyToUrip.host, - rkey: replyToUrip.rkey, - }) + const response = await fetch( + `https://mention.earth/api/posts/${replyToUrip.host}/${replyToUrip.rkey}`, + ) + if (!response.ok) { + throw new Error('Failed to fetch parent post') + } + const parentPost = await response.json() if (parentPost) { const parentRef = { uri: parentPost.uri, diff --git a/src/lib/constants.ts b/src/lib/constants.ts index 5d7b5eb..2bd7e28 100644 --- a/src/lib/constants.ts +++ b/src/lib/constants.ts @@ -4,14 +4,14 @@ import {AppBskyActorDefs} from '@atproto/api' 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' -export const BSKY_SERVICE = 'https://bsky.social' -export const PUBLIC_BSKY_SERVICE = 'https://public.api.bsky.app' +export const BSKY_SERVICE = 'https://mention.earth' +export const PUBLIC_BSKY_SERVICE = 'http://localhost:3000' export const DEFAULT_SERVICE = BSKY_SERVICE const HELP_DESK_LANG = 'en-us' -export const HELP_DESK_URL = `https://blueskyweb.zendesk.com/hc/${HELP_DESK_LANG}` +export const HELP_DESK_URL = `https://mentionbyoxy.zendesk.com/hc/${HELP_DESK_LANG}` 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' +export const BSKY_DOWNLOAD_URL = 'https://mention.earth/download' export const STARTER_PACK_MAX_SIZE = 150 // HACK @@ -92,7 +92,7 @@ export function LINK_META_PROXY(serviceUrl: string) { return STAGING_LINK_META_PROXY } -export const STATUS_PAGE_URL = 'https://status.bsky.app/' +export const STATUS_PAGE_URL = 'https://status.mention.earth/' // Hitslop constants export const createHitslop = (size: number): Insets => ({ diff --git a/src/view/screens/Home.tsx b/src/view/screens/Home.tsx index 59b2967..5bf2e87 100644 --- a/src/view/screens/Home.tsx +++ b/src/view/screens/Home.tsx @@ -2,7 +2,7 @@ import React from 'react' import {ActivityIndicator, StyleSheet} from 'react-native' import {useFocusEffect} from '@react-navigation/native' -import {PROD_DEFAULT_FEED} from '#/lib/constants' +// Removed the import for PROD_DEFAULT_FEED import {useNonReactiveCallback} from '#/lib/hooks/useNonReactiveCallback' import {useOTAUpdates} from '#/lib/hooks/useOTAUpdates' import {useSetTitle} from '#/lib/hooks/useSetTitle' @@ -264,7 +264,7 @@ function HomeScreenReady({ testID="customFeedPage" isPageFocused isPageAdjacent={false} - feed={`feedgen|${PROD_DEFAULT_FEED('whats-hot')}`} + feed="feedgen|https://example.com/whats-hot" renderEmptyState={renderCustomFeedEmptyState} />