From e412bda8200fc15f56bba6fa42597f88082ca412 Mon Sep 17 00:00:00 2001 From: ThaUnknown <6506529+ThaUnknown@users.noreply.github.com> Date: Tue, 19 Mar 2024 20:08:00 +0100 Subject: [PATCH] fix: mobile settings and video player --- capacitor/package.json | 2 +- capacitor/src/support.js | 3 +- capacitor/webpack.config.cjs | 11 +- common/modules/support.js | 3 +- common/modules/util.js | 9 +- common/views/Player/Player.svelte | 16 +-- common/views/Settings/PlayerSettings.svelte | 30 +++--- common/views/Settings/TorrentSettings.svelte | 102 ++++++++++--------- 8 files changed, 91 insertions(+), 85 deletions(-) diff --git a/capacitor/package.json b/capacitor/package.json index 8179e23..1db1fd0 100644 --- a/capacitor/package.json +++ b/capacitor/package.json @@ -1,6 +1,6 @@ { "name": "capacitor", - "version": "1.0.5", + "version": "1.0.9", "private": true, "scripts": { "build:native": "cd public/nodejs/ && npm install && docker build -t android-build:latest . && docker run -v ${PWD}:/app/ -it android-build:latest /bin/bash /app/setup-deps.sh", diff --git a/capacitor/src/support.js b/capacitor/src/support.js index 34363dc..400d088 100644 --- a/capacitor/src/support.js +++ b/capacitor/src/support.js @@ -10,5 +10,6 @@ export const SUPPORTS = { torrentPort: true, torrentPath: false, torrentPersist: false, - keybinds: false + keybinds: false, + isAndroid: true } diff --git a/capacitor/webpack.config.cjs b/capacitor/webpack.config.cjs index c77746e..ae51c65 100644 --- a/capacitor/webpack.config.cjs +++ b/capacitor/webpack.config.cjs @@ -5,6 +5,11 @@ const CopyWebpackPlugin = require('copy-webpack-plugin') const mode = process.env.NODE_ENV?.trim() || 'development' +const alias = { + '@/modules/ipc.js': join(__dirname, 'src', 'ipc.js'), + '@/modules/support.js': join(__dirname, 'src', 'support.js') +} + /** @type {import('webpack').Configuration} */ const capacitorConfig = { devtool: 'source-map', @@ -22,6 +27,7 @@ const capacitorConfig = { aliasFields: [], mainFields: ['module', 'main', 'node'], alias: { + ...alias, wrtc: false, 'bittorrent-tracker/lib/client/http-tracker.js': resolve('../node_modules/bittorrent-tracker/lib/client/http-tracker.js') } @@ -46,9 +52,4 @@ const capacitorConfig = { ] } -const alias = { - '@/modules/ipc.js': join(__dirname, 'src', 'ipc.js'), - '@/modules/support.js': join(__dirname, 'src', 'support.js') -} - module.exports = [capacitorConfig, merge(commonConfig(__dirname, alias, 'browser', 'index'), { entry: [join(__dirname, 'src', 'capacitor.js')] })] diff --git a/common/modules/support.js b/common/modules/support.js index a32399e..a60b720 100644 --- a/common/modules/support.js +++ b/common/modules/support.js @@ -11,5 +11,6 @@ export const SUPPORTS = { torrentPath: true, torrentPersist: true, keybinds: true, - extensions: true + extensions: true, + isAndroid: false } diff --git a/common/modules/util.js b/common/modules/util.js index 4eb966d..56685d0 100644 --- a/common/modules/util.js +++ b/common/modules/util.js @@ -1,4 +1,4 @@ -import { SUPPORTS } from './support.js' +import { SUPPORTS } from '@/modules/support.js' export function countdown (s) { const d = Math.floor(s / (3600 * 24)) @@ -152,7 +152,7 @@ export const defaults = { playerAutocomplete: true, playerDeband: false, rssQuality: '1080', - rssFeedsNew: [['New Releases', 'SubsPlease']], + rssFeedsNew: SUPPORTS.extensions ? [['New Releases', 'SubsPlease']] : [], rssAutoplay: true, torrentSpeed: 5, torrentPersist: false, @@ -162,12 +162,12 @@ export const defaults = { dhtPort: 0, missingFont: true, maxConns: 50, - subtitleRenderHeight: '0', + subtitleRenderHeight: SUPPORTS.isAndroid ? '720' : '0', subtitleLanguage: 'eng', audioLanguage: 'jpn', enableDoH: false, doHURL: 'https://cloudflare-dns.com/dns-query', - disableSubtitleBlur: false, + disableSubtitleBlur: SUPPORTS.isAndroid, showDetailsInRPC: true, smoothScroll: true, cards: 'small', @@ -175,6 +175,7 @@ export const defaults = { torrentPath: undefined, font: undefined, angle: 'default', + toshoURL: SUPPORTS.extensions ? decodeURIComponent(atob('aHR0cHM6Ly9mZWVkLmFuaW1ldG9zaG8ub3JnLw==')) : '', extensions: SUPPORTS.extensions ? ['@thaunknown/ani-resourced'] : [], sources: {} } diff --git a/common/views/Player/Player.svelte b/common/views/Player/Player.svelte index 5fb0362..c992f9f 100644 --- a/common/views/Player/Player.svelte +++ b/common/views/Player/Player.svelte @@ -1036,11 +1036,11 @@
{ page = 'player' }} /> - skip_previous - fast_rewind - {ended ? 'replay' : paused ? 'play_arrow' : 'pause'} - fast_forward - skip_next + skip_previous + fast_rewind + {ended ? 'replay' : paused ? 'play_arrow' : 'pause'} + fast_forward + skip_next
{#if currentSkippable}
-
{toTS(targetTime, safeduration > 3600 ? 2 : 3)} / {toTS(safeduration - targetTime, safeduration > 3600 ? 2 : 3)}
+
{toTS(targetTime, safeduration > 3600 ? 2 : 3)} / {toTS(safeduration - targetTime, safeduration > 3600 ? 2 : 3)}
{#if playbackRate !== 1} -
x{playbackRate.toFixed(1)}
+
x{playbackRate.toFixed(1)}
{/if} - (showKeybinds = true)}> keyboard + (showKeybinds = true)}> keyboard {#if 'audioTracks' in HTMLVideoElement.prototype && video?.audioTracks?.length > 1} - -
- - -
-
- - - {/if} + +
+ + +
+
+ + +

Language Settings

diff --git a/common/views/Settings/TorrentSettings.svelte b/common/views/Settings/TorrentSettings.svelte index adf965c..7ad9fd3 100644 --- a/common/views/Settings/TorrentSettings.svelte +++ b/common/views/Settings/TorrentSettings.svelte @@ -59,7 +59,59 @@ } +

Extension Settings

+ +
+
+ +
+ +
+
+
+ {#each settings.extensions as extension, i} +
+
+ {extension} +
+ +
+ {/each} +
+
+
+ +
+
+ {#key settings.extensions} + {#await extensionsWorker then worker} + {#await worker.metadata then metadata} + {#each metadata as { accuracy, name, description }} +
+
+
{name}
+
{description}
+
+
+
Accuracy: {accuracy}
+
+ + +
+
+
+ {/each} + {/await} + {/await} + {/key} +
+
+
+

Lookup Settings

+ + + -
- -
-
-
- {#each settings.extensions as extension, i} -
-
- {extension} -
- -
- {/each} -
-
- - -
-
- {#key settings.extensions} - {#await extensionsWorker then worker} - {#await worker.metadata then metadata} - {#each metadata as { accuracy, name, description }} -
-
-
{name}
-
{description}
-
-
-
Accuracy: {accuracy}
-
- - -
-
-
- {/each} - {/await} - {/await} - {/key} -
-
-