fix: cloudflare turnstile protection error (#9663)

This commit is contained in:
RieN 7z 2025-08-30 16:56:04 +08:00 committed by GitHub
parent d4e024f42d
commit e5327aba78
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -10,6 +10,13 @@ export function initSessionUserAgent() {
const newUA = originUA.replace(/CherryStudio\/\S+\s/, '').replace(/Electron\/\S+\s/, '')
wvSession.setUserAgent(newUA)
wvSession.webRequest.onBeforeSendHeaders((details, cb) => {
const headers = {
...details.requestHeaders,
'User-Agent': newUA
}
cb({ requestHeaders: headers })
})
}
/**