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