diff --git a/src/index.js b/src/index.js index 30585d9..0a88bca 100644 --- a/src/index.js +++ b/src/index.js @@ -1,4 +1,4 @@ -const { app, BrowserWindow } = require('electron') +const { app, BrowserWindow, protocol } = require('electron') const path = require('path') // Keep a global reference of the window object, if you don't, the window will @@ -37,6 +37,12 @@ function createWindow () { icon: path.join(__dirname, '/renderer/public/logo.ico'), show: false }) + + protocol.registerHttpProtocol('miru', (req, cb) => { + const token = req.url.slice(7) + mainWindow.loadURL(path.join(__dirname, '/renderer/dist/index.html' + token)) + }) + // mainWindow.removeMenu() mainWindow.webContents.session.webRequest.onBeforeSendHeaders( (details, callback) => { diff --git a/src/renderer/src/lib/pages/Settings.svelte b/src/renderer/src/lib/pages/Settings.svelte index da627b5..27df91b 100644 --- a/src/renderer/src/lib/pages/Settings.svelte +++ b/src/renderer/src/lib/pages/Settings.svelte @@ -53,7 +53,7 @@ function handleFolder({ target }) { if (target.files.length) { const filepath = target.files[0].path - const path = filepath.slice(0, (filepath.lastIndexOf('\\') || filepath.lastIndexOf('/')) + 1) + const path = filepath.slice(0, filepath.lastIndexOf('\\') + 1 || filepath.lastIndexOf('/')) + 1 settings.torrentPath = path } } diff --git a/src/renderer/src/modules/anilist.js b/src/renderer/src/modules/anilist.js index adb1cc5..8248030 100644 --- a/src/renderer/src/modules/anilist.js +++ b/src/renderer/src/modules/anilist.js @@ -10,12 +10,12 @@ async function handleRequest (opts) { const json = await res.json() if (!res.ok) { for (const error of json.errors) { - halfmoon.initStickyAlert({ - content: `Failed making request to anilist!
${error.status} - ${error.message}`, - title: 'Search Failed', - alertType: 'alert-danger', - fillType: '' - }) + // halfmoon.initStickyAlert({ + // content: `Failed making request to anilist!
${error.status} - ${error.message}`, + // title: 'Search Failed', + // alertType: 'alert-danger', + // fillType: '' + // }) console.error(error) } }