Configure proxy

This commit is contained in:
Eric Bailey
2025-01-09 12:42:00 -06:00
parent cea35fafd5
commit d376969a0d
2 changed files with 5 additions and 2 deletions
-2
View File
@@ -6,5 +6,3 @@ export const LOG_LEVEL = (process.env.EXPO_PUBLIC_LOG_LEVEL || 'info') as
| 'error' | 'error'
export const APPVIEW_PROXY = process.env.APPVIEW_PROXY || '' export const APPVIEW_PROXY = process.env.APPVIEW_PROXY || ''
console.log({APPVIEW_PROXY})
+5
View File
@@ -13,6 +13,7 @@ import {tryFetchGates} from '#/lib/statsig/statsig'
import {getAge} from '#/lib/strings/time' import {getAge} from '#/lib/strings/time'
import {logger} from '#/logger' import {logger} from '#/logger'
import {snoozeEmailConfirmationPrompt} from '#/state/shell/reminders' import {snoozeEmailConfirmationPrompt} from '#/state/shell/reminders'
import {APPVIEW_PROXY} from '#/env'
import {emitNetworkConfirmed, emitNetworkLost} from '../events' import {emitNetworkConfirmed, emitNetworkLost} from '../events'
import {addSessionErrorLog} from './logging' import {addSessionErrorLog} from './logging'
import { import {
@@ -24,6 +25,7 @@ import {isSessionExpired, isSignupQueued} from './util'
export function createPublicAgent() { export function createPublicAgent() {
configureModerationForGuest() // Side effect but only relevant for tests configureModerationForGuest() // Side effect but only relevant for tests
// TODO logged out view
return new BskyAppAgent({service: PUBLIC_BSKY_SERVICE}) return new BskyAppAgent({service: PUBLIC_BSKY_SERVICE})
} }
@@ -36,6 +38,7 @@ export async function createAgentAndResume(
) => void, ) => void,
) { ) {
const agent = new BskyAppAgent({service: storedAccount.service}) const agent = new BskyAppAgent({service: storedAccount.service})
agent.configureProxy(`did:web:${APPVIEW_PROXY}#bsky_appview`)
if (storedAccount.pdsUrl) { if (storedAccount.pdsUrl) {
agent.sessionManager.pdsUrl = new URL(storedAccount.pdsUrl) agent.sessionManager.pdsUrl = new URL(storedAccount.pdsUrl)
} }
@@ -83,6 +86,7 @@ export async function createAgentAndLogin(
) => void, ) => void,
) { ) {
const agent = new BskyAppAgent({service}) const agent = new BskyAppAgent({service})
agent.configureProxy(`did:web:${APPVIEW_PROXY}#bsky_appview`)
await agent.login({identifier, password, authFactorToken}) await agent.login({identifier, password, authFactorToken})
const account = agentToSessionAccountOrThrow(agent) const account = agentToSessionAccountOrThrow(agent)
@@ -118,6 +122,7 @@ export async function createAgentAndCreateAccount(
) => void, ) => void,
) { ) {
const agent = new BskyAppAgent({service}) const agent = new BskyAppAgent({service})
agent.configureProxy(`did:web:${APPVIEW_PROXY}#bsky_appview`)
await agent.createAccount({ await agent.createAccount({
email, email,
password, password,