diff --git a/CHANGELOG.md b/CHANGELOG.md
index f6b31856..b166cac5 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -16,6 +16,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Video Player HUD now focuses initially on the trackbar, instead of the pause button
- Pressing back cancels seek, hides UI, then closes the video player
- Scrubbing accelerates on long videos
+- Added a "login" button in expired session profiles
## [0.48.1] - 2026-07-04
diff --git a/playlet-lib/src/components/Dialog/InvidiousLoginDialog.bs b/playlet-lib/src/components/Dialog/InvidiousLoginDialog.bs
index 4ac008d7..3c3143bc 100644
--- a/playlet-lib/src/components/Dialog/InvidiousLoginDialog.bs
+++ b/playlet-lib/src/components/Dialog/InvidiousLoginDialog.bs
@@ -1,6 +1,7 @@
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
+import "pkg:/source/utils/UrlUtils.bs"
function Init()
m.urlLabel = m.top.findNode("urlLabel")
@@ -17,7 +18,12 @@ function OnNodeReady()
address = m.webserver@.GetServerAddress()
isValidAddress = not StringUtils.IsNullOrEmpty(address)
if isValidAddress
- m.top.url = `${address}/invidious/login`
+ url = `${address}/invidious/login`
+ serverUrl = m.top.serverUrl
+ if not StringUtils.IsNullOrEmpty(serverUrl)
+ url = UrlUtils.AppendQueryParams(url, { server: serverUrl })
+ end if
+ m.top.url = url
else
m.urlLabel.text = Tr(Locale.Dialogs.IpAddressNotAvailable)
end if
diff --git a/playlet-lib/src/components/Dialog/InvidiousLoginDialog.xml b/playlet-lib/src/components/Dialog/InvidiousLoginDialog.xml
index 44488566..463f9f35 100644
--- a/playlet-lib/src/components/Dialog/InvidiousLoginDialog.xml
+++ b/playlet-lib/src/components/Dialog/InvidiousLoginDialog.xml
@@ -3,6 +3,7 @@
+
diff --git a/playlet-lib/src/components/Screens/ProfileScreen/LoginUtils.bs b/playlet-lib/src/components/Screens/ProfileScreen/LoginUtils.bs
new file mode 100644
index 00000000..70455f78
--- /dev/null
+++ b/playlet-lib/src/components/Screens/ProfileScreen/LoginUtils.bs
@@ -0,0 +1,46 @@
+import "pkg:/components/Dialog/DialogUtils.bs"
+import "pkg:/source/utils/Locale.bs"
+import "pkg:/source/utils/Types.bs"
+
+namespace LoginUtils
+
+ function ShowInvidiousLoginDialog(serverUrl = "" as string) as void
+ dialog = CreateObject("roSGNode", "InvidiousLoginDialog")
+ dialog.serverUrl = serverUrl
+ dialog@.BindNode()
+ m.top.getScene().dialog = dialog
+ end function
+
+ function ShowLoginWithYouTubeDisclaimerDialog() as void
+ dialog = DialogUtils.ShowDialogEx({
+ title: Tr(Locale.Dialogs.Disclaimer)
+ message: [
+ Tr(Locale.Dialogs.YouTubeLoginDisclaimer1)
+ Tr(Locale.Dialogs.YouTubeLoginDisclaimer2)
+ Tr(Locale.Dialogs.YouTubeLoginDisclaimer3)
+ ]
+ large: true
+ buttons: [
+ Tr(Locale.Buttons.OK)
+ Tr(Locale.Buttons.Cancel)
+ ]
+ })
+ dialog.ObserveField("buttonSelected", FuncName(LoginUtils.OnLoginWithYouTubeDisclaimerDialogButtonSelected))
+ end function
+
+ function OnLoginWithYouTubeDisclaimerDialogButtonSelected(event as object) as void
+ buttonSelected = event.getData()
+ if buttonSelected <> 0
+ return
+ end if
+
+ LoginUtils.ShowYouTubeLoginDialog()
+ end function
+
+ function ShowYouTubeLoginDialog() as void
+ dialog = CreateObject("roSGNode", "YouTubeLoginDialog")
+ dialog@.BindNode()
+ m.top.getScene().dialog = dialog
+ end function
+
+end namespace
diff --git a/playlet-lib/src/components/Screens/ProfileScreen/ProfileScreen.bs b/playlet-lib/src/components/Screens/ProfileScreen/ProfileScreen.bs
index 65859c30..91819a28 100644
--- a/playlet-lib/src/components/Screens/ProfileScreen/ProfileScreen.bs
+++ b/playlet-lib/src/components/Screens/ProfileScreen/ProfileScreen.bs
@@ -1,6 +1,7 @@
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/components/Screens/ProfileScreen/BackendTypeSelectionView/BackendTypeSelectionViewUtils.bs"
+import "pkg:/components/Screens/ProfileScreen/LoginUtils.bs"
import "pkg:/components/Screens/ProfileScreen/ProfileView/ProfileViewUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Logging.bs"
@@ -54,15 +55,15 @@ function OnBackEndSelected(event as object) as void
selectedBackendType = event.getData()
if selectedBackendType = "BackendTypeInvidious"
- LoginWithInvidious()
+ OnLoginWithInvidiousSelected()
else if selectedBackendType = "BackendTypeYouTube"
- ShowLoginWithYouTubeDialog()
+ LoginUtils.ShowLoginWithYouTubeDisclaimerDialog()
else
LogError("Unknown backend type:", selectedBackendType)
end if
end function
-function LoginWithInvidious() as void
+function OnLoginWithInvidiousSelected() as void
invidiousInstance = m.preferences["invidious.instance"]
if StringUtils.IsNullOrEmpty(invidiousInstance)
DialogUtils.ShowDialogEx({
@@ -75,41 +76,7 @@ function LoginWithInvidious() as void
return
end if
- dialog = CreateObject("roSGNode", "InvidiousLoginDialog")
- dialog@.BindNode()
- m.top.getScene().dialog = dialog
-end function
-
-function ShowLoginWithYouTubeDialog() as void
- dialog = DialogUtils.ShowDialogEx({
- title: Tr(Locale.Dialogs.Disclaimer)
- message: [
- Tr(Locale.Dialogs.YouTubeLoginDisclaimer1)
- Tr(Locale.Dialogs.YouTubeLoginDisclaimer2)
- Tr(Locale.Dialogs.YouTubeLoginDisclaimer3)
- ]
- large: true
- buttons: [
- Tr(Locale.Buttons.OK)
- Tr(Locale.Buttons.Cancel)
- ]
- })
- dialog.ObserveField("buttonSelected", FuncName(OnLoginWithYouTubeDialogButtonSelected))
-end function
-
-function OnLoginWithYouTubeDialogButtonSelected(event as object) as void
- buttonSelected = event.getData()
- if buttonSelected <> 0
- return
- end if
-
- LoginWithYouTube()
-end function
-
-function LoginWithYouTube() as void
- dialog = CreateObject("roSGNode", "YouTubeLoginDialog")
- dialog@.BindNode()
- m.top.getScene().dialog = dialog
+ LoginUtils.ShowInvidiousLoginDialog()
end function
function OnCurrentProfileChanged() as void
diff --git a/playlet-lib/src/components/Screens/ProfileScreen/ProfileView/ProfileView.bs b/playlet-lib/src/components/Screens/ProfileScreen/ProfileView/ProfileView.bs
index 1591304a..9bd6d240 100644
--- a/playlet-lib/src/components/Screens/ProfileScreen/ProfileView/ProfileView.bs
+++ b/playlet-lib/src/components/Screens/ProfileScreen/ProfileView/ProfileView.bs
@@ -1,28 +1,39 @@
import "pkg:/components/ContentNode/ProfileContentAuthTokenUtils.types.bs"
import "pkg:/components/Navigation/Navigation.bs"
+import "pkg:/components/Screens/ProfileScreen/LoginUtils.bs"
import "pkg:/source/utils/DisposableObserve.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Locale.bs"
+import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/RemoteKeys.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
function Init()
+ m.loginButton = m.top.findNode("loginButton")
m.activateButton = m.top.findNode("activateButton")
m.logoutButton = m.top.findNode("logoutButton")
m.closeButton = m.top.findNode("closeButton")
m.reauthLabel = m.top.findNode("ReauthLabel")
+ m.loginButton.disabled = true
+ m.needsReauth = false
+
+ DisposableObserveField(m.loginButton, "buttonSelected", FuncName(Login))
DisposableObserveField(m.activateButton, "buttonSelected", FuncName(Activate))
DisposableObserveField(m.logoutButton, "buttonSelected", FuncName(Logout))
DisposableObserveField(m.closeButton, "buttonSelected", FuncName(Close))
end function
function OnNodeReady()
+ SetNavigation(m.loginButton, RemoteKeys.Down, m.activateButton)
+ SetNavigation(m.activateButton, RemoteKeys.Up, m.loginButton)
SetNavigation(m.activateButton, RemoteKeys.Down, m.logoutButton)
SetNavigation(m.logoutButton, RemoteKeys.Down, m.closeButton)
SetNavigation(m.closeButton, RemoteKeys.Up, m.logoutButton)
SetNavigation(m.logoutButton, RemoteKeys.Up, m.activateButton)
+ SetNavigation(m.loginButton, RemoteKeys.Down, m.logoutButton)
+ SetNavigation(m.logoutButton, RemoteKeys.Up, m.loginButton)
DisposableObserveFieldScoped(m.profilesService, "currentProfile", FuncName(OnCunrrentProfileChanged))
DisposableObserveFieldScoped(m.profilesService, "onProfileLogout", FuncName(OnProfileLogout))
@@ -31,7 +42,10 @@ end function
function OnContentSet() as void
content = m.top.content
if content = invalid
+ m.needsReauth = false
m.reauthLabel.visible = false
+ m.loginButton.visible = false
+ m.loginButton.disabled = true
return
end if
@@ -73,17 +87,21 @@ function OnContentSet() as void
m.top.backendTypePosterUri = ""
end if
- UpdateReauthState(content)
+ UpdateReauthState(content.authState)
- UpdateActivateButton()
+ UpdateActivateButton(content.isSelected)
end function
function OnFocusChange() as void
- if not m.top.focus
- return
+ if m.top.focus
+ FocusTopButton()
end if
+end function
- if m.activateButton.focusable
+function FocusTopButton() as void
+ if m.loginButton.focusable
+ NodeSetFocus(m.loginButton, true)
+ else if m.activateButton.focusable
NodeSetFocus(m.activateButton, true)
else
NodeSetFocus(m.logoutButton, true)
@@ -108,6 +126,22 @@ function OnKeyEvent(key as string, press as boolean) as boolean
return true
end function
+function Login() as void
+ content = m.top.content
+ if content = invalid
+ return
+ end if
+
+ backendType = content.type
+ if backendType = "invidious"
+ LoginUtils.ShowInvidiousLoginDialog(ValidString(content.serverUrl))
+ else if backendType = "youtube"
+ LoginUtils.ShowYouTubeLoginDialog()
+ else
+ LogError("Unknown backend type:", backendType)
+ end if
+end function
+
function Activate() as void
content = m.top.content
if content = invalid
@@ -145,15 +179,27 @@ function OnDispose()
m.top.content = invalid
end function
-function UpdateReauthState(content as object) as void
- needsReauth = content.authState = ProfileContentAuthTokenUtils.ProfileAuthState.NeedsReauth
+function UpdateReauthState(authState as string) as void
+ needsReauth = authState = ProfileContentAuthTokenUtils.ProfileAuthState.NeedsReauth
+ if needsReauth = m.needsReauth
+ return
+ end if
+ m.needsReauth = needsReauth
+
if needsReauth
m.reauthLabel.text = [
Tr(Locale.Dialogs.ProfileNeedsReauthMessageLine1)
Tr(Locale.Dialogs.ProfileNeedsReauthMessageLine2)
].Join(Chr(10))
+ m.loginButton.text = Tr(Locale.Buttons.Login)
end if
m.reauthLabel.visible = needsReauth
+ m.loginButton.visible = needsReauth
+ m.loginButton.disabled = not needsReauth
+
+ if m.top.isInFocusChain()
+ FocusTopButton()
+ end if
end function
function OnCunrrentProfileChanged() as void
@@ -162,7 +208,7 @@ function OnCunrrentProfileChanged() as void
return
end if
m.top.crownVisible = content.isSelected
- UpdateActivateButton()
+ UpdateActivateButton(content.isSelected)
end function
function OnProfileLogout() as void
@@ -177,13 +223,7 @@ function OnProfileLogout() as void
end if
end function
-function UpdateActivateButton() as void
- content = m.top.content
- if content = invalid
- return
- end if
-
- isSelected = content.isSelected
+function UpdateActivateButton(isSelected as boolean) as void
if isSelected
if m.activateButton.hasFocus()
NodeSetFocus(m.logoutButton, true)
diff --git a/playlet-lib/src/components/Screens/ProfileScreen/ProfileView/ProfileView.xml b/playlet-lib/src/components/Screens/ProfileScreen/ProfileView/ProfileView.xml
index f1d59740..7107353a 100644
--- a/playlet-lib/src/components/Screens/ProfileScreen/ProfileView/ProfileView.xml
+++ b/playlet-lib/src/components/Screens/ProfileScreen/ProfileView/ProfileView.xml
@@ -79,6 +79,13 @@
+