macOS is great

This commit is contained in:
ThaUnknown 2022-04-12 12:50:48 +02:00
parent 0a7b52c3e7
commit 786df48338
2 changed files with 14 additions and 8 deletions

View file

@ -1,6 +1,6 @@
{
"name": "Miru",
"version": "1.4.9",
"version": "1.4.10",
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
"main": "src/index.js",
"homepage": "https://github.com/ThaUnknown/miru#readme",

View file

@ -27,16 +27,22 @@ if (!gotTheLock) {
// There's probably a better way to do this instead of a for loop and split[1][0]
// but for now it works as a way to fix multiple OS's commandLine differences
for (const line of commandLine) {
if (line.startsWith('miru://')) {
let token = line.split('access_token=')[1].split('&token_type')[0]
if (token) {
if (token.endsWith('/')) token = token.slice(0, -1)
mainWindow.webContents.send('altoken', token)
}
}
if (line.startsWith('miru://')) return sendToken(line)
}
})
}
app.on('open-url', (event, url) => {
event.preventDefault()
if (url.startsWith('miru://')) sendToken(url)
})
function sendToken (line) {
let token = line.split('access_token=')[1].split('&token_type')[0]
if (token) {
if (token.endsWith('/')) token = token.slice(0, -1)
mainWindow.webContents.send('altoken', token)
}
}
ipcMain.on('open', (event, url) => {
shell.openExternal(url)