Preferences / Web App (#79)

* Add basic router

* Add a preferences file

* small changes

* Basic settings navigation menu

* Lint fix

* Add bunch of controls

* Lint fix

* StringControl

* Lint fix

* Add description to keyboard

* Settings saving and loading

* Lint fix

* Settings migration stuff

* GET web api

* Lint fix

* PUT and DELETE (I really fucking hate BrightScript)

* plug in sponsorblock settings

* autoplay, quality, and video proxying

* Remove unused stuff

* Lint fix

* Invidious instance stuff

* cache public instances on start

* Start loading home screen after fetching instances

* Move web app out of settings to its own screen

* picture in picture when in settings

* Web app (#80)

* Update instance stuff

* Update dependencies

* Add basic layout

* Info and settings page, missing styling

* Navbar fixes

* Settings page formatting

* Theme stuff

* Feedback link

* Fix username badge

* Fix svelte warnings

* A wip search page

* Add a couple of api functions

* Wip home screen

* user country code

* Expose token and proxy auth calls

* Use auth requests server side

* Some cleanup

* Add svelte vs code extension

* remove old web app

* More layout stuff

* Tweak for string control

* Filter out old search suggestions

* Search history stuff

* img size for lazy loading

* Basic modal to play video

* Lint fix

* Dependencies bump

* Add video duration and LIVE indicator to cell

* Delete legacy stuff

* Add dev menu

* Lint fix

* Video cell layout

* Cell stuff

* prefs visibility

* Modal layout

* Drag and drop functionality

* Clear search history

* Move web calls to main app

* changelog

* changelog

* Mostly comments

* Lint fix

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
This commit is contained in:
Brahim Hadricheandgithub-action linter authored and GitHub committed 2023-06-24 15:33:09 -04:00
1 parent 9a631aab51
commit 8f8c7d38a8
91 files changed
+3979 -1787

No files matched your search

@@ -117,27 +117,20 @@ function OnVideoDetailsTaskResults(output as object) as void
end if
playletStreamUrls.push(hlsUrlLocal)
else
if metadata.dashUrl <> invalid
#if DASH_THUMBNAILS
' Redirect to our server so we can inject thumbnails (storyboards) into the DASH manifest
dashUrl = `http://${GetLocalIpAddress()}:8888/dash?v=${videoId}`
#else
dashUrl = metadata.dashUrl
#end if
playletStreamUrls.push(dashUrl)
if dashUrl.InStr("?") = -1
dashUrlLocal = dashUrl + "?local=true"
else
dashUrlLocal = dashUrl + "&local=true"
end if
playletStreamUrls.push(dashUrlLocal)
settings = FindAndGetPreferenceValues(["playback.preferred_quality", "invidious.proxy_videos"])
if settings = invalid
settings = {
"playback.preferred_quality": "auto",
"invidious.proxy_videos": "if_needed"
}
end if
if metadata.formatStreams.Count() > 0
playletStreamUrls.push(Invidious.GetVideoStreamUrl(videoId, false))
playletStreamUrls.push(Invidious.GetVideoStreamUrl(videoId, true))
if settings["playback.preferred_quality"] = "720p"
AddStreamUrls(playletStreamUrls, metadata, settings)
AddDashUrls(playletStreamUrls, metadata, settings)
else
AddDashUrls(playletStreamUrls, metadata, settings)
AddStreamUrls(playletStreamUrls, metadata, settings)
end if
end if
@@ -159,6 +152,57 @@ function OnVideoDetailsTaskResults(output as object) as void
m.videoContainer@.watchedVideosAdd(videoId)
end function
function AddDashUrls(playletStreamUrls as object, metadata as object, settings as object) as void
if metadata.dashUrl = invalid
return
end if
#if DASH_THUMBNAILS
' Redirect to our server so we can inject thumbnails (storyboards) into the DASH manifest
dashUrl = `http://${GetLocalIpAddress()}:8888/dash?v=${videoId}`
#else
dashUrl = metadata.dashUrl
#end if
if dashUrl.InStr("?") = -1
dashUrlLocal = dashUrl + "?local=true"
else
dashUrlLocal = dashUrl + "&local=true"
end if
proxyVideos = settings["invidious.proxy_videos"]
if proxyVideos = "if_needed"
playletStreamUrls.push(dashUrl)
playletStreamUrls.push(dashUrlLocal)
else if proxyVideos = "never"
playletStreamUrls.push(dashUrl)
else if proxyVideos = "always"
playletStreamUrls.push(dashUrlLocal)
else
playletStreamUrls.push(dashUrl)
playletStreamUrls.push(dashUrlLocal)
end if
end function
function AddStreamUrls(playletStreamUrls as object, metadata as object, settings as object) as void
if metadata.formatStreams = invalid or metadata.formatStreams.Count() = 0
return
end if
proxyVideos = settings["invidious.proxy_videos"]
if proxyVideos = "if_needed"
playletStreamUrls.push(Invidious.GetVideoStreamUrl(metadata.videoId, false))
playletStreamUrls.push(Invidious.GetVideoStreamUrl(metadata.videoId, true))
else if proxyVideos = "never"
playletStreamUrls.push(Invidious.GetVideoStreamUrl(metadata.videoId, false))
else if proxyVideos = "always"
playletStreamUrls.push(Invidious.GetVideoStreamUrl(metadata.videoId, true))
else
playletStreamUrls.push(Invidious.GetVideoStreamUrl(metadata.videoId, false))
playletStreamUrls.push(Invidious.GetVideoStreamUrl(metadata.videoId, true))
end if
end function
function FindChildNodeOfType(node as object, nodeType as string) as object
if node.subtype() = nodeType
return node
@@ -296,6 +340,11 @@ function OnVideoPlayerStateChange() as void
end function
function PlayNextRecommendedVideo(recommendedVideos as object) as boolean
settings = FindAndGetPreferenceValues(["playback.autoplay"])
if settings = invalid or settings["playback.autoplay"] <> true
return false
end if
if recommendedVideos = invalid or recommendedVideos.Count() = 0
return false
end if