mirror of
https://github.com/NoCrypt/migu.git
synced 2026-01-11 20:10:22 +00:00
feat: migu own url handler and more
This commit is contained in:
parent
aa3fcdf52c
commit
893ee8804d
14 changed files with 36 additions and 36 deletions
|
|
@ -32,7 +32,7 @@
|
|||
</intent-filter>
|
||||
|
||||
<intent-filter>
|
||||
<data android:scheme="miru" />
|
||||
<data android:scheme="migu" />
|
||||
|
||||
<action android:name="android.intent.action.VIEW" />
|
||||
<category android:name="android.intent.category.BROWSABLE" />
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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.",
|
||||
|
|
|
|||
|
|
@ -238,7 +238,7 @@
|
|||
},
|
||||
{
|
||||
label: 'Watch on Migu',
|
||||
url: `miru://anime/${np.media?.id}`
|
||||
url: `migu://anime/${np.media?.id}`
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.",
|
||||
|
|
|
|||
|
|
@ -140,7 +140,7 @@
|
|||
<span class='material-symbols-outlined mr-15 font-size-18 w-30'> open_in_new </span>
|
||||
Open
|
||||
</button>
|
||||
<button class='btn flex-fill font-weight-bold font-size-16 ml-5 d-flex align-items-center' use:click={() => { copyToClipboard(`https://miru.watch/anime/${media.id}`) }}>
|
||||
<button class='btn flex-fill font-weight-bold font-size-16 ml-5 d-flex align-items-center' use:click={() => { copyToClipboard(`https://miguapp.pages.dev/anime/${media.id}`) }}>
|
||||
<span class='material-symbols-outlined mr-15 font-size-18 w-30'> share </span>
|
||||
Share
|
||||
</button>
|
||||
|
|
|
|||
|
|
@ -131,7 +131,7 @@
|
|||
<button class='btn bg-dark btn-lg btn-square ml-10 material-symbols-outlined font-size-20 shadow-none border-0' class:filled={media.mediaListEntry} use:click={toggleStatus}>
|
||||
bookmark
|
||||
</button>
|
||||
<button class='btn bg-dark btn-lg btn-square ml-10 material-symbols-outlined font-size-20 shadow-none border-0' use:click={() => copyToClipboard(`https://miru.watch/anime/${media.id}`)}>
|
||||
<button class='btn bg-dark btn-lg btn-square ml-10 material-symbols-outlined font-size-20 shadow-none border-0' use:click={() => copyToClipboard(`https://miguapp.pages.dev/anime/${media.id}`)}>
|
||||
share
|
||||
</button>
|
||||
<button class='btn bg-dark btn-lg btn-square ml-10 material-symbols-outlined font-size-20 shadow-none border-0' use:click={() => openInBrowser(`https://anilist.co/anime/${media.id}`)}>
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@
|
|||
|
||||
function invite () {
|
||||
if (p2pt) {
|
||||
navigator.clipboard.writeText(`https://miru.watch/w2g/${p2pt.identifierString}`)
|
||||
navigator.clipboard.writeText(`https://miguapp.pages.dev/w2g/${p2pt.identifierString}`)
|
||||
toast('Copied to clipboard', {
|
||||
description: 'Copied invite URL to clipboard',
|
||||
duration: 5000
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@
|
|||
"customDir": "2ffc48f0b43f"
|
||||
},
|
||||
"protocols": {
|
||||
"name": "miru",
|
||||
"name": "migu",
|
||||
"schemes": [
|
||||
"miru"
|
||||
"migu"
|
||||
]
|
||||
},
|
||||
"publish": [
|
||||
|
|
@ -99,7 +99,7 @@
|
|||
"Comment": "Bittorrent streaming software for cats",
|
||||
"Keywords": "anime",
|
||||
"Type": "Application",
|
||||
"MimeType": "x-scheme-handler/miru;"
|
||||
"MimeType": "x-scheme-handler/migu;"
|
||||
},
|
||||
"target": [
|
||||
{
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ export default class App {
|
|||
})
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
app.setAppUserModelId('com.github.thaunknown.miru')
|
||||
app.setAppUserModelId('com.github.nocrypt.migu')
|
||||
// this message usually fires in dev-mode from the parent process
|
||||
process.on('message', data => {
|
||||
if (data === 'graceful-exit') this.destroy()
|
||||
|
|
@ -117,8 +117,8 @@ export default class App {
|
|||
this.mainWindow.webContents.on('render-process-gone', async (e, { reason }) => {
|
||||
if (reason === 'crashed') {
|
||||
if (++crashcount > 10) {
|
||||
await dialog.showMessageBox({ message: 'Crashed too many times.', title: 'Miru', detail: 'App crashed too many times. For a fix visit https://miru.watch/faq/', icon: '/renderer/public/logo_filled.png' })
|
||||
shell.openExternal('https://miru.watch/faq/')
|
||||
await dialog.showMessageBox({ message: 'Crashed too many times.', title: 'Migu', detail: 'App crashed too many times. Make an issue at https://github.com/NoCrypt/migu/issues', icon: '/renderer/public/logo_filled.png' })
|
||||
shell.openExternal('https://github.com/NoCrypt/migu/issues')
|
||||
} else {
|
||||
app.relaunch()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@ import path from 'path'
|
|||
|
||||
if (process.defaultApp) {
|
||||
if (process.argv.length >= 2) {
|
||||
app.setAsDefaultProtocolClient('miru', process.execPath, [path.resolve(process.argv[1])])
|
||||
app.setAsDefaultProtocolClient('migu', process.execPath, [path.resolve(process.argv[1])])
|
||||
}
|
||||
} else {
|
||||
app.setAsDefaultProtocolClient('miru')
|
||||
app.setAsDefaultProtocolClient('migu')
|
||||
}
|
||||
|
||||
export default class Protocol {
|
||||
// schema: miru://key/value
|
||||
// schema: migu://key/value
|
||||
protocolMap = {
|
||||
auth: token => this.sendToken(token),
|
||||
anime: id => this.window.webContents.send('open-anime', id),
|
||||
|
|
@ -20,7 +20,7 @@ export default class Protocol {
|
|||
donate: () => shell.openExternal('https://github.com/sponsors/ThaUnknown/')
|
||||
}
|
||||
|
||||
protocolRx = /miru:\/\/([a-z0-9]+)\/(.*)/i
|
||||
protocolRx = /migu:\/\/([a-z0-9]+)\/(.*)/i
|
||||
|
||||
/**
|
||||
* @param {import('electron').BrowserWindow} window
|
||||
|
|
@ -28,7 +28,7 @@ export default class Protocol {
|
|||
constructor (window) {
|
||||
this.window = window
|
||||
|
||||
protocol.registerHttpProtocol('miru', (req, cb) => {
|
||||
protocol.registerHttpProtocol('migu', (req, cb) => {
|
||||
const token = req.url.slice(7)
|
||||
this.window.loadURL(development ? 'http://localhost:5000/app.html' + token : `file://${path.join(__dirname, '/app.html')}${token}`)
|
||||
})
|
||||
|
|
|
|||
|
|
@ -56,19 +56,19 @@ app.setJumpList?.([
|
|||
items: [
|
||||
{
|
||||
type: 'task',
|
||||
program: 'miru://schedule/',
|
||||
program: 'migu://schedule/',
|
||||
title: 'Airing Schedule',
|
||||
description: 'Open The Airing Schedule'
|
||||
},
|
||||
{
|
||||
type: 'task',
|
||||
program: 'miru://w2g/',
|
||||
program: 'migu://w2g/',
|
||||
title: 'Watch Together',
|
||||
description: 'Create a New Watch Together Lobby'
|
||||
},
|
||||
{
|
||||
type: 'task',
|
||||
program: 'miru://donate/',
|
||||
program: 'migu://donate/',
|
||||
title: 'Donate',
|
||||
description: 'Support This App'
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,17 +9,17 @@ export function onRequest ({ params }) {
|
|||
<!DOCTYPE html>
|
||||
<html style=background:#000>
|
||||
<head>
|
||||
<meta http-equiv=refresh content="5; url=https://miru.watch">
|
||||
<meta http-equiv=refresh content="5; url=https://miguapp.pages.dev">
|
||||
<meta property="og:title" content="Anime">
|
||||
<meta property="og:description" content="Stream anime torrents, real-time with no waiting for downloads">
|
||||
<meta property="og:site_name" content="Miru">
|
||||
<meta property="og:image" content=https://miru.watch/app_original.png>
|
||||
<meta property="og:url" content=miru://anime/${id}>
|
||||
<meta property="og:site_name" content="Migu">
|
||||
<meta property="og:image" content=https://miguapp.pages.dev/imgs/banner.png>
|
||||
<meta property="og:url" content=migu://anime/${id}>
|
||||
<meta data-vmid="twitter:card" name="twitter:card" content="summary_large_image">
|
||||
<meta name="theme-color" content="#17191C">
|
||||
</head>
|
||||
<body>
|
||||
<iframe src=miru://anime/${id} style=border:none></iframe>Redirecting...
|
||||
<iframe src=migu://anime/${id} style=border:none></iframe>Redirecting...
|
||||
</body>
|
||||
</html>`
|
||||
|
||||
|
|
@ -30,5 +30,5 @@ export function onRequest ({ params }) {
|
|||
})
|
||||
}
|
||||
} catch (e) {}
|
||||
return Response.redirect('https://miru.watch/')
|
||||
return Response.redirect('https://miguapp.pages.dev/')
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,17 +8,17 @@ export function onRequest ({ params }) {
|
|||
<!DOCTYPE html>
|
||||
<html style=background:#000>
|
||||
<head>
|
||||
<meta http-equiv=refresh content="5; url=https://miru.watch">
|
||||
<meta http-equiv=refresh content="5; url=https://miguapp.pages.dev">
|
||||
<meta property="og:title" content="Watch Together">
|
||||
<meta property="og:description" content="Stream anime torrents, real-time with no waiting for downloads">
|
||||
<meta property="og:site_name" content="Migu">
|
||||
<meta property="og:image" content=https://miru.watch/app_original.png>
|
||||
<meta property="og:url" content=miru://w2g/${id}>
|
||||
<meta property="og:image" content=https://miguapp.pages.dev/imgs/banner.png>
|
||||
<meta property="og:url" content=migu://w2g/${id}>
|
||||
<meta data-vmid="twitter:card" name="twitter:card" content="summary_large_image">
|
||||
<meta name="theme-color" content="#17191C">
|
||||
</head>
|
||||
<body>
|
||||
<iframe src=miru://w2g/${id} style=border:none></iframe>Redirecting...
|
||||
<iframe src=migu://w2g/${id} style=border:none></iframe>Redirecting...
|
||||
</body>
|
||||
</html>`
|
||||
|
||||
|
|
@ -28,6 +28,6 @@ export function onRequest ({ params }) {
|
|||
}
|
||||
})
|
||||
} catch (e) {
|
||||
return Response.redirect('https://miru.watch/')
|
||||
return Response.redirect('https://miguapp.pages.dev/')
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue