cleanup, debug code

This commit is contained in:
Hailey
2025-08-01 11:34:52 -07:00
parent 9c4475981b
commit 2b38d5f0e0
5 changed files with 28 additions and 14 deletions
+7
View File
@@ -78,3 +78,10 @@ export const SENTRY_DSN: string | undefined = process.env.EXPO_PUBLIC_SENTRY_DSN
*/
export const BITDRIFT_API_KEY: string | undefined =
process.env.EXPO_PUBLIC_BITDRIFT_API_KEY
/**
* GCP project ID which is required for device attestation
*/
export const GCP_PROJECT_ID: number = Number(
process.env.EXPO_PUBLIC_GCP_PROJECT_ID,
)
@@ -13,6 +13,7 @@ const ALLOWED_HOSTS = [
'js.hcaptcha.com',
'newassets.hcaptcha.com',
'api2.hcaptcha.com',
'e9755d3e012b.ngrok.app',
]
export function CaptchaWebView({
@@ -29,12 +30,13 @@ export function CaptchaWebView({
onError: (error: unknown) => void
}) {
const redirectHost = React.useMemo(() => {
if (!state?.serviceUrl) return 'bsky.app'
return state?.serviceUrl &&
new URL(state?.serviceUrl).host === 'staging.bsky.dev'
? 'staging.bsky.app'
: 'bsky.app'
return 'e9755d3e012b.ngrok.app'
// if (!state?.serviceUrl) return 'bsky.app'
//
// return state?.serviceUrl &&
// new URL(state?.serviceUrl).host === 'staging.bsky.dev'
// ? 'staging.bsky.app'
// : 'bsky.app'
}, [state?.serviceUrl])
const wasSuccessful = React.useRef(false)
@@ -52,7 +54,7 @@ export function CaptchaWebView({
if (wasSuccessful.current) return
const urlp = new URL(e.url)
if (urlp.host !== redirectHost) return
if (urlp.host !== redirectHost || urlp.pathname === '/gate/signup') return
const code = urlp.searchParams.get('code')
if (urlp.searchParams.get('state') !== stateParam || !code) {
+7 -2
View File
@@ -28,8 +28,9 @@ import {Divider} from '#/components/Divider'
import {LinearGradientBackground} from '#/components/LinearGradientBackground'
import {InlineLinkText} from '#/components/Link'
import {Text} from '#/components/Typography'
import {GCP_PROJECT_ID} from '#/env'
import * as bsky from '#/types/bsky'
import {GCP_PROJECT_ID} from '#/env'
import {logger} from '#/logger'
export function Signup({onPressBack}: {onPressBack: () => void}) {
const {_} = useLingui()
@@ -106,10 +107,14 @@ export function Signup({onPressBack}: {onPressBack: () => void}) {
// On Android, warmup the Play Integrity API on the signup screen so it is ready by the time we get to the gate screen.
useEffect(() => {
console.log('here...')
if (!isAndroid) {
return
}
ReactNativeDeviceAttest.warumpIntegrity(GCP_PROJECT_ID)
console.log('TRYING TO WARMUP')
ReactNativeDeviceAttest.warmupIntegrity(GCP_PROJECT_ID).catch(err =>
logger.error(err),
)
}, [])
return (