From 00361d5507d3e816209a71c239f4859373d2892e Mon Sep 17 00:00:00 2001 From: Brahim Hadriche Date: Sat, 11 Jul 2026 17:13:55 -0400 Subject: [PATCH] Auth state for web app --- CHANGELOG.md | 1 + .../ProfilesService/ProfilesService.bs | 1 + playlet-web/src/lib/ProfileAvatar.svelte | 21 ++++++++++--------- playlet-web/src/lib/ProfilesDialog.svelte | 13 ++++++++++++ playlet-web/src/lib/Types.ts | 5 +++++ .../src/lib/VideoFeed/VideoListRow.svelte | 8 ++++++- 6 files changed, 38 insertions(+), 11 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b166cac5..22cac9bd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Fixed - Wrong SponsorBlock in the trackbar due to image caching +- Expired profile sessions were not marked in web app ### Changed diff --git a/playlet-lib/src/components/Services/ProfilesService/ProfilesService.bs b/playlet-lib/src/components/Services/ProfilesService/ProfilesService.bs index fb1fc87a..b1225709 100644 --- a/playlet-lib/src/components/Services/ProfilesService/ProfilesService.bs +++ b/playlet-lib/src/components/Services/ProfilesService/ProfilesService.bs @@ -173,6 +173,7 @@ function GetProfilesDto(includeAccessToken as boolean) as object "serverUrl": profileNode.serverUrl "thumbnail": profileNode.thumbnail "color": color + "authState": profileNode.authState } if includeAccessToken diff --git a/playlet-web/src/lib/ProfileAvatar.svelte b/playlet-web/src/lib/ProfileAvatar.svelte index fbae2b2f..239aeb53 100644 --- a/playlet-web/src/lib/ProfileAvatar.svelte +++ b/playlet-web/src/lib/ProfileAvatar.svelte @@ -3,7 +3,8 @@ export let navbar = false; export let selected = false; import UserIcon from "assets/user.svg.svelte"; - import { playletStateStore } from "lib/Stores"; + import { playletStateStore, translate } from "lib/Stores"; + import { ProfileAuthState } from "lib/Types"; let currentProfile = profile; @@ -15,20 +16,20 @@ ); }); } + + $: needsReauth = currentProfile?.authState === ProfileAuthState.NeedsReauth; + $: outlineClass = navbar + ? `border-2 ${needsReauth ? "border-warning" : "border-primary"}` + : `ring ring-offset-base-100 ring-offset-2 ${ + needsReauth ? "ring-warning" : selected ? "ring-primary" : "" + }`; {#if currentProfile && currentProfile.username}
{#if currentProfile.type === "youtube" && currentProfile.thumbnail} diff --git a/playlet-web/src/lib/ProfilesDialog.svelte b/playlet-web/src/lib/ProfilesDialog.svelte index c6209dca..3443826c 100644 --- a/playlet-web/src/lib/ProfilesDialog.svelte +++ b/playlet-web/src/lib/ProfilesDialog.svelte @@ -3,6 +3,7 @@ import { PlayletApi } from "./Api/PlayletApi"; import { get } from "svelte/store"; import ProfileAvatar from "./ProfileAvatar.svelte"; + import { ProfileAuthState } from "lib/Types"; export function show() { modal.showModal(); @@ -118,9 +119,21 @@ > {/if}
+ {#if profile.authState === ProfileAuthState.NeedsReauth} +
+ {$translate("Session expired")} +
+ {/if}
+ {#if profile.authState === ProfileAuthState.NeedsReauth} +
+ {$translate( + "The session has expired. Please sign in again with this profile, or switch to another profile." + )} +
+ {/if} {#if profile.id !== currentProfile?.id}