on about window open link with external browser
This commit is contained in:
parent
03b2fed9ef
commit
7ba34c1074
|
@ -124,8 +124,9 @@
|
||||||
}
|
}
|
||||||
$('#hash').html('<a href="https://github.com/cutls/TheDesk/commits/' + about[3] + '" target="_blank">' + about[3].slice(0, 7) + '</a>')
|
$('#hash').html('<a href="https://github.com/cutls/TheDesk/commits/' + about[3] + '" target="_blank">' + about[3].slice(0, 7) + '</a>')
|
||||||
$(document).on('click', 'a', (e) => {
|
$(document).on('click', 'a', (e) => {
|
||||||
|
e.preventDefault()
|
||||||
var url = $(e.target).attr('href')
|
var url = $(e.target).attr('href')
|
||||||
postMessage(['openUrl', url], '*')
|
postMessage(['openUrlMainProcess', url], '*')
|
||||||
return false
|
return false
|
||||||
})
|
})
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -7,12 +7,17 @@ window.addEventListener('DOMContentLoaded', () => {
|
||||||
ipc.send('acsCheck', '')
|
ipc.send('acsCheck', '')
|
||||||
})
|
})
|
||||||
|
|
||||||
onmessage = function(e) {
|
onmessage = async function (e) {
|
||||||
if (e.data[0] == 'openUrl') {
|
if (e.data[0] == 'openUrl') {
|
||||||
urls = e.data[1].match(/https?:\/\/(.+)/)
|
urls = e.data[1].match(/https?:\/\/(.+)/)
|
||||||
if (urls) {
|
if (urls) {
|
||||||
shell.openExternal(e.data[1])
|
shell.openExternal(e.data[1])
|
||||||
}
|
}
|
||||||
|
} else if (e.data[0] == 'openUrlMainProcess') {
|
||||||
|
urls = e.data[1].match(/https?:\/\/(.+)/)
|
||||||
|
if (urls) {
|
||||||
|
ipc.send('openUrl', e.data[1])
|
||||||
|
}
|
||||||
} else if (e.data[0] == 'sendSinmpleIpc') {
|
} else if (e.data[0] == 'sendSinmpleIpc') {
|
||||||
ipc.send(e.data[1], '')
|
ipc.send(e.data[1], '')
|
||||||
} else if (e.data[0] == 'dialogStore') {
|
} else if (e.data[0] == 'dialogStore') {
|
||||||
|
@ -96,7 +101,6 @@ ipc.on('platform', function(event, args) {
|
||||||
localStorage.setItem('bit', args[1])
|
localStorage.setItem('bit', args[1])
|
||||||
localStorage.setItem('about', JSON.stringify([args[2], args[3], args[4], args[5]]))
|
localStorage.setItem('about', JSON.stringify([args[2], args[3], args[4], args[5]]))
|
||||||
})
|
})
|
||||||
|
|
||||||
ipc.on('reload', function (event, arg) {
|
ipc.on('reload', function (event, arg) {
|
||||||
location.reload()
|
location.reload()
|
||||||
})
|
})
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
const { shell } = require('electron')
|
||||||
|
|
||||||
function system(mainWindow, dir, lang, dirname) {
|
function system(mainWindow, dir, lang, dirname) {
|
||||||
const electron = require('electron')
|
const electron = require('electron')
|
||||||
const app = electron.app
|
const app = electron.app
|
||||||
|
@ -144,6 +146,9 @@ function system(mainWindow, dir, lang, dirname) {
|
||||||
ipc.on('about', (e, args) => {
|
ipc.on('about', (e, args) => {
|
||||||
about()
|
about()
|
||||||
})
|
})
|
||||||
|
ipc.on('openUrl', function (event, arg) {
|
||||||
|
shell.openExternal(arg)
|
||||||
|
})
|
||||||
function about() {
|
function about() {
|
||||||
var ver = app.getVersion()
|
var ver = app.getVersion()
|
||||||
var window = new BrowserWindow({
|
var window = new BrowserWindow({
|
||||||
|
@ -151,7 +156,9 @@ function system(mainWindow, dir, lang, dirname) {
|
||||||
webviewTag: false,
|
webviewTag: false,
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
preload: join(dirname, 'js', 'platform', 'preload.js'),
|
spellcheck: false,
|
||||||
|
sandbox: false,
|
||||||
|
preload: join(__dirname, 'js', 'platform', 'preload.js'),
|
||||||
},
|
},
|
||||||
width: 300,
|
width: 300,
|
||||||
height: 500,
|
height: 500,
|
||||||
|
@ -175,6 +182,7 @@ function system(mainWindow, dir, lang, dirname) {
|
||||||
webviewTag: false,
|
webviewTag: false,
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
|
sandbox: false,
|
||||||
preload: join(dirname, 'js', 'platform', 'preload.js'),
|
preload: join(dirname, 'js', 'platform', 'preload.js'),
|
||||||
},
|
},
|
||||||
width: 350,
|
width: 350,
|
||||||
|
@ -321,6 +329,7 @@ function system(mainWindow, dir, lang, dirname) {
|
||||||
webviewTag: false,
|
webviewTag: false,
|
||||||
nodeIntegration: false,
|
nodeIntegration: false,
|
||||||
contextIsolation: true,
|
contextIsolation: true,
|
||||||
|
sandbox: false,
|
||||||
preload: join(dirname, 'js', 'platform', 'preload.js'),
|
preload: join(dirname, 'js', 'platform', 'preload.js'),
|
||||||
},
|
},
|
||||||
width: 414,
|
width: 414,
|
||||||
|
|
Loading…
Reference in New Issue
Block a user