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-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/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/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'] } 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/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)/+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 @@ {: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)/search/[slug]/+page.svelte b/materialious/src/routes/(app)/search/[slug]/+page.svelte index 65fbfc1d..c147dd55 100644 --- a/materialious/src/routes/(app)/search/[slug]/+page.svelte +++ b/materialious/src/routes/(app)/search/[slug]/+page.svelte @@ -6,33 +6,43 @@ 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', block: 'center', inline: 'nearest' }); + } + }); + 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 +50,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..64ce5236 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,23 @@ 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]: [...new Set([...newSearch, ...search])] + }); + }); } return { - search: search, slug: params.slug, searchType: type }; 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..c4364ea2 100644 --- a/materialious/src/routes/(app)/subscriptions/+page.ts +++ b/materialious/src/routes/(app)/subscriptions/+page.ts @@ -19,12 +19,10 @@ export async function load() { feedCacheStore.set({ subscription: videos }); } else { await getFeed(100, 1).then((feeds) => { - const newVideos = [...feeds.notifications, ...feeds.videos]; - feedCacheStore.set({ subscription: { ...Array.from(new Set(newVideos)), ...videos } }); + const newVideos = [...feeds.notifications, ...feeds.videos, ...videos]; + feedCacheStore.set({ + subscription: [...new Set(newVideos)] + }); }); } - - 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 }; } 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(