fix: adapt to migu

This commit is contained in:
NoCrypt 2024-09-01 08:41:31 +07:00
parent 41ce71e623
commit 74afccea75
7 changed files with 53 additions and 46 deletions

View file

@ -3,7 +3,7 @@
import { writable } from 'simple-store-svelte' import { writable } from 'simple-store-svelte'
import { anilistClient } from '@/modules/anilist.js' import { anilistClient } from '@/modules/anilist.js'
import IPC from '@/modules/ipc.js' import IPC from '@/modules/ipc.js'
import { rss } from './views/TorrentSearch/TorrentModal.svelte' // import { rss } from './views/TorrentSearch/TorrentModal.svelte'
export const page = writable('home') export const page = writable('home')
export const view = writable(null) export const view = writable(null)
@ -38,7 +38,7 @@
if (!state) return if (!state) return
ignoreNext = true ignoreNext = true
view.set(null) view.set(null)
rss.set(null) // rss.set(null)
if (document.fullscreenElement) { if (document.fullscreenElement) {
document.exitFullscreen(); document.exitFullscreen();
if (state.type === 'view') page.set('home') if (state.type === 'view') page.set('home')
@ -61,7 +61,6 @@
import Logout from './components/Logout.svelte' import Logout from './components/Logout.svelte'
import Navbar from './components/Navbar.svelte' import Navbar from './components/Navbar.svelte'
import { SUPPORTS } from '@/modules/support.js'; import { SUPPORTS } from '@/modules/support.js';
import IPC from '@/modules/ipc.js'
import UpdateModal, { changeLog, updateModal } from './components/UpdateModal.svelte'; import UpdateModal, { changeLog, updateModal } from './components/UpdateModal.svelte';
setContext('view', view) setContext('view', view)
@ -105,6 +104,7 @@
$updateModal = false $updateModal = false
}) })
</script> </script>

View file

@ -23,6 +23,7 @@
import { client } from '@/modules/torrent.js'; import { client } from '@/modules/torrent.js';
import { settings } from '@/modules/settings.js'; import { settings } from '@/modules/settings.js';
import IPC from '@/modules/ipc.js'; import IPC from '@/modules/ipc.js';
import { rss } from './views/TorrentSearch/TorrentModal.svelte';
export let page = 'home' export let page = 'home'
@ -32,6 +33,10 @@
onMount(() => { onMount(() => {
// Check update // Check update
if($settings.enableAutoUpdate && SUPPORTS.update) IPC.emit('update') if($settings.enableAutoUpdate && SUPPORTS.update) IPC.emit('update')
window.addEventListener('popstate', e => {
$rss = null
})
}); });
function closeMiniplayer() { function closeMiniplayer() {

View file

@ -1,5 +1,6 @@
<script> <script>
import { click } from "@/modules/click.js"; import { click } from "@/modules/click.js";
import { Lock } from 'lucide-svelte'
export let isLocked = false; export let isLocked = false;
let lockImmersed = false; let lockImmersed = false;
@ -34,9 +35,12 @@
style="padding: 28px" style="padding: 28px"
> >
<span <span
class="material-symbols-outlined pointer lock-button" class="icon pointer lock-button"
class:opacity-0={lockImmersed} class:opacity-0={lockImmersed}
use:click={() => (isLocked = false)}>lock</span use:click={() => (isLocked = false)}>
<Lock size='2.5rem' strokeWidth={2.5} />
</span
> >
</div> </div>
{/if} {/if}
@ -54,7 +58,7 @@
color: white; color: white;
} }
.material-symbols-outlined { .icon {
font-size: 2.8rem; font-size: 2.8rem;
padding: 1.5rem; padding: 1.5rem;
display: flex; display: flex;

View file

@ -4,7 +4,7 @@
import { rss } from '@/views/TorrentSearch/TorrentModal.svelte' import { rss } from '@/views/TorrentSearch/TorrentModal.svelte'
import NavbarLink from './NavbarLink.svelte' import NavbarLink from './NavbarLink.svelte'
import { MagnifyingGlass } from 'svelte-radix' import { MagnifyingGlass } from 'svelte-radix'
import { Users, Clock, Settings, Heart, ListVideo } from 'lucide-svelte' import { Users, Clock, Settings, Heart, ListVideo, House } from 'lucide-svelte'
const view = getContext('view') const view = getContext('view')
export let page export let page
@ -15,34 +15,34 @@
$rss = null $rss = null
} }
function close () {
page = 'home'
noModals()
}
</script> </script>
<nav class='navbar navbar-fixed-bottom d-block d-md-none border-0 bg-dark'> <nav class='navbar navbar-fixed-bottom d-block d-md-none border-0 bg-dark' style='border-top: 1.5px #fff2 solid !important;'>
<div class='navbar-menu h-full d-flex flex-row justify-content-center align-items-center m-0 pb-5' class:animate={page !== 'player'}> <div class='navbar-menu h-full d-flex flex-row justify-content-center align-items-center m-0 pb-5' class:animate={page !== 'player'}>
<img src='./logo_filled.png' class='w-50 h-50 m-10 pointer p-5' alt='ico' use:click={close} /> <!-- <img src='./logo_filled.png' class='w-50 h-50 m-10 pointer p-5' alt='ico' /> -->
<NavbarLink click={() => { page = 'search' }} _page='search' css='ml-auto' icon='search' {page} let:active> <NavbarLink click={() => { page = 'home'; noModals()}} _page='home' icon='home' {page} let:active>
<MagnifyingGlass size='2rem' class='flex-shrink-0 p-5 w-30 h-30 m-5 rounded' stroke-width={active ? '2' : '0'} stroke='currentColor' /> <House size='2.2rem' class='flex-shrink-0 p-5 w-30 h-30 m-5 rounded' strokeWidth={active ? '3.5' : '2'} />
</NavbarLink> </NavbarLink>
<NavbarLink click={() => { page = 'schedule' }} _page='schedule' icon='schedule' {page} let:active> <NavbarLink click={() => { page = 'search'; noModals()}} _page='search' icon='search' {page} let:active>
<Clock size='2rem' class='flex-shrink-0 p-5 w-30 h-30 m-5 rounded' strokeWidth={active ? '3.5' : '2'} /> <MagnifyingGlass size='2.2rem' class='flex-shrink-0 p-5 w-30 h-30 m-5 rounded' stroke-width={active ? '2' : '0'} stroke='currentColor' />
</NavbarLink> </NavbarLink>
{#if $media?.media} {#if $media?.media}
<NavbarLink click={() => { $view = $media.media }} icon='queue_music' {page} let:active> <NavbarLink click={() => { noModals(false) }} icon='queue_music' {page} let:active>
<ListVideo size='2rem' class='flex-shrink-0 p-5 w-30 h-30 m-5 rounded' strokeWidth={active ? '3.5' : '2'} /> <ListVideo size='2.2rem' class='flex-shrink-0 p-5 w-30 h-30 m-5 rounded' strokeWidth={active ? '3.5' : '2'} />
</NavbarLink>
{:else}
<NavbarLink click={() => { page = 'schedule'; noModals() }} _page='schedule' icon='schedule' {page} let:active>
<Clock size='2.2rem' class='flex-shrink-0 p-5 w-30 h-30 m-5 rounded' strokeWidth={active ? '3.5' : '2'} />
</NavbarLink> </NavbarLink>
{/if} {/if}
<NavbarLink click={() => { page = 'watchtogether' }} _page='watchtogether' icon='groups' {page} let:active> <NavbarLink click={() => { page = 'watchtogether'; noModals() }} _page='watchtogether' icon='groups' {page} let:active>
<Users size='2rem' class='flex-shrink-0 p-5 w-30 h-30 m-5 rounded' strokeWidth={active ? '3.5' : '2'} /> <Users size='2.2rem' class='flex-shrink-0 p-5 w-30 h-30 m-5 rounded' strokeWidth={active ? '3.5' : '2'} />
</NavbarLink> </NavbarLink>
<!-- <NavbarLink click={() => { IPC.emit('open', 'https://github.com/sponsors/ThaUnknown/') }} icon='favorite' css='ml-auto donate' {page} let:active> <!-- <NavbarLink click={() => { IPC.emit('open', 'https://github.com/sponsors/ThaUnknown/') }} icon='favorite' css='ml-auto donate' {page} let:active>
<Heart size='2rem' class='flex-shrink-0 p-5 w-30 h-30 m-5 rounded donate' strokeWidth={active ? '3.5' : '2'} fill='currentColor' /> <Heart size='2.2rem' class='flex-shrink-0 p-5 w-30 h-30 m-5 rounded donate' strokeWidth={active ? '3.5' : '2'} fill='currentColor' />
</NavbarLink> --> </NavbarLink> -->
<NavbarLink click={() => { page = 'settings' }} _page='settings' icon='settings' css='ml-auto' {page} let:active> <NavbarLink click={() => { page = 'settings'; noModals() }} _page='settings' icon='settings' css='ml-auto' {page} let:active>
<Settings size='2rem' class='flex-shrink-0 p-5 w-30 h-30 m-5 rounded' strokeWidth={active ? '3.5' : '2'} /> <Settings size='2.2rem' class='flex-shrink-0 p-5 w-30 h-30 m-5 rounded' strokeWidth={active ? '3.5' : '2'} />
</NavbarLink> </NavbarLink>
</div> </div>
</nav> </nav>

View file

@ -18,7 +18,7 @@
import { SUPPORTS } from '@/modules/support.js' import { SUPPORTS } from '@/modules/support.js'
import 'rvfc-polyfill' import 'rvfc-polyfill'
import IPC from '@/modules/ipc.js' import IPC from '@/modules/ipc.js'
import { ArrowDown, ArrowUp, Captions, Cast, CircleHelp, Contrast, FastForward, Keyboard, List, ListMusic, ListVideo, Maximize, Minimize, Pause, PictureInPicture, PictureInPicture2, Play, Proportions, RefreshCcw, Rewind, RotateCcw, RotateCw, ScreenShare, SkipBack, SkipForward, Users, Volume1, Volume2, VolumeX } from 'lucide-svelte' import { ArrowDown, ArrowUp, Captions, Cast, CircleHelp, Contrast, FastForward, Keyboard, List, ListMusic, ListVideo, Lock, Maximize, Minimize, Pause, PictureInPicture, PictureInPicture2, Play, Proportions, RefreshCcw, Rewind, RotateCcw, RotateCw, ScreenShare, SkipBack, SkipForward, Users, Volume1, Volume2, VolumeX } from 'lucide-svelte'
import { swipeControls } from '@/modules/swipecontrol.js'; import { swipeControls } from '@/modules/swipecontrol.js';
import { volumeScroll } from '@/modules/volumescroll.js'; import { volumeScroll } from '@/modules/volumescroll.js';
import GestureLock from '@/components/GestureLock.svelte'; import GestureLock from '@/components/GestureLock.svelte';
@ -1249,7 +1249,9 @@
<Keyboard size='2.5rem' strokeWidth={2.5} /> <Keyboard size='2.5rem' strokeWidth={2.5} />
</span> </span>
{#if SUPPORTS.isAndroid} {#if SUPPORTS.isAndroid}
<span class='material-symbols-outlined ctrl' use:click={() => (isLocked = true)}> lock </span> <span class='icon ctrl mr-5 d-flex align-items-center h-full' use:click={() => (isLocked = true)}>
<Lock size='2.5rem' strokeWidth={2.5} />
</span>
{/if} {/if}
{#if 'audioTracks' in HTMLVideoElement.prototype && video?.audioTracks?.length > 1} {#if 'audioTracks' in HTMLVideoElement.prototype && video?.audioTracks?.length > 1}
<div class='dropdown dropup with-arrow' use:click={toggleDropdown}> <div class='dropdown dropup with-arrow' use:click={toggleDropdown}>
@ -1434,10 +1436,6 @@
align-items: center; align-items: center;
height: 100%; height: 100%;
} }
.bind.material-symbols-outlined {
font-size: 2.2rem !important;
font-weight: unset !important;
}
.stats { .stats {
font-size: 2.3rem !important; font-size: 2.3rem !important;
padding-top: 1.5rem; padding-top: 1.5rem;

View file

@ -17,7 +17,7 @@
$: { $: {
if (draggingItemIndex != null && hoveredItemIndex != null && draggingItemIndex !== hoveredItemIndex) { if (draggingItemIndex != null && hoveredItemIndex != null && draggingItemIndex !== hoveredItemIndex) {
swapItem(draggingItemIndex, hoveredItemIndex) [homeSections[draggingItemIndex], homeSections[hoveredItemIndex]] = [homeSections[hoveredItemIndex], homeSections[draggingItemIndex]]
draggingItemIndex = hoveredItemIndex draggingItemIndex = hoveredItemIndex
} }
@ -78,12 +78,12 @@
<div class='input-group-prepend'> <div class='input-group-prepend'>
<!-- svelte-ignore a11y-no-noninteractive-tabindex --> <!-- svelte-ignore a11y-no-noninteractive-tabindex -->
<!-- svelte-ignore a11y-click-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<button on:click={() => moveItem(index, 'up')} class='input-group-text d-flex justify-content-center px-5 material-symbols-outlined font-size-20 pointer'><ArrowUp size='1.8rem' /></button> <button on:click={() => moveItem(index, 'up')} class='input-group-text d-flex justify-content-center px-5 font-size-20 pointer'><ArrowUp size='1.8rem' /></button>
</div> </div>
<div class='input-group-prepend'> <div class='input-group-prepend'>
<!-- svelte-ignore a11y-no-noninteractive-tabindex --> <!-- svelte-ignore a11y-no-noninteractive-tabindex -->
<!-- svelte-ignore a11y-click-events-have-key-events --> <!-- svelte-ignore a11y-click-events-have-key-events -->
<button on:click={() => moveItem(index, 'down')} class='input-group-text d-flex justify-content-center px-5 material-symbols-outlined font-size-20 pointer'><ArrowDown size='1.8rem' /></button> <button on:click={() => moveItem(index, 'down')} class='input-group-text d-flex justify-content-center px-5 font-size-20 pointer'><ArrowDown size='1.8rem' /></button>
</div> </div>
{/if} {/if}
<select class='form-control bg-dark w-400 mw-full' bind:value={homeSections[index]}> <select class='form-control bg-dark w-400 mw-full' bind:value={homeSections[index]}>

View file

@ -16,7 +16,7 @@
sunos: 'SunOS', sunos: 'SunOS',
win32: 'Windows' win32: 'Windows'
} }
export let version = '1.0.0' let version = '1.0.0'
IPC.on('version', data => (version = data)) IPC.on('version', data => (version = data))
IPC.emit('version') IPC.emit('version')
@ -57,11 +57,11 @@
app: { app: {
name: 'App', name: 'App',
icon: Settings icon: Settings
},
changelog: {
name: 'Changelog',
icon: Logs
} }
// changelog: {
// name: 'Changelog',
// icon: Logs
// }
} }
function pathListener (data) { function pathListener (data) {
$settings.torrentPathNew = data $settings.torrentPathNew = data
@ -75,7 +75,7 @@
if (anilistClient.userID?.viewer?.data?.Viewer) { if (anilistClient.userID?.viewer?.data?.Viewer) {
$logout = true $logout = true
} else { } else {
IPC.emit('open', 'https://anilist.co/api/v2/oauth/authorize?client_id=20321&response_type=token') // Change redirect_url to migu://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') { if (platformMap[window.version.platform] === 'Linux') {
toast('Support Notification', { toast('Support Notification', {
description: "If your linux distribution doesn't support custom protocol handlers, you can simply paste the full URL into the app.", description: "If your linux distribution doesn't support custom protocol handlers, you can simply paste the full URL into the app.",
@ -95,7 +95,7 @@
</script> </script>
<Tabs> <Tabs>
<div class='d-flex w-full h-full position-relative settings root flex-md-row flex-column overflow-y-auto overflow-y-md-hidden' style="padding-top: var(--safe-area-top)" use:smoothScroll> <div class='d-flex w-full h-full position-relative settings root flex-md-row flex-column overflow-y-auto overflow-y-md-hidden' use:smoothScroll>
<div class='d-flex flex-column flex-row h-full w-md-300 bg-dark position-relative px-20 px-md-0 flex-basis-0-md-custom'> <div class='d-flex flex-column flex-row h-full w-md-300 bg-dark position-relative px-20 px-md-0 flex-basis-0-md-custom'>
<div class='px-20 py-15 font-size-24 font-weight-semi-bold'>Settings</div> <div class='px-20 py-15 font-size-24 font-weight-semi-bold'>Settings</div>
{#each Object.values(groups) as group} {#each Object.values(groups) as group}
@ -106,8 +106,8 @@
</div> </div>
</TabLabel> </TabLabel>
{/each} {/each}
<div class='pointer my-5 rounded' tabindex='0' role='button' use:click={() => IPC.emit('open', 'https://github.com/sponsors/ThaUnknown/')}> <!-- <div class='pointer my-5 rounded' tabindex='0' role='button' use:click={() => IPC.emit('open', 'https://github.com/sponsors/ThaUnknown/')}>
<!-- <div class='px-20 py-10 d-flex align-items-center'> <div class='px-20 py-10 d-flex align-items-center'>
<Heart class='pr-10 d-inline-flex' size='3.1rem' /> <Heart class='pr-10 d-inline-flex' size='3.1rem' />
<div class='font-size-16 line-height-normal'>Donate</div> <div class='font-size-16 line-height-normal'>Donate</div>
</div> </div>
@ -150,11 +150,11 @@
</Tab> </Tab>
<Tab> <Tab>
<div class='root h-full w-full overflow-y-md-auto p-20' use:smoothScroll> <div class='root h-full w-full overflow-y-md-auto p-20' use:smoothScroll>
<AppSettings {version} bind:settings={$settings} /> <AppSettings {version} settings={$settings} />
<div class='h-250' /> <div class='h-250' />
</div> </div>
</Tab> </Tab>
<!-- <Tab> <Tab>
<div class='root my-20 px-20 overflow-y-md-auto w-full' use:smoothScroll> <div class='root my-20 px-20 overflow-y-md-auto w-full' use:smoothScroll>
<div class='h-300 row px-20 px-sm-0'> <div class='h-300 row px-20 px-sm-0'>
<div class='col-sm-3 d-none d-sm-flex' /> <div class='col-sm-3 d-none d-sm-flex' />
@ -220,10 +220,10 @@
</div> </div>
</div> </div>
{/each} {/each}
{/await} {/await}
<div class='h-250 d-md-none' /> <div class='h-250 d-md-none' />
</div> </div>
</Tab> --> </Tab>
</div> </div>
</Tabs> </Tabs>