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