* TODO * TODO * Add some translations * Remote screen and settings * Video player and http client
45 lines
1.1 KiB
Plaintext
45 lines
1.1 KiB
Plaintext
import "DialogPalette.bs"
|
|
import "pkg:/source/utils/Locale.bs"
|
|
import "pkg:/source/utils/StringUtils.bs"
|
|
import "pkg:/source/utils/Types.bs"
|
|
|
|
function Init()
|
|
SetPalette(m.top)
|
|
m.urlLabel = m.top.findNode("urlLabel")
|
|
m.qrCode = m.top.findNode("QrCodePoster")
|
|
|
|
m.top.width = "920"
|
|
m.top.observeFieldScoped("buttonSelected", FuncName(Close))
|
|
|
|
scanLabel = m.top.findNode("scanLabel")
|
|
scanLabel.text = Tr(Locale.Dialogs.ScanTheQrCode)
|
|
end function
|
|
|
|
function OnNodeReady()
|
|
address = m.webserver@.GetServerAddress()
|
|
isValidAddress = not StringUtils.IsNullOrEmpty(address)
|
|
if isValidAddress
|
|
m.top.url = `${address}/invidious/login`
|
|
else
|
|
m.urlLabel.text = Tr(Locale.Dialogs.IpAddressNotAvailable)
|
|
end if
|
|
|
|
m.invidious.observeFieldScoped("authToken", FuncName(OnAuthTokenChange))
|
|
end function
|
|
|
|
function Close()
|
|
m.top.close = true
|
|
end function
|
|
|
|
function OnUrlSet()
|
|
url = m.top.url
|
|
|
|
m.urlLabel.text = url
|
|
m.qrCode.text = url
|
|
end function
|
|
|
|
function OnAuthTokenChange()
|
|
m.invidious.unobserveFieldScoped("authToken")
|
|
Close()
|
|
end function
|