fetch e2e proxy did directly
This commit is contained in:
@@ -152,6 +152,7 @@ echo "Metro bundle pre-warmed for $bundle_platform"
|
|||||||
if [[ "$platform" == "android" ]]; then
|
if [[ "$platform" == "android" ]]; then
|
||||||
phase "Configuring Android localhost routing"
|
phase "Configuring Android localhost routing"
|
||||||
adb -s "$device_id" reverse tcp:3000 tcp:3000
|
adb -s "$device_id" reverse tcp:3000 tcp:3000
|
||||||
|
adb -s "$device_id" reverse tcp:1986 tcp:1986
|
||||||
adb -s "$device_id" reverse tcp:8081 tcp:8081
|
adb -s "$device_id" reverse tcp:8081 tcp:8081
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -28,10 +28,11 @@ appId: xyz.blueskyweb.app
|
|||||||
- back
|
- back
|
||||||
- extendedWaitUntil:
|
- extendedWaitUntil:
|
||||||
visible:
|
visible:
|
||||||
id: e2eProxyHeaderInput
|
id: e2eConfigureProxy
|
||||||
timeout: 180000
|
timeout: 180000
|
||||||
- tapOn:
|
|
||||||
id: e2eProxyHeaderInput
|
|
||||||
- inputText: ${output.result}
|
|
||||||
- tapOn:
|
- tapOn:
|
||||||
id: e2eConfigureProxy
|
id: e2eConfigureProxy
|
||||||
|
- extendedWaitUntil:
|
||||||
|
visible:
|
||||||
|
id: e2eSignInAlice
|
||||||
|
timeout: 30000
|
||||||
|
|||||||
+16
-1
@@ -7,8 +7,23 @@ let server: TestPDS
|
|||||||
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
// eslint-disable-next-line @typescript-eslint/no-misused-promises
|
||||||
createHTTPServer(async (req, res) => {
|
createHTTPServer(async (req, res) => {
|
||||||
const url = parse(req.url || '/', true)
|
const url = parse(req.url || '/', true)
|
||||||
|
if (req.method === 'GET') {
|
||||||
|
if (!server) {
|
||||||
|
return res.writeHead(503).end()
|
||||||
|
}
|
||||||
|
return res
|
||||||
|
.writeHead(200, {
|
||||||
|
'content-type': 'application/json',
|
||||||
|
})
|
||||||
|
.end(
|
||||||
|
JSON.stringify({
|
||||||
|
pdsUrl: server.pdsUrl,
|
||||||
|
appviewDid: server.appviewDid,
|
||||||
|
}),
|
||||||
|
)
|
||||||
|
}
|
||||||
if (req.method !== 'POST') {
|
if (req.method !== 'POST') {
|
||||||
return res.writeHead(200).end()
|
return res.writeHead(405).end()
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
console.log('Closing old server')
|
console.log('Closing old server')
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import {useRef, useState} from 'react'
|
import {useState} from 'react'
|
||||||
import {Keyboard, LogBox, Pressable, TextInput, View} from 'react-native'
|
import {LogBox, Pressable, View} from 'react-native'
|
||||||
import {useQueryClient} from '@tanstack/react-query'
|
import {useQueryClient} from '@tanstack/react-query'
|
||||||
|
|
||||||
import {BLUESKY_PROXY_HEADER} from '#/lib/constants'
|
import {BLUESKY_PROXY_HEADER} from '#/lib/constants'
|
||||||
@@ -61,33 +61,23 @@ export function TestCtrls() {
|
|||||||
)
|
)
|
||||||
setShowLoggedOut(false)
|
setShowLoggedOut(false)
|
||||||
}
|
}
|
||||||
const proxyHeader = useRef('')
|
const configureProxy = async () => {
|
||||||
const configureProxy = () => {
|
const res = await fetch('http://localhost:1986')
|
||||||
const header = `${proxyHeader.current}#bsky_appview`
|
if (!res.ok) {
|
||||||
|
throw new Error(`Failed to load the E2E proxy DID: ${res.status}`)
|
||||||
|
}
|
||||||
|
const {appviewDid} = (await res.json()) as {appviewDid: string}
|
||||||
|
const header = `${appviewDid}#bsky_appview`
|
||||||
BLUESKY_PROXY_HEADER.set(header)
|
BLUESKY_PROXY_HEADER.set(header)
|
||||||
agent.configureProxy(header as any)
|
agent.configureProxy(header as any)
|
||||||
hasConfiguredProxy = true
|
hasConfiguredProxy = true
|
||||||
setIsProxyConfigured(true)
|
setIsProxyConfigured(true)
|
||||||
Keyboard.dismiss()
|
|
||||||
}
|
}
|
||||||
return (
|
return (
|
||||||
<View style={{position: 'absolute', top: 100, right: 0, zIndex: 100}}>
|
<View style={{position: 'absolute', top: 100, right: 0, zIndex: 100}}>
|
||||||
<TextInput
|
|
||||||
accessibilityLabel="Text input field"
|
|
||||||
accessibilityHint="Enter proxy header"
|
|
||||||
testID="e2eProxyHeaderInput"
|
|
||||||
onChangeText={val => {
|
|
||||||
proxyHeader.current = val
|
|
||||||
}}
|
|
||||||
autoComplete="off"
|
|
||||||
autoCorrect={false}
|
|
||||||
autoCapitalize="none"
|
|
||||||
onSubmitEditing={configureProxy}
|
|
||||||
style={BTN}
|
|
||||||
/>
|
|
||||||
<Pressable
|
<Pressable
|
||||||
testID="e2eConfigureProxy"
|
testID="e2eConfigureProxy"
|
||||||
onPress={configureProxy}
|
onPress={() => void configureProxy()}
|
||||||
accessibilityRole="button"
|
accessibilityRole="button"
|
||||||
style={BTN}
|
style={BTN}
|
||||||
/>
|
/>
|
||||||
|
|||||||
Reference in New Issue
Block a user