Enhance logging for mobile requests in log-requests middleware
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 44s
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 44s
Add functionality to log all requests from mobile devices, improving debugging capabilities. Extend the existing passkey endpoint checks to include a new endpoint for cross-device registration. This update aims to provide clearer insights into mobile user interactions with the application.
This commit is contained in:
@@ -19,14 +19,16 @@ export default defineEventHandler((event) => {
|
||||
'/api/auth/passkeys/register',
|
||||
'/api/auth/passkeys/authentication-options',
|
||||
'/api/auth/passkeys/login',
|
||||
'/api/auth/passkeys/recovery'
|
||||
'/api/auth/passkeys/recovery',
|
||||
'/passkey-register-cross-device'
|
||||
]
|
||||
|
||||
const isPasskeyEndpoint = passkeyEndpoints.some(ep => path.startsWith(ep))
|
||||
// Logge auch alle Requests vom Smartphone (Mobile User-Agent)
|
||||
const isMobile = /Mobile|Android|iPhone|iPad/i.test(userAgent || '')
|
||||
const isPasskeyEndpoint = passkeyEndpoints.some(ep => path.startsWith(ep)) || (isMobile && path.startsWith('/'))
|
||||
|
||||
if (isPasskeyEndpoint) {
|
||||
const timestamp = new Date().toISOString()
|
||||
const isMobile = /Mobile|Android|iPhone|iPad/i.test(userAgent || '')
|
||||
|
||||
console.log('')
|
||||
console.log('─'.repeat(80))
|
||||
@@ -51,6 +53,12 @@ export default defineEventHandler((event) => {
|
||||
console.log(`[REQUEST] ⚠️ Wenn dieser Request vom Smartphone kommt, sollte der User-Agent Mobile/Android/iPhone enthalten`)
|
||||
}
|
||||
|
||||
// Logge alle Requests vom Smartphone (für Debugging)
|
||||
if (isMobile && path.startsWith('/') && !path.startsWith('/_nuxt') && !path.startsWith('/api')) {
|
||||
console.log(`[REQUEST] 📱 SMARTPHONE REQUEST - ${path}`)
|
||||
console.log(`[REQUEST] ⚠️ Wenn das Smartphone die Website öffnet, sollten hier Requests erscheinen`)
|
||||
}
|
||||
|
||||
console.log('─'.repeat(80))
|
||||
console.log('')
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user