mirror of
https://github.com/NoCrypt/migu.git
synced 2026-04-20 16:12:31 +00:00
Changed external anilist token to be sent through IPC from main to renderer
This commit is contained in:
parent
2179c3b145
commit
34292c1fcc
3 changed files with 13 additions and 9 deletions
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "Miru",
|
||||
"version": "1.4.8",
|
||||
"version": "1.4.9",
|
||||
"author": "ThaUnknown_ <ThaUnknown@users.noreply.github.com>",
|
||||
"main": "src/index.js",
|
||||
"homepage": "https://github.com/ThaUnknown/miru#readme",
|
||||
|
|
|
|||
16
src/index.js
16
src/index.js
|
|
@ -24,14 +24,14 @@ if (!gotTheLock) {
|
|||
if (mainWindow.isMinimized()) mainWindow.restore()
|
||||
mainWindow.focus()
|
||||
}
|
||||
if (commandLine.length === 3) {
|
||||
let token = commandLine[2].slice(9)
|
||||
if (token.endsWith('/')) token = token.slice(0, -1)
|
||||
if (token) {
|
||||
if (process.env.NODE_ENV !== 'development ') {
|
||||
mainWindow.loadURL(path.join(__dirname, '/renderer/dist/index.html#' + token))
|
||||
} else {
|
||||
mainWindow.loadURL('http://localhost:3000#' + token)
|
||||
// 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 (let i = 0; i < commandLine.length; i++) {
|
||||
if (commandLine[i].startsWith('miru://')) {
|
||||
let token = commandLine[i].split('access_token=')[1].split('&token_type')[0]
|
||||
if (token.endsWith('/')) token = token.slice(0, -1)
|
||||
if (token) {
|
||||
mainWindow.webContents.send('altoken', token)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,6 +29,10 @@
|
|||
window.IPC.on('path', data => {
|
||||
set.torrentPath = data
|
||||
})
|
||||
window.IPC.on('altoken', data => {
|
||||
localStorage.setItem('ALtoken', data)
|
||||
location.reload()
|
||||
})
|
||||
</script>
|
||||
|
||||
<script>
|
||||
|
|
|
|||
Loading…
Reference in a new issue