mirror of
https://github.com/NoCrypt/migu.git
synced 2026-04-19 07:32:05 +00:00
macOS is great
This commit is contained in:
parent
0a7b52c3e7
commit
786df48338
2 changed files with 14 additions and 8 deletions
|
|
@ -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",
|
||||
|
|
|
|||
20
src/index.js
20
src/index.js
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue