Fix web app views when using new backend

This commit is contained in:
Brahim Hadriche committed 2024-12-22 20:43:22 -05:00
1 parent 51fa4c0540
commit 93d660e978
11 files changed
+45 -4

No files matched your search

+1
View File
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed
- Regression caused watch history thumbnails to break
- Web app views when using new backend
## [0.34.0] - 2024-12-22
+5
View File
@@ -1,5 +1,7 @@
import { PlayletApi } from "lib/Api/PlayletApi";
const DISABLE_CACHE = true;
export class InvidiousApi {
public instance: string;
public endpoints: any;
@@ -290,6 +292,9 @@ export class InvidiousApi {
// TODO:P2 use more appropriate cache storage
private getCache(url: string, cacheSeconds: number) {
if (DISABLE_CACHE) {
return null;
}
const cacheKey = this.getCacheKey(url);
const cache = localStorage.getItem(cacheKey);
if (!cache) {
+6 -1
View File
@@ -112,7 +112,12 @@ export class YoutubeJs {
type: "video",
title: info.basic_info.title,
videoId: info.basic_info.id,
videoThumbnails: [],
videoThumbnails: [{
quality: "medium",
url: `https://i.ytimg.com/vi/${info.basic_info.id}/mqdefault.jpg`,
width: 320,
height: 180
}],
storyboards: [],
description: "",
published: 0,
+1
View File
@@ -258,6 +258,7 @@
videoThumbnails={videoMetadata?.videoThumbnails}
author={videoMetadata?.author}
lengthSeconds={videoMetadata?.lengthSeconds}
lengthText={videoMetadata?.lengthText}
liveNow={videoMetadata?.liveNow}
isUpcoming={videoMetadata?.isUpcoming}
premiereTimestamp={videoMetadata?.premiereTimestamp}
@@ -6,6 +6,7 @@
export let title: string | undefined = undefined;
export let playlistId: string | undefined = undefined;
export let videoCount: number | undefined = undefined;
export let videoCountText: string | undefined = undefined;
export let playlistThumbnail: string | undefined = undefined;
export let videos: any[] | undefined = undefined;
@@ -50,6 +51,7 @@
title,
playlistThumbnail: getPlaylistThumbnail(),
videoCount,
videoCountText,
videos,
};
}
@@ -89,6 +91,7 @@
bind:title
bind:playlistThumbnail
bind:videoCount
bind:videoCountText
bind:videos
bind:invidiousInstance
/>
@@ -9,6 +9,7 @@
export let playlistId: string | undefined = undefined;
export let playlistThumbnail: string | undefined = undefined;
export let videoCount: number | undefined = undefined;
export let videoCountText: string | undefined = undefined;
export let videos: any[] | undefined = undefined;
export let updated: number | undefined = undefined;
@@ -84,6 +85,7 @@
bind:title
bind:playlistThumbnail
bind:videoCount
bind:videoCountText
bind:videos
bind:invidiousInstance
/>
@@ -100,5 +102,6 @@
bind:playlistId
bind:playlistThumbnail
bind:videoCount
bind:videoCountText
bind:videos
/>
@@ -3,6 +3,7 @@
export let title: string | undefined = undefined;
export let videoCount: number | undefined = undefined;
export let videoCountText: string | undefined = undefined;
export let playlistThumbnail: string | undefined = undefined;
export let videos: any[] | undefined = undefined;
@@ -37,6 +38,9 @@
}
function getVideoCountText() {
if (videoCountText) {
return videoCountText;
}
if (isNaN(videoCount) || videoCount < 0) {
return "";
}
@@ -9,6 +9,7 @@
export let videoThumbnails: any[] | undefined = undefined;
export let author: string | undefined = undefined;
export let lengthSeconds: number = undefined;
export let lengthText: string | undefined = undefined;
export let liveNow: boolean = undefined;
export let viewCount: number | undefined = undefined;
export let isUpcoming: boolean = undefined;
@@ -64,6 +65,7 @@
videoThumbnails: getVideoThumbnails(),
author,
lengthSeconds,
lengthText,
liveNow,
viewCount,
timestamp,
@@ -96,6 +98,7 @@
bind:videoThumbnails
bind:liveNow
bind:lengthSeconds
bind:lengthText
bind:viewCount
bind:isUpcoming
bind:premiereTimestamp
@@ -109,6 +112,7 @@
bind:checked={videoStartAtChecked}
bind:timestamp={videoStartAtTimestamp}
{lengthSeconds}
{lengthText}
/>
<div class="join join-vertical m-2">
<button class="btn join-item hover:btn-accent" on:click={playOnTv}>
@@ -16,6 +16,7 @@
export let isUpcoming: boolean = undefined;
export let premiereTimestamp: number | undefined = undefined;
export let lengthSeconds: number = undefined;
export let lengthText: string | undefined = undefined;
export let liveNow: boolean = undefined;
// svelte-ignore unused-export-let
@@ -190,6 +191,7 @@
bind:isUpcoming
bind:premiereTimestamp
bind:lengthSeconds
bind:lengthText
bind:viewCount
bind:invidiousInstance
/>
@@ -214,6 +216,7 @@
bind:title
bind:author
bind:lengthSeconds
bind:lengthText
bind:videoThumbnails
bind:liveNow
bind:isUpcoming
@@ -3,6 +3,7 @@
export let checked = false;
export let lengthSeconds = undefined;
export let lengthText = undefined;
export let timestamp = 0;
let textInputElemet;
@@ -15,6 +16,12 @@
}
}
$: {
if (lengthSeconds === undefined && lengthText) {
lengthSeconds = getTimeStamp(lengthText);
}
}
$: timestampRange = timestamp !== undefined ? timestamp : 0;
function getTimeStamp(timestampText) {
@@ -6,6 +6,7 @@
export let videoThumbnails: any[] | undefined = undefined;
export let liveNow: boolean = undefined;
export let lengthSeconds: number = undefined;
export let lengthText: string | undefined = undefined;
export let viewCount: number | undefined = undefined;
export let isUpcoming: boolean | undefined = undefined;
export let premiereTimestamp: number | undefined = undefined;
@@ -29,7 +30,11 @@
}
}
function getFormattedTime(length) {
function getFormattedTime(text, length) {
if (text) {
return text;
}
const hours = Math.floor(length / 3600);
const minutes = Math.floor((length / 60) % 60);
const seconds = length % 60;
@@ -80,11 +85,11 @@
>
{$tr("LIVE")}
</div>
{:else if lengthSeconds}
{:else if lengthSeconds || lengthText}
<div
class="absolute bottom-2 right-0 bg-black/70 text-white text-sm rounded-sm pt-1 pb-1 pr-2 pl-2"
>
{getFormattedTime(lengthSeconds)}
{getFormattedTime(lengthText, lengthSeconds)}
</div>
{/if}
</figure>