From 88ab29e6a1418c5a65645ebfd9c862e1fdb39f52 Mon Sep 17 00:00:00 2001 From: ThaUnknown <6506529+ThaUnknown@users.noreply.github.com> Date: Tue, 21 Nov 2023 01:17:09 +0100 Subject: [PATCH] fix: torrent port on android fix: better font select componennt fix: menubar being clickable on android feat: subtitle render height limit feat: higher memory limits for libass feat: better looking settings feat: hide settings unsupported by platform feat: better setting descriptions fix: miniplayer dragging on mobile --- capacitor/src/support.js | 12 +- capacitor/src/webtorrent.js | 2 +- common/Router.svelte | 2 +- common/components/FontSelect.svelte | 81 --- common/components/Menubar.svelte | 3 +- common/components/Navbar.svelte | 2 +- common/components/Sidebar.svelte | 2 +- common/components/TabLabel.svelte | 8 +- common/modules/subtitles.js | 3 + common/modules/support.js | 12 +- common/modules/util.js | 1 + common/modules/webtorrent.js | 8 +- common/package.json | 3 +- common/views/Settings.svelte | 550 ------------------ common/views/Settings/AppSettings.svelte | 54 ++ .../Settings/HomeSectionsSettings.svelte | 102 ++-- .../views/Settings/InterfaceSettings.svelte | 88 +++ common/views/Settings/PlayerSettings.svelte | 127 ++++ common/views/Settings/SettingCard.svelte | 21 + common/views/Settings/Settings.svelte | 164 ++++++ common/views/Settings/TorrentSettings.svelte | 96 +++ pnpm-lock.yaml | 15 +- 22 files changed, 653 insertions(+), 703 deletions(-) delete mode 100644 common/components/FontSelect.svelte delete mode 100644 common/views/Settings.svelte create mode 100644 common/views/Settings/AppSettings.svelte create mode 100644 common/views/Settings/InterfaceSettings.svelte create mode 100644 common/views/Settings/PlayerSettings.svelte create mode 100644 common/views/Settings/SettingCard.svelte create mode 100644 common/views/Settings/Settings.svelte create mode 100644 common/views/Settings/TorrentSettings.svelte diff --git a/capacitor/src/support.js b/capacitor/src/support.js index 2994f5f..1ebffcc 100644 --- a/capacitor/src/support.js +++ b/capacitor/src/support.js @@ -1,5 +1,13 @@ -// feature support list, overriden per environment +// feature support list, overriden per environment, capacitor export const SUPPORTS = { - offscreenRender: false + offscreenRender: false, + update: false, + angle: false, + doh: false, + dht: false, + discord: false, + torrentPort: false, + torrentPath: false, + torrentPersist: false } diff --git a/capacitor/src/webtorrent.js b/capacitor/src/webtorrent.js index 0ee9de8..dbf1a39 100644 --- a/capacitor/src/webtorrent.js +++ b/capacitor/src/webtorrent.js @@ -25,4 +25,4 @@ async function storageQuota () { return quota - usage } -globalThis.client = new TorrentClient(ipcRendererWebTorrent, storageQuota, 'browser', controller, { torrentPort: Math.random() * 65535 + 1 }) +globalThis.client = new TorrentClient(ipcRendererWebTorrent, storageQuota, 'browser', controller, { torrentPort: Math.floor(Math.random() * 65535 + 1) }) diff --git a/common/Router.svelte b/common/Router.svelte index c05a7bc..a482bf4 100644 --- a/common/Router.svelte +++ b/common/Router.svelte @@ -1,7 +1,7 @@ - - - - - diff --git a/common/components/Menubar.svelte b/common/components/Menubar.svelte index 0bbcbab..4a81a60 100644 --- a/common/components/Menubar.svelte +++ b/common/components/Menubar.svelte @@ -61,7 +61,8 @@ } @media (pointer: none), (pointer: coarse) { .navbar { - display: none; + display: none !important; + height: 0; } } diff --git a/common/components/Navbar.svelte b/common/components/Navbar.svelte index 5857275..4b00031 100644 --- a/common/components/Navbar.svelte +++ b/common/components/Navbar.svelte @@ -2,7 +2,7 @@ import { getContext } from 'svelte' import { alID } from '@/modules/anilist.js' import { media } from '../views/Player/MediaHandler.svelte' - import { platformMap } from '../views/Settings.svelte' + import { platformMap } from '@/views/Settings/Settings.svelte' import { toast } from 'svelte-sonner' import { click } from '@/modules/click.js' import { logout } from './Logout.svelte' diff --git a/common/components/Sidebar.svelte b/common/components/Sidebar.svelte index f8435f9..b29ff88 100644 --- a/common/components/Sidebar.svelte +++ b/common/components/Sidebar.svelte @@ -2,7 +2,7 @@ import { getContext } from 'svelte' import { alID } from '@/modules/anilist.js' import { media } from '../views/Player/MediaHandler.svelte' - import { platformMap } from '../views/Settings.svelte' + import { platformMap } from '@/views/Settings/Settings.svelte' import { settings } from '@/modules/settings.js' import { toast } from 'svelte-sonner' import { click } from '@/modules/click.js' diff --git a/common/components/TabLabel.svelte b/common/components/TabLabel.svelte index 57063d3..5dcac1a 100644 --- a/common/components/TabLabel.svelte +++ b/common/components/TabLabel.svelte @@ -9,6 +9,12 @@ registerTab(tab) -
selectTab(tab)}> +
selectTab(tab)}>
+ + diff --git a/common/modules/subtitles.js b/common/modules/subtitles.js index 80c58bc..5da01ab 100644 --- a/common/modules/subtitles.js +++ b/common/modules/subtitles.js @@ -160,6 +160,9 @@ export default class Subtitles { subContent: defaultHeader, fonts: this.fonts, offscreenRender: SUPPORTS.offscreenRender, + libassMemoryLimit: 1024, + libassGlyphLimit: 80000, + maxRenderHeight: parseInt(settings.value.subtitleRenderHeight) || 0, fallbackFont: settings.value.font?.name || 'roboto medium', availableFonts: { 'roboto medium': './Roboto.ttf' diff --git a/common/modules/support.js b/common/modules/support.js index 9747cdd..725a357 100644 --- a/common/modules/support.js +++ b/common/modules/support.js @@ -1,5 +1,13 @@ -// feature support list, overriden per environment +// feature support list, overriden per environment, global export const SUPPORTS = { - offscreenRender: true + offscreenRender: true, + update: true, + angle: true, + doh: true, + dht: true, + discord: true, + torrentPort: true, + torrentPath: true, + torrentPersist: true } diff --git a/common/modules/util.js b/common/modules/util.js index c422ffb..d0a94f0 100644 --- a/common/modules/util.js +++ b/common/modules/util.js @@ -157,6 +157,7 @@ export const defaults = { dhtPort: 0, missingFont: true, maxConns: 50, + subtitleRenderHeight: 0, subtitleLanguage: 'eng', audioLanguage: 'jpn', enableDoH: false, diff --git a/common/modules/webtorrent.js b/common/modules/webtorrent.js index 6ef2e5f..0dd33e3 100644 --- a/common/modules/webtorrent.js +++ b/common/modules/webtorrent.js @@ -6,11 +6,17 @@ import { defaults, fontRx, subRx, videoRx } from './util.js' const LARGE_FILESIZE = 32_000_000_000 +let storedSettings = {} + +try { + storedSettings = JSON.parse(localStorage.getItem('settings')) || {} +} catch (error) {} + export default class TorrentClient extends WebTorrent { static excludedErrorMessages = ['WebSocket', 'User-Initiated Abort, reason=', 'Connection failed.'] constructor (ipc, storageQuota, serverMode, controller, settingOverrides = {}) { - const settings = { ...defaults, ...(JSON.parse(localStorage.getItem('settings')) || {}), ...settingOverrides } + const settings = { ...defaults, ...storedSettings, ...settingOverrides } super({ dht: !settings.torrentDHT, maxConns: settings.maxConns, diff --git a/common/package.json b/common/package.json index 1e0cfda..8325170 100644 --- a/common/package.json +++ b/common/package.json @@ -13,11 +13,12 @@ "p2pt": "github:ThaUnknown/p2pt#modernise", "perfect-seekbar": "^1.1.0", "quartermoon": "^1.2.3", + "simple-font-select": "^1.0.1", "simple-store-svelte": "^1.0.1", "svelte": "^4.2.3", "svelte-keybinds": "^1.0.5", "svelte-loader": "^3.1.9", - "svelte-miniplayer": "^1.0.4", + "svelte-miniplayer": "^1.0.5", "svelte-sonner": "^0.3.3", "webpack-merge": "^5.10.0" } diff --git a/common/views/Settings.svelte b/common/views/Settings.svelte deleted file mode 100644 index 9e615fd..0000000 --- a/common/views/Settings.svelte +++ /dev/null @@ -1,550 +0,0 @@ - - - - - -
-
-
Settings
- {#each Object.values(groups) as group} - -
- {group.icon} -
-
{group.name}
-
{group.desc}
-
-
-
- {/each} - - - - - -

Restart may be required for some settings to take effect.

-

If you don't know what shit does, use default settings.

-

v{version} {platformMap[window.version.platform]} {window.version.arch}

-
-
- -
-
-
-
font_download
- Default Subtitle Font -
- -
-
- - -
-
-
-
play_arrow
- Playback Settings -
-
-
- - -
-
- - -
-
- - -
-
-
-
list
- Anilist Settings -
-
-
- - -
-
-
-
translate
- Language Settings -
-
-
-
- Preferred Subtitle Language -
- -
-
-
- Preferred Audio Language -
- -
-
-
- -
- {#each $settings.rssFeedsNew as _, i} -
-
- Feed -
- - - - - - - -
- -
-
- {/each} -
- -
-
-
- Quality -
- -
-
- - -
-
- - -
-
-
- DoH URL -
- -
-
-
- Tosho URL -
- -
-
-
- -
-
-
- -
- -
-
-
- Max Speed -
- -
- MB/s -
-
-
-
- Max Connections -
- -
-
-
- DHT Port -
- -
-
-
- Torrent Port -
- -
-
- - -
-
- - -
-
- - -
-
-
- -
-
- - -
-
-
- -
-
- - -
-
- - -
-
- -