Cast using Youtube app (DIAL/LoungeAPI) (#276)

* Dial+Lounge API PoC

* format

* Fix for chrome

* comments

* Rate limit and logger stuff

* rename route

* remove invalid routes

* remove device image

* Simplify device description

* command test

* Lint fix

* register pairing code

* tv code UI

* Lint fix

* Avoid creating lots of objects

* dpad command

* small refactor

* tweak

* validation

* timer

* fix

* Revert "timer"

This reverts commit e349565910882408898c9bddda55dadaa9d743de.

* Commands

* setVolume command

* lounge service timer

* Some state messages

* Lint fix

* player state sync

* voice handler

* Adjustments, and add a TODO list

* Lint fix

* comment

* play at timestamp

* Remote screen UI

* UI adjustment

* Small refactor

* Refactor long polling

* Add TODO

* Manage logging a bit better to avoid spam in DIAL server

* cache dial file

* logging

* comment

* Join lounge lazily

* long poller tweak

* ui tweak

* set shouldQuit field

* remote connect notification

* Lint fix

* Randomize device id, new device on start

* Lint fix

* Lounge disconnect on start

* Speed up lounge by not blocking on sent messages

* add version to lounge data saved

* dial server fix rendezvous

* todo

* no message

* Display network name

* playlist changes

* Lint fix

* tweak params

* tweak

* player state

* comments

* Refactor Video Queue (#295)

* Refactor Video Queue

* Video queue and playlists

* Web app casting

* queue playlist notification

* VideoQueueView work

* restore properties

* changes

* queue notification and previous/next state

* Lint fix

* very basic error handling

* Update changelog and privacy policy

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
This commit is contained in:
Brahim Hadricheandgithub-action linter authored and GitHub committed 2024-02-19 16:30:48 -05:00
1 parent ec9178d687
commit 7d1ba07286
85 files changed
+3666 -938

No files matched your search

@@ -343,6 +343,8 @@ namespace HttpClient
if m._sent <> true
LogError("Failed to send request")
else
m._timer = CreateObject("roTimeSpan")
end if
return m
@@ -482,6 +484,27 @@ namespace HttpClient
return response
end function
function IsCompleted() as boolean
if m.urlTransfer = invalid
return false
end if
messagePort = m.urlTransfer.GetMessagePort()
message = messagePort.PeekMessage()
if message <> invalid
return true
end if
if m._timer <> invalid
elapsedMs = m._timer.TotalMilliseconds()
if elapsedMs > m._timeoutSeconds * 1000
return true
end if
end if
return false
end function
private function CreateRoUrlTransfer() as object
urlTransfer = CreateObject("roUrlTransfer")
if urlTransfer = invalid
@@ -16,4 +16,8 @@ namespace MathUtils
end if
end function
function Clamp(value as dynamic, minValue as dynamic, maxValue as dynamic) as dynamic
return Max(Min(value, maxValue), minValue)
end function
end namespace
@@ -10,6 +10,8 @@ namespace RegistryUtils
const INVIDIOUS_TOKEN = "invidious_token"
const LAST_LOUNGE_DATA = "last_lounge_data"
' "invidious_instances" is deprecated, but we keep for migration purposes
const INVIDIOUS_INSTANCES = "invidious_instances"
+97
View File
@@ -57,6 +57,60 @@ namespace UrlUtils
return url
end function
function GetUrlEncodedForm(fields as object) as string
form = ""
if IsArray(fields)
for each item in fields
key = item.key
value = item.value
if key = invalid or value = invalid
continue for
end if
if form <> ""
form += "&"
end if
if not IsString(value)
value = `${value}`
end if
form += key.EncodeUriComponent() + "=" + value.EncodeUriComponent()
end for
else if IsAssociativeArray(fields)
for each key in fields
value = fields[key]
if value = invalid
continue for
end if
if form <> ""
form += "&"
end if
if not IsString(value)
value = `${value}`
end if
form += key.EncodeUriComponent() + "=" + value.EncodeUriComponent()
end for
end if
return form
end function
function GetUrlDecodedForm(body as string) as object
fields = {}
components = body.split("&")
for each component in components
keyValue = component.split("=")
key = keyValue[0].DecodeUriComponent()
value = keyValue[1].DecodeUriComponent()
fields[key] = value
end for
return fields
end function
function GetEncodedQueryParam(key as string, value as dynamic) as string
if IsString(value)
return key.EncodeUriComponent() + "=" + value.EncodeUriComponent()
@@ -141,4 +195,47 @@ namespace UrlUtils
end for
return query
end function
' Parses the URL into protocol, host, port, and path
function ParseUrl(url as string) as object
protocol = invalid
port = invalid
path = "/"
index = url.InStr("://")
if index > 0
protocol = url.Left(index)
url = url.Mid(index + 3)
else
protocol = "http"
end if
index = url.InStr("/")
if index > 0
host = url.Left(index)
path = url.Mid(index)
else
host = url
end if
index = host.InStr(":")
if index > 0
port = host.Mid(index + 1)
host = host.Left(index)
else
if protocol = "http"
port = "80"
else if protocol = "https"
port = "443"
end if
end if
return {
protocol: protocol
host: host
port: port
path: path
}
end function
end namespace