From 893ee8804dfb027bdf0eafa8c36d9b77a84b0d1a Mon Sep 17 00:00:00 2001 From: NoCrypt <57245077+NoCrypt@users.noreply.github.com> Date: Sat, 3 Aug 2024 23:06:08 +0700 Subject: [PATCH] feat: migu own url handler and more --- capacitor/android/app/src/main/AndroidManifest.xml | 2 +- capacitor/src/capacitor.js | 6 +++--- common/components/Sidebar.svelte | 2 +- common/views/Player/MediaHandler.svelte | 2 +- common/views/Settings/Settings.svelte | 4 ++-- common/views/ViewAnime/Controls.svelte | 2 +- common/views/ViewAnime/ViewAnime.svelte | 2 +- common/views/WatchTogether/WatchTogether.svelte | 2 +- electron/package.json | 6 +++--- electron/src/main/app.js | 6 +++--- electron/src/main/protocol.js | 10 +++++----- electron/src/main/util.js | 6 +++--- functions/anime/[id].js | 12 ++++++------ functions/w2g/[id].js | 10 +++++----- 14 files changed, 36 insertions(+), 36 deletions(-) diff --git a/capacitor/android/app/src/main/AndroidManifest.xml b/capacitor/android/app/src/main/AndroidManifest.xml index a89ef53..ef55f99 100644 --- a/capacitor/android/app/src/main/AndroidManifest.xml +++ b/capacitor/android/app/src/main/AndroidManifest.xml @@ -32,7 +32,7 @@ - + diff --git a/capacitor/src/capacitor.js b/capacitor/src/capacitor.js index 58ab471..e0d9cbf 100644 --- a/capacitor/src/capacitor.js +++ b/capacitor/src/capacitor.js @@ -40,16 +40,16 @@ IPC.on('notification', noti => { if (canShowNotifications) LocalNotifications.schedule({ notifications: [notification] }) }) -// schema: miru://key/value +// schema: migu://key/value const protocolMap = { auth: token => sendToken(token), anime: id => IPC.emit('open-anime', id), w2g: link => IPC.emit('w2glink', link), schedule: () => IPC.emit('schedule'), - donate: () => Browser.open({ url: 'https://github.com/sponsors/ThaUnknown/' }) + donate: () => Browser.open({ url: 'https://github.com/sponsors/NoCrypt/' }) } -const protocolRx = /miru:\/\/([a-z0-9]+)\/(.*)/i +const protocolRx = /migu:\/\/([a-z0-9]+)\/(.*)/i function handleProtocol (text) { const match = text.match(protocolRx) diff --git a/common/components/Sidebar.svelte b/common/components/Sidebar.svelte index a644830..96f3a49 100644 --- a/common/components/Sidebar.svelte +++ b/common/components/Sidebar.svelte @@ -48,7 +48,7 @@ if (anilistClient.userID?.viewer?.data?.Viewer) { $logout = true } else { - IPC.emit('open', 'https://anilist.co/api/v2/oauth/authorize?client_id=4254&response_type=token') // Change redirect_url to miru://auth + IPC.emit('open', 'https://anilist.co/api/v2/oauth/authorize?client_id=20321&response_type=token') // Change redirect_url to migu://auth if (platformMap[window.version.platform] === 'Linux') { toast('Support Notification', { description: "If your linux distribution doesn't support custom protocol handlers, you can simply paste the full URL into the app.", diff --git a/common/views/Player/MediaHandler.svelte b/common/views/Player/MediaHandler.svelte index 1033bf9..8ea854f 100644 --- a/common/views/Player/MediaHandler.svelte +++ b/common/views/Player/MediaHandler.svelte @@ -238,7 +238,7 @@ }, { label: 'Watch on Migu', - url: `miru://anime/${np.media?.id}` + url: `migu://anime/${np.media?.id}` } ] } diff --git a/common/views/Settings/Settings.svelte b/common/views/Settings/Settings.svelte index 42c8929..005157b 100644 --- a/common/views/Settings/Settings.svelte +++ b/common/views/Settings/Settings.svelte @@ -21,7 +21,7 @@ IPC.emit('version') const changeLog = (async () => { - const res = await fetch('https://api.github.com/repos/ThaUnknown/miru/releases') + const res = await fetch('https://api.github.com/repos/NoCrypt/migu/releases') const json = await res.json() return json.map(({ body, tag_name: version, published_at: date, assets }) => ({ body, version, date, assets })) })() @@ -74,7 +74,7 @@ if (anilistClient.userID?.viewer?.data?.Viewer) { $logout = true } else { - IPC.emit('open', 'https://anilist.co/api/v2/oauth/authorize?client_id=4254&response_type=token') // Change redirect_url to miru://auth + IPC.emit('open', 'https://anilist.co/api/v2/oauth/authorize?client_id=20321&response_type=token') // Change redirect_url to migu://auth if (platformMap[window.version.platform] === 'Linux') { toast('Support Notification', { description: "If your linux distribution doesn't support custom protocol handlers, you can simply paste the full URL into the app.", diff --git a/common/views/ViewAnime/Controls.svelte b/common/views/ViewAnime/Controls.svelte index 14243e0..1a9a7dd 100644 --- a/common/views/ViewAnime/Controls.svelte +++ b/common/views/ViewAnime/Controls.svelte @@ -140,7 +140,7 @@ open_in_new Open - diff --git a/common/views/ViewAnime/ViewAnime.svelte b/common/views/ViewAnime/ViewAnime.svelte index bfd1771..34a62eb 100644 --- a/common/views/ViewAnime/ViewAnime.svelte +++ b/common/views/ViewAnime/ViewAnime.svelte @@ -131,7 +131,7 @@ -