From 7cd9702dc5082d8d4346514665357156b0ae7bb3 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Thu, 29 May 2025 17:49:30 +1200 Subject: [PATCH 1/9] Minor fix --- materialious/android/app/build.gradle | 4 ++-- materialious/electron/materialious.metainfo.xml | 6 +++++- materialious/electron/package.json | 2 +- materialious/package.json | 2 +- materialious/src/lib/css/shaka-player-theme.css | 5 +---- update_versions.py | 2 +- 6 files changed, 11 insertions(+), 10 deletions(-) diff --git a/materialious/android/app/build.gradle b/materialious/android/app/build.gradle index ced51595..f6402ca6 100644 --- a/materialious/android/app/build.gradle +++ b/materialious/android/app/build.gradle @@ -7,8 +7,8 @@ android { applicationId "us.materialio.app" minSdkVersion rootProject.ext.minSdkVersion targetSdkVersion rootProject.ext.targetSdkVersion - versionCode 109 - versionName "1.8.5" + versionCode 110 + versionName "1.8.6" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" aaptOptions { // Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps. diff --git a/materialious/electron/materialious.metainfo.xml b/materialious/electron/materialious.metainfo.xml index d98e74a6..5e98996c 100644 --- a/materialious/electron/materialious.metainfo.xml +++ b/materialious/electron/materialious.metainfo.xml @@ -54,7 +54,11 @@ - + + + https://github.com/Materialious/Materialious/releases/tag/1.8.6 + + https://github.com/Materialious/Materialious/releases/tag/1.8.5 diff --git a/materialious/electron/package.json b/materialious/electron/package.json index ab585488..d91704df 100644 --- a/materialious/electron/package.json +++ b/materialious/electron/package.json @@ -1,6 +1,6 @@ { "name": "Materialious", - "version": "1.8.5", + "version": "1.8.6", "description": "Modern material design for Invidious.", "author": { "name": "Ward Pearce", diff --git a/materialious/package.json b/materialious/package.json index b72d5e08..45497fe3 100644 --- a/materialious/package.json +++ b/materialious/package.json @@ -1,6 +1,6 @@ { "name": "materialious", - "version": "1.8.5", + "version": "1.8.6", "private": true, "scripts": { "dev": "vite dev", diff --git a/materialious/src/lib/css/shaka-player-theme.css b/materialious/src/lib/css/shaka-player-theme.css index 18b7bb4e..37cd5a59 100644 --- a/materialious/src/lib/css/shaka-player-theme.css +++ b/materialious/src/lib/css/shaka-player-theme.css @@ -285,7 +285,6 @@ height: 50vh !important; transform: translate(-50%, -50%) !important; pointer-events: all !important; - z-index: 99999999 !important; pointer-events: auto !important; opacity: 1 !important; visibility: visible !important; @@ -320,20 +319,18 @@ width: 100vw !important; height: 100vh !important; background: transparent !important; - z-index: 99999998 !important; pointer-events: auto !important; } .youtube-theme .shaka-overflow-menu:hover, .youtube-theme .shaka-settings-menu:hover { - z-index: 99999998 !important; pointer-events: auto !important; opacity: 1 !important; visibility: visible !important; } #shaka-container { - z-index: 99999998 !important; + z-index: 98 !important; pointer-events: auto !important; opacity: 1 !important; visibility: visible !important; diff --git a/update_versions.py b/update_versions.py index b30b9e54..706565a8 100644 --- a/update_versions.py +++ b/update_versions.py @@ -3,7 +3,7 @@ import os import re from datetime import datetime -LATEST_VERSION = "1.8.5" +LATEST_VERSION = "1.8.6" RELEASE_DATE = datetime.now().strftime("%Y-%-m-%d") # Format: YYYY-M-D WORKING_DIR = os.path.join( From 51bb71a52e4a6894b0195aa0d649d17476cc160e Mon Sep 17 00:00:00 2001 From: WardPearce Date: Thu, 29 May 2025 18:11:47 +1200 Subject: [PATCH 2/9] Fixes to instance checking --- materialious/electron/package-lock.json | 4 +- .../lib/components/Settings/Interface.svelte | 19 ++++-- .../lib/components/Settings/Settings.svelte | 62 +------------------ .../src/lib/components/Thumbnail.svelte | 2 +- materialious/src/lib/css/global.css | 10 --- materialious/src/lib/patches/youtubejs.ts | 2 +- .../routes/(app)/watch/[slug]/+page.svelte | 8 +-- 7 files changed, 23 insertions(+), 84 deletions(-) diff --git a/materialious/electron/package-lock.json b/materialious/electron/package-lock.json index aa3b9685..38215ea6 100644 --- a/materialious/electron/package-lock.json +++ b/materialious/electron/package-lock.json @@ -1,12 +1,12 @@ { "name": "Materialious", - "version": "1.8.5", + "version": "1.8.6", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "Materialious", - "version": "1.8.5", + "version": "1.8.6", "license": "MIT", "dependencies": { "@capacitor-community/electron": "^5.0.0", diff --git a/materialious/src/lib/components/Settings/Interface.svelte b/materialious/src/lib/components/Settings/Interface.svelte index e53723ca..998963ca 100644 --- a/materialious/src/lib/components/Settings/Interface.svelte +++ b/materialious/src/lib/components/Settings/Interface.svelte @@ -1,6 +1,4 @@ {#if Capacitor.isNativePlatform()} -
+
+ {#if invalidInstance} +
+ {/if} {/if} - {:else} - From 588d9a6e05b159bb5158e282034e5268a959d198 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Thu, 29 May 2025 18:31:46 +1200 Subject: [PATCH 3/9] Improved transcript cue merging logic --- .../src/lib/components/Transcript.svelte | 121 +++++++++++++++++- 1 file changed, 118 insertions(+), 3 deletions(-) diff --git a/materialious/src/lib/components/Transcript.svelte b/materialious/src/lib/components/Transcript.svelte index feba597b..2c5e6f28 100644 --- a/materialious/src/lib/components/Transcript.svelte +++ b/materialious/src/lib/components/Transcript.svelte @@ -40,6 +40,118 @@ } }); + export function dedupeAndMergeOverlappingCues(cues: VTTCue[], timeOffset = -1): VTTCue[] { + const merged: VTTCue[] = []; + + for (const cue of cues) { + const trimmedText = cue.text.trim(); + if (!trimmedText) { + continue; + } + + let wasMerged = false; + + for (let i = 0; i < merged.length; i++) { + const existing = merged[i]; + + const timeGap = Math.abs(cue.startTime - existing.endTime); + const isTimeAdjacent = timeGap <= 1.5; + + if (isTimeAdjacent && areCuesTextSimilar(existing.text, cue.text)) { + const mergedText = mergeCueText(existing.text, cue.text); + + const newStart = Math.max(0, Math.min(existing.startTime, cue.startTime) + timeOffset); + const newEnd = Math.max(existing.endTime, cue.endTime) + timeOffset; + + const mergedCue = new VTTCue(newStart, newEnd, mergedText); + copyCueMeta(mergedCue, cue); + + merged[i] = mergedCue; + wasMerged = true; + break; + } + } + + if (!wasMerged) { + const offsetCue = new VTTCue( + Math.max(0, cue.startTime + timeOffset), + cue.endTime + timeOffset, + cue.text + ); + copyCueMeta(offsetCue, cue); + merged.push(offsetCue); + } + } + + // Ensure no overlapping cues (each cue ends before the next starts) + for (let i = 0; i < merged.length - 1; i++) { + const current = merged[i]; + const next = merged[i + 1]; + if (current.endTime > next.startTime) { + current.endTime = Math.max(current.startTime, next.startTime - 0.01); // 10ms gap + } + } + + return merged; + } + + function areCuesTextSimilar(a: string, b: string): boolean { + if (a === b) return true; + + // Normalize and compare overlap ratio + const cleanA = normalizeText(a); + const cleanB = normalizeText(b); + + const overlap = getTextOverlap(cleanA, cleanB); + const minLength = Math.min(cleanA.length, cleanB.length); + + // Consider similar if 60% or more overlap + return overlap / minLength >= 0.6; + } + + function getTextOverlap(a: string, b: string): number { + const maxOverlap = Math.min(a.length, b.length); + for (let i = maxOverlap; i > 0; i--) { + if (a.endsWith(b.slice(0, i)) || b.endsWith(a.slice(0, i))) { + return i; + } + } + return 0; + } + + function normalizeText(text: string): string { + return text + .trim() + .replace(/\s+/g, ' ') + .replace(/[.,?!"'”“]/g, '') + .toLowerCase(); + } + + function mergeCueText(a: string, b: string): string { + // Avoid duplicating overlap + const overlapLen = getTextOverlap(a, b); + if (a.endsWith(b.slice(0, overlapLen))) { + return a + b.slice(overlapLen); + } + if (b.endsWith(a.slice(0, overlapLen))) { + return b + a.slice(overlapLen); + } + return `${a} ${b}`; + } + + function copyCueMeta(target: VTTCue, source: VTTCue): void { + target.region = source.region; + target.vertical = source.vertical; + target.snapToLines = source.snapToLines; + target.line = source.line; + target.lineAlign = source.lineAlign; + target.position = source.position; + target.positionAlign = source.positionAlign; + target.size = source.size; + target.align = source.align; + target.style = source.style; + } + async function loadTranscript() { if (!url) { transcript = null; @@ -48,9 +160,11 @@ isLoading = true; transcript = null; + const resp = await fetch(`${!video.fallbackPatch ? get(instanceStore) : ''}${url}`); transcript = await parseText(await resp.text(), { strict: false }); - transcriptCues = transcript.cues; + + transcriptCues = dedupeAndMergeOverlappingCues(transcript.cues); isLoading = false; } @@ -58,7 +172,7 @@ if (!transcript) return; if (search.trim() === '') { - transcriptCues = transcript.cues; + transcriptCues = dedupeAndMergeOverlappingCues(transcript.cues); return; } @@ -66,7 +180,8 @@ keys: ['text'] }); - transcriptCues = fuse.search(search).map((item) => item.item); + const results = fuse.search(search).map((item) => item.item); + transcriptCues = dedupeAndMergeOverlappingCues(results); } From 78eedb2fe5bd38a381790ceaf2cb7cccc71b8f41 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Thu, 29 May 2025 18:35:35 +1200 Subject: [PATCH 4/9] Decreased to cue 50% similarlity --- materialious/src/lib/components/Transcript.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/materialious/src/lib/components/Transcript.svelte b/materialious/src/lib/components/Transcript.svelte index 2c5e6f28..bf35151d 100644 --- a/materialious/src/lib/components/Transcript.svelte +++ b/materialious/src/lib/components/Transcript.svelte @@ -105,8 +105,8 @@ const overlap = getTextOverlap(cleanA, cleanB); const minLength = Math.min(cleanA.length, cleanB.length); - // Consider similar if 60% or more overlap - return overlap / minLength >= 0.6; + // Consider similar if 50% or more overlap + return overlap / minLength >= 0.5; } function getTextOverlap(a: string, b: string): number { From 174dd9946d54aa59a57ed8cb3cdc3218d4afc482 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Thu, 29 May 2025 18:39:13 +1200 Subject: [PATCH 5/9] Added shorts support --- .../android/app/src/main/AndroidManifest.xml | 16 ++++++++++++++++ materialious/src/routes/(app)/+layout.svelte | 5 +---- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/materialious/android/app/src/main/AndroidManifest.xml b/materialious/android/app/src/main/AndroidManifest.xml index bfc605c7..da6049ea 100644 --- a/materialious/android/app/src/main/AndroidManifest.xml +++ b/materialious/android/app/src/main/AndroidManifest.xml @@ -48,6 +48,22 @@ android:scheme="https" android:host="youtu.be" android:pathPrefix="/watch" /> + + + + diff --git a/materialious/src/routes/(app)/+layout.svelte b/materialious/src/routes/(app)/+layout.svelte index 15e200cf..53a4812c 100644 --- a/materialious/src/routes/(app)/+layout.svelte +++ b/materialious/src/routes/(app)/+layout.svelte @@ -36,11 +36,8 @@ import { _ } from 'svelte-i18n'; import { get } from 'svelte/store'; import { pwaInfo } from 'virtual:pwa-info'; - interface Props { - children?: import('svelte').Snippet; - } - let { children }: Props = $props(); + let { children } = $props(); let mobileSearchShow = $state(false); From 2f771e9efc5766d39a6aaf867e72a9a37f51e16b Mon Sep 17 00:00:00 2001 From: WardPearce Date: Thu, 29 May 2025 18:43:32 +1200 Subject: [PATCH 6/9] Clicking on nav logo takes to default page instead of home --- materialious/src/routes/(app)/+layout.svelte | 3 ++- materialious/src/routes/+layout.ts | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/materialious/src/routes/(app)/+layout.svelte b/materialious/src/routes/(app)/+layout.svelte index 53a4812c..42cc158f 100644 --- a/materialious/src/routes/(app)/+layout.svelte +++ b/materialious/src/routes/(app)/+layout.svelte @@ -21,6 +21,7 @@ darkModeStore, instanceStore, interfaceAmoledTheme, + interfaceDefaultPage, showWarningStore, syncPartyPeerStore, themeColorStore @@ -235,7 +236,7 @@ {/if} -