diff --git a/materialious/android/app/build.gradle b/materialious/android/app/build.gradle index 31285055..acd9401b 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 10 - versionName "1.0.10" + versionCode 11 + versionName "1.0.11" 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 e6e00701..ef098278 100644 --- a/materialious/electron/package.json +++ b/materialious/electron/package.json @@ -1,6 +1,6 @@ { "name": "Materialious", - "version": "1.0.10", + "version": "1.0.11", "description": "Modern material design for Invidious.", "author": { "name": "Ward Pearce", diff --git a/materialious/package-lock.json b/materialious/package-lock.json index 581be1b1..cd85171f 100644 --- a/materialious/package-lock.json +++ b/materialious/package-lock.json @@ -1,12 +1,12 @@ { "name": "materialious", - "version": "1.0.10", + "version": "1.0.11", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "materialious", - "version": "1.0.10", + "version": "1.0.11", "dependencies": { "@capacitor-community/electron": "^5.0.1", "@capacitor/android": "^6.0.0", @@ -17,6 +17,7 @@ "beercss": "^3.5.5", "fuse.js": "^7.0.0", "human-number": "^2.0.4", + "iso-3166": "^4.3.0", "material-dynamic-colors": "^1.1.0", "media-icons": "^0.10.0", "mousetrap": "^1.6.5", @@ -7870,6 +7871,15 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, + "node_modules/iso-3166": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/iso-3166/-/iso-3166-4.3.0.tgz", + "integrity": "sha512-H4kM/sVbxTjSl9xnQCYOrNWdpN0R8Uz26j1BuXI9E6U+kw5wmd3HyPgr/v4+NCuvV/NcvwTfZxd5XZ4lPKvBNA==", + "funding": { + "type": "github", + "url": "https://github.com/sponsors/wooorm" + } + }, "node_modules/jake": { "version": "10.9.1", "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.1.tgz", diff --git a/materialious/package.json b/materialious/package.json index 8e0db101..cef31c49 100644 --- a/materialious/package.json +++ b/materialious/package.json @@ -1,6 +1,6 @@ { "name": "materialious", - "version": "1.0.10", + "version": "1.0.11", "private": true, "scripts": { "dev": "vite dev", @@ -46,6 +46,7 @@ "beercss": "^3.5.5", "fuse.js": "^7.0.0", "human-number": "^2.0.4", + "iso-3166": "^4.3.0", "material-dynamic-colors": "^1.1.0", "media-icons": "^0.10.0", "mousetrap": "^1.6.5", @@ -56,4 +57,4 @@ "svelte-persisted-store": "^0.9.2", "vidstack": "^1.11.21" } -} \ No newline at end of file +} diff --git a/materialious/src/lib/Api/index.ts b/materialious/src/lib/Api/index.ts index 943c961b..706fd5ac 100644 --- a/materialious/src/lib/Api/index.ts +++ b/materialious/src/lib/Api/index.ts @@ -4,6 +4,7 @@ import { deArrowInstanceStore, deArrowThumbnailInstanceStore, instanceStore, + interfaceRegionStore, returnYTDislikesInstanceStore, synciousInstanceStore } from '../store'; @@ -25,8 +26,18 @@ import type { VideoPlay } from './model'; -export function buildPath(path: string): string { - return `${get(instanceStore)}/api/v1/${path}`; +export function buildPath(path: string): URL { + return new URL(`${get(instanceStore)}/api/v1/${path}`); +} + +export function setRegion(url: URL): URL { + const region = get(interfaceRegionStore); + + if (region) { + url.searchParams.set('region', region); + } + + return url; } export async function fetchErrorHandle(response: Response): Promise { @@ -47,7 +58,7 @@ export function buildAuthHeaders(): { headers: { Authorization: string; }; } { } export async function getTrending(): Promise { - const resp = await fetchErrorHandle(await fetch(buildPath('trending'))); + const resp = await fetchErrorHandle(await fetch(setRegion(buildPath('trending')))); return await resp.json(); } @@ -57,7 +68,7 @@ export async function getPopular(): Promise { } export async function getVideo(videoId: string, local: boolean = false): Promise { - const resp = await fetchErrorHandle(await fetch(buildPath(`videos/${videoId}?local=${local}`))); + const resp = await fetchErrorHandle(await fetch(setRegion(buildPath(`videos/${videoId}?local=${local}`)))); return await resp.json(); } @@ -84,7 +95,7 @@ export async function getComments( parameters.source = 'youtube'; } - const path = new URL(buildPath(`comments/${videoId}`)); + const path = buildPath(`comments/${videoId}`); path.search = new URLSearchParams(parameters).toString(); const resp = await fetchErrorHandle(await fetch(path)); return await resp.json(); @@ -104,7 +115,7 @@ export async function getChannelContent( ): Promise { if (typeof parameters.type === 'undefined') parameters.type = 'videos'; - const url = new URL(buildPath(`channels/${channelId}/${parameters.type}`)); + const url = buildPath(`channels/${channelId}/${parameters.type}`); if (typeof parameters.continuation !== 'undefined') url.searchParams.set('continuation', parameters.continuation); @@ -114,7 +125,7 @@ export async function getChannelContent( } export async function getSearchSuggestions(search: string): Promise { - const path = new URL(buildPath('search/suggestions')); + const path = buildPath('search/suggestions'); path.search = new URLSearchParams({ q: search }).toString(); const resp = await fetchErrorHandle(await fetch(path)); return await resp.json(); @@ -140,14 +151,14 @@ export async function getSearch( options.page = '1'; } - const path = new URL(buildPath('search')); + const path = buildPath('search'); path.search = new URLSearchParams({ ...options, q: search }).toString(); - const resp = await fetchErrorHandle(await fetch(path)); + const resp = await fetchErrorHandle(await fetch(setRegion(path))); return await resp.json(); } export async function getFeed(maxResults: number, page: number): Promise { - const path = new URL(buildPath('auth/feed')); + const path = buildPath('auth/feed'); path.search = new URLSearchParams({ max_results: maxResults.toString(), page: page.toString() diff --git a/materialious/src/lib/Api/model.ts b/materialious/src/lib/Api/model.ts index 6fe6552f..2e28ac2e 100644 --- a/materialious/src/lib/Api/model.ts +++ b/materialious/src/lib/Api/model.ts @@ -117,7 +117,7 @@ export interface ReturnYTDislikes { export interface Comment { author: string; authorThumbnails: Image[]; - authorID: string; + authorId: string; authorUrl: string; isEdited: boolean; isPinned: boolean; diff --git a/materialious/src/lib/Comment.svelte b/materialious/src/lib/Comment.svelte index d17d5512..e64a312e 100644 --- a/materialious/src/lib/Comment.svelte +++ b/materialious/src/lib/Comment.svelte @@ -38,12 +38,14 @@ />
-

- {comment.author} - {comment.publishedText} -

+ +

+ {comment.author} + {comment.publishedText} +

+
{#if comment.isPinned} push_pin {/if} diff --git a/materialious/src/lib/Player.svelte b/materialious/src/lib/Player.svelte index 4ce8499d..b658d3fc 100644 --- a/materialious/src/lib/Player.svelte +++ b/materialious/src/lib/Player.svelte @@ -2,6 +2,7 @@ import 'vidstack/bundle'; import { page } from '$app/stores'; + import { Capacitor } from '@capacitor/core'; import type { Page } from '@sveltejs/kit'; import { SponsorBlock, type Category } from 'sponsorblock-api'; import { onDestroy, onMount } from 'svelte'; @@ -138,7 +139,11 @@ } if (get(playerDashStore)) { - src = [{ src: data.video.dashUrl + '?local=true', type: 'application/dash+xml' }]; + src = [{ src: data.video.dashUrl, type: 'application/dash+xml' }]; + + if (Capacitor.getPlatform() !== 'electron' || proxyVideos) { + (src[0] as { src: string }).src += '?local=true'; + } player.addEventListener('dash-can-play', async () => { await loadPlayerPos(); diff --git a/materialious/src/lib/PlaylistThumbnail.svelte b/materialious/src/lib/PlaylistThumbnail.svelte index 5de14df7..f45fc4ca 100644 --- a/materialious/src/lib/PlaylistThumbnail.svelte +++ b/materialious/src/lib/PlaylistThumbnail.svelte @@ -2,7 +2,7 @@ import { onMount } from 'svelte'; import { _ } from 'svelte-i18n'; import type { Playlist } from './Api/model'; - import { getBestThumbnail, truncate } from './misc'; + import { getBestThumbnail, getLetterCaseClass, truncate } from './misc'; export let playlist: Playlist; export let disabled: boolean = false; @@ -66,7 +66,7 @@