修改验证窗口属性

pull/225/head
lyswhut 2020-05-01 00:01:31 +08:00
parent 7ed95ff523
commit 9040c13c3f
2 changed files with 23 additions and 8 deletions

View File

@ -95,18 +95,23 @@
"shortcutName": "lx-music" "shortcutName": "lx-music"
}, },
"dmg": { "dmg": {
"window": {
"size": {
"width": 600,
"height": 400
}
},
"contents": [ "contents": [
{ {
"x": 110, "x": 106,
"y": 150, "y": 252,
"name": "lx-music" "name": "lx-music"
}, },
{ {
"x": 240, "x": 490,
"y": 150, "y": 252,
"type": "link", "type": "link",
"path": "/Applications", "path": "/Applications"
"name": "lx-music"
} }
], ],
"title": "洛雪音乐助手 v${version}" "title": "洛雪音乐助手 v${version}"

View File

@ -20,7 +20,13 @@ mainHandle('xm_verify_open', (event, url) => new Promise((resolve, reject) => {
view.destroy() view.destroy()
} }
view = new BrowserView() view = new BrowserView({
webPreferences: {
enableRemoteModule: false,
disableHtmlFullscreenWindowResize: true,
},
movable: false,
})
view.webContents.on('did-finish-load', () => { view.webContents.on('did-finish-load', () => {
if (/punish\?/.test(view.webContents.getURL())) return if (/punish\?/.test(view.webContents.getURL())) return
let ses = view.webContents.session let ses = view.webContents.session
@ -37,7 +43,11 @@ mainHandle('xm_verify_open', (event, url) => new Promise((resolve, reject) => {
global.mainWindow.setBrowserView(view) global.mainWindow.setBrowserView(view)
const windowSizeInfo = getWindowSizeInfo(global.appSetting) const windowSizeInfo = getWindowSizeInfo(global.appSetting)
view.setBounds({ x: (windowSizeInfo.width - 360) / 2, y: ((windowSizeInfo.height - 320 + 52) / 2), width: 360, height: 320 }) view.setBounds({ x: (windowSizeInfo.width - 360) / 2, y: ((windowSizeInfo.height - 320 + 52) / 2), width: 360, height: 320 })
view.webContents.loadURL(url) view.webContents.loadURL(url, {
httpReferrer: 'https://www.xiami.com/',
userAgent: 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.165 Electron/8.2.4 Safari/537.36',
})
view.webContents.openDevTools()
})) }))
mainHandle('xm_verify_close', async() => { mainHandle('xm_verify_close', async() => {