diff --git a/capacitor/package.json b/capacitor/package.json index 12a997f..25f0feb 100644 --- a/capacitor/package.json +++ b/capacitor/package.json @@ -19,6 +19,7 @@ }, "devDependencies": { "@capacitor/assets": "github:thaunknown/capacitor-assets", + "@capacitor/cli": "^6.1.2", "cordova-res": "^0.15.4", "nodejs-mobile-gyp": "^0.4.0", "npm-run-all": "^4.1.5", @@ -30,7 +31,7 @@ "@capacitor/android": "^6.1.1", "@capacitor/app": "^6.0.0", "@capacitor/app-launcher": "^6.0.2", - "@capacitor/browser": "^6.0.1", + "@capacitor/browser": "^6.0.2", "@capacitor/cli": "^6.1.1", "@capacitor/core": "^6.1.1", "@capacitor/device": "^6.0.1", diff --git a/capacitor/src/capacitor.js b/capacitor/src/capacitor.js index 3cc4bb7..3a82e37 100644 --- a/capacitor/src/capacitor.js +++ b/capacitor/src/capacitor.js @@ -85,6 +85,7 @@ IPC.on('dialog', async () => { // schema: migu://key/value const protocolMap = { auth: token => sendToken(token), + malauth: token => sendMalToken(token), anime: id => IPC.emit('open-anime', id), w2g: link => IPC.emit('w2glink', link), schedule: () => IPC.emit('schedule'), @@ -106,6 +107,17 @@ function sendToken (line) { } } +function sendMalToken (line) { + let code = line.split('code=')[1].split('&state')[0] + let state = line.split('&state=')[1] + if (code && state) { + if (code.endsWith('/')) code = code.slice(0, -1) + if (state.endsWith('/')) state = state.slice(0, -1) + if (state.includes('%')) state = decodeURIComponent(state) + IPC.emit('maltoken', code, state) + } +} + App.getLaunchUrl().then(res => { if (location.hash !== '#skipAlLogin') { location.hash = '#skipAlLogin' diff --git a/common/App.svelte b/common/App.svelte index 803c5d7..4e2af2d 100644 --- a/common/App.svelte +++ b/common/App.svelte @@ -6,6 +6,7 @@ // import { rss } from './views/TorrentSearch/TorrentModal.svelte' export const page = writable('home') + export const overlay = writable('none') export const view = writable(null) export async function handleAnime (anime) { view.set(null) @@ -58,7 +59,7 @@ import TorrentModal from './views/TorrentSearch/TorrentModal.svelte' import Menubar from './components/Menubar.svelte' import { toast, Toaster } from 'svelte-sonner' - import Logout from './components/Logout.svelte' + import Profiles from './components/Profiles.svelte' import Navbar from './components/Navbar.svelte' import { SUPPORTS } from '@/modules/support.js'; import UpdateModal, { changeLog, updateModal } from './components/UpdateModal.svelte'; @@ -108,20 +109,20 @@ -