fix(WebviewService): simplify user agent string modification by removing Chrome version replacement

This commit is contained in:
fullex 2025-05-13 13:54:18 +08:00 committed by 亢奋猫
parent 392a821c6c
commit 6381a28b27

View File

@ -6,12 +6,8 @@ import { session, shell, webContents } from 'electron'
*/
export function initSessionUserAgent() {
const wvSession = session.fromPartition('persist:webview')
const newChromeVersion = '135.0.7049.96'
const originUA = wvSession.getUserAgent()
const newUA = originUA
.replace(/CherryStudio\/\S+\s/, '')
.replace(/Electron\/\S+\s/, '')
.replace(/Chrome\/\d+\.\d+\.\d+\.\d+/, `Chrome/${newChromeVersion}`)
const newUA = originUA.replace(/CherryStudio\/\S+\s/, '').replace(/Electron\/\S+\s/, '')
wvSession.setUserAgent(newUA)
}