mirror of
https://hubproxy.babadafafafafa.cn/https://github.com/lyswhut/lx-music-desktop.git
synced 2026-09-20 08:04:00 +08:00
禁止打开非http协议链接
This commit is contained in:
@@ -54,6 +54,7 @@ app.on('web-contents-created', (event, contents) => {
|
||||
event.preventDefault()
|
||||
if (/^devtools/.test(navigationUrl)) return
|
||||
console.log(navigationUrl)
|
||||
if (!/^https?:\/\//.test(navigationUrl)) return
|
||||
await shell.openExternal(navigationUrl)
|
||||
})
|
||||
contents.on('will-attach-webview', (event, webPreferences, params) => {
|
||||
|
||||
@@ -232,6 +232,7 @@ export const objectDeepMerge = (target, source, mergedObj) => {
|
||||
* @param {*} url
|
||||
*/
|
||||
export const openUrl = url => {
|
||||
if (!/^https?:\/\//.test(url)) return
|
||||
shell.openExternal(url)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user