Compare commits

...
17 Commits
Author SHA1 Message Date
Brahim Hadriche 9eeb9fcffe Release v0.35.5 (#538) 2025-01-09 11:25:01 -05:00
Brahim Hadriche 75769b72e0 [UX] Clarify that you can't login using Playlet built-in backend (yet) 2025-01-08 12:50:03 -05:00
Brahim Hadriche c14195041e [skip ci] typo 2025-01-07 18:16:25 -05:00
Brahim Hadriche ec941d64dc Announcements - do not show again 2025-01-07 18:13:34 -05:00
Brahim Hadriche fbac4ab959 Release v0.35.4 (#537) 2025-01-07 17:11:04 -05:00
Brahim Hadriche fb15f7d80b Redirect popular to trending (better caching) 2025-01-05 17:33:19 -05:00
Brahim Hadriche a6bb522702 update dependencies (#535) 2025-01-04 11:30:05 -05:00
Brahim Hadriche ebd83f21a4 Update versions 2025-01-02 14:40:07 -05:00
Brahim Hadricheandgithub-action linter c85ac0acf1 Oauth stuff (#533)
* qrcode

* add stuff

* Some oauth stuff

* remove some test code

* Lint fix

* Revert "add stuff"

This reverts commit 8508471e4a0a2bfa06d4f04bfdece1f3c9191e1c.

* Lint fix

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2025-01-01 21:17:19 -05:00
Brahim Hadriche fde8eaa0c2 Ensure a videoId when fetching video info 2025-01-01 13:40:57 -05:00
Brahim Hadriche 09902e0ec3 Small bug fix 2025-01-01 13:14:16 -05:00
Brahim Hadriche 5eefb9f6cd A couple of small fixes 2024-12-31 15:38:53 -05:00
Weblate (bot)andLacey Anaya 7baa95141a Translated using Weblate (German) (#532)
Currently translated at 99.6% (315 of 316 strings)

Translation: Playlet/Playlet
Translate-URL: https://hosted.weblate.org/projects/playlet/playlet/de/

Co-authored-by: Lacey Anaya <yecakeh263@anawalls.com>
2024-12-31 15:31:00 -05:00
Brahim Hadriche 115b1798e0 [Shore] fix project imports 2024-12-30 09:53:40 -05:00
Brahim Hadriche 1f36480b07 [skip ci] Tweak 2024-12-29 17:04:39 -05:00
Brahim Hadriche 9c329d4ee8 parse continuation 2024-12-29 12:29:34 -05:00
Brahim Hadriche 0d3c7e4f3f [skip ci] observe field fix 2024-12-29 11:35:19 -05:00
80 changed files with 670 additions and 132 deletions

No files matched your search

+18
View File
@@ -5,6 +5,24 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.35.5] - 2025-01-09
### Added
- Ability to hide announcement messages
- [UX] Clarify that you can't login using Playlet built-in backend (Yet)
## [0.35.4] - 2025-01-07
### Added
- German translation (Thanks to Lacey Anaya)
### Fixed
- Video duration in queue view
- Crash in player when video ID is invalid (again)
## [0.35.3] - 2024-12-29 ## [0.35.3] - 2024-12-29
### Fixed ### Fixed
+1 -1
View File
@@ -2,7 +2,7 @@ openapi: 3.0.0
info: info:
title: Playlet Web API title: Playlet Web API
version: 0.35.3 version: 0.35.5
description: description:
Playlet Web API is a RESTful API for controlling the Playlet app on Playlet Web API is a RESTful API for controlling the Playlet app on
Roku devices. The API is intended to be used by the Playlet web app, but can Roku devices. The API is intended to be used by the Playlet web app, but can
+11 -10
View File
@@ -1,18 +1,18 @@
{ {
"name": "playlet", "name": "playlet",
"version": "0.35.3", "version": "0.35.5",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet", "name": "playlet",
"version": "0.35.3", "version": "0.35.5",
"hasInstallScript": true, "hasInstallScript": true,
"devDependencies": { "devDependencies": {
"@rokucommunity/bslint": "^0.8.27", "@rokucommunity/bslint": "^0.8.27",
"@types/crypto-js": "^4.2.2", "@types/crypto-js": "^4.2.2",
"@types/fs-extra": "^11.0.4", "@types/fs-extra": "^11.0.4",
"@types/node": "^22.10.2", "@types/node": "^22.10.5",
"@types/xml2js": "^0.4.14", "@types/xml2js": "^0.4.14",
"argparse": "^2.0.1", "argparse": "^2.0.1",
"brighterscript": "0.68.2", "brighterscript": "0.68.2",
@@ -35,7 +35,7 @@
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typescript": "5.7.2", "typescript": "5.7.2",
"xml2js": "^0.6.2", "xml2js": "^0.6.2",
"yaml": "^2.6.1" "yaml": "^2.7.0"
}, },
"engines": { "engines": {
"node": "20" "node": "20"
@@ -730,9 +730,9 @@
} }
}, },
"node_modules/@types/node": { "node_modules/@types/node": {
"version": "22.10.2", "version": "22.10.5",
"resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.2.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-22.10.5.tgz",
"integrity": "sha512-Xxr6BBRCAOQixvonOye19wnzyDiUtTeqldOOmj3CkeblonbccA12PFwlufvRdrpjXxqnmUaeiU5EOA+7s5diUQ==", "integrity": "sha512-F8Q+SeGimwOo86fiovQh8qiXfFEh2/ocYv7tU5pJ3EXMSSxk1Joj5wefpFK2fHTf/N6HKGSxIDBT9f3gCxXPkQ==",
"dev": true, "dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
@@ -6555,10 +6555,11 @@
"dev": true "dev": true
}, },
"node_modules/yaml": { "node_modules/yaml": {
"version": "2.6.1", "version": "2.7.0",
"resolved": "https://registry.npmjs.org/yaml/-/yaml-2.6.1.tgz", "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.0.tgz",
"integrity": "sha512-7r0XPzioN/Q9kXBro/XPnA6kznR73DHq+GXh5ON7ZozRO6aMjbmiBuKste2wslTFkC5d1dw0GooOCepZXJ2SAg==", "integrity": "sha512-+hSoy/QHluxmC9kCIJyL/uyFmLmc+e5CFR5Wa+bpIhIj85LVb9ZH2nVnqrHoSvKogwODv0ClqZkmiSSaIH5LTA==",
"dev": true, "dev": true,
"license": "ISC",
"bin": { "bin": {
"yaml": "bin.mjs" "yaml": "bin.mjs"
}, },
+5 -4
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet", "name": "playlet",
"version": "0.35.3", "version": "0.35.5",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"devDependencies": { "devDependencies": {
"@rokucommunity/bslint": "^0.8.27", "@rokucommunity/bslint": "^0.8.27",
"@types/crypto-js": "^4.2.2", "@types/crypto-js": "^4.2.2",
"@types/fs-extra": "^11.0.4", "@types/fs-extra": "^11.0.4",
"@types/node": "^22.10.2", "@types/node": "^22.10.5",
"@types/xml2js": "^0.4.14", "@types/xml2js": "^0.4.14",
"argparse": "^2.0.1", "argparse": "^2.0.1",
"brighterscript": "0.68.2", "brighterscript": "0.68.2",
@@ -29,7 +29,7 @@
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typescript": "5.7.2", "typescript": "5.7.2",
"xml2js": "^0.6.2", "xml2js": "^0.6.2",
"yaml": "^2.6.1" "yaml": "^2.7.0"
}, },
"engines": { "engines": {
"node": "20" "node": "20"
@@ -65,6 +65,7 @@
"update-deps": "npx npm-check-updates --deep --upgrade --install always --reject @sveltejs/vite-plugin-svelte,svelte,vite,@vitejs/plugin-legacy", "update-deps": "npx npm-check-updates --deep --upgrade --install always --reject @sveltejs/vite-plugin-svelte,svelte,vite,@vitejs/plugin-legacy",
"registry:write": "node tools/registry.js --input registry.json", "registry:write": "node tools/registry.js --input registry.json",
"registry:read": "node tools/registry.js --output registry.json", "registry:read": "node tools/registry.js --output registry.json",
"registry:clear": "node tools/registry.js --clear" "registry:clear": "node tools/registry.js --clear",
"restart-app": "node tools/restart-app.js --app-id dev"
} }
} }
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-app", "name": "playlet-app",
"version": "0.35.3", "version": "0.35.5",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-app", "name": "playlet-app",
"version": "0.35.3" "version": "0.35.5"
} }
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-app", "name": "playlet-app",
"version": "0.35.3", "version": "0.35.5",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"scripts": { "scripts": {
"prebuild": "rm -rf ../build/playlet-app", "prebuild": "rm -rf ../build/playlet-app",
@@ -1,5 +1,8 @@
import "LoadingMessages.bs" import "LoadingMessages.bs"
import "pkg:/source/Dialog.bs"
import "pkg:/source/Logger.bs" import "pkg:/source/Logger.bs"
import "pkg:/source/Manifest.bs"
import "pkg:/source/Registry.bs"
function Init() as void function Init() as void
m.scene = m.top.getScene() m.scene = m.top.getScene()
+1 -1
View File
@@ -3,7 +3,7 @@ title=Playlet
# Do not update version manually, it is auto updated from package.json # Do not update version manually, it is auto updated from package.json
major_version=0 major_version=0
minor_version=35 minor_version=35
build_version=00003 build_version=00005
ui_resolutions=hd ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p uri_resolution_autosub=$$RES$$,480p,720p,1080p
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.35.3", "version": "0.35.5",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.35.3" "version": "0.35.5"
} }
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.35.3", "version": "0.35.5",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"scripts": { "scripts": {
"prebuild": "rm -rf ../build/playlet-lib", "prebuild": "rm -rf ../build/playlet-lib",
@@ -7,6 +7,15 @@
<field id="serverUrl" type="string" /> <field id="serverUrl" type="string" />
<field id="accessToken" type="string" /> <field id="accessToken" type="string" />
<!-- Innertube fields -->
<field id="refreshToken" type="string" />
<field id="scope" type="string" />
<field id="tokenType" type="string" />
<field id="expiresIn" type="longinteger" />
<field id="expiresTimestamp" type="longinteger" />
<field id="clientId" type="string" />
<field id="clientSecret" type="string" />
<field id="color" type="color" /> <field id="color" type="color" />
</interface> </interface>
</component> </component>
@@ -1,4 +1,7 @@
import "pkg:/source/utils/Locale.bs" import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/RegistryUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
namespace DialogUtils namespace DialogUtils
@@ -90,4 +93,58 @@ namespace DialogUtils
return dialog return dialog
end function end function
function ShowDialogOnce(options as object) as object
messageId = ValidString(options.messageId)
hasMessageId = messageId <> ""
if hasMessageId
messages = RegistryUtils.Read(RegistryUtils.MESSAGES)
if not StringUtils.IsNullOrEmpty(messages)
messages = ParseJson(messages)
if IsAssociativeArray(messages)
savedMessageId = ValidString(messages["messageId"])
if savedMessageId = messageId
return invalid
end if
end if
end if
end if
options.buttons = [
Tr(Locale.Buttons.OK)
`${Tr(Locale.Buttons.OK)} - ${Tr(Locale.Buttons.DotNotShowAgain)}`
]
dialog = ShowDialogEx(options)
if dialog = invalid
return invalid
end if
dialog.AddFields({
"messageId": messageId
})
dialog.ObserveField("buttonSelected", FuncName(OnShowDialogOnceButtonSelected))
return dialog
end function
function OnShowDialogOnceButtonSelected(event as object) as void
buttonSelected = event.getData()
if buttonSelected <> 1
return
end if
dialog = event.GetRoSGNode()
messageId = dialog.messageId
if messageId = ""
return
end if
messages = {
"messageId": messageId
}
RegistryUtils.Write(RegistryUtils.MESSAGES, FormatJson(messages))
end function
end namespace end namespace
+2 -1
View File
@@ -35,7 +35,8 @@ function StartWebServer()
end function end function
function ShowAnnouncement() function ShowAnnouncement()
DialogUtils.ShowDialogEx({ DialogUtils.ShowDialogOnce({
messageId: "1736288537"
title: "Announcement - Playlet backend" title: "Announcement - Playlet backend"
message: [ message: [
"An experimental built-in backend has been added to Playlet." "An experimental built-in backend has been added to Playlet."
@@ -34,7 +34,8 @@ function StartWebServer()
end function end function
function ShowAnnouncement() function ShowAnnouncement()
DialogUtils_ShowDialogEx({ DialogUtils_ShowDialogOnce({
messageId: "1736288537"
title: "Announcement - Playlet backend" title: "Announcement - Playlet backend"
message: [ message: [
"An experimental built-in backend has been added to Playlet." "An experimental built-in backend has been added to Playlet."
@@ -17,6 +17,7 @@
<script type="text/brightscript" uri="pkg:/source/utils/StringUtils.brs" /> <script type="text/brightscript" uri="pkg:/source/utils/StringUtils.brs" />
<script type="text/brightscript" uri="pkg:/source/utils/Logging.brs" /> <script type="text/brightscript" uri="pkg:/source/utils/Logging.brs" />
<script type="text/brightscript" uri="pkg:/components/Dialog/DialogUtils.brs" /> <script type="text/brightscript" uri="pkg:/components/Dialog/DialogUtils.brs" />
<script type="text/brightscript" uri="pkg:/source/utils/RegistryUtils.brs" />
<script type="text/brightscript" uri="pkg:/source/bslib.brs" /> <script type="text/brightscript" uri="pkg:/source/bslib.brs" />
<children> <children>
<Logger id="Logger" /> <Logger id="Logger" />
@@ -1,4 +1,7 @@
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/RemoteKeys.bs" import "pkg:/source/utils/RemoteKeys.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
function InitializeLongPress(keys as object, duration = 1.0 as float) function InitializeLongPress(keys as object, duration = 1.0 as float)
longPressKeyMap = {} longPressKeyMap = {}
@@ -58,14 +58,11 @@ function GenerateQrCode() as void
m.top.uri = "" m.top.uri = ""
if StringUtils.IsNullOrEmpty(text) if StringUtils.IsNullOrEmpty(text)
m.busySpinner.control = "stop" m.top.isBusy = false
m.busySpinner.visible = false
return return
end if end if
m.busySpinnerPoster.rotation = 0 m.top.isBusy = true
m.busySpinner.visible = true
m.busySpinner.control = "start"
m.qrCodeGenTask = AsyncTask.Start(Tasks.GenerateQrCodeTask, { m.qrCodeGenTask = AsyncTask.Start(Tasks.GenerateQrCodeTask, {
poster: m.top poster: m.top
@@ -80,6 +77,18 @@ function OnGenerateQrCodeTaskResult(output as object) as void
return return
end if end if
m.busySpinner.control = "stop" m.top.isBusy = false
m.busySpinner.visible = false end function
function OnIsBusy()
isBusy = m.top.isBusy
if isBusy
m.busySpinnerPoster.rotation = 0
m.busySpinner.control = "start"
m.busySpinner.visible = true
else
m.busySpinner.control = "stop"
m.busySpinner.visible = false
end if
end function end function
@@ -2,6 +2,7 @@
<interface> <interface>
<field id="text" type="string" onChange="OnTextChange" /> <field id="text" type="string" onChange="OnTextChange" />
<field id="padding" type="integer" /> <field id="padding" type="integer" />
<field id="isBusy" type="boolean" onChange="OnIsBusy" alwaysNotify="true" />
</interface> </interface>
<children> <children>
<BusySpinner <BusySpinner
@@ -38,6 +38,17 @@ function OnRowItemSelected() as void
row = m.profileRowList.content.GetChild(0) row = m.profileRowList.content.GetChild(0)
selectedProfile = row.GetChild(index) selectedProfile = row.GetChild(index)
if selectedProfile.type = "login" if selectedProfile.type = "login"
invidiousInstance = m.preferences["invidious.instance"]
if StringUtils.IsNullOrEmpty(invidiousInstance)
DialogUtils.ShowDialogEx({
title: "No Invidious Instance"
message: [
"Playlet built-in backend does not support login yet.",
"Can only login if an Invidious instance is set in the settings."
]
})
return
end if
dialog = CreateObject("roSGNode", "LoginDialog") dialog = CreateObject("roSGNode", "LoginDialog")
dialog@.BindNode() dialog@.BindNode()
m.top.getScene().dialog = dialog m.top.getScene().dialog = dialog
@@ -3,6 +3,7 @@
<field id="navBar" type="node" bind="/NavBar" /> <field id="navBar" type="node" bind="/NavBar" />
<field id="profilesService" type="node" bind="/ProfilesService" /> <field id="profilesService" type="node" bind="/ProfilesService" />
<field id="appController" type="node" bind="/AppController" /> <field id="appController" type="node" bind="/AppController" />
<field id="preferences" type="node" bind="/Preferences" />
</interface> </interface>
<children> <children>
@@ -1,5 +1,6 @@
import "pkg:/components/Web/WebServer/Http/HttpUtils.bs" import "pkg:/components/Web/WebServer/Http/HttpUtils.bs"
import "pkg:/source/services/XmlObject.bs" import "pkg:/source/services/XmlObject.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/StringUtils.bs" import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/UrlUtils.bs" import "pkg:/source/utils/UrlUtils.bs"
@@ -1,3 +1,7 @@
import "pkg:/components/Services/Innertube/Context.bs"
import "pkg:/source/services/HttpClient.bs"
import "pkg:/source/utils/StringUtils.bs"
namespace Innertube namespace Innertube
function CreateBrowseRequest(browseId as string, clienType as Innertube.ClientType, params = "" as string, continuation = "" as string) as object function CreateBrowseRequest(browseId as string, clienType as Innertube.ClientType, params = "" as string, continuation = "" as string) as object
@@ -1,16 +1,16 @@
const INNERTUBE_IOS_CLIENT_NAME = "5" const INNERTUBE_IOS_CLIENT_NAME = "5"
const INNERTUBE_IOS_CLIENT_VERSION = "19.09.3" const INNERTUBE_IOS_CLIENT_VERSION = "19.49.7"
const INNERTUBE_IOS_OS_VERSION = "15.6" const INNERTUBE_IOS_OS_VERSION = "15.6"
const INNERTUBE_IOS_USER_AGENT = "com.google.ios.youtube/19.09.3 (iPhone14,3; U; CPU iOS 15_6 like Mac OS X)" const INNERTUBE_IOS_USER_AGENT = "com.google.ios.youtube/19.49.7 (iPhone14,3; U; CPU iOS 15_6 like Mac OS X)"
const INNERTUBE_WEB_CLIENT_NAME = "1" const INNERTUBE_WEB_CLIENT_NAME = "1"
const INNERTUBE_WEB_CLIENT_VERSION = "2.20241126.01.00" const INNERTUBE_WEB_CLIENT_VERSION = "2.20241230.09.00"
const INNERTUBE_WEB_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0" const INNERTUBE_WEB_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0"
const INNERTUBE_WEB_BROWSER_NAME = "Chrome" const INNERTUBE_WEB_BROWSER_NAME = "Chrome"
const INNERTUBE_WEB_BROWSER_VERSION = "131.0.0.0" const INNERTUBE_WEB_BROWSER_VERSION = "131.0.0.0"
const INNERTUBE_TV_CLIENT_NAME = "2" const INNERTUBE_TV_CLIENT_NAME = "2"
const INNERTUBE_TV_CLIENT_VERSION = "7.20241211.14.00" const INNERTUBE_TV_CLIENT_VERSION = "7.20241211.14.01"
const INNERTUBE_TV_USER_AGENT = "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/538.2 (KHTML, like Gecko) Large Screen Safari/538.2 LG Browser/7.00.00(LGE; 24LF4820-BU; 03.20.14; 1; DTV_W15L); webOS.TV-2015; LG NetCast.TV-2013 Compatible (LGE, 24LF4820-BU, wireless)" const INNERTUBE_TV_USER_AGENT = "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/538.2 (KHTML, like Gecko) Large Screen Safari/538.2 LG Browser/7.00.00(LGE; 24LF4820-BU; 03.20.14; 1; DTV_W15L); webOS.TV-2015; LG NetCast.TV-2013 Compatible (LGE, 24LF4820-BU, wireless)"
const INNERTUBE_TV_DEVICE_MAKE = "LGE" const INNERTUBE_TV_DEVICE_MAKE = "LGE"
const INNERTUBE_TV_DEVICE_MODEL = "24LF4820-BU" const INNERTUBE_TV_DEVICE_MODEL = "24LF4820-BU"
@@ -1,4 +1,5 @@
import "pkg:/components/Services/Innertube/Constants.bs" import "pkg:/components/Services/Innertube/Constants.bs"
import "pkg:/source/utils/StringUtils.bs"
namespace Innertube namespace Innertube
@@ -69,6 +69,11 @@ namespace InnertubeService
parsedResponse = Innertube.ParseInnertubeNextResponse(nextResponse.Json(), parsedResponse) parsedResponse = Innertube.ParseInnertubeNextResponse(nextResponse.Json(), parsedResponse)
end if end if
' If for some reason we missed the videoId, add it back
if parsedResponse.error = invalid and StringUtils.IsNullOrEmpty(parsedResponse.videoId)
parsedResponse["videoId"] = videoId
end if
return parsedResponse return parsedResponse
end function end function
@@ -231,20 +236,24 @@ namespace InnertubeService
function GetBrowseAuthenticatedPage(browserId as string, options = invalid as object) as object function GetBrowseAuthenticatedPage(browserId as string, options = invalid as object) as object
cancellation = invalid cancellation = invalid
access_token = invalid accessToken = invalid
continuation = ""
if options <> invalid if options <> invalid
if options.DoesExist("cancellation") if options.DoesExist("cancellation")
cancellation = options.cancellation cancellation = options.cancellation
end if end if
if options.DoesExist("access_token") if options.DoesExist("accessToken")
access_token = options.access_token accessToken = options.accessToken
end if
if options.DoesExist("continuation")
continuation = options.continuation
end if end if
end if end if
request = Innertube.CreateBrowseRequest(browserId, Innertube.ClientType.Tv) request = Innertube.CreateBrowseRequest(browserId, Innertube.ClientType.Tv, "", continuation)
if access_token <> invalid if accessToken <> invalid
request.Header("Authorization", "Bearer " + access_token) request.Header("Authorization", "Bearer " + accessToken)
end if end if
request.Cancellation(cancellation) request.Cancellation(cancellation)
@@ -394,7 +403,7 @@ namespace InnertubeService
return invalid return invalid
end if end if
result2 = Innertube.GetDeviceAndUserCode(result.client_id, cancellation) result2 = Innertube.GetDeviceAndUserCode(result.clientId, cancellation)
if CancellationUtils.IsCancelled(cancellation) if CancellationUtils.IsCancelled(cancellation)
return invalid return invalid
@@ -405,7 +414,7 @@ namespace InnertubeService
end function end function
function AuthGetActivationUrl(code as object) as string function AuthGetActivationUrl(code as object) as string
return `https://www.youtube.com/tv/activate?user_code=${code.user_code}` return `https://www.youtube.com/tv/activate?user_code=${code.userCode}`
end function end function
function AuthPollForAccessToken(code as object, cancellation = invalid as object) as object function AuthPollForAccessToken(code as object, cancellation = invalid as object) as object
@@ -423,10 +432,10 @@ namespace InnertubeService
if expiresTimestamp = invalid or expiresTimestamp < nowSeconds if expiresTimestamp = invalid or expiresTimestamp < nowSeconds
refreshed = Innertube.RefreshAccessToken(accessToken, cancellation) refreshed = Innertube.RefreshAccessToken(accessToken, cancellation)
if IsAssociativeArray(refreshed) and refreshed.DoesExist("access_token") if IsAssociativeArray(refreshed) and refreshed.DoesExist("accessToken")
accessToken.Append(refreshed) accessToken.Append(refreshed)
if accessToken.DoesExist("expires_in") if accessToken.DoesExist("expiresIn")
accessToken["expires_timestamp"] = TimeUtils.Now().AsSeconds() + accessToken["expires_in"] accessToken["expiresTimestamp"] = TimeUtils.Now().AsSeconds() + accessToken["expiresIn"]
end if end if
return true return true
end if end if
@@ -440,7 +449,7 @@ namespace InnertubeService
return false return false
end if end if
return Innertube.RevokeAccessToken(accessToken["access_token"], cancellation) return Innertube.RevokeAccessToken(accessToken["accessToken"], cancellation)
end function end function
end namespace end namespace
@@ -1,4 +1,7 @@
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/ObjectUtils.bs" import "pkg:/source/utils/ObjectUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
namespace Innertube namespace Innertube
@@ -64,6 +67,9 @@ namespace Innertube
"richItemRenderer": ParseRichItemRenderer "richItemRenderer": ParseRichItemRenderer
"continuationItemRenderer": ParseContinuationItemRenderer "continuationItemRenderer": ParseContinuationItemRenderer
"appendContinuationItemsAction": ParseAppendContinuationItemsAction "appendContinuationItemsAction": ParseAppendContinuationItemsAction
"gridContinuation": ParseGridContinuation
"tvSurfaceContentContinuation": ParseTvSurfaceContentContinuation
' Ignored nodes:
' Posts not yet supported ' Posts not yet supported
"postRenderer": ParseNotImplemented "postRenderer": ParseNotImplemented
' a "View all posts" button ' a "View all posts" button
@@ -74,8 +80,8 @@ namespace Innertube
"expandableTabRenderer": ParseNotImplemented "expandableTabRenderer": ParseNotImplemented
' Usually contains a "X unavailable video(s) are hidden" message. Ignored. ' Usually contains a "X unavailable video(s) are hidden" message. Ignored.
"messageRenderer": ParseNotImplemented "messageRenderer": ParseNotImplemented
' Obviously ignored.
"clickTrackingParams": ParseNotImplemented "clickTrackingParams": ParseNotImplemented
"promoShelfRenderer": ParseNotImplemented
} }
end function end function
@@ -846,11 +852,32 @@ namespace Innertube
end if end if
end if end if
lengthText = ""
isUpcoming = false
liveNow = false
thumbnailOverlays = ObjectUtils.Dig(nodeData, ["header", "tileHeaderRenderer", "thumbnailOverlays"])
if IsArray(thumbnailOverlays)
for each overlay in thumbnailOverlays
maybeLengthText = ParseText(ObjectUtils.Dig(overlay, ["thumbnailOverlayTimeStatusRenderer", "text"]))
if maybeLengthText <> ""
lengthText = maybeLengthText
end if
liveNow = liveNow or (ValidString(ObjectUtils.Dig(overlay, ["thumbnailOverlayTimeStatusRenderer", "style"])) = "LIVE")
isUpcoming = isUpcoming or (ValidString(ObjectUtils.Dig(overlay, ["thumbnailOverlayTimeStatusRenderer", "style"])) = "UPCOMING")
end for
if liveNow or isUpcoming
lengthText = ""
end if
end if
video = { video = {
"type": "video" "type": "video"
"videoId": videoId "videoId": videoId
"title": ParseText(ObjectUtils.Dig(nodeData, ["metadata", "tileMetadataRenderer", "title"])) "title": ParseText(ObjectUtils.Dig(nodeData, ["metadata", "tileMetadataRenderer", "title"]))
"videoThumbnails": videoThumbnails "videoThumbnails": videoThumbnails
"lengthText": lengthText
"liveNow": liveNow
"isUpcoming": isUpcoming
} }
PushFeedItem(video, context) PushFeedItem(video, context)
@@ -864,19 +891,34 @@ namespace Innertube
return invalid return invalid
end if end if
videoCountText = ""
thumbnailOverlays = ObjectUtils.Dig(nodeData, ["header", "tileHeaderRenderer", "thumbnailOverlays"])
if IsArray(thumbnailOverlays)
for each overlay in thumbnailOverlays
videoCountText = ParseText(ObjectUtils.Dig(overlay, ["thumbnailOverlayTimeStatusRenderer", "text"]))
if videoCountText <> ""
exit for
end if
end for
end if
playlist = { playlist = {
"type": "playlist" "type": "playlist"
"playlistId": playlistId "playlistId": playlistId
"title": ParseText(ObjectUtils.Dig(nodeData, ["metadata", "tileMetadataRenderer", "title"])) "title": ParseText(ObjectUtils.Dig(nodeData, ["metadata", "tileMetadataRenderer", "title"]))
"playlistThumbnail": ObjectUtils.Dig(nodeData, ["header", "tileHeaderRenderer", "thumbnail", "thumbnails"]) "playlistThumbnail": ObjectUtils.Dig(nodeData, ["header", "tileHeaderRenderer", "thumbnail", "thumbnails", 0, "url"])
"videoCountText": videoCountText
} }
PushFeedItem(playlist, context) PushFeedItem(playlist, context)
return invalid return invalid
end function end function
function ParseGridRenderer(nodeData as object, _context as object) as object function ParseGridRenderer(nodeData as object, context as object) as object
' TODO: handle gridRenderer.continuations continuation = ObjectUtils.Dig(nodeData, ["continuations", 0, "nextContinuationData", "continuation"])
if IsString(continuation)
context.currentFeed.continuation = continuation
end if
return nodeData["items"] return nodeData["items"]
end function end function
@@ -900,10 +942,23 @@ namespace Innertube
return invalid return invalid
end function end function
function ParseAppendContinuationItemsAction(nodeData as object, context as object) as object function ParseAppendContinuationItemsAction(nodeData as object, _context as object) as object
return nodeData["continuationItems"] return nodeData["continuationItems"]
end function end function
function ParseGridContinuation(nodeData as object, context as object) as object
continuation = ObjectUtils.Dig(nodeData, ["continuations", 0, "nextContinuationData", "continuation"])
if IsString(continuation)
context.currentFeed.continuation = continuation
end if
return nodeData["items"]
end function
function ParseTvSurfaceContentContinuation(nodeData as object, context as object) as object
' title = ParseText(ObjectUtils.Dig(nodeData, ["header", "tvSurfaceHeaderRenderer", "title"]))
return nodeData["content"]
end function
function ParseText(data as object) as string function ParseText(data as object) as string
if data = invalid if data = invalid
return "" return ""
@@ -46,8 +46,8 @@ namespace Innertube
end if end if
return { return {
"client_id": match[1] "clientId": match[1]
"client_secret": match[2] "clientSecret": match[2]
} }
end function end function
@@ -69,13 +69,14 @@ namespace Innertube
throw `Failed to get device code: ${response.ErrorMessage()}` throw `Failed to get device code: ${response.ErrorMessage()}`
end if end if
responseData = response.Json() responseData = ToCamelCase(response.Json())
if responseData.DoesExist("error_code")
if responseData.DoesExist("errorCode")
throw "Failed to get device code: " + ToString(responseData) throw "Failed to get device code: " + ToString(responseData)
end if end if
if responseData.DoesExist("expires_in") if responseData.DoesExist("expiresIn")
responseData["expires_timestamp"] = TimeUtils.Now().AsSeconds() + responseData["expires_in"] responseData["expiresTimestamp"] = TimeUtils.Now().AsSeconds() + responseData["expiresIn"]
end if end if
return responseData return responseData
@@ -83,9 +84,9 @@ namespace Innertube
function PollForAccessToken(clientIdentity as object, deviceAndUserCode as object, cancellation = invalid as dynamic) as object function PollForAccessToken(clientIdentity as object, deviceAndUserCode as object, cancellation = invalid as dynamic) as object
payload = { payload = {
"client_id": clientIdentity.client_id "client_id": clientIdentity.clientId
"client_secret": clientIdentity.client_secret "client_secret": clientIdentity.clientSecret
"code": deviceAndUserCode.device_code "code": deviceAndUserCode.deviceCode
"grant_type": "http://oauth.net/grant_type/device/1.0" "grant_type": "http://oauth.net/grant_type/device/1.0"
} }
@@ -104,13 +105,13 @@ namespace Innertube
} }
end if end if
responseData = response.Json() responseData = ToCamelCase(response.Json())
if not responseData.DoesExist("error") if not responseData.DoesExist("error")
if responseData.DoesExist("expires_in") if responseData.DoesExist("expiresIn")
responseData["expires_timestamp"] = TimeUtils.Now().AsSeconds() + responseData["expires_in"] responseData["expiresTimestamp"] = TimeUtils.Now().AsSeconds() + responseData["expiresIn"]
end if end if
responseData["client_id"] = clientIdentity.client_id responseData["clientId"] = clientIdentity["clientId"]
responseData["client_secret"] = clientIdentity.client_secret responseData["clientSecret"] = clientIdentity["clientSecret"]
return responseData return responseData
end if end if
@@ -142,9 +143,9 @@ namespace Innertube
function RefreshAccessToken(accessToken as object, cancellation = invalid as dynamic) as object function RefreshAccessToken(accessToken as object, cancellation = invalid as dynamic) as object
payload = { payload = {
"client_id": accessToken.client_id "client_id": accessToken.clientId
"client_secret": accessToken.client_secret "client_secret": accessToken.clientSecret
"refresh_token": accessToken.refresh_token "refresh_token": accessToken.refreshToken
"grant_type": "refresh_token" "grant_type": "refresh_token"
} }
@@ -156,8 +157,8 @@ namespace Innertube
throw `Failed to refresh token: ${response.ErrorMessage()}` throw `Failed to refresh token: ${response.ErrorMessage()}`
end if end if
responseData = response.Json() responseData = ToCamelCase(response.Json())
if responseData.DoesExist("error_code") if responseData.DoesExist("errorCode")
throw "Failed to refresh token: " + ToString(responseData) throw "Failed to refresh token: " + ToString(responseData)
end if end if
@@ -176,4 +177,22 @@ namespace Innertube
return success return success
end function end function
function ToCamelCase(obj as object) as object
if not IsAssociativeArray(obj)
return obj
end if
newObj = {}
for each key in obj
newKey = key
underScoreIndex = newKey.InStr("_")
while underScoreIndex <> -1 and underScoreIndex < newKey.Len() - 2
newKey = newKey.Left(underScoreIndex) + UCase(newKey.Mid(underScoreIndex + 1, 1)) + newKey.Mid(underScoreIndex + 2)
underScoreIndex = newKey.InStr("_")
end while
newObj[newKey] = obj[key]
end for
return newObj
end function
end namespace end namespace
@@ -1,6 +1,7 @@
import "pkg:/components/Services/Innertube/NodesParser.bs" import "pkg:/components/Services/Innertube/NodesParser.bs"
import "pkg:/source/utils/ObjectUtils.bs" import "pkg:/source/utils/ObjectUtils.bs"
import "pkg:/source/utils/StringUtils.bs" import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
namespace Innertube namespace Innertube
@@ -315,6 +316,7 @@ namespace Innertube
responseData["response"] responseData["response"]
responseData["onResponseReceivedActions"] responseData["onResponseReceivedActions"]
responseData["onResponseReceivedCommands"] responseData["onResponseReceivedCommands"]
responseData["continuationContents"]
] ]
end function end function
@@ -1,3 +1,9 @@
import "pkg:/components/Services/Innertube/Context.bs"
import "pkg:/components/Services/Innertube/NodesParser.bs"
import "pkg:/source/services/HttpClient.bs"
import "pkg:/source/utils/ObjectUtils.bs"
import "pkg:/source/utils/Types.bs"
namespace Innertube namespace Innertube
function CreatePlayerRequest(videoId as string, ctt as string) as object function CreatePlayerRequest(videoId as string, ctt as string) as object
@@ -1,3 +1,6 @@
import "pkg:/components/Services/Innertube/Context.bs"
import "pkg:/source/services/HttpClient.bs"
namespace Innertube namespace Innertube
function CreateResolveUrlRequest(url as string) as object function CreateResolveUrlRequest(url as string) as object
deviceInfo = CreateObject("roDeviceInfo") deviceInfo = CreateObject("roDeviceInfo")
@@ -1,5 +1,8 @@
import "pkg:/components/Services/Innertube/Context.bs" import "pkg:/components/Services/Innertube/Context.bs"
import "pkg:/components/Services/Innertube/Parser.bs" import "pkg:/components/Services/Innertube/Parser.bs"
import "pkg:/components/Services/Innertube/SearchFilters.bs"
import "pkg:/source/services/HttpClient.bs"
import "pkg:/source/utils/Types.bs"
namespace Innertube namespace Innertube
@@ -560,9 +560,15 @@ namespace Invidious
videos.Append(json.videos) videos.Append(json.videos)
end if end if
return { result = {
items: videos items: videos
} }
if json.continuation <> invalid
result.continuation = json.continuation
end if
return result
end function end function
function WatchHistoryHandler(context as object) as object function WatchHistoryHandler(context as object) as object
@@ -576,49 +582,49 @@ namespace Invidious
end if end if
json = response.Json() json = response.Json()
if not IsArray(json) if IsArray(json)
return invalid videos = []
end if if json.Count() = 0
return {
items: videos
}
end if
videos = [] videoDictionary = {}
if json.Count() = 0
return { videosMetadata = InnertubeService.GetVideoInfoBatched(json)
if not StringUtils.IsNullOrEmpty(videosMetadata.error)
LogError("Failed to load video metadata", videosMetadata.error)
else
for each video in videosMetadata.videos
videoDictionary[video.videoId] = video
end for
end if
for each videoId in json
video = videoDictionary[videoId]
if video = invalid
video = {
"type": "video"
"videoId": videoId
"videoThumbnails": [{
"quality": "medium"
"url": `https://i.ytimg.com/vi/${videoId}/mqdefault.jpg`
"width": 320
"height": 180
}]
}
end if
videos.push(video)
end for
json = {
items: videos items: videos
} }
end if end if
videoDictionary = {} return json
videosMetadata = InnertubeService.GetVideoInfoBatched(json)
if not StringUtils.IsNullOrEmpty(videosMetadata.error)
LogError("Failed to load video metadata", videosMetadata.error)
else
for each video in videosMetadata.videos
videoDictionary[video.videoId] = video
end for
end if
for each videoId in json
video = videoDictionary[videoId]
if video = invalid
video = {
"type": "video"
"videoId": videoId
"videoThumbnails": [{
"quality": "medium"
"url": `https://i.ytimg.com/vi/${videoId}/mqdefault.jpg`
"width": 320
"height": 180
}]
}
end if
videos.push(video)
end for
return {
items: videos
}
end function end function
function DeleteExpiredToken(response as object, authToken as object) as void function DeleteExpiredToken(response as object, authToken as object) as void
@@ -1,4 +1,5 @@
import "pkg:/source/utils/Locale.bs" import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/StringUtils.bs"
namespace LoungeDeviceConnected namespace LoungeDeviceConnected
const NOTIFICATION_NODE_ID = "DeviceConnectedNotification" const NOTIFICATION_NODE_ID = "DeviceConnectedNotification"
@@ -51,6 +51,15 @@ function LoadProfilesFromRegistry()
profileNode.username = profile.username profileNode.username = profile.username
profileNode.serverUrl = profile.serverUrl profileNode.serverUrl = profile.serverUrl
profileNode.accessToken = profile.accessToken profileNode.accessToken = profile.accessToken
profileNode.refreshToken = profile.refreshToken
profileNode.scope = profile.scope
profileNode.tokenType = profile.tokenType
profileNode.expiresIn = profile.expiresIn
profileNode.expiresTimestamp = profile.expiresTimestamp
profileNode.clientId = profile.clientId
profileNode.clientSecret = profile.clientSecret
profileNode.color = profile.color profileNode.color = profile.color
profileNodes.Push(profileNode) profileNodes.Push(profileNode)
@@ -157,6 +166,13 @@ function GetProfilesDto(includeAccessToken as boolean) as object
if includeAccessToken if includeAccessToken
profile["accessToken"] = profileNode.accessToken profile["accessToken"] = profileNode.accessToken
profile["refreshToken"] = profileNode.refreshToken
profile["scope"] = profileNode.scope
profile["tokenType"] = profileNode.tokenType
profile["expiresIn"] = profileNode.expiresIn
profile["expiresTimestamp"] = profileNode.expiresTimestamp
profile["clientId"] = profileNode.clientId
profile["clientSecret"] = profileNode.clientSecret
end if end if
userProfiles.profiles.Push(profile) userProfiles.profiles.Push(profile)
@@ -1,4 +1,5 @@
import "pkg:/components/Services/Invidious/InvidiousService.bs" import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/source/utils/StringUtils.bs"
@asynctask @asynctask
function ProfilesVerifyTokensTask(input as object) as object function ProfilesVerifyTokensTask(input as object) as object
@@ -10,6 +11,9 @@ function ProfilesVerifyTokensTask(input as object) as object
invalidProfiles = [] invalidProfiles = []
for each profileNode in profileContentNodes for each profileNode in profileContentNodes
if not StringUtils.IsNullOrEmpty(profileNode.refreshToken)
continue for
end if
if not service.VerifyTokenScope(profileNode.accessToken) if not service.VerifyTokenScope(profileNode.accessToken)
invalidProfiles.push(profileNode) invalidProfiles.push(profileNode)
end if end if
@@ -2,6 +2,7 @@ import "pkg:/components/Services/SponsorBlock/Notifications/SponsorBlockNotifica
import "pkg:/components/Services/SponsorBlock/SponsorBlockService.bs" import "pkg:/components/Services/SponsorBlock/SponsorBlockService.bs"
import "pkg:/source/AsyncTask/AsyncTask.bs" import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs" import "pkg:/source/AsyncTask/Tasks.bs"
import "VideoPlayer.bs"
namespace SponsorBlock namespace SponsorBlock
@@ -172,7 +172,7 @@ function OnVideoContentTaskResults(output as object) as void
end if end if
error = ErrorUtils.Format(error) error = ErrorUtils.Format(error)
LogError(error) LogError(error)
videoId = output.task.input.content.videoId videoId = `${output.task.input.content.videoId}`
title = Tr(Locale.VideoPlayer.VideoLoadError) title = Tr(Locale.VideoPlayer.VideoLoadError)
message = Tr(Locale.VideoPlayer.VideoLoadErrorMessage).Replace("%1", videoId) + `\n${error}` message = Tr(Locale.VideoPlayer.VideoLoadErrorMessage).Replace("%1", videoId) + `\n${error}`
@@ -1,3 +1,6 @@
import "pkg:/source/utils/DisposableObserve.bs"
import "pkg:/source/utils/Types.bs"
enum MinimizeState enum MinimizeState
None ' None is not a valid state, but it is the default value pre-initialization None ' None is not a valid state, but it is the default value pre-initialization
Minimizing Minimizing
@@ -1,3 +1,7 @@
import "pkg:/source/utils/DisposableObserve.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Types.bs"
enum PlayerUiState enum PlayerUiState
None ' None is not a valid state, but it is the default value pre-initialization None ' None is not a valid state, but it is the default value pre-initialization
FadingIn FadingIn
@@ -1,5 +1,6 @@
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs" import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
import "pkg:/source/utils/FocusManagement.bs" import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Logging.bs"
namespace VideoQueueUtils namespace VideoQueueUtils
@@ -16,13 +16,7 @@ function OnContentSet() as void
m.top.title = content.title m.top.title = content.title
m.top.thumbnailUri = content.thumbnail m.top.thumbnailUri = content.thumbnail
if ValidInt(content.lengthSeconds) <> 0 SetDurationText(content.lengthText)
SetDurationText(content.lengthText)
m.top.durationRectVisible = true
else
m.top.durationRectVisible = false
end if
SetHighlight() SetHighlight()
end function end function
@@ -31,6 +25,12 @@ function OnIndexSet() as void
end function end function
function SetDurationText(text as string) as void function SetDurationText(text as string) as void
hasText = text <> ""
m.top.durationRectVisible = hasText
if not hasText
return
end if
m.top.duration = text m.top.duration = text
label = m.durationLabel label = m.durationLabel
@@ -1,4 +1,5 @@
import "pkg:/components/Services/BookmarksService/BookmarksServiceUtils.bs" import "pkg:/components/Services/BookmarksService/BookmarksServiceUtils.bs"
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
import "pkg:/source/utils/RegistryUtils.bs" import "pkg:/source/utils/RegistryUtils.bs"
namespace Http namespace Http
@@ -1,3 +1,4 @@
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
import "pkg:/source/utils/CacheUtils.bs" import "pkg:/source/utils/CacheUtils.bs"
namespace Http namespace Http
@@ -1,5 +1,7 @@
import "pkg:/components/Services/Dash/DashManifest.bs" import "pkg:/components/Services/Dash/DashManifest.bs"
import "pkg:/components/Services/Invidious/InvidiousService.bs" import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
namespace Http namespace Http
@@ -1,5 +1,8 @@
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
import "pkg:/source/services/HttpClient.bs"
import "pkg:/source/services/XmlObject.bs" import "pkg:/source/services/XmlObject.bs"
import "pkg:/source/utils/MessagePortUtils.bs" import "pkg:/source/utils/MessagePortUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
namespace Http namespace Http
@@ -1,3 +1,4 @@
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
import "pkg:/source/services/HttpClient.bs" import "pkg:/source/services/HttpClient.bs"
namespace Http namespace Http
@@ -70,12 +71,6 @@ namespace Http
return true return true
end if end if
lengthSeconds = metadata.lengthSeconds
if not IsInt(lengthSeconds)
response.Default(500, "Player metadata lengthSeconds is invalid")
return true
end if
index = request.query.index index = request.query.index
if StringUtils.IsNullOrEmpty(index) if StringUtils.IsNullOrEmpty(index)
response.Default(400, "Missing index") response.Default(400, "Missing index")
@@ -89,7 +84,7 @@ namespace Http
end if end if
storyboard = storyboards[index] storyboard = storyboards[index]
hlsManifest = m.GenerateStoryboardManifest(storyboard, lengthSeconds) hlsManifest = m.GenerateStoryboardManifest(storyboard)
response.http_code = 200 response.http_code = 200
response.SetBodyDataString(hlsManifest) response.SetBodyDataString(hlsManifest)
@@ -186,7 +181,7 @@ namespace Http
return hlsManifest.Replace("VIDEO-RANGE=HLG", "VIDEO-RANGE=SDR").Replace("VIDEO-RANGE=PQ", "VIDEO-RANGE=SDR") return hlsManifest.Replace("VIDEO-RANGE=HLG", "VIDEO-RANGE=SDR").Replace("VIDEO-RANGE=PQ", "VIDEO-RANGE=SDR")
end function end function
function GenerateStoryboardManifest(storyboard as object, lengthSeconds as float) as string function GenerateStoryboardManifest(storyboard as object) as string
tileCount = storyboard.storyboardWidth * storyboard.storyboardHeight tileCount = storyboard.storyboardWidth * storyboard.storyboardHeight
intervalSeconds = Cdbl(storyboard.interval) / 1000.0 intervalSeconds = Cdbl(storyboard.interval) / 1000.0
targetDuration = tileCount * intervalSeconds targetDuration = tileCount * intervalSeconds
@@ -1,4 +1,5 @@
import "pkg:/components/Screens/HomeScreen/HomeScreenUtils.bs" import "pkg:/components/Screens/HomeScreen/HomeScreenUtils.bs"
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
namespace Http namespace Http
@@ -1,3 +1,5 @@
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
namespace Http namespace Http
class HomeRouter extends HttpRouter class HomeRouter extends HttpRouter
@@ -1,4 +1,5 @@
import "pkg:/components/Services/Invidious/InvidiousService.bs" import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
import "pkg:/source/utils/CryptoUtils.bs" import "pkg:/source/utils/CryptoUtils.bs"
namespace Http namespace Http
@@ -1,4 +1,5 @@
import "pkg:/components/Services/Innertube/InnertubeService.bs" import "pkg:/components/Services/Innertube/InnertubeService.bs"
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
namespace Http namespace Http
@@ -19,6 +20,154 @@ namespace Http
return true return true
end function end function
@get("/playlet-invidious-backend/api/v1/auth/feed")
function GetAuthFeed(context as object) as boolean
request = context.request
response = context.response
accessToken = request.headers["authorization"]
if StringUtils.IsNullOrEmpty(accessToken) or not accessToken.StartsWith("Bearer ")
response.Json({
"error": "Missing or invalid 'Authorization' header"
})
response.http_code = 403
return true
end if
options = {
"accessToken": accessToken.Mid("Bearer ".Len())
}
continuation = request.query.continuation
if not StringUtils.IsNullOrEmpty(continuation)
options.continuation = continuation
end if
feeds = InnertubeService.GetSubscriptions(options)
if feeds = invalid
response.Json({
"error": "Failed to get auth feed"
})
response.http_code = 500
return true
end if
result = {
"videos": []
}
if feeds.Count() > 0
result["videos"] = ValidArray(feeds[0].items)
if feeds[0].DoesExist("continuation")
result["continuation"] = feeds[0].continuation
end if
end if
response.Json(result)
return true
end function
@get("/playlet-invidious-backend/api/v1/auth/subscriptions")
function GetAuthSubscriptions(context as object) as boolean
request = context.request
response = context.response
accessToken = request.headers["authorization"]
if StringUtils.IsNullOrEmpty(accessToken) or not accessToken.StartsWith("Bearer ")
response.Json({
"error": "Missing or invalid 'Authorization' header"
})
response.http_code = 403
return true
end if
response.Json([])
return true
end function
@get("/playlet-invidious-backend/api/v1/auth/playlists")
function GetAuthPlaylists(context as object) as boolean
request = context.request
response = context.response
accessToken = request.headers["authorization"]
if StringUtils.IsNullOrEmpty(accessToken) or not accessToken.StartsWith("Bearer ")
response.Json({
"error": "Missing or invalid 'Authorization' header"
})
response.http_code = 403
return true
end if
options = {
"accessToken": accessToken.Mid("Bearer ".Len())
}
continuation = request.query.continuation
if not StringUtils.IsNullOrEmpty(continuation)
options.continuation = continuation
end if
feeds = InnertubeService.GetPlaylists(options)
if feeds = invalid
response.Json({
"error": "Failed to get auth playlists"
})
response.http_code = 500
return true
end if
if feeds.Count() > 0
response.Json(feeds[0])
return true
end if
response.Json({
"items": []
})
return true
end function
@get("/playlet-invidious-backend/api/v1/auth/history")
function GetAuthHistory(context as object) as boolean
request = context.request
response = context.response
accessToken = request.headers["authorization"]
if StringUtils.IsNullOrEmpty(accessToken) or not accessToken.StartsWith("Bearer ")
response.Json({
"error": "Missing or invalid 'Authorization' header"
})
response.http_code = 403
return true
end if
options = {
"accessToken": accessToken.Mid("Bearer ".Len())
}
continuation = request.query.continuation
if not StringUtils.IsNullOrEmpty(continuation)
options.continuation = continuation
end if
feeds = InnertubeService.GetWatchHistory(options)
if feeds = invalid
response.Json({
"error": "Failed to get auth history"
})
response.http_code = 500
return true
end if
if feeds.Count() > 0
response.Json(feeds[0])
return true
end if
response.Json({
"items": []
})
return true
end function
@get("/playlet-invidious-backend/api/v1/stats") @get("/playlet-invidious-backend/api/v1/stats")
function GetStats(context as object) as boolean function GetStats(context as object) as boolean
response = context.response response = context.response
@@ -60,7 +209,9 @@ namespace Http
@get("/playlet-invidious-backend/api/v1/popular") @get("/playlet-invidious-backend/api/v1/popular")
function GetPopular(context as object) as boolean function GetPopular(context as object) as boolean
return m.GetTrending(context) response = context.response
response.Redirect("/playlet-invidious-backend/api/v1/trending")
return true
end function end function
@get("/playlet-invidious-backend/api/v1/search/suggestions") @get("/playlet-invidious-backend/api/v1/search/suggestions")
@@ -1,4 +1,7 @@
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
import "pkg:/source/utils/RegistryUtils.bs" import "pkg:/source/utils/RegistryUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
namespace Http namespace Http
@@ -1,3 +1,5 @@
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
namespace Http namespace Http
class PreferencesRouter extends HttpRouter class PreferencesRouter extends HttpRouter
@@ -1,3 +1,6 @@
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
import "pkg:/source/utils/StringUtils.bs"
namespace Http namespace Http
class ProfilesRouter extends HttpRouter class ProfilesRouter extends HttpRouter
@@ -3,7 +3,10 @@
#const LOG_EXPORT_CODE = false #const LOG_EXPORT_CODE = false
import "pkg:/components/Dialog/DialogUtils.bs" import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
import "pkg:/source/utils/RegistryUtils.bs" import "pkg:/source/utils/RegistryUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/TimeUtils.bs"
const REGISTRY_EXPORT_VERSION = 1 const REGISTRY_EXPORT_VERSION = 1
@@ -1,4 +1,5 @@
import "pkg:/components/Services/SearchHistory/SearchHistoryUtils.bs" import "pkg:/components/Services/SearchHistory/SearchHistoryUtils.bs"
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
namespace Http namespace Http
@@ -1,3 +1,4 @@
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
import "pkg:/source/utils/MessagePortUtils.bs" import "pkg:/source/utils/MessagePortUtils.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
@@ -1,5 +1,7 @@
import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs" import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
import "pkg:/components/VideoQueue/VideoQueueUtils.bs" import "pkg:/components/VideoQueue/VideoQueueUtils.bs"
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
import "pkg:/source/utils/MathUtils.bs" import "pkg:/source/utils/MathUtils.bs"
namespace Http namespace Http
@@ -2,6 +2,7 @@ import "pkg:/components/ChannelView/ChannelUtils.bs"
import "pkg:/components/PlaylistView/PlaylistUtils.bs" import "pkg:/components/PlaylistView/PlaylistUtils.bs"
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs" import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
import "pkg:/components/VideoQueue/VideoQueueUtils.bs" import "pkg:/components/VideoQueue/VideoQueueUtils.bs"
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
namespace Http namespace Http
@@ -1,6 +1,7 @@
import "HttpRequest.bs" import "HttpRequest.bs"
import "HttpResponse.bs" import "HttpResponse.bs"
import "HttpSettings.bs" import "HttpSettings.bs"
import "pkg:/components/Web/WebServer/Http/HttpConnectionState.bs"
import "pkg:/source/utils/Logging.bs" import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/StringUtils.bs" import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
@@ -1,5 +1,7 @@
import "HttpRequestState.bs" import "HttpRequestState.bs"
import "pkg:/components/Web/WebServer/Http/HttpConnection.bs"
import "pkg:/components/Web/WebServer/Http/HttpUtils.bs" import "pkg:/components/Web/WebServer/Http/HttpUtils.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
import "pkg:/source/utils/UrlUtils.bs" import "pkg:/source/utils/UrlUtils.bs"
@@ -1,3 +1,7 @@
import "pkg:/components/Web/WebServer/Http/HttpConnection.bs"
import "pkg:/components/Web/WebServer/Http/HttpServer.bs"
import "pkg:/components/Web/WebServer/Http/HttpSettings.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/StringUtils.bs" import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/TimeUtils.bs" import "pkg:/source/utils/TimeUtils.bs"
@@ -1,3 +1,9 @@
import "pkg:/components/Web/WebServer/Http/HttpConnection.bs"
import "pkg:/components/Web/WebServer/Http/HttpRequest.bs"
import "pkg:/components/Web/WebServer/Http/HttpResponse.bs"
import "pkg:/source/utils/ErrorUtils.bs"
import "pkg:/source/utils/Logging.bs"
namespace Http namespace Http
class HttpRouter class HttpRouter
@@ -1,3 +1,4 @@
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
namespace Http namespace Http
@@ -1,3 +1,5 @@
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
namespace Http namespace Http
class CorsMiddleware extends HttpRouter class CorsMiddleware extends HttpRouter
@@ -1,4 +1,5 @@
import "EtagUtils.bs" import "EtagUtils.bs"
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
import "pkg:/source/utils/CryptoUtils.bs" import "pkg:/source/utils/CryptoUtils.bs"
import "pkg:/source/utils/StringUtils.bs" import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
@@ -1,3 +1,7 @@
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
namespace Http namespace Http
class EtagUtils class EtagUtils
@@ -1,4 +1,9 @@
import "pkg:/components/Web/WebServer/Http/HttpRequest.bs"
import "pkg:/components/Web/WebServer/Http/HttpResponse.bs"
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/StringUtils.bs" import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
namespace Http namespace Http
@@ -1,6 +1,7 @@
import "pkg:/source/utils/Logging.bs" import "pkg:/source/utils/Logging.bs"
import "WebSocketConnectionState.bs" import "WebSocketConnectionState.bs"
import "WebSocketFrame.bs" import "WebSocketFrame.bs"
import "WebSocketServer.bs"
namespace Web namespace Web
@@ -1,4 +1,7 @@
import "pkg:/components/Web/WebServer/Http/HttpRouter.bs"
import "pkg:/source/utils/CryptoUtils.bs" import "pkg:/source/utils/CryptoUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
namespace Http namespace Http
@@ -81,6 +81,7 @@ auth_playlists:
title: Playlists title: Playlists
url: /api/v1/auth/playlists url: /api/v1/auth/playlists
authenticated: true authenticated: true
paginationType: Continuation
playlist: playlist:
title: Playlist title: Playlist
@@ -1264,5 +1264,9 @@
<source>3D</source> <source>3D</source>
<translation>3D</translation> <translation>3D</translation>
</message> </message>
<message>
<source>Buffering</source>
<translation type="unfinished">Puffert</translation>
</message>
</context> </context>
</TS> </TS>
@@ -36,6 +36,10 @@
<source>OK</source> <source>OK</source>
<translation>OK</translation> <translation>OK</translation>
</message> </message>
<message>
<source>Do not show again</source>
<translation>Do not show again</translation>
</message>
<message> <message>
<source>Activate</source> <source>Activate</source>
<translation>Activate</translation> <translation>Activate</translation>
+1 -1
View File
@@ -3,7 +3,7 @@ title=PlayletLib
# Do not update version manually, it is auto updated from package.json # Do not update version manually, it is auto updated from package.json
major_version=0 major_version=0
minor_version=35 minor_version=35
build_version=00003 build_version=00005
ui_resolutions=hd ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p uri_resolution_autosub=$$RES$$,480p,720p,1080p
@@ -1,3 +1,4 @@
import "pkg:/source/utils/MessagePortUtils.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
namespace CancellationUtils namespace CancellationUtils
@@ -15,7 +16,7 @@ namespace CancellationUtils
return return
end if end if
cancellation.node.ObserveFieldScoped(cancellation.field, messagePort) MessagePortUtils.ObserveFieldScopedExSafe(cancellation.node, cancellation.field, messagePort)
end function end function
function UnobserveCancellationScoped(cancellation as dynamic) as void function UnobserveCancellationScoped(cancellation as dynamic) as void
+1
View File
@@ -14,6 +14,7 @@ namespace Locale
@locale @locale
enum Buttons enum Buttons
OK = "OK" OK = "OK"
DotNotShowAgain = "Do not show again"
Activate = "Activate" Activate = "Activate"
InUse = "In Use" InUse = "In Use"
Login = "Login" Login = "Login"
@@ -8,6 +8,7 @@ namespace RegistryUtils
const SEARCH_HISTORY = "search_history" const SEARCH_HISTORY = "search_history"
const PLAYLET_LIB_URLS = "playlet_lib_urls" const PLAYLET_LIB_URLS = "playlet_lib_urls"
const BOOKMARKS = "bookmarks" const BOOKMARKS = "bookmarks"
const MESSAGES = "messages"
const LAST_LOUNGE_DATA = "last_lounge_data" const LAST_LOUNGE_DATA = "last_lounge_data"
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-web", "name": "playlet-web",
"version": "0.35.3", "version": "0.35.5",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-web", "name": "playlet-web",
"version": "0.35.3", "version": "0.35.5",
"devDependencies": { "devDependencies": {
"@sveltejs/vite-plugin-svelte": "3.1.2", "@sveltejs/vite-plugin-svelte": "3.1.2",
"@tailwindcss/typography": "^0.5.15", "@tailwindcss/typography": "^0.5.15",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-web", "name": "playlet-web",
"version": "0.35.3", "version": "0.35.5",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
@@ -0,0 +1,43 @@
// This plugin validates missing imports in bs files
// The idea is for each script, create a dummy component that only imports the script
// Then the linter will detect if there are undefined symbols not imported in the component.
// There are some false positives, and the approach is "weird", but it works for now.
// Plugin not used by default.
import {
BscFile,
CompilerPlugin,
isBrsFile,
} from 'brighterscript';
import { existsSync } from 'fs-extra';
export class ImportValidationPlugin implements CompilerPlugin {
public name = 'ImportValidationPlugin';
afterFileParse(file: BscFile) {
if (!isBrsFile(file)) {
return
}
// Skip generated files
if (!existsSync(file.srcPath)) {
return;
}
this.generateXmlComponent(file);
}
generateXmlComponent(file: BscFile) {
const path = file.pkgPath;
const name = path.split('/').pop().replace('.bs', '') + `TestComponent${path.length}`;
const content = `<component name="${name}" extends="Node">
<script type="text/brightscript" uri="pkg:/${file.pkgPath}" />
</component>`
file.program.setFile(`${path}.TestComponent.xml`, content);
}
}
export default () => {
return new ImportValidationPlugin();
};
+24
View File
@@ -0,0 +1,24 @@
// Restarts the Roku app
const { ArgumentParser } = require('argparse');
const getEnvVars = require('./get-env-vars');
const config = getEnvVars(['ROKU_DEV_TARGET']);
(async () => {
const parser = new ArgumentParser({
description: 'Restart Roku app using ECP'
});
parser.add_argument('--app-id', { help: 'App Id' });
const args = parser.parse_args();
const appId = args.app_id
const url = `http://${config.ROKU_DEV_TARGET}:8060/launch/${appId}?restart=true`;
console.log("Restarting app", appId);
await fetch(url, {
method: 'POST',
body: '',
});
})();