From 80cd26aa28e12f22c35ba5a09655d2726f715669 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Sun, 1 Jun 2025 21:22:18 +1200 Subject: [PATCH 1/6] Minor fixes to feed state manangement --- materialious/src/routes/(app)/+page.svelte | 3 ++- materialious/src/routes/(app)/+page.ts | 1 - materialious/src/routes/(app)/subscriptions/+page.svelte | 6 ++---- materialious/src/routes/(app)/subscriptions/+page.ts | 6 +----- materialious/src/routes/(app)/trending/+page.svelte | 5 ++--- materialious/src/routes/(app)/trending/+page.ts | 2 -- 6 files changed, 7 insertions(+), 16 deletions(-) diff --git a/materialious/src/routes/(app)/+page.svelte b/materialious/src/routes/(app)/+page.svelte index 50ef53fa..3f6015e1 100644 --- a/materialious/src/routes/(app)/+page.svelte +++ b/materialious/src/routes/(app)/+page.svelte @@ -1,5 +1,6 @@ @@ -11,5 +12,5 @@

Popular page has been disabled

{:else} - + {/if} diff --git a/materialious/src/routes/(app)/+page.ts b/materialious/src/routes/(app)/+page.ts index 5045ff65..37b3ed62 100644 --- a/materialious/src/routes/(app)/+page.ts +++ b/materialious/src/routes/(app)/+page.ts @@ -24,7 +24,6 @@ export async function load() { } return { - popular: popular, popularDisabled: popularDisabled }; } diff --git a/materialious/src/routes/(app)/subscriptions/+page.svelte b/materialious/src/routes/(app)/subscriptions/+page.svelte index c4042a56..47c5ed03 100644 --- a/materialious/src/routes/(app)/subscriptions/+page.svelte +++ b/materialious/src/routes/(app)/subscriptions/+page.svelte @@ -6,10 +6,8 @@ import { _ } from 'svelte-i18n'; import InfiniteLoading, { type InfiniteEvent } from 'svelte-infinite-loading'; - let { data } = $props(); - let currentPage = 1; - let videos: (VideoBase | Video | PlaylistPageVideo)[] = $state(data.videos); + let videos: (VideoBase | Video | PlaylistPageVideo)[] = $state($feedCacheStore.subscription); async function loadMore(event: InfiniteEvent) { currentPage++; @@ -32,6 +30,6 @@ - + diff --git a/materialious/src/routes/(app)/subscriptions/+page.ts b/materialious/src/routes/(app)/subscriptions/+page.ts index 0f042c53..48b7fdce 100644 --- a/materialious/src/routes/(app)/subscriptions/+page.ts +++ b/materialious/src/routes/(app)/subscriptions/+page.ts @@ -20,11 +20,7 @@ export async function load() { } else { await getFeed(100, 1).then((feeds) => { const newVideos = [...feeds.notifications, ...feeds.videos]; - feedCacheStore.set({ subscription: { ...Array.from(new Set(newVideos)), ...videos } }); + feedCacheStore.set({ subscription: Array.from(new Set({ ...newVideos, ...videos })) }); }); } - - return { - videos: videos - }; } diff --git a/materialious/src/routes/(app)/trending/+page.svelte b/materialious/src/routes/(app)/trending/+page.svelte index be94a542..0ab8e773 100644 --- a/materialious/src/routes/(app)/trending/+page.svelte +++ b/materialious/src/routes/(app)/trending/+page.svelte @@ -1,7 +1,6 @@ - + diff --git a/materialious/src/routes/(app)/trending/+page.ts b/materialious/src/routes/(app)/trending/+page.ts index 5e032f8e..252f2de0 100644 --- a/materialious/src/routes/(app)/trending/+page.ts +++ b/materialious/src/routes/(app)/trending/+page.ts @@ -17,6 +17,4 @@ export async function load() { } else { getTrending().then((newTrending) => feedCacheStore.set({ trending: newTrending })); } - - return { trending: trending }; } From 51e865c94af5826fd345636cd5590defb2419e47 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Sun, 1 Jun 2025 21:22:38 +1200 Subject: [PATCH 2/6] Bump version --- materialious/android/app/build.gradle | 4 ++-- materialious/electron/materialious.metainfo.xml | 6 +++++- materialious/electron/package.json | 2 +- materialious/package.json | 2 +- update_versions.py | 2 +- 5 files changed, 10 insertions(+), 6 deletions(-) diff --git a/materialious/android/app/build.gradle b/materialious/android/app/build.gradle index 26f9e2fd..96ba4ff1 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 112 - versionName "1.8.8" + versionCode 113 + versionName "1.8.9" 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 475f55ad..12251e9d 100644 --- a/materialious/electron/materialious.metainfo.xml +++ b/materialious/electron/materialious.metainfo.xml @@ -57,7 +57,11 @@ - + + + https://github.com/Materialious/Materialious/releases/tag/1.8.9 + + https://github.com/Materialious/Materialious/releases/tag/1.8.8 diff --git a/materialious/electron/package.json b/materialious/electron/package.json index 2ee1b142..9d1fb938 100644 --- a/materialious/electron/package.json +++ b/materialious/electron/package.json @@ -1,6 +1,6 @@ { "name": "Materialious", - "version": "1.8.8", + "version": "1.8.9", "description": "Modern material design for Invidious.", "author": { "name": "Ward Pearce", diff --git a/materialious/package.json b/materialious/package.json index 0810f24a..a16809ea 100644 --- a/materialious/package.json +++ b/materialious/package.json @@ -1,6 +1,6 @@ { "name": "materialious", - "version": "1.8.8", + "version": "1.8.9", "private": true, "scripts": { "dev": "vite dev", diff --git a/update_versions.py b/update_versions.py index 436824ae..aa99d81e 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.8" +LATEST_VERSION = "1.8.9" RELEASE_DATE = datetime.now().strftime("%Y-%-m-%d") # Format: YYYY-M-D WORKING_DIR = os.path.join( From f4a1395e59be9241f06046946b9daa15cf4e33d6 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Sun, 1 Jun 2025 21:24:27 +1200 Subject: [PATCH 3/6] Disable player tooltips --- materialious/electron/package-lock.json | 4 ++-- materialious/src/lib/components/Player.svelte | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/materialious/electron/package-lock.json b/materialious/electron/package-lock.json index d1622245..32a04e42 100644 --- a/materialious/electron/package-lock.json +++ b/materialious/electron/package-lock.json @@ -1,12 +1,12 @@ { "name": "Materialious", - "version": "1.8.8", + "version": "1.8.9", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "Materialious", - "version": "1.8.8", + "version": "1.8.9", "license": "MIT", "dependencies": { "@capacitor-community/electron": "^5.0.0", diff --git a/materialious/src/lib/components/Player.svelte b/materialious/src/lib/components/Player.svelte index 79cf6f4e..9ed39da8 100644 --- a/materialious/src/lib/components/Player.svelte +++ b/materialious/src/lib/components/Player.svelte @@ -247,7 +247,7 @@ 'language', 'statistics' ], - enableTooltips: true, + enableTooltips: false, seekBarColors: { played: (await getDynamicTheme())['--primary'] } From f5b931f4a9221772ac0383ebf326f207f94dfbc9 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Sun, 1 Jun 2025 21:42:52 +1200 Subject: [PATCH 4/6] Inmprovements to search caching via state --- materialious/src/lib/store.ts | 5 +- .../routes/(app)/search/[slug]/+page.svelte | 54 ++++++++++++------- .../src/routes/(app)/search/[slug]/+page.ts | 19 ++++--- 3 files changed, 52 insertions(+), 26 deletions(-) diff --git a/materialious/src/lib/store.ts b/materialious/src/lib/store.ts index 381ad075..9964d249 100644 --- a/materialious/src/lib/store.ts +++ b/materialious/src/lib/store.ts @@ -4,7 +4,7 @@ import type { DataConnection } from 'peerjs'; import { persisted } from 'svelte-persisted-store'; import { writable, type Writable } from 'svelte/store'; import type { TitleCase } from './letterCasing'; -import type { PlaylistPageVideo, Video, VideoBase } from './api/model'; +import type { Channel, HashTag, Playlist, PlaylistPageVideo, Video, VideoBase } from './api/model'; function platformDependentDefault(givenValue: any, defaultValue: any): any { if (typeof givenValue !== 'undefined' && typeof givenValue !== null) { @@ -115,4 +115,7 @@ export const searchHistoryStore: Writable = persisted('searchHistory', export const feedCacheStore: Writable<{ [key: string]: (VideoBase | Video | PlaylistPageVideo)[]; }> = writable({}); +export const searchCacheStore: Writable<{ + [searchType: string]: (Channel | Video | Playlist | HashTag)[]; +}> = writable({}); export const feedLastItemId: Writable = writable(undefined); diff --git a/materialious/src/routes/(app)/search/[slug]/+page.svelte b/materialious/src/routes/(app)/search/[slug]/+page.svelte index 65fbfc1d..34efccd2 100644 --- a/materialious/src/routes/(app)/search/[slug]/+page.svelte +++ b/materialious/src/routes/(app)/search/[slug]/+page.svelte @@ -6,33 +6,41 @@ import PageLoading from '$lib/components/PageLoading.svelte'; import PlaylistThumbnail from '$lib/components/PlaylistThumbnail.svelte'; import Thumbnail from '$lib/components/Thumbnail.svelte'; + import { feedLastItemId, searchCacheStore } from '$lib/store.js'; + import { onMount } from 'svelte'; import { _ } from 'svelte-i18n'; import InfiniteLoading, { type InfiniteEvent } from 'svelte-infinite-loading'; let { data } = $props(); - let searchResults = $state(data); - + let currentType: 'playlist' | 'all' | 'video' | 'channel' = $state('all'); let currentPage = 1; + onMount(() => { + if ($feedLastItemId) { + document.getElementById($feedLastItemId)?.scrollIntoView({ behavior: 'instant' }); + } + }); + async function changeType(type: 'playlist' | 'all' | 'video' | 'channel') { - searchResults.searchType = type; + currentType = type; currentPage = 1; - searchResults.search = []; - searchResults.search = await getSearch(searchResults.slug, { type: type }); + searchCacheStore.set({ [type]: await getSearch(data.slug, { type: type }) }); } async function loadMore(event: InfiniteEvent) { currentPage++; - const newSearch = await getSearch(searchResults.slug, { + const newSearch = await getSearch(data.slug, { page: currentPage.toString(), - type: searchResults.searchType + type: currentType }); if (newSearch.length === 0) { event.detail.complete(); } else { - searchResults.search = [...searchResults.search, ...newSearch]; + searchCacheStore.set({ + [currentType]: [...($searchCacheStore[currentType] ?? []), ...newSearch] + }); event.detail.loaded(); } } @@ -40,16 +48,12 @@ -{#if searchResults.search.length > 0} +{#if $searchCacheStore[currentType].length > 0}
- {#each searchResults.search as item} + {#each $searchCacheStore[currentType] as item} {#key item} -
+
+ feedLastItemId.set( + 'videoId' in item ? item.videoId : 'authorId' in item ? item.authorId : item.title + )} + id={'videoId' in item + ? item.videoId + : 'authorId' in item + ? item.authorId + : item.title} + > {#if item.type === 'video'} {:else if item.type === 'channel'} diff --git a/materialious/src/routes/(app)/search/[slug]/+page.ts b/materialious/src/routes/(app)/search/[slug]/+page.ts index bb14dc2e..86a7d30a 100644 --- a/materialious/src/routes/(app)/search/[slug]/+page.ts +++ b/materialious/src/routes/(app)/search/[slug]/+page.ts @@ -1,5 +1,7 @@ import { getSearch } from '$lib/api/index'; +import { searchCacheStore } from '$lib/store.js'; import { error } from '@sveltejs/kit'; +import { get } from 'svelte/store'; export async function load({ params, url }) { let type: 'playlist' | 'all' | 'video' | 'channel'; @@ -11,16 +13,21 @@ export async function load({ params, url }) { type = 'all'; } - let search; + const search = get(searchCacheStore).all; - try { - search = await getSearch(params.slug, { type: type }); - } catch (errorMessage: any) { - error(500, errorMessage); + if (!search) { + try { + searchCacheStore.set({ [type]: await getSearch(params.slug, { type: type }) }); + } catch (errorMessage: any) { + error(500, errorMessage); + } + } else { + getSearch(params.slug, { type: type }).then((newSearch) => { + searchCacheStore.set({ [type]: Array.from(new Set({ ...newSearch, ...search })) }); + }); } return { - search: search, slug: params.slug, searchType: type }; From 5e8f15aff0c3e5e0567f796338992679bf507ef5 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Sun, 1 Jun 2025 22:03:12 +1200 Subject: [PATCH 5/6] More fixes --- materialious/src/lib/components/VideoList.svelte | 4 +++- materialious/src/routes/(app)/search/[slug]/+page.svelte | 4 +++- materialious/src/routes/(app)/search/[slug]/+page.ts | 4 +++- materialious/src/routes/(app)/subscriptions/+page.ts | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/materialious/src/lib/components/VideoList.svelte b/materialious/src/lib/components/VideoList.svelte index ceee9e94..ec267bfb 100644 --- a/materialious/src/lib/components/VideoList.svelte +++ b/materialious/src/lib/components/VideoList.svelte @@ -22,7 +22,9 @@ onMount(() => { if ($feedLastItemId) - document.getElementById($feedLastItemId)?.scrollIntoView({ behavior: 'instant' }); + document + .getElementById($feedLastItemId) + ?.scrollIntoView({ behavior: 'instant', block: 'center', inline: 'nearest' }); }); diff --git a/materialious/src/routes/(app)/search/[slug]/+page.svelte b/materialious/src/routes/(app)/search/[slug]/+page.svelte index 34efccd2..c147dd55 100644 --- a/materialious/src/routes/(app)/search/[slug]/+page.svelte +++ b/materialious/src/routes/(app)/search/[slug]/+page.svelte @@ -18,7 +18,9 @@ onMount(() => { if ($feedLastItemId) { - document.getElementById($feedLastItemId)?.scrollIntoView({ behavior: 'instant' }); + document + .getElementById($feedLastItemId) + ?.scrollIntoView({ behavior: 'instant', block: 'center', inline: 'nearest' }); } }); diff --git a/materialious/src/routes/(app)/search/[slug]/+page.ts b/materialious/src/routes/(app)/search/[slug]/+page.ts index 86a7d30a..43996078 100644 --- a/materialious/src/routes/(app)/search/[slug]/+page.ts +++ b/materialious/src/routes/(app)/search/[slug]/+page.ts @@ -23,7 +23,9 @@ export async function load({ params, url }) { } } else { getSearch(params.slug, { type: type }).then((newSearch) => { - searchCacheStore.set({ [type]: Array.from(new Set({ ...newSearch, ...search })) }); + searchCacheStore.set({ + [type]: [...newSearch, ...search] + }); }); } diff --git a/materialious/src/routes/(app)/subscriptions/+page.ts b/materialious/src/routes/(app)/subscriptions/+page.ts index 48b7fdce..53370063 100644 --- a/materialious/src/routes/(app)/subscriptions/+page.ts +++ b/materialious/src/routes/(app)/subscriptions/+page.ts @@ -20,7 +20,9 @@ export async function load() { } else { await getFeed(100, 1).then((feeds) => { const newVideos = [...feeds.notifications, ...feeds.videos]; - feedCacheStore.set({ subscription: Array.from(new Set({ ...newVideos, ...videos })) }); + feedCacheStore.set({ + subscription: [...newVideos, ...videos] + }); }); } } From 281d3cef8041969990be082dd8d8b0c6dce6b290 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Sun, 1 Jun 2025 22:09:01 +1200 Subject: [PATCH 6/6] More fixes to state management for feeds / searches --- materialious/src/routes/(app)/+layout.svelte | 11 +++++++++-- materialious/src/routes/(app)/search/[slug]/+page.ts | 2 +- materialious/src/routes/(app)/subscriptions/+page.ts | 4 ++-- 3 files changed, 12 insertions(+), 5 deletions(-) diff --git a/materialious/src/routes/(app)/+layout.svelte b/materialious/src/routes/(app)/+layout.svelte index 6b1f4cb0..aa101f48 100644 --- a/materialious/src/routes/(app)/+layout.svelte +++ b/materialious/src/routes/(app)/+layout.svelte @@ -173,7 +173,10 @@
{#each getPages() as navPage} {#if !navPage.requiresAuth || isLoggedIn} -
{navPage.icon}
{navPage.name}
@@ -256,7 +259,11 @@