fix anilist auth, torrent path

This commit is contained in:
ThaUnknown 2022-03-13 20:10:20 +01:00
parent d5dafa1878
commit 9aaade57b5
3 changed files with 14 additions and 8 deletions

View file

@ -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) => {

View file

@ -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
}
}

View file

@ -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!<br>${error.status} - ${error.message}`,
title: 'Search Failed',
alertType: 'alert-danger',
fillType: ''
})
// halfmoon.initStickyAlert({
// content: `Failed making request to anilist!<br>${error.status} - ${error.message}`,
// title: 'Search Failed',
// alertType: 'alert-danger',
// fillType: ''
// })
console.error(error)
}
}