Revert "test: log调试请求头获取功能"
This reverts commit 62e75d0061d82cb69f24b750c7553b6fe1b6d6cd.
This commit is contained in:
parent
e4f9f6636d
commit
4cbd9f562c
@ -681,12 +681,10 @@ const headerInfo = ref({})
|
|||||||
const connectToApp = async () => {
|
const connectToApp = async () => {
|
||||||
console.group('🔗 APP Connection Process')
|
console.group('🔗 APP Connection Process')
|
||||||
console.debug('🚀 Starting APP connection...')
|
console.debug('🚀 Starting APP connection...')
|
||||||
console.log('connectToApp()')
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 检查是否在APP环境中
|
// 检查是否在APP环境中
|
||||||
if (!isInApp()) {
|
if (!isInApp()) {
|
||||||
console.log('!isInApp()')
|
|
||||||
console.debug('🌐 Browser environment detected')
|
console.debug('🌐 Browser environment detected')
|
||||||
appConnected.value = true
|
appConnected.value = true
|
||||||
console.groupEnd()
|
console.groupEnd()
|
||||||
@ -699,15 +697,12 @@ const connectToApp = async () => {
|
|||||||
|
|
||||||
// 检查是否已经连接且未过期
|
// 检查是否已经连接且未过期
|
||||||
if (isAppConnected()) {
|
if (isAppConnected()) {
|
||||||
console.log('isAppConnected()')
|
|
||||||
console.debug('✅ APP already connected and valid')
|
console.debug('✅ APP already connected and valid')
|
||||||
appConnected.value = true
|
appConnected.value = true
|
||||||
|
|
||||||
// 使用缓存的头部信息
|
// 使用缓存的头部信息
|
||||||
const cachedHeaderInfo = getAppHeaderInfo()
|
const cachedHeaderInfo = getAppHeaderInfo()
|
||||||
if (cachedHeaderInfo) {
|
if (cachedHeaderInfo) {
|
||||||
console.log('cachedHeaderInfo')
|
|
||||||
|
|
||||||
headerInfo.value = cachedHeaderInfo
|
headerInfo.value = cachedHeaderInfo
|
||||||
console.debug('🔧 Using cached HTTP headers')
|
console.debug('🔧 Using cached HTTP headers')
|
||||||
}
|
}
|
||||||
@ -722,8 +717,6 @@ const connectToApp = async () => {
|
|||||||
|
|
||||||
// 检查是否有正在进行的连接
|
// 检查是否有正在进行的连接
|
||||||
if (appConnectionManager.isConnecting()) {
|
if (appConnectionManager.isConnecting()) {
|
||||||
console.log('appConnectionManager.isConnecting()')
|
|
||||||
|
|
||||||
console.debug('⏳ Connection already in progress, waiting...')
|
console.debug('⏳ Connection already in progress, waiting...')
|
||||||
await appConnectionManager.getConnectionPromise()
|
await appConnectionManager.getConnectionPromise()
|
||||||
appConnected.value = true
|
appConnected.value = true
|
||||||
@ -738,18 +731,14 @@ const connectToApp = async () => {
|
|||||||
|
|
||||||
// 建立新的APP连接
|
// 建立新的APP连接
|
||||||
console.debug('📱 Establishing new APP connection...')
|
console.debug('📱 Establishing new APP connection...')
|
||||||
console.log('📱 Establishing new APP connection...')
|
|
||||||
|
|
||||||
const connectionResult = await new Promise((resolve, reject) => {
|
const connectionResult = await new Promise((resolve, reject) => {
|
||||||
const connectionPromise = new Promise((connectResolve, connectReject) => {
|
const connectionPromise = new Promise((connectResolve, connectReject) => {
|
||||||
connectApplication(async (access) => {
|
connectApplication(async (access) => {
|
||||||
try {
|
try {
|
||||||
const result = parseAccessOrigin(access)
|
const result = parseAccessOrigin(access)
|
||||||
console.log('获取请求头信息:', result)
|
|
||||||
|
|
||||||
if (result.success) {
|
if (result.success) {
|
||||||
console.log('result.success')
|
|
||||||
|
|
||||||
// 解析头部信息
|
// 解析头部信息
|
||||||
headerInfo.value = parseHeader(result.data)
|
headerInfo.value = parseHeader(result.data)
|
||||||
|
|
||||||
@ -765,15 +754,11 @@ const connectToApp = async () => {
|
|||||||
connectResolve({ success: true, environment: 'app', fromCache: false })
|
connectResolve({ success: true, environment: 'app', fromCache: false })
|
||||||
} else {
|
} else {
|
||||||
console.error('❌ Failed to parse access origin:', result.error)
|
console.error('❌ Failed to parse access origin:', result.error)
|
||||||
console.log('获取请求头信息失败:', result.error)
|
|
||||||
|
|
||||||
appConnectionManager.reset()
|
appConnectionManager.reset()
|
||||||
connectReject(new Error(result.error))
|
connectReject(new Error(result.error))
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('❌ Connection process failed:', error)
|
console.error('❌ Connection process failed:', error)
|
||||||
console.log('连接失败:', error)
|
|
||||||
|
|
||||||
appConnectionManager.reset()
|
appConnectionManager.reset()
|
||||||
connectReject(error)
|
connectReject(error)
|
||||||
}
|
}
|
||||||
@ -785,7 +770,6 @@ const connectToApp = async () => {
|
|||||||
|
|
||||||
connectionPromise.then(resolve).catch(reject)
|
connectionPromise.then(resolve).catch(reject)
|
||||||
})
|
})
|
||||||
console.log('连接成功')
|
|
||||||
|
|
||||||
console.debug('✅ Connection completed successfully')
|
console.debug('✅ Connection completed successfully')
|
||||||
console.groupEnd()
|
console.groupEnd()
|
||||||
@ -795,8 +779,6 @@ const connectToApp = async () => {
|
|||||||
|
|
||||||
return connectionResult
|
return connectionResult
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log('连接失败:', error)
|
|
||||||
|
|
||||||
console.error('❌ Connection failed:', error)
|
console.error('❌ Connection failed:', error)
|
||||||
appConnected.value = false
|
appConnected.value = false
|
||||||
console.groupEnd()
|
console.groupEnd()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user