From 859879a5a65f3045edc14cff05443c00c458a1b4 Mon Sep 17 00:00:00 2001 From: WardPearce Date: Tue, 10 Sep 2024 17:44:09 +1200 Subject: [PATCH 1/3] Minor fixes --- materialious/android/app/build.gradle | 4 ++-- materialious/electron/package.json | 2 +- materialious/package.json | 2 +- materialious/src/lib/Comment.svelte | 7 +------ materialious/src/lib/misc.ts | 5 +++++ materialious/src/lib/videoDownload.ts | 7 +++---- materialious/src/routes/(app)/watch/[slug]/+page.svelte | 9 ++++----- update_versions.py | 2 +- 8 files changed, 18 insertions(+), 20 deletions(-) diff --git a/materialious/android/app/build.gradle b/materialious/android/app/build.gradle index 9f4336c8..b84c7b12 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 29 - versionName "1.3.0" + versionCode 30 + versionName "1.3.1" 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/package.json b/materialious/electron/package.json index bc669ae8..688b1a05 100644 --- a/materialious/electron/package.json +++ b/materialious/electron/package.json @@ -1,6 +1,6 @@ { "name": "Materialious", - "version": "1.3.0", + "version": "1.3.1", "description": "Modern material design for Invidious.", "author": { "name": "Ward Pearce", diff --git a/materialious/package.json b/materialious/package.json index f3c4b846..01aaf2fb 100644 --- a/materialious/package.json +++ b/materialious/package.json @@ -1,6 +1,6 @@ { "name": "materialious", - "version": "1.3.0", + "version": "1.3.1", "private": true, "scripts": { "dev": "vite dev", diff --git a/materialious/src/lib/Comment.svelte b/materialious/src/lib/Comment.svelte index 271962f2..7412c989 100644 --- a/materialious/src/lib/Comment.svelte +++ b/materialious/src/lib/Comment.svelte @@ -2,18 +2,13 @@ import { _ } from 'svelte-i18n'; import { getComments } from './Api'; import { type Comment, type Comments } from './Api/model'; - import { getBestThumbnail, numberWithCommas, proxyGoogleImage } from './misc'; + import { getBestThumbnail, loadPfp, numberWithCommas, proxyGoogleImage } from './misc'; export let comment: Comment; export let videoId: string; let replies: Comments | undefined = undefined; - async function loadPfp(url: string): Promise { - const resp = await fetch(url); - return URL.createObjectURL(await resp.blob()); - } - async function loadReplies(continuation: string) { try { replies = await getComments(videoId, { diff --git a/materialious/src/lib/misc.ts b/materialious/src/lib/misc.ts index 906bdeaa..7effca4d 100644 --- a/materialious/src/lib/misc.ts +++ b/materialious/src/lib/misc.ts @@ -170,6 +170,11 @@ export function proxyVideoUrl(source: string): string { return rawSrc.toString(); } +export async function loadPfp(url: string): Promise { + const resp = await fetch(url); + return URL.createObjectURL(await resp.blob()); +} + export function proxyGoogleImage(source: string): string { if (source.startsWith('//')) source = `https:${source}`; diff --git a/materialious/src/lib/videoDownload.ts b/materialious/src/lib/videoDownload.ts index ac6049b9..ab66e459 100644 --- a/materialious/src/lib/videoDownload.ts +++ b/materialious/src/lib/videoDownload.ts @@ -1,5 +1,4 @@ import { FFmpeg } from '@ffmpeg/ffmpeg'; -import { proxyVideoUrl } from './misc'; interface MediaQuality { bandwidth: string; @@ -69,7 +68,7 @@ async function fetchDASHManifest(manifestUrl: string) { export async function listCombinedQualities(manifestUrl: string): Promise { - const manifest = await fetchDASHManifest(manifestUrl); + const manifest = await fetchDASHManifest(`${manifestUrl}?local=true`); const qualities: MediaQuality[] = []; // Fetch all AdaptationSets (both video and audio) @@ -93,7 +92,7 @@ export async function listCombinedQualities(manifestUrl: string): Promise { const videoBandwidth = videoRep.getAttribute('bandwidth'); - const videoUrl = proxyVideoUrl(videoRep.getElementsByTagName('BaseURL')[0].textContent as string); + const videoUrl = videoRep.getElementsByTagName('BaseURL')[0].textContent as string; const width = videoRep.getAttribute('width'); const height = videoRep.getAttribute('height'); const resolution = width && height ? `${width}x${height}` : undefined; @@ -101,7 +100,7 @@ export async function listCombinedQualities(manifestUrl: string): Promise { - const audioUrl = proxyVideoUrl(audioRep.getElementsByTagName('BaseURL')[0].textContent as string); + const audioUrl = audioRep.getElementsByTagName('BaseURL')[0].textContent as string; const audioChannels = audioRep.getElementsByTagName('AudioChannelConfiguration')[0]?.getAttribute('value') || ''; const audioBandwidth = audioRep.getAttribute('bandwidth') || ''; diff --git a/materialious/src/routes/(app)/watch/[slug]/+page.svelte b/materialious/src/routes/(app)/watch/[slug]/+page.svelte index a3378f77..9453c8e3 100644 --- a/materialious/src/routes/(app)/watch/[slug]/+page.svelte +++ b/materialious/src/routes/(app)/watch/[slug]/+page.svelte @@ -44,6 +44,7 @@ import { _ } from 'svelte-i18n'; import { get } from 'svelte/store'; import type { MediaPlayerElement } from 'vidstack/elements'; + import { loadPfp } from '../../../../lib/misc.js'; export let data; @@ -447,11 +448,9 @@