Merge pull request #512 from Materialious/update/1.2.0

Update/1.2.0
This commit is contained in:
Ward
2024-09-07 17:02:13 +12:00
committed by GitHub
15 changed files with 646 additions and 743 deletions
-1
View File
@@ -1,4 +1,3 @@
---
services:
materialious:
image: wardpearce/materialious
+2 -2
View File
@@ -7,8 +7,8 @@ android {
applicationId "us.materialio.app"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 24
versionName "1.1.12"
versionCode 25
versionName "1.2.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
aaptOptions {
// Files and dirs to omit from the packaged assets dir, modified to accommodate modern web apps.
@@ -1,22 +1,22 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="210dp"
android:height="297dp"
android:viewportWidth="210"
android:viewportHeight="297">
android:width="206.44dp"
android:height="191.86dp"
android:viewportWidth="206.44"
android:viewportHeight="191.86">
<path
android:strokeWidth="1"
android:pathData="m86.73,119.52 l1.31,4.89l0,0l45.03,12.06 -32.96,32.96 -0,0 6.21,23.17 26.75,-26.75 26.75,-26.75 -36.54,-9.79zM91.07,135.72 L96.52,156.06 97.07,158.13 113.48,141.72z"
android:pathData="m86.73,66.65 l1.31,4.89l0,0l45.03,12.06 -32.96,32.96 -0,0 6.21,23.17 26.75,-26.75 26.75,-26.75 -36.54,-9.79zM91.07,82.85 L96.52,103.19 97.07,105.26 113.48,88.86z"
android:fillColor="#ffffff"
android:strokeColor="#00000000"
android:strokeLineCap="square"/>
<path
android:strokeWidth="1"
android:pathData="M69.77,192.6 L96.52,165.85l26.75,-26.75 -36.54,-9.79 -36.54,-9.79 9.79,36.54z"
android:pathData="M69.77,139.74 L96.52,112.99l26.75,-26.75 -36.54,-9.79 -36.54,-9.79 9.79,36.54z"
android:fillColor="#ffffff"
android:strokeColor="#00000000"
android:strokeLineCap="square"/>
<path
android:pathData="M86.73,109.37m-4.98,0a4.98,4.98 0,1 1,9.96 0a4.98,4.98 0,1 1,-9.96 0"
android:pathData="M86.73,56.51m-4.98,0a4.98,4.98 0,1 1,9.96 0a4.98,4.98 0,1 1,-9.96 0"
android:strokeWidth="10.98"
android:fillColor="#ffffff"
android:strokeColor="#00000000"
@@ -8,7 +8,7 @@
"vPrefixedTagName": false,
"releaseType": "release"
},
"icon": "logo.png",
"icon": "appIcon.png",
"files": [
"assets/**/*",
"build/**/*",
+4 -4
View File
@@ -1,6 +1,6 @@
{
"name": "Materialious",
"version": "1.1.12",
"version": "1.2.0",
"description": "Modern material design for Invidious.",
"author": {
"name": "Ward Pearce",
@@ -25,12 +25,12 @@
"electron-is-dev": "~2.0.0",
"electron-serve": "~1.1.0",
"electron-unhandled": "~4.0.1",
"electron-updater": "^5.3.0",
"electron-updater": "^6.3.4",
"electron-window-state": "^5.0.3"
},
"devDependencies": {
"electron": "^26.2.2",
"electron-builder": "~23.6.0",
"electron-builder": "^25.0.5",
"electron-rebuild": "^3.2.9",
"typescript": "^5.0.4"
},
@@ -38,4 +38,4 @@
"capacitor",
"electron"
]
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

+569 -709
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "materialious",
"version": "1.1.12",
"version": "1.2.0",
"private": true,
"scripts": {
"dev": "vite dev",
+2
View File
@@ -175,6 +175,8 @@ export async function getSubscriptions(): Promise<Subscription[]> {
}
export async function amSubscribed(authorId: string): Promise<boolean> {
if (!get(authStore)) return false;
try {
const subscriptions = (await getSubscriptions()).filter((sub) => sub.authorId === authorId);
return subscriptions.length === 1;
+14 -8
View File
@@ -4,6 +4,7 @@
import { page } from '$app/stores';
import { Capacitor } from '@capacitor/core';
import type { Page } from '@sveltejs/kit';
import { type ParsedCaptionsResult } from 'media-captions';
import { SponsorBlock, type Category } from 'sponsorblock-api';
import { onDestroy, onMount } from 'svelte';
import { _ } from 'svelte-i18n';
@@ -26,6 +27,7 @@
sponsorBlockDisplayToastStore,
sponsorBlockStore,
sponsorBlockUrlStore,
synciousInstanceStore,
synciousStore
} from './store';
import { getDynamicTheme } from './theme';
@@ -41,6 +43,8 @@
let playerIsLive = false;
let playerPosSet = false;
let transcript: ParsedCaptionsResult;
function loadTimeFromUrl(page: Page): boolean {
if (player) {
const timeGivenUrl = page.url.searchParams.get('time');
@@ -90,11 +94,13 @@
timestampIndex += 1;
});
player.textTracks.add({
kind: 'chapters',
src: URL.createObjectURL(new Blob([chapterWebVTT])),
default: true
});
if (timestampIndex > 0) {
player.textTracks.add({
kind: 'chapters',
src: URL.createObjectURL(new Blob([chapterWebVTT])),
default: true
});
}
}
player.addEventListener('pause', () => {
@@ -217,7 +223,7 @@
let toSetTime = 0;
if (get(synciousStore) && get(authStore)) {
if (get(synciousStore) && get(synciousInstanceStore) && get(authStore)) {
try {
toSetTime = (await getVideoProgress(data.video.videoId))[0].time;
} catch {}
@@ -244,7 +250,7 @@
localStorage.setItem(`v_${data.video.videoId}`, player.currentTime.toString());
} catch {}
if (get(synciousStore) && get(authStore)) {
if (get(synciousStore) && get(synciousInstanceStore) && get(authStore)) {
saveVideoProgress(data.video.videoId, player.currentTime);
}
} else {
@@ -252,7 +258,7 @@
localStorage.removeItem(`v_${data.video.videoId}`);
} catch {}
if (get(synciousStore) && get(authStore)) {
if (get(synciousStore) && get(synciousInstanceStore) && get(authStore)) {
deleteVideoProgress(data.video.videoId);
}
}
+29 -4
View File
@@ -22,6 +22,7 @@
playerSavePlaybackPositionStore,
syncPartyConnectionsStore,
syncPartyPeerStore,
synciousInstanceStore,
synciousStore
} from './store';
@@ -42,6 +43,8 @@
let proxyVideos = get(playerProxyVideosStore);
let placeholderHeight: number = 0;
let watchUrl = new URL(`${location.origin}/watch/${video.videoId}`);
if (playlistId !== '') {
@@ -101,11 +104,14 @@
return;
}
calcThumbnailPlaceholderHeight();
// Check if sideways should be enabled or disabled.
disableSideways();
addEventListener('resize', () => {
disableSideways();
calcThumbnailPlaceholderHeight();
});
// Load author details in background.
@@ -190,7 +196,7 @@
loading = false;
};
if (get(synciousStore) && get(authStore)) {
if (get(synciousStore) && get(synciousInstanceStore) && get(authStore)) {
try {
progress = (await getVideoProgress(video.videoId))[0].time.toString();
} catch {}
@@ -244,6 +250,22 @@
imgHeight = document.getElementById('thumbnail-container')?.clientHeight as number;
}
function calcThumbnailPlaceholderHeight() {
if (!sideways) {
if (innerWidth < 1000) {
if (innerWidth < 600) {
placeholderHeight = innerWidth / 2;
} else {
placeholderHeight = innerWidth / 4;
}
} else {
placeholderHeight = innerWidth / 12;
}
} else {
placeholderHeight = 115;
}
}
</script>
{#if !thumbnailHidden}
@@ -262,13 +284,12 @@
on:click={syncChangeVideo}
>
{#if loading}
{#if !sideways}
<div class="secondary-container" style="width: 100%;height: 200px;"></div>
{/if}
<div class="secondary-container" style="width: 100%;height: {placeholderHeight}px;"></div>
{:else if loaded}
{#if showVideoPreview && videoPreview}
<div style="max-width: 100%; max-height: {imgHeight}px;">
<video
id="video-preview"
style="max-width: 100%; max-height: {imgHeight}px;"
autoplay
poster={img.src}
@@ -395,6 +416,10 @@
width: 200px;
}
#video-preview[poster] {
object-fit: contain;
}
.video-title {
display: inline-block;
white-space: nowrap;
+14 -3
View File
@@ -1,13 +1,24 @@
import type { VideoPlay } from '$lib/Api/model';
import { Capacitor } from '@capacitor/core';
import type Peer from 'peerjs';
import type { DataConnection } from 'peerjs';
import { persisted } from 'svelte-persisted-store';
import { writable, type Writable } from 'svelte/store';
import type { TitleCase } from './misc';
function platformDependentDefault(givenValue: any, defaultValue: any): any {
if (typeof givenValue !== 'undefined' || typeof givenValue !== null) {
return givenValue;
} else if (defaultValue && Capacitor.getPlatform() !== 'web') {
return defaultValue;
}
}
export const instanceStore: Writable<string> = persisted(
"invidiousInstance",
import.meta.env.VITE_DEFAULT_INVIDIOUS_INSTANCE || 'https://invidious.materialio.us'
platformDependentDefault(import.meta.env.VITE_DEFAULT_INVIDIOUS_INSTANCE, 'https://invidious.materialio.us')
);
export const authStore: Writable<null | { username: string; token: string; }> = persisted(
@@ -34,13 +45,13 @@ export const playerAndroidBackgroundPlayStore = persisted('androidBackgroundPlay
export const returnYtDislikesStore = persisted('returnYtDislikes', false);
export const returnYTDislikesInstanceStore: Writable<string | null | undefined> = persisted(
'returnYTDislikesInstance',
import.meta.env.VITE_DEFAULT_RETURNYTDISLIKES_INSTANCE || 'https://ryd-proxy.materialio.us'
platformDependentDefault(import.meta.env.VITE_DEFAULT_RETURNYTDISLIKES_INSTANCE, 'https://ryd-proxy.materialio.us')
);
export const synciousStore = persisted('syncious', true);
export const synciousInstanceStore: Writable<string | null | undefined> = persisted(
'synciousInstance',
import.meta.env.VITE_DEFAULT_SYNCIOUS_INSTANCE || 'https://syncious.materialio.us'
platformDependentDefault(import.meta.env.VITE_DEFAULT_SYNCIOUS_INSTANCE, 'https://syncious.materialio.us')
);
export const interfaceRegionStore: Writable<string> = persisted('interfaceRegion', 'US');
+1 -1
View File
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Maintainer>
<Icon>https://i.imgur.com/wTtRPnS.png</Icon>
<Icon>https://i.imgur.com/aS2nnhv.png</Icon>
<Profile>Materialious is the team behind the open-source privacy respecting front-end for Invidious.</Profile>
<DonateLink>https://github.com/sponsors/WardPearce</DonateLink>
<DonateText>If you like our work please consider sponsoring on GitHub.</DonateText>
+1 -1
View File
@@ -11,7 +11,7 @@
<Overview>Materialious is a privacy respecting frontend for YouTube built ontop of Invidious.</Overview>
<Category>Productivity: Tools:</Category>
<WebUI>http://[IP]:[PORT:80]</WebUI>
<Icon>https://i.imgur.com/wTtRPnS.png</Icon>
<Icon>https://i.imgur.com/aS2nnhv.png</Icon>
<ExtraParams>--restart=always</ExtraParams>
<Requires>For security reasons regarding CORS, your hosted instance of Materialious must serve as the value for the Access-Control-Allow-Origin header on Invidious.&#xD;
&#xD;
+1 -1
View File
@@ -5,7 +5,7 @@ import json
import os
import re
LATEST_VERSION = "1.1.12"
LATEST_VERSION = "1.2.0"
WORKING_DIR = os.path.join(os.path.dirname(os.path.realpath(__file__)), "materialious")
ROOT_PACKAGE = os.path.join(WORKING_DIR, "package.json")