Compare commits

..
18 Commits
Author SHA1 Message Date
Brahim Hadriche 55bdf2855b Release v0.48.6 (#948) 2026-10-03 17:12:05 -04:00
Brahim Hadriche 725c427eb7 [skip ci] Add telemetry fallback 2026-10-03 17:07:03 -04:00
Brahim Hadriche d453730e3b [skip ci] capture caption and manifest syslog errors separately 2026-10-02 22:09:53 -04:00
sekuso 8be85f2dd0 when invidious returns 403 on authenticated request, inspect error be… (#944)
* when invidious returns 403 on authenticated request, inspect error before determining if it's fatal for the user token

* simplifying with ibicha's !945 edits - no more followup request to subs endpoint to verify token, just pass if 403 fails for some unk reason
2026-10-02 21:51:43 -04:00
Brahim Hadriche 3dab7b5069 Fixed missing shows, seasons, courses and stations (except paid ones) 2026-10-01 08:37:14 -04:00
Brahim Hadriche e93f9a02c2 [chore] update dependencies (#938)
* update dependencies

* no message
2026-09-29 14:47:11 -04:00
Brahim Hadriche 37a1fffb8d Release v0.48.5 (#943) 2026-09-29 14:06:52 -04:00
Brahim Hadriche 6ae6f6cb68 Fixed issue with start up tasks that might have caused "Failed to fetch session data" errors. 2026-09-26 20:03:51 -04:00
Brahim Hadriche 510d81b872 Release v0.48.4 (#942) 2026-09-24 18:55:56 -04:00
Brahim Hadriche ebabb6ca99 Audio track fix 2026-09-24 16:37:42 -04:00
Brahim Hadriche 1678bee3b5 [chore] update dependencies (#927)
* update dependencies

* Few updates
2026-09-09 15:36:51 -04:00
Brahim Hadriche c055260023 [skip ci] License related fixes
remove wrong license comment - https://github.com/FortAwesome/Font-Awesome/issues/19191
Add MIT notice for qrcode
2026-08-25 20:32:47 -04:00
Brahim Hadriche e0f5c9691b Filter out search tiles 2026-08-19 11:53:58 -04:00
Brahim Hadriche 9da9bdf06f [skip ci] ci fix 2026-08-15 10:24:54 -04:00
Brahim Hadriche fea1c22aa9 [skip ci] prevent crashes on older pinned versions of playlet-lib 2026-08-12 18:47:59 -04:00
Brahim Hadriche 48b10e8618 [skip ci] small fixes 2026-08-02 09:42:41 -04:00
Brahim Hadriche 7286c099a0 http client telemetry fix 2026-07-30 15:30:54 -04:00
Brahim Hadriche f29b0f0af8 [skip ci] onkeyevent test for player 2026-07-30 14:00:20 -04:00
44 changed files with 1698 additions and 2549 deletions

No files matched your search

+1
View File
@@ -8,6 +8,7 @@ on:
jobs: jobs:
update_wiki_stats: update_wiki_stats:
runs-on: ubuntu-latest runs-on: ubuntu-latest
timeout-minutes: 20
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 uses: actions/checkout@v4
+19
View File
@@ -5,6 +5,25 @@ 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.48.6] - 2026-10-03
### Fixed
- Missing shows, seasons, courses and stations (except paid ones)
- Keep Invidious profiles signed in when a 403 does not report a known authentication error
## [0.48.5] - 2026-09-29
### Fixed
- Issue with start up tasks that might have caused "Failed to fetch session data" errors.
## [0.48.4] - 2026-09-24
### Fixed
- Default audio track is now the regular audio instead of "Voice Boost" or "Stable Volume", which are now separate tracks
## [0.48.3] - 2026-07-28 ## [0.48.3] - 2026-07-28
### Fixed ### Fixed
+1
View File
@@ -15,6 +15,7 @@
1010 1010
], ],
"diagnosticLevel": "hint", "diagnosticLevel": "hint",
"minFirmwareVersion": "11.5.0",
// The validation regex rules are validated using the validation-plugin.ts plugin // The validation regex rules are validated using the validation-plugin.ts plugin
"validation": [ "validation": [
{ {
+379 -1950
View File
File diff suppressed because it is too large. Load diff
+15 -21
View File
@@ -1,39 +1,37 @@
{ {
"name": "playlet", "name": "playlet",
"version": "0.48.3", "version": "0.48.6",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"devDependencies": { "devDependencies": {
"@rokucommunity/bslint": "^0.8.44", "@rokucommunity/bslint": "^0.8.46",
"@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": "^26.1.1", "@types/node": "^26.6.3",
"@types/xml2js": "^0.4.14", "@types/xml2js": "^0.4.14",
"argparse": "^3.0.0", "argparse": "^3.0.2",
"brighterscript": "0.73.0", "brighterscript": "0.73.5",
"brighterscript-formatter": "^1.8.1", "brighterscript-formatter": "^1.8.3",
"convert-svg-to-png": "^0.7.1", "convert-svg-to-png": "^0.7.1",
"crypto-js": "^4.2.0", "crypto-js": "^4.2.0",
"dotenv": "^17.4.2", "dotenv": "^18.0.4",
"fs-extra": "^11.4.0", "fs-extra": "^11.4.1",
"glob": "^13.0.6", "glob": "^13.0.6",
"imap": "^0.8.19", "imap": "^0.8.19",
"ip": "^2.0.1", "ip": "^2.0.1",
"json5": "^2.2.3", "json5": "^2.2.3",
"mailparser": "^3.9.14", "mailparser": "^3.9.28",
"protocol-buffers-schema": "^3.6.1", "protocol-buffers-schema": "^3.6.1",
"puppeteer": "^25.3.0", "roku-deploy": "^3.18.4",
"roku-deploy": "^3.18.2",
"roku-test-automation": "^2.2.2", "roku-test-automation": "^2.2.2",
"rooibos-roku": "5.16.4", "rooibos-roku": "5.16.5",
"rounded-rect-9patch": "^1.1.2",
"semver": "^7.8.5", "semver": "^7.8.5",
"shelljs": "^0.10.0", "shelljs": "^0.10.0",
"telnet-client": "^2.2.13", "telnet-client": "^2.2.14",
"ts-node": "^10.9.2", "ts-node": "^10.9.2",
"typescript": "6.0.3", "typescript": "6.0.3",
"xml2js": "^0.6.2", "xml2js": "^0.6.2",
"yaml": "^2.9.0", "yaml": "^2.9.1",
"youtubei.js": "^17.2.0" "youtubei.js": "^18.1.0"
}, },
"engines": { "engines": {
"node": "22" "node": "22"
@@ -68,20 +66,16 @@
"test:integration:player": "npx tsx ./integration-tests/vpd-run-player.ts", "test:integration:player": "npx tsx ./integration-tests/vpd-run-player.ts",
"version-sync": "node tools/version-sync.js", "version-sync": "node tools/version-sync.js",
"manifest-git-hash": "node tools/update-manifest-git-hash.js", "manifest-git-hash": "node tools/update-manifest-git-hash.js",
"sign-released-package": "node tools/sign-released-package.js",
"screenshot": "node tools/screenshot.js", "screenshot": "node tools/screenshot.js",
"convert-images": "node tools/convert-images.js", "convert-images": "node tools/convert-images.js",
"update-rale-component": "cd tools/RALE && rm TrackerTask.xml && curl -o TrackerTask.zip https://devtools.web.roku.com/roku-advanced-layout-editor/app/TrackerTask.zip && unzip TrackerTask.zip && rm TrackerTask.zip", "update-rale-component": "cd tools/RALE && rm TrackerTask.xml && curl -o TrackerTask.zip https://devtools.web.roku.com/roku-advanced-layout-editor/app/TrackerTask.zip && unzip TrackerTask.zip && rm TrackerTask.zip",
"postinstall": "cd playlet-lib && npm install && cd ../playlet-app && npm install && cd ../playground && npm install && cd ../playlet-web && npm install", "postinstall": "cd playlet-lib && npm install && cd ../playlet-app && npm install && cd ../playground && npm install && cd ../playlet-web && npm install",
"update-deps": "npx npm-check-updates --deep --upgrade --install always --reject typescript,svelte-preprocess", "update-deps": "npx npm-check-updates --deep --upgrade --install always --reject typescript",
"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", "restart-app": "node tools/restart-app.js",
"check-for-updates": "node tools/check-for-updates.js", "check-for-updates": "node tools/check-for-updates.js",
"shutdown": "node tools/shutdown.js" "shutdown": "node tools/shutdown.js"
},
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "^4.62.2"
} }
} }
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-app", "name": "playlet-app",
"version": "0.48.3", "version": "0.48.6",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-app", "name": "playlet-app",
"version": "0.48.3" "version": "0.48.6"
} }
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-app", "name": "playlet-app",
"version": "0.48.3", "version": "0.48.6",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"scripts": { "scripts": {
"prebuild": "node ../tools/rm.js ../build/playlet-app", "prebuild": "node ../tools/rm.js ../build/playlet-app",
+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=48 minor_version=48
build_version=00003 build_version=00006
ui_resolutions=hd ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p uri_resolution_autosub=$$RES$$,480p,720p,1080p
+1
View File
@@ -23,6 +23,7 @@ function Main(args as object) as void
Registry.ClearPlayletLibUrlsIfNeeded(args) Registry.ClearPlayletLibUrlsIfNeeded(args)
Registry.ClearRegistryIfNeeded(args) Registry.ClearRegistryIfNeeded(args)
Registry.ClearUnsupportedPlayletLibUrls()
scene = screen.CreateScene("BootstrapScene") scene = screen.CreateScene("BootstrapScene")
screen.show() screen.show()
+37
View File
@@ -0,0 +1,37 @@
namespace PlayletLibUrls
const RELEASE_URL_PATTERN = "^https://github\.com/iBicha/playlet/releases/download/v(\d+\.\d+\.\d+)/"
' v0.11.0 is the first release without HomeGridScreen, which still crashes on the devices
' pinned to v0.7.0 - v0.10.3.
const MIN_VERSION = "0.11.0"
function IsUnsupported(entry as object) as boolean
matches = CreateObject("roRegex", RELEASE_URL_PATTERN, "").Match(entry.link)
if matches.Count() <> 2
return false
end if
return CompareVersions(matches[1], MIN_VERSION) < 0
end function
function CompareVersions(left as string, right as string) as integer
leftParts = left.Tokenize(".")
rightParts = right.Tokenize(".")
for i = 0 to leftParts.Count() - 1
leftPart = leftParts[i].ToInt()
rightPart = rightParts[i].ToInt()
if leftPart < rightPart
return -1
end if
if leftPart > rightPart
return 1
end if
end for
return 0
end function
end namespace
@@ -0,0 +1,61 @@
namespace Tests
@suite
class PlayletLibUrlsTests extends Rooibos.BaseTestSuite
@describe("PlayletLibUrls.IsUnsupported")
@it("reports a tagged release below the minimum version")
@params("https://github.com/iBicha/playlet/releases/download/v0.7.0/playlet-lib.zip")
@params("https://github.com/iBicha/playlet/releases/download/v0.9.0/playlet-lib.zip")
@params("https://github.com/iBicha/playlet/releases/download/v0.10.3/playlet-lib.zip")
@params("https://github.com/iBicha/playlet/releases/download/v0.10.3/playlet-lib.squashfs.pkg")
function _(link as string)
m.assertTrue(PlayletLibUrls.IsUnsupported({ type: "custom", link: link }))
end function
@it("reports nothing for a tagged release at or above the minimum version")
@params("https://github.com/iBicha/playlet/releases/download/v0.11.0/playlet-lib.zip")
@params("https://github.com/iBicha/playlet/releases/download/v0.11.1/playlet-lib.zip")
@params("https://github.com/iBicha/playlet/releases/download/v0.48.3/playlet-lib.squashfs.pkg")
@params("https://github.com/iBicha/playlet/releases/download/v1.0.0/playlet-lib.zip")
function _(link as string)
m.assertFalse(PlayletLibUrls.IsUnsupported({ type: "custom", link: link }))
end function
@it("reports nothing for a url that carries no version")
@params("https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip")
@params("https://github.com/iBicha/playlet/releases/download/canary/playlet-lib.zip")
@params("https://github.com/iBicha/playlet/releases/download/0.10.3/playlet-lib.zip")
@params("http://192.168.1.10:8888/playlet-lib.zip")
@params("pkg:/lib/playlet-lib.zip")
@params("")
function _(link as string)
m.assertFalse(PlayletLibUrls.IsUnsupported({ type: "custom", link: link }))
end function
@describe("PlayletLibUrls.CompareVersions")
@it("reports the same version as equal")
function _()
m.assertEqual(PlayletLibUrls.CompareVersions("0.11.0", "0.11.0"), 0)
end function
@it("orders by the first part that differs")
@params("0.10.3", "0.11.0")
@params("0.11.0", "0.11.1")
@params("0.11.0", "1.0.0")
function _(older as string, newer as string)
m.assertEqual(PlayletLibUrls.CompareVersions(older, newer), -1)
m.assertEqual(PlayletLibUrls.CompareVersions(newer, older), 1)
end function
@it("compares parts as numbers, not text")
function _()
m.assertEqual(PlayletLibUrls.CompareVersions("0.9.0", "0.11.0"), -1)
m.assertEqual(PlayletLibUrls.CompareVersions("0.11.0", "0.9.0"), 1)
end function
end class
end namespace
+19
View File
@@ -1,3 +1,5 @@
import "pkg:/source/PlayletLibUrls.bs"
namespace Registry namespace Registry
function ReadKey(key as string, section as string) as dynamic function ReadKey(key as string, section as string) as dynamic
@@ -41,6 +43,23 @@ namespace Registry
Logger.Log("Cleared key playlet_lib_urls from registry") Logger.Log("Cleared key playlet_lib_urls from registry")
end function end function
' BootstrapScene's load-failure fallback never reaches a pinned lib that loads and then
' crashes, so the device stays on it across every channel update.
function ClearUnsupportedPlayletLibUrls() as void
urls = GetPlayletLibUrlsFromRegistry()
if urls = invalid
return
end if
for each entry in urls
if PlayletLibUrls.IsUnsupported(entry)
DeleteKey("playlet_lib_urls", "Playlet")
Logger.Log(`Cleared key playlet_lib_urls from registry: ${entry.link} is no longer supported`)
return
end if
end for
end function
function ClearRegistryIfNeeded(launchArgs as object) as void function ClearRegistryIfNeeded(launchArgs as object) as void
if launchArgs = invalid or launchArgs.clearRegistry = invalid if launchArgs = invalid or launchArgs.clearRegistry = invalid
return return
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.48.3", "version": "0.48.6",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.48.3" "version": "0.48.6"
} }
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.48.3", "version": "0.48.6",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"scripts": { "scripts": {
"prebuild": "node ../tools/rm.js ../build/playlet-lib", "prebuild": "node ../tools/rm.js ../build/playlet-lib",
@@ -2,51 +2,20 @@ import "pkg:/source/utils/MessagePortUtils.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
function Init() function Init()
m.jobQueueTaskReady = false
m.jobQueueTask = CreateObject("roSGNode", "JobQueueTask") m.jobQueueTask = CreateObject("roSGNode", "JobQueueTask")
m.jobQueueTask.observeFieldScoped("ready", FuncName(OnJobQueueTaskReady))
m.jobQueueTask.control = "run"
m.top.observeField("shutdown", FuncName(OnShutdown)) m.top.observeField("shutdown", FuncName(OnShutdown))
m.top.observeField("request", FuncName(OnRequest)) m.top.observeField("request", FuncName(OnRequest))
end function m.jobQueueTask.control = "run"
function OnJobQueueTaskReady(event as object) as void
jobQueueTask = event.getRoSGNode()
jobQueueTask.unobserveFieldScoped("ready")
m.jobQueueTaskReady = true
pendingRequestEvents = m.pendingRequestEvents
if pendingRequestEvents = invalid
return
end if
m.pendingRequestEvents = invalid
for each requestEvent in pendingRequestEvents
OnRequest(requestEvent)
end for
end function end function
function OnShutdown() as void function OnShutdown() as void
m.top.unobserveField("shutdown") m.top.unobserveField("shutdown")
m.top.unobserveField("request") m.top.unobserveField("request")
m.jobQueueTaskReady = false
m.jobQueueTask.unobserveField("ready")
m.jobQueueTask.shutdown = true m.jobQueueTask.shutdown = true
m.jobQueueTask = invalid m.jobQueueTask = invalid
m.pendingRequestEvents = invalid
end function end function
function OnRequest(event as object) as void function OnRequest(event as object) as void
if not m.jobQueueTaskReady
if m.pendingRequestEvents = invalid
m.pendingRequestEvents = []
end if
m.pendingRequestEvents.push(event)
LogWarnNoTelemetry("JobQueue: Job queue task is not ready, request will be queued")
return
end if
request = event.getData() request = event.getData()
if not IsAssociativeArray(request) if not IsAssociativeArray(request)
LogError("JobQueue: Invalid request data", request) LogError("JobQueue: Invalid request data", request)
@@ -9,65 +9,57 @@ import "pkg:/source/utils/StringUtils.bs"
const MAX_JOB_TASK_COUNT = 30 const MAX_JOB_TASK_COUNT = 30
' Minimum number of JobTasks that will be kept alive ' Minimum number of JobTasks that will be kept alive
const MIN_JOB_TASK_COUNT = 2 const MIN_JOB_TASK_COUNT = 2
' Time in milliseconds to wait before scaling down JobTasks ' Time in milliseconds without a message before scaling down JobTasks
const SCALE_DOWN_THRESHOLD_MS = 10000 const SCALE_DOWN_THRESHOLD_MS = 10000
' wait() sometimes isn't woken by a new message (seen on device); the next wait() returns it
const POLL_MS = 1000
' Missed requests cluster right after start (measured): check the port more often then
const STARTUP_WINDOW_MS = 2000
const STARTUP_POLL_MS = 100
function Init() function Init()
m.top.functionName = "JobQueueTaskLoop" m.top.functionName = "JobQueueTaskLoop"
m.port = CreateObject("roMessagePort")
m.top.observeField("shutdown", m.port)
m.top.observeField("request", m.port)
end function end function
function JobQueueTaskLoop() as void function JobQueueTaskLoop() as void
messagePort = CreateObject("roMessagePort") port = m.port
m.top.observeField("shutdown", messagePort)
m.top.observeField("request", messagePort)
m.top.ready = true
m.busyJobTasks = {} m.busyJobTasks = {}
m.idleJobTasks = [] m.idleJobTasks = []
requests = [] requests = []
startup = CreateObject("roTimespan")
scaleDownTimer = CreateObject("roTimespan")
while true while true
while requests.count() > 0 while requests.Count() > 0 and m.idleJobTasks.Count() > 0
if m.idleJobTasks.Count() > 0 ScheduleRequest(requests.Shift(), m.idleJobTasks.Pop())
ScheduleRequest(requests.Shift(), m.idleJobTasks.Pop())
continue while
end if
if m.idleJobTasks.Count() + m.busyJobTasks.Count() < MAX_JOB_TASK_COUNT
LogDebug("Creating a new JobTask. Idle:", m.idleJobTasks.Count(), ", Busy:", m.busyJobTasks.Count())
jobTask = CreateObject("roSGNode", "JobTask")
jobTaskId = "JobTask-" + StringUtils.RandomId()
jobTask.id = jobTaskId
jobTaskObject = {
id: jobTaskId
node: jobTask
}
m.busyJobTasks[jobTaskId] = jobTaskObject
MessagePortUtils.ObserveFieldScopedExSafe(jobTask, "ready", messagePort)
jobTask.control = "run"
else
#if DEBUG
LogWarnNoTelemetry("Cannot create new JobTask. Idle:", m.idleJobTasks.Count(), ", Busy:", m.busyJobTasks.Count())
#end if
end if
exit while
end while end while
scaleDownThresholdMs = m.idleJobTasks.Count() > MIN_JOB_TASK_COUNT ? SCALE_DOWN_THRESHOLD_MS : 0 if requests.Count() > 0 and m.idleJobTasks.Count() + m.busyJobTasks.Count() < MAX_JOB_TASK_COUNT
message = wait(scaleDownThresholdMs, messagePort) StartJobTask(requests.Shift(), port)
end if
waitMs = POLL_MS
if startup.TotalMilliseconds() < STARTUP_WINDOW_MS
waitMs = STARTUP_POLL_MS
end if
message = wait(waitMs, port)
if message = invalid if message = invalid
if m.idleJobTasks.Count() > 0 if m.idleJobTasks.Count() > MIN_JOB_TASK_COUNT and scaleDownTimer.TotalMilliseconds() >= SCALE_DOWN_THRESHOLD_MS
jobTaskObject = m.idleJobTasks.Pop() jobTaskObject = m.idleJobTasks.Pop()
jobTaskObject.node.UnobserveFieldScoped("ready") jobTaskObject.node.UnobserveFieldScoped("ready")
jobTaskObject.node.shutdown = true jobTaskObject.node.shutdown = true
LogDebug("Scaled down JobTasks. Idle:", m.idleJobTasks.Count(), ", Busy:", m.busyJobTasks.Count()) LogDebug("Scaled down JobTasks. Idle:", m.idleJobTasks.Count(), ", Busy:", m.busyJobTasks.Count())
scaleDownTimer.Mark()
end if end if
continue while continue while
end if end if
scaleDownTimer.Mark()
messageType = Type(message) messageType = Type(message)
if messageType = "roSGNodeEvent" if messageType = "roSGNodeEvent"
@@ -89,16 +81,32 @@ function JobQueueTaskLoop() as void
end while end while
end function end function
function StartJobTask(request as object, port as object) as void
LogDebug("Creating a new JobTask. Idle:", m.idleJobTasks.Count(), ", Busy:", m.busyJobTasks.Count())
jobTask = CreateObject("roSGNode", "JobTask")
jobTaskId = "JobTask-" + StringUtils.RandomId()
jobTask.id = jobTaskId
jobTaskObject = {
id: jobTaskId
node: jobTask
}
MessagePortUtils.ObserveFieldScopedExSafe(jobTask, "ready", port)
' Set the request before starting the task: its first wait() then returns it right away,
' with no wakeup to miss.
ScheduleRequest(request, jobTaskObject)
jobTask.control = "run"
end function
function ScheduleRequest(request as dynamic, jobTaskObject as dynamic) function ScheduleRequest(request as dynamic, jobTaskObject as dynamic)
m.busyJobTasks[jobTaskObject.id] = jobTaskObject m.busyJobTasks[jobTaskObject.id] = jobTaskObject
jobTaskObject.node.request = request jobTaskObject.node.request = request
end function end function
function Shutdown() function Shutdown()
m.top.UnobserveFieldScoped("request") m.top.UnobserveField("request")
m.top.UnobserveFieldScoped("shutdown") m.top.UnobserveField("shutdown")
m.top.request = invalid m.top.request = invalid
m.top.ready = false
for each jobTaskId in m.busyJobTasks for each jobTaskId in m.busyJobTasks
jobTask = m.busyJobTasks[jobTaskId] jobTask = m.busyJobTasks[jobTaskId]
@@ -2,6 +2,5 @@
<interface> <interface>
<field id="request" type="assocarray" /> <field id="request" type="assocarray" />
<field id="shutdown" type="boolean" /> <field id="shutdown" type="boolean" />
<field id="ready" type="boolean" />
</interface> </interface>
</component> </component>
@@ -2,20 +2,21 @@ import "pkg:/components/JobSystem/JobRequest.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"
' wait() sometimes isn't woken by a new message (seen on device); the next wait() returns it
const POLL_MS = 1000
function Init() function Init()
m.top.functionName = "JobTaskLoop" m.top.functionName = "JobTaskLoop"
m.port = CreateObject("roMessagePort")
m.top.observeField("shutdown", m.port)
m.top.observeField("request", m.port)
end function end function
function JobTaskLoop() as void function JobTaskLoop() as void
msgPort = CreateObject("roMessagePort") port = m.port
m.top.observeField("shutdown", msgPort)
m.top.observeField("request", msgPort)
m.top.ready = true
while true while true
msg = wait(0, msgPort) msg = wait(POLL_MS, port)
msgType = type(msg) msgType = type(msg)
if msgType = "roSGNodeEvent" if msgType = "roSGNodeEvent"
+27 -2
View File
@@ -8,6 +8,13 @@ const FILENAME = "app_logs.txt"
const FILENAME_PREVIOUS = "app_logs_previous.txt" const FILENAME_PREVIOUS = "app_logs_previous.txt"
const FILENAME_STARTUP = "cachefs:/playlet_startup_logs.txt" const FILENAME_STARTUP = "cachefs:/playlet_startup_logs.txt"
enum SysLogUrlType
Captions = "captions"
VideoPlayback = "videoplayback"
Manifest = "manifest"
Other = "other"
end enum
function Init() function Init()
m.top.functionName = "LoggerLoop" m.top.functionName = "LoggerLoop"
@@ -125,9 +132,10 @@ function OnLineSysLog(event as object, dateTime as object, logsFile as string, b
buffer.FromAsciiString(line + `\n`) buffer.FromAsciiString(line + `\n`)
buffer.AppendFile(logsFile) buffer.AppendFile(logsFile)
fingerprint = `SysLog${info.Status}${info.LogType}${httpCode}${info.Method}` urlType = GetSysLogUrlType(info.OrigUrl)
fingerprint = `SysLog-${urlType}-${info.Status}-${info.LogType}-${httpCode}-${info.Method}`
if ThrottleEvent("SysLogError", fingerprint, 60) if ThrottleEvent("SysLogError" + urlType, fingerprint, 60)
return return
end if end if
@@ -138,6 +146,23 @@ function OnLineSysLog(event as object, dateTime as object, logsFile as string, b
}) })
end function end function
function GetSysLogUrlType(url as dynamic) as string
if not IsString(url)
return SysLogUrlType.Other
end if
if url.InStr("/api/timedtext") <> -1 or url.InStr("/api/v1/captions/") <> -1
return SysLogUrlType.Captions
end if
if url.InStr("/videoplayback") <> -1 or url.InStr("/api/dash/live-seg") <> -1
return SysLogUrlType.VideoPlayback
end if
if url.InStr("/api/manifest/") <> -1 or url.InStr("/api/dash") <> -1 or url.InStr("/api/hls") <> -1
return SysLogUrlType.Manifest
end if
return SysLogUrlType.Other
end function
function OnLineLogMonitorMemoryWarning(event as object, dateTime as object, logsFile as string, buffer as object) as void function OnLineLogMonitorMemoryWarning(event as object, dateTime as object, logsFile as string, buffer as object) as void
info = event.getInfo() info = event.getInfo()
message = "[WARN][AppMonitorMemory] " + ToString(info) message = "[WARN][AppMonitorMemory] " + ToString(info)
@@ -255,6 +255,7 @@ class DashManifest
xtagsInfo = m.GetXtagsInfo(format) xtagsInfo = m.GetXtagsInfo(format)
format.xtagsInfo = xtagsInfo format.xtagsInfo = xtagsInfo
format.isDrc = xtagsInfo.isDrc format.isDrc = xtagsInfo.isDrc
format.isVoiceBoost = xtagsInfo.isVoiceBoost
format.isDubbed = xtagsInfo.isDubbed format.isDubbed = xtagsInfo.isDubbed
format.isAutoDubbed = xtagsInfo.isAutoDubbed format.isAutoDubbed = xtagsInfo.isAutoDubbed
format.isDescriptive = xtagsInfo.isDescriptive format.isDescriptive = xtagsInfo.isDescriptive
@@ -277,12 +278,7 @@ class DashManifest
audioTrackId = format.audioTrack.id audioTrackId = format.audioTrack.id
end if end if
drc = "" groupId = `${mimeType}-${justCodec}-${colorInfo}-${audioTrackId}${m.GetAudioVariantSuffix(format)}`
if format.isDrc = true
drc = "drc"
end if
groupId = `${mimeType}-${justCodec}-${colorInfo}-${audioTrackId}-${drc}`
if groupInfo[groupId] = invalid if groupInfo[groupId] = invalid
groupInfo[groupId] = [] groupInfo[groupId] = []
@@ -441,7 +437,7 @@ class DashManifest
end for end for
end if end if
if IsAssociativeArray(firstFormat.audioTrack) or firstFormat.isDrc = true if IsAssociativeArray(firstFormat.audioTrack) or firstFormat.isDrc = true or firstFormat.isVoiceBoost = true
' Roles ' Roles
roles = m.GetTrackRoles(firstFormat) roles = m.GetTrackRoles(firstFormat)
for each role in roles for each role in roles
@@ -474,9 +470,7 @@ class DashManifest
if IsAssociativeArray(stream.audioTrack) and IsString(stream.audioTrack.id) if IsAssociativeArray(stream.audioTrack) and IsString(stream.audioTrack.id)
representationId = `${representationId}-${stream.audioTrack.id}` representationId = `${representationId}-${stream.audioTrack.id}`
end if end if
if stream.isDrc = true representationId = `${representationId}${m.GetAudioVariantSuffix(stream)}`
representationId = `${representationId}-drc`
end if
representationAttributes = { representationAttributes = {
"id": representationId "id": representationId
@@ -739,7 +733,10 @@ class DashManifest
function GetTrackRoles(format as object) as object function GetTrackRoles(format as object) as object
roles = [] roles = []
if format.isOriginal = true ' Within the preferred language, the device defaults to a "main" track (a set
' without a Role counts as main) regardless of bitrate or manifest order.
' Stable Volume and Voice Boost are opt-in re-mixes of the original.
if format.isOriginal = true and format.isDrc <> true and format.isVoiceBoost <> true
roles.Push("main") roles.Push("main")
else else
roles.Push("alternate") roles.Push("alternate")
@@ -753,13 +750,28 @@ class DashManifest
roles.Push("description") roles.Push("description")
end if end if
if format.isDrc = true ' The device's audio menu ignores Label: it lists tracks by language, and this
' role is what shows a same-language variant separately, as "Enhanced audio".
if format.isVoiceBoost = true
roles.Push("enhanced-audio-intelligibility") roles.Push("enhanced-audio-intelligibility")
end if end if
return roles return roles
end function end function
' Stable Volume and Voice Boost are re-mixes of the same itag: without the suffix
' they share an AdaptationSet (and Representation ids) with the regular mix.
function GetAudioVariantSuffix(format as object) as string
suffix = ""
if format.isDrc = true
suffix = `${suffix}-drc`
end if
if format.isVoiceBoost = true
suffix = `${suffix}-vb`
end if
return suffix
end function
function GenerateImageAdaptationSets(xml as object, storyboards as object, id as integer) as integer function GenerateImageAdaptationSets(xml as object, storyboards as object, id as integer) as integer
' https://developer.roku.com/en-ca/docs/developer-program/media-playback/trick-mode/hls-and-dash.md#dash-standard-thumbnail-tiles ' https://developer.roku.com/en-ca/docs/developer-program/media-playback/trick-mode/hls-and-dash.md#dash-standard-thumbnail-tiles
for i = storyboards.Count() - 1 to 0 step -1 for i = storyboards.Count() - 1 to 0 step -1
@@ -885,6 +897,7 @@ class DashManifest
lang: "" lang: ""
acont: "" acont: ""
isDrc: false isDrc: false
isVoiceBoost: false
isDubbed: false isDubbed: false
isAutoDubbed: false isAutoDubbed: false
isDescriptive: false isDescriptive: false
@@ -921,6 +934,8 @@ class DashManifest
result.acont = tags[key] result.acont = tags[key]
else if key = "drc" and tags[key] = "1" else if key = "drc" and tags[key] = "1"
result.isDrc = true result.isDrc = true
else if key = "vb" and tags[key] = "1"
result.isVoiceBoost = true
end if end if
end for end for
@@ -1084,18 +1084,25 @@ namespace Innertube
function ParseLockupViewModel(nodeData as object, context as object) as object function ParseLockupViewModel(nodeData as object, context as object) as object
contentType = ValidString(nodeData["contentType"]) contentType = ValidString(nodeData["contentType"])
if contentType = "LOCKUP_CONTENT_TYPE_VIDEO" if contentType = "LOCKUP_CONTENT_TYPE_VIDEO" or contentType = "LOCKUP_CONTENT_TYPE_MOVIE"
return LockupViewModelTypeVideo(nodeData, context) return LockupViewModelTypeVideo(nodeData, context)
else if contentType = "LOCKUP_CONTENT_TYPE_SHORT" else if contentType = "LOCKUP_CONTENT_TYPE_SHORT"
return LockupViewModelTypeShort(nodeData, context) return LockupViewModelTypeShort(nodeData, context)
else if contentType = "LOCKUP_CONTENT_TYPE_PLAYLIST" else if contentType = "LOCKUP_CONTENT_TYPE_PLAYLIST" or contentType = "LOCKUP_CONTENT_TYPE_PODCAST" or contentType = "LOCKUP_CONTENT_TYPE_ALBUM"
return LockupViewModelTypePlaylist(nodeData, context) return LockupViewModelTypePlaylist(nodeData, context)
else if contentType = "LOCKUP_CONTENT_TYPE_PODCAST" else if contentType = "LOCKUP_CONTENT_TYPE_SHOW" or contentType = "LOCKUP_CONTENT_TYPE_SEASON" or contentType = "LOCKUP_CONTENT_TYPE_COURSE" or contentType = "LOCKUP_CONTENT_TYPE_STATION"
return LockupViewModelTypePodcast(nodeData, context) ' For these content types the tap target, not the type, says what the item is: a show or season
else if contentType = "LOCKUP_CONTENT_TYPE_ALBUM" ' is a creator playlist or a paid Movies & TV title, a station is a live stream or a YouTube Music playlist.
return LockupViewModelTypeAlbum(nodeData, context) contentId = ValidString(nodeData["contentId"])
else if contentType = "LOCKUP_CONTENT_TYPE_MOVIE" command = ObjectUtils.Dig(nodeData, ["rendererContext", "commandContext", "onTap", "innertubeCommand"])
return LockupViewModelTypeVideo(nodeData, context) if contentId <> ""
if ValidString(ObjectUtils.Dig(command, ["watchEndpoint", "videoId"])) = contentId
return LockupViewModelTypeVideo(nodeData, context)
end if
if ValidString(ObjectUtils.Dig(command, ["watchEndpoint", "playlistId"])) = contentId or ValidString(ObjectUtils.Dig(command, ["watchPlaylistEndpoint", "playlistId"])) = contentId or ValidString(ObjectUtils.Dig(command, ["browseEndpoint", "browseId"])) = "VL" + contentId
return LockupViewModelTypePlaylist(nodeData, context)
end if
end if
end if end if
Warning(`Unknown content type: ${contentType}`, nodeData, context) Warning(`Unknown content type: ${contentType}`, nodeData, context)
@@ -1109,7 +1116,7 @@ namespace Innertube
end function end function
' The badge overlay has two shapes: thumbnailOverlayBadgeViewModel.thumbnailBadges (older, still ' The badge overlay has two shapes: thumbnailOverlayBadgeViewModel.thumbnailBadges (older, still
' used on playlist/podcast/album lockups) and thumbnailBottomOverlayViewModel.badges (video lockups) ' used on playlist lockups) and thumbnailBottomOverlayViewModel.badges (video lockups)
function ParseThumbnailBadge(thumbnailViewModel as object) as object function ParseThumbnailBadge(thumbnailViewModel as object) as object
overlays = ObjectUtils.Dig(thumbnailViewModel, ["overlays"]) overlays = ObjectUtils.Dig(thumbnailViewModel, ["overlays"])
if not IsArray(overlays) if not IsArray(overlays)
@@ -1161,7 +1168,12 @@ namespace Innertube
metadata = ObjectUtils.Dig(nodeData, ["metadata", "lockupMetadataViewModel"]) metadata = ObjectUtils.Dig(nodeData, ["metadata", "lockupMetadataViewModel"])
title = ObjectUtils.Dig(metadata, ["title", "content"]) title = ObjectUtils.Dig(metadata, ["title", "content"])
thumbnailViewModel = ObjectUtils.Dig(nodeData, ["contentImage", "thumbnailViewModel"]) contentImage = nodeData["contentImage"]
thumbnailViewModel = ObjectUtils.Dig(contentImage, ["thumbnailViewModel"])
if thumbnailViewModel = invalid
' Station lockups frame their live stream as a collection
thumbnailViewModel = ObjectUtils.Dig(contentImage, ["collectionThumbnailViewModel", "primaryThumbnail", "thumbnailViewModel"])
end if
if context.generateVideoThumbnails = true if context.generateVideoThumbnails = true
videoThumbnails = GenerateVideoThumbnails(videoId) videoThumbnails = GenerateVideoThumbnails(videoId)
@@ -1330,76 +1342,6 @@ namespace Innertube
return invalid return invalid
end function end function
function LockupViewModelTypePodcast(nodeData as object, context as object) as object
playlistId = nodeData["contentId"]
if not IsString(playlistId)
Warning("Invalid playlist ID in lockupViewModelTypePodcast", nodeData, context)
return invalid
end if
metadata = ObjectUtils.Dig(nodeData, ["metadata", "lockupMetadataViewModel"])
title = ObjectUtils.Dig(metadata, ["title", "content"])
thumbnailViewModel = ObjectUtils.Dig(nodeData, ["contentImage", "collectionThumbnailViewModel", "primaryThumbnail", "thumbnailViewModel"])
thumbnail = ObjectUtils.Dig(thumbnailViewModel, ["image", "sources", 0, "url"])
videoCountText = GetThumbnailBadgeText(thumbnailViewModel)
author = invalid
authorId = invalid
if IsString(context.currentAuthor) and IsString(context.currentAuthorId)
author = context.currentAuthor
authorId = context.currentAuthorId
end if
playlist = {
"type": "playlist"
"playlistId": playlistId
"title": title
"author": author
"authorId": authorId
"playlistThumbnail": thumbnail
"videoCountText": videoCountText
}
PushFeedItem(playlist, context)
return invalid
end function
function LockupViewModelTypeAlbum(nodeData as object, context as object) as object
playlistId = nodeData["contentId"]
if not IsString(playlistId)
Warning("Invalid playlist ID in lockupViewModelTypeAlbum", nodeData, context)
return invalid
end if
metadata = ObjectUtils.Dig(nodeData, ["metadata", "lockupMetadataViewModel"])
title = ObjectUtils.Dig(metadata, ["title", "content"])
thumbnailViewModel = ObjectUtils.Dig(nodeData, ["contentImage", "collectionThumbnailViewModel", "primaryThumbnail", "thumbnailViewModel"])
thumbnail = ObjectUtils.Dig(thumbnailViewModel, ["image", "sources", 0, "url"])
videoCountText = GetThumbnailBadgeText(thumbnailViewModel)
author = invalid
authorId = invalid
if IsString(context.currentAuthor) and IsString(context.currentAuthorId)
author = context.currentAuthor
authorId = context.currentAuthorId
end if
playlist = {
"type": "playlist"
"playlistId": playlistId
"title": title
"author": author
"authorId": authorId
"playlistThumbnail": thumbnail
"videoCountText": videoCountText
}
PushFeedItem(playlist, context)
return invalid
end function
function ParseShortsLockupViewModel(nodeData as object, context as object) as object function ParseShortsLockupViewModel(nodeData as object, context as object) as object
if context.disableShorts = true if context.disableShorts = true
LogInfo("Skipping Short based on user settings") LogInfo("Skipping Short based on user settings")
@@ -1496,6 +1438,12 @@ namespace Innertube
return invalid return invalid
end if end if
' "Explore more" tileRenderer, opens a search with a predefined query, like TILE_CONTENT_TYPE_EDU below
if TileRendererHasSearchEndpoint(nodeData["onSelectCommand"])
LogWarnNoTelemetry("Skipping tileRenderer without contentType for search endpoint")
return invalid
end if
Warning("TileRenderer without contentType", nodeData, context) Warning("TileRenderer without contentType", nodeData, context)
return invalid return invalid
end if end if
@@ -1526,6 +1474,29 @@ namespace Innertube
return invalid return invalid
end function end function
function TileRendererHasSearchEndpoint(onSelectCommand as object) as boolean
if not IsAssociativeArray(onSelectCommand)
return false
end if
if IsAssociativeArray(onSelectCommand["searchEndpoint"])
return true
end if
commands = ObjectUtils.Dig(onSelectCommand, ["commandExecutorCommand", "commands"])
if not IsArray(commands)
return false
end if
for each command in commands
if IsAssociativeArray(command) and IsAssociativeArray(command["searchEndpoint"])
return true
end if
end for
return false
end function
function TileRendererTypeVideo(nodeData as object, context as object) as object function TileRendererTypeVideo(nodeData as object, context as object) as object
videoId = nodeData["contentId"] videoId = nodeData["contentId"]
if not IsString(videoId) if not IsString(videoId)
@@ -17,6 +17,9 @@ namespace Innertube
if sessionData = invalid or not IsInt(sessionData.timestamp) if sessionData = invalid or not IsInt(sessionData.timestamp)
return false return false
end if end if
if StringUtils.IsNullOrEmpty(sessionData.visitorData)
return false
end if
nowSeconds = TimeUtils.Now().AsSeconds() nowSeconds = TimeUtils.Now().AsSeconds()
return nowSeconds - sessionData.timestamp <= INNERTUBE_VISITOR_DATA_LIFESPAN_SECONDS return nowSeconds - sessionData.timestamp <= INNERTUBE_VISITOR_DATA_LIFESPAN_SECONDS
end function end function
@@ -110,7 +110,7 @@ namespace Invidious
request.Headers(m.GetAuthenticationHeaders(auth.token)) request.Headers(m.GetAuthenticationHeaders(auth.token))
request.Cancellation(cancellation) request.Cancellation(cancellation)
response = request.Await() response = request.Await()
m.MarkNeedsReauthOn403(response, auth.profile) m.MarkNeedsReauthIfCredentialsRejected(response, auth.profile)
end function end function
function SearchSuggestions(q as string, cancellation = invalid as object) as object function SearchSuggestions(q as string, cancellation = invalid as object) as object
@@ -214,7 +214,7 @@ namespace Invidious
response = request.Await() response = request.Await()
if isAuthenticatedRequest if isAuthenticatedRequest
m.MarkNeedsReauthOn403(response, auth.profile) m.MarkNeedsReauthIfCredentialsRejected(response, auth.profile)
end if end if
return response return response
end function end function
@@ -612,7 +612,7 @@ namespace Invidious
function AuthFeedHandler(context as object) as object function AuthFeedHandler(context as object) as object
response = context.response response = context.response
m.MarkNeedsReauthOn403(response, context.profile) m.MarkNeedsReauthIfCredentialsRejected(response, context.profile)
if not response.IsSuccess() if not response.IsSuccess()
return invalid return invalid
@@ -647,7 +647,7 @@ namespace Invidious
function WatchHistoryHandler(context as object) as object function WatchHistoryHandler(context as object) as object
response = context.response response = context.response
m.MarkNeedsReauthOn403(response, context.profile) m.MarkNeedsReauthIfCredentialsRejected(response, context.profile)
if not response.IsSuccess() if not response.IsSuccess()
return invalid return invalid
@@ -699,14 +699,20 @@ namespace Invidious
return json return json
end function end function
' A 403 on an authenticated call is terminal — only a fresh sign-in recovers. function MarkNeedsReauthIfCredentialsRejected(response as object, profile as object) as void
function MarkNeedsReauthOn403(response as object, profile as object) as void
if response.StatusCode() <> 403 if response.StatusCode() <> 403
return return
end if end if
LogWarn(`Invidious instance responded with 403: ${response.Text()}`) body = ValidString(response.Text())
if profile <> invalid and profile.type = "invidious" LogWarn(`Invidious instance responded with 403: ${body}`)
if profile = invalid or profile.type <> "invidious"
return
end if
' Invidious answers 403 to any exception on /api/v1/auth/*, including a route failing after
' authentication succeeded. Only these errors, raised while validating the session, mean it's dead.
if body.InStr("Request must be authenticated") <> -1 or body.InStr("Invalid signature") <> -1 or body.InStr("Erroneous token") <> -1 or body.InStr("Token is expired") <> -1
profile@.MarkNeedsReauth() profile@.MarkNeedsReauth()
end if end if
end function end function
@@ -773,7 +779,7 @@ namespace Invidious
request.Cancellation(cancellation) request.Cancellation(cancellation)
response = request.Await() response = request.Await()
m.MarkNeedsReauthOn403(response, auth.profile) m.MarkNeedsReauthIfCredentialsRejected(response, auth.profile)
return response return response
end function end function
@@ -787,7 +793,7 @@ namespace Invidious
request.Cancellation(cancellation) request.Cancellation(cancellation)
response = request.Await() response = request.Await()
m.MarkNeedsReauthOn403(response, auth.profile) m.MarkNeedsReauthIfCredentialsRejected(response, auth.profile)
return response return response
end function end function
@@ -801,7 +807,7 @@ namespace Invidious
request.Cancellation(cancellation) request.Cancellation(cancellation)
response = request.Await() response = request.Await()
m.MarkNeedsReauthOn403(response, auth.profile) m.MarkNeedsReauthIfCredentialsRejected(response, auth.profile)
return response return response
end function end function
end class end class
+28 -15
View File
@@ -1,6 +1,9 @@
import "pkg:/source/services/HttpClient.bs" import "pkg:/source/services/HttpClient.bs"
const SENTRY_ENVELOPE_URL = "https://playlet-v8556.ondigitalocean.app/envelope" const SUPPORT_SERVER_ENVELOPE_URL = "https://playlet-v8556.ondigitalocean.app/envelope"
' A fallback is needed to investigate https://github.com/iBicha/playlet/issues/906
const SENTRY_FALLBACK_ENVELOPE_URL = "https://o4509923566288896.ingest.us.sentry.io/api/4512194184544256/envelope/"
const SENTRY_FALLBACK_KEY = "a16c510299b23ccc63bdc84f751c9950"
const SUPPORTS_ATTACHMENTS = false const SUPPORTS_ATTACHMENTS = false
@@ -95,24 +98,34 @@ namespace Sentry
end if end if
end for end for
request = HttpClient.Post(SENTRY_ENVELOPE_URL, payload) request = HttpClient.Post(SUPPORT_SERVER_ENVELOPE_URL, payload)
request.Header("Content-Type", "application/x-sentry-envelope") request.Header("Content-Type", "application/x-sentry-envelope")
response = request.Await() response = request.Await()
if not response.IsSuccess() ' Only when the server never answered: its own failures hit every device at once and would exhaust the fallback's quota
#if DEBUG if response.StatusCode() <= 0
LogErrorNoTelemetry("Failed to send event to Sentry:", response.ErrorMessage(), `\nHeaders:`, response.Headers()) LogWarnNoTelemetry("Support server unreachable, sending events to the Sentry fallback:", response.ErrorMessage())
#end if request = HttpClient.Post(SENTRY_FALLBACK_ENVELOPE_URL, payload)
request.Header("Content-Type", "application/x-sentry-envelope")
retryAfter = ValidString(response.Headers()["Retry-After"]).ToInt() request.QueryParam("sentry_key", SENTRY_FALLBACK_KEY)
LogErrorNoTelemetry("Rate limited by Sentry. Retry after", retryAfter, "seconds") response = request.Await()
if retryAfter = 0
retryAfter = 60
end if
return retryAfter
end if end if
LogDebug("Sent events to Sentry. Response:", response.Text()) if response.IsSuccess()
return 0 LogDebug("Sent events to", request.BuildUrl(), "Response:", response.Text())
return 0
end if
retryAfter = ValidString(response.Headers()["Retry-After"]).ToInt()
if retryAfter = 0
retryAfter = 60
end if
if response.StatusCode() = 429
LogErrorNoTelemetry("Rate limited by", request.BuildUrl(), "Retry after", retryAfter, "seconds")
else
LogErrorNoTelemetry("Failed to send events to", request.BuildUrl(), response.ErrorMessage(), `\nRetry after`, retryAfter, "seconds")
end if
return retryAfter
end function end function
function GetFingerprint(message as dynamic) as dynamic function GetFingerprint(message as dynamic) as dynamic
@@ -48,14 +48,14 @@ function TelemetryLoop() as void
m.dist = GetDist(m.tags) m.dist = GetDist(m.tags)
m.userId = GetUserId() m.userId = GetUserId()
ReportSessionStart()
ReportLastExitCrash()
m.top.observeField("LogInfo", msgPort) m.top.observeField("LogInfo", msgPort)
m.top.observeField("LogWarn", msgPort) m.top.observeField("LogWarn", msgPort)
m.top.observeField("LogError", msgPort) m.top.observeField("LogError", msgPort)
m.top.observeField("LogEvent", msgPort) m.top.observeField("LogEvent", msgPort)
ReportSessionStart()
ReportLastExitCrash()
#if SUPPORTS_BATCHING #if SUPPORTS_BATCHING
debouceMs = 2000 debouceMs = 2000
debounceCountLimit = 20 debounceCountLimit = 20
@@ -1,8 +1,9 @@
# VideoPlayerDev # VideoPlayerDev
The custom video player intended to replace `components/VideoPlayer` — a stock-OS-trickplay replica plus a The custom video player that replaced `components/VideoPlayer` — a stock-OS-trickplay replica plus a control
control button row. It is selected at **compile time** by `#const USE_DEV_PLAYER` in `VideoQueue.bs` (default button row. It is selected at **compile time** by `#const USE_DEV_PLAYER` in `VideoQueue.bs`, currently `true`:
`false`). Build with the flag `true` to run it (and the integration suite). this is the player that ships. Build with the flag `false` to fall back to the stock `VideoPlayer` (the
integration suite asserts the dev player, so it only passes with the flag on).
## Architecture ## Architecture
@@ -418,7 +418,7 @@ function TrySponsorBlockSkip() as boolean
end function end function
' OK/Select — the one shared key. Priority (after the SponsorBlock skip, handled in OnKeyEvent): commit (if a ' OK/Select — the one shared key. Priority (after the SponsorBlock skip, handled in OnKeyEvent): commit (if a
' transport is active) -> chrome/pause toggle. OK is the VOD pause key (there is no separate ECP Pause). So ' transport is active) -> chrome/pause toggle. OK is the VOD pause key. So
' while idle: VOD = play/pause toggle (reveals chrome + LargePause); live = chrome toggle only (no pause). ' while idle: VOD = play/pause toggle (reveals chrome + LargePause); live = chrome toggle only (no pause).
function OnOkPress() as boolean function OnOkPress() as boolean
' commit an active transport. ' commit an active transport.
@@ -84,6 +84,14 @@ function TestSetup() as void
m.top.unobserveField(deviceField) m.top.unobserveField(deviceField)
end for end for
' The mock node is shared across tests and `duration` is not alwaysNotify, so a leftover duration=100
' swallows the next test's identical write and OnDuration never fires. Reset with the observers off.
m.top.state = VideoState.None
m.top.control = VideoControl.None
m.top.position = 0
m.top.duration = 0
m.top.seek = 0
OnNodeReady() OnNodeReady()
end function end function
@@ -118,6 +126,13 @@ function TestSetLive(edgeMs as integer) as void
m.transport.OnPosition(edgeMs) m.transport.OnPosition(edgeMs)
end function end function
' TestSeedSponsorBlock — the segments job's result, minus the job. Writing m.top.position afterwards runs the
' REAL OnPosition, which is what arms the manual notice.
function TestSeedSponsorBlock(segments as object) as void
m.sponsorblock.enabled = true
m.sponsorblock.segments = segments
end function
' TestFireLiveBadgeHold — fire the liveBadgeHold timer's handler now (the spec can't wait out the real timer). ' TestFireLiveBadgeHold — fire the liveBadgeHold timer's handler now (the spec can't wait out the real timer).
function TestFireLiveBadgeHold() as void function TestFireLiveBadgeHold() as void
OnLiveBadgeHoldFire() OnLiveBadgeHoldFire()
@@ -214,6 +229,7 @@ function TestSnapshot() as object
focusTarget: m.focusTarget focusTarget: m.focusTarget
focusedButton: m.focusedButton focusedButton: m.focusedButton
nudgeCount: m.top.nudgeCount nudgeCount: m.top.nudgeCount
sponsorNoticeShown: SponsorBlock.GetCurrentNotification(m.notifications) <> invalid
forceLiveBadge: m.trickPlayBar.forceLiveBadge forceLiveBadge: m.trickPlayBar.forceLiveBadge
liveBadgeShown: m.trickPlayBar.findNode("liveLabel").visible liveBadgeShown: m.trickPlayBar.findNode("liveLabel").visible
barRemainingText: m.trickPlayBar.findNode("remainingLabel").text barRemainingText: m.trickPlayBar.findNode("remainingLabel").text
@@ -52,6 +52,7 @@
<function name="TestWireQueueClose" /> <function name="TestWireQueueClose" />
<function name="TestSetControl" /> <function name="TestSetControl" />
<function name="TestSetLive" /> <function name="TestSetLive" />
<function name="TestSeedSponsorBlock" />
<function name="TestFireLiveBadgeHold" /> <function name="TestFireLiveBadgeHold" />
<function name="TestKillAutoHide" /> <function name="TestKillAutoHide" />
<function name="TestFinishChromeFadeOut" /> <function name="TestFinishChromeFadeOut" />
@@ -216,11 +216,18 @@ namespace Tests
end function end function
' Up/Down reveal the chrome when it is hidden in idle (they otherwise do nothing). ' Up/Down reveal the chrome when it is hidden in idle (they otherwise do nothing).
@it("Up reveals the chrome when it is hidden in idle") @it("Up and Down each reveal the chrome when it is hidden in idle")
function _() function _()
m.assertFalse(m.Snap().chromeShown) ' starts hidden after setup m.assertFalse(m.Snap().chromeShown) ' starts hidden after setup
m.top.callFunc("TestKey", RemoteKeys.Up, true) m.top.callFunc("TestKey", RemoteKeys.Up, true)
m.assertTrue(m.Snap().chromeShown, "Up revealed the chrome") m.assertTrue(m.Snap().chromeShown, "Up revealed the chrome")
' back to fully hidden: the reveal only fires from Hidden, not mid fade-out.
m.top.callFunc("TestKey", RemoteKeys.Back, true)
m.top.callFunc("TestFinishChromeFadeOut")
m.assertFalse(m.Snap().chromeShown)
m.top.callFunc("TestKey", RemoteKeys.Down, true)
m.assertTrue(m.Snap().chromeShown, "Down revealed the chrome")
end function end function
' ========================================================================================= ' =========================================================================================
@@ -349,6 +356,121 @@ namespace Tests
m.assertTrue(m.top.videoQueue.closePlayer, "rung 4: Back closes") m.assertTrue(m.top.videoQueue.closePlayer, "rung 4: Back closes")
end function end function
' =========================================================================================
' Key router — the branches that decide WHICH handler runs.
' =========================================================================================
' The segment shape SponsorBlockSegmentsJob returns.
function ManualSegment(startS as float, endS as float) as object
return [{ start: startS, end: endS, option: "manual_skip", title: "Sponsor", shortTitle: "Sponsor", actionText: "Press OK to skip", showNotification: true, UUID: "seg-manual", category: "sponsor" }]
end function
' Minimize is the discriminator: activating it would have hidden the chrome.
@it("an armed SponsorBlock notice outranks the buttons tier: OK skips instead of activating the button")
function _()
m.top.duration = 100
m.top.callFunc("TestSeedSponsorBlock", m.ManualSegment(10.0, 40.0))
m.top.position = 12.0 ' the REAL OnPosition arms the manual notice
m.assertTrue(m.Snap().sponsorNoticeShown, "the notice is up")
m.top.callFunc("TestKey", RemoteKeys.Up, true) ' reveal -> bar tier
m.top.callFunc("TestKey", RemoteKeys.Up, true) ' bar -> buttons tier
m.top.callFunc("TestKey", RemoteKeys.Right, true) ' highlight minimize
m.assertEqual(m.Snap().focusedButton, 1)
m.top.callFunc("TestKey", RemoteKeys.Ok, true)
after = m.Snap()
m.assertEqual(Int(m.top.seek * 1000), 40000, "OK skipped to the segment end, not into the focused button")
m.assertFalse(after.sponsorNoticeShown, "the skip took the notice down")
m.assertTrue(after.chromeShown, "minimize never ran -- it would have hidden the chrome")
end function
@it("an armed SponsorBlock notice outranks the Back ladder: Back dismisses the notice, not the player")
function _()
m.top.duration = 100
m.top.callFunc("TestSeedSponsorBlock", m.ManualSegment(10.0, 40.0))
m.top.position = 12.0
m.assertTrue(m.Snap().sponsorNoticeShown)
m.assertFalse(m.Snap().chromeShown, "chrome hidden: an unrouted Back here would CLOSE the player")
seekBefore = m.top.seek
m.top.callFunc("TestKey", RemoteKeys.Back, true)
after = m.Snap()
m.assertFalse(after.sponsorNoticeShown, "Back took the notice down")
m.assertFalse(m.top.videoQueue.closePlayer, "Back acted on the notice, NOT on the player")
m.assertEqual(m.top.seek, seekBefore, "dismissing is not skipping")
' one-shot: with the notice gone the next Back is the ordinary ladder again (rung 4 -> close).
m.top.callFunc("TestKey", RemoteKeys.Back, true)
m.assertTrue(m.top.videoQueue.closePlayer, "the notice consumed one Back, not every Back")
end function
@it("an armed notice on a segment at the video end finishes playback instead of seeking")
function _()
m.top.duration = 100
m.top.callFunc("TestSeedSponsorBlock", m.ManualSegment(90.0, 99.5)) ' ends within 2s of duration
m.top.position = 92.0
m.assertTrue(m.Snap().sponsorNoticeShown)
seekBefore = m.top.seek
m.top.callFunc("TestKey", RemoteKeys.Ok, true)
m.assertEqual(m.top.seek, seekBefore, "no seek was issued: the skip resolved to finish")
m.assertTrue(m.top.videoQueue.closePlayer, "no next video -> the finish closed the player")
end function
@it("the non-transport keys act on the key-DOWN edge only")
function _()
' Back goes first: only from the start state does its DOWN edge close the player.
m.assertFalse(m.top.callFunc("TestKey", RemoteKeys.Back, false), "the Back key-up is not consumed")
m.assertFalse(m.top.videoQueue.closePlayer, "the Back key-up must not close the player")
m.top.callFunc("TestKey", RemoteKeys.Ok, true) ' reveal
m.top.callFunc("TestKey", RemoteKeys.Ok, true) ' pause
m.top.callFunc("TestSetState", VideoState.Paused)
m.assertEqual(m.Snap().control, VideoControl.Pause)
m.assertFalse(m.top.callFunc("TestKey", RemoteKeys.Ok, false), "the OK key-up is not consumed")
m.assertFalse(m.top.callFunc("TestKey", RemoteKeys.Play, false), "the Play key-up is not consumed")
m.assertFalse(m.top.callFunc("TestKey", RemoteKeys.PlayOnly, false), "the PlayOnly key-up is not consumed")
m.assertFalse(m.top.callFunc("TestKey", RemoteKeys.Pause, false), "the Pause key-up is not consumed")
m.assertEqual(m.Snap().control, VideoControl.Pause, "no key-up toggled the pause back to playing")
end function
@it("Play commits an active transport, like OK")
function _()
m.top.callFunc("TestKey", RemoteKeys.Left, true)
m.top.callFunc("TestKey", RemoteKeys.Left, false)
m.assertEqual(m.Snap().transportMode, TransportController.Mode.Scrub)
m.top.callFunc("TestKey", RemoteKeys.Play, true)
after = m.Snap()
m.assertEqual(after.transportMode, TransportController.Mode.Idle, "Play committed the scrub")
m.assertTrue(after.seekSettling, "the commit emitted a play-through seek, not a play/pause toggle")
end function
@it("PlayOnly toggles play/pause, like Play")
function _()
m.top.callFunc("TestKey", RemoteKeys.PlayOnly, true)
m.assertEqual(m.Snap().control, VideoControl.Pause, "PlayOnly paused the playing video")
m.top.callFunc("TestSetState", VideoState.Paused)
m.top.callFunc("TestKey", RemoteKeys.PlayOnly, true)
m.assertEqual(m.Snap().control, VideoControl.Resume, "PlayOnly resumed the paused video")
end function
@it("the transport keys fall through the buttons tier to the transport")
function _()
m.top.callFunc("TestKey", RemoteKeys.Up, true) ' reveal -> bar tier
m.top.callFunc("TestKey", RemoteKeys.Up, true) ' bar -> buttons tier
m.assertEqual(m.Snap().focusTarget, PlayerCoordinatorLogic.FocusTarget.Buttons)
m.top.callFunc("TestKey", RemoteKeys.Rewind, true)
m.top.callFunc("TestKey", RemoteKeys.Rewind, false)
after = m.Snap()
m.assertEqual(after.transportMode, TransportController.Mode.Scan, "Rev started the scan from the buttons tier")
m.assertEqual(after.focusTarget, PlayerCoordinatorLogic.FocusTarget.Bar, "a transport key moves focus to the bar")
m.assertEqual(after.nudgeCount, 0, "the row did not treat it as one of its own keys")
end function
' The point of the bar-default: Left/Right seek and OK pauses with no navigation at all, straight off a ' The point of the bar-default: Left/Right seek and OK pauses with no navigation at all, straight off a
' fresh reveal. Pinned as its own test rather than left as a side effect of the tier round-trip tests. ' fresh reveal. Pinned as its own test rather than left as a side effect of the tier round-trip tests.
@it("a fresh idle reveal defaults focus to the bar: Left/Right seek and OK pauses with no navigation") @it("a fresh idle reveal defaults focus to the bar: Left/Right seek and OK pauses with no navigation")
@@ -555,6 +677,61 @@ namespace Tests
m.assertEqual(snap.focusedButton, 1, "the highlight is untouched") m.assertEqual(snap.focusedButton, 1, "the highlight is untouched")
end function end function
' Each arm is asserted: a state that silently failed to arm makes every row that follows vacuous.
function ArmRouterState(state as string) as void
m.top.callFunc("TestSetup")
m.top.callFunc("TestSetState", VideoState.Playing) ' opens the brain's ready-gate, as beforeEach does
if state = "idle hidden"
m.assertFalse(m.Snap().chromeShown, "armed: " + state)
else if state = "chrome/bar"
m.top.callFunc("TestKey", RemoteKeys.Up, true)
snap = m.Snap()
m.assertTrue(snap.chromeShown, "armed: " + state)
m.assertEqual(snap.focusTarget, PlayerCoordinatorLogic.FocusTarget.Bar, "armed: " + state)
else if state = "chrome/buttons"
m.top.callFunc("TestKey", RemoteKeys.Up, true)
m.top.callFunc("TestKey", RemoteKeys.Up, true)
snap = m.Snap()
m.assertTrue(snap.chromeShown, "armed: " + state)
m.assertEqual(snap.focusTarget, PlayerCoordinatorLogic.FocusTarget.Buttons, "armed: " + state)
else if state = "transport"
m.top.callFunc("TestKey", RemoteKeys.Left, true)
m.top.callFunc("TestKey", RemoteKeys.Left, false)
m.assertEqual(m.Snap().transportMode, TransportController.Mode.Scrub, "armed: " + state)
end if
end function
' BrighterScript enums are compile-time constants with no runtime form, so a new RemoteKeys member
' cannot fail this until someone lists it below — these lists are the decision record, not reflection.
@it("every remote key's disposition is pinned in every router state")
function _()
ownedEverywhere = [RemoteKeys.Left, RemoteKeys.Right, RemoteKeys.Rewind, RemoteKeys.FastForward, RemoteKeys.Replay, RemoteKeys.Ok, RemoteKeys.Back, RemoteKeys.Play, RemoteKeys.PlayOnly]
' AppController's, not the player's.
passedEverywhere = [RemoteKeys.Options, RemoteKeys.Pause, RemoteKeys.OkLongPress, RemoteKeys.OptionsLongPress]
' the tier keys are owned only while there is a tier to move through or a chrome to reveal.
tierKeys = [RemoteKeys.Up, RemoteKeys.Down]
for each state in ["idle hidden", "chrome/bar", "chrome/buttons", "transport"]
for each key in ownedEverywhere
m.ArmRouterState(state)
m.assertTrue(m.top.callFunc("TestKey", key, true), "'" + key + "' must be consumed in state " + state)
end for
for each key in passedEverywhere
m.ArmRouterState(state)
m.assertFalse(m.top.callFunc("TestKey", key, true), "'" + key + "' must pass to the parent in state " + state)
end for
for each key in tierKeys
m.ArmRouterState(state)
consumed = m.top.callFunc("TestKey", key, true)
if state = "transport"
m.assertFalse(consumed, "'" + key + "' has nothing to do under a transport -- it passes to the parent")
else
m.assertTrue(consumed, "'" + key + "' moves focus or reveals the chrome in state " + state)
end if
end for
end for
end function
' The coordinator twin of the brain's unmodeled-axis meta-test: every m.* field on the coordinator must ' The coordinator twin of the brain's unmodeled-axis meta-test: every m.* field on the coordinator must
' be consciously classified here. A NEW coordinator field fails this until someone decides what it is — ' be consciously classified here. A NEW coordinator field fails this until someone decides what it is —
' a state axis needs transition coverage, a flag needs its consuming path tested. ' a state axis needs transition coverage, a flag needs its consuming path tested.
-1
View File
@@ -1,4 +1,3 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"> <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<!--! Font Awesome Pro 6.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license (Commercial License) Copyright 2022 Fonticons, Inc.-->
<path fill="#EBEBEB" d="M416 208c0 45.9-14.9 88.3-40 122.7l126.6 126.7c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0s208 93.1 208 208M208 352c79.5 0 144-64.5 144-144S287.5 64 208 64 64 128.5 64 208s64.5 144 144 144"/> <path fill="#EBEBEB" d="M416 208c0 45.9-14.9 88.3-40 122.7l126.6 126.7c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0s208 93.1 208 208M208 352c79.5 0 144-64.5 144-144S287.5 64 208 64 64 128.5 64 208s64.5 144 144 144"/>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 533 B

After

Width:  |  Height:  |  Size: 365 B

@@ -1,5 +1,5 @@
{ {
inputHash: 'c4e2899f8a5e58f6ae711e91e518b4f3', inputHash: '020c780cc50d3bc4ed9fc56f03bd1b21',
outputs: [ outputs: [
{ {
outputFilePath: 'images/icons/search.png', outputFilePath: 'images/icons/search.png',
+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=48 minor_version=48
build_version=00003 build_version=00006
ui_resolutions=hd ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p uri_resolution_autosub=$$RES$$,480p,720p,1080p
+24 -1
View File
@@ -1,4 +1,27 @@
' Credits to https://github.com/kazuhikoarase/qrcode-generator/pull/110 ' QR code generation ported from https://github.com/kazuhikoarase/qrcode-generator
' (PR #110).
'
' Original work: Copyright (c) 2009 Kazuhiko Arase - MIT License (full text below).
' Modifications: Copyright (c) Playlet contributors - AGPL-3.0, as part of this project.
'
' Permission is hereby granted, free of charge, to any person obtaining a copy
' of this software and associated documentation files (the "Software"), to deal
' in the Software without restriction, including without limitation the rights
' to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
' copies of the Software, and to permit persons to whom the Software is
' furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in all
' copies or substantial portions of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
' IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
' OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
' SOFTWARE.
'
' Main changes: ' Main changes:
' - Removed Kanji, because it added a significant amount of size, while the use ' - Removed Kanji, because it added a significant amount of size, while the use
' cases of this app does not include Kanji ' cases of this app does not include Kanji
@@ -471,7 +471,15 @@ namespace HttpClient
backoffMs = 1000 + Rnd(2000) backoffMs = 1000 + Rnd(2000)
tryNumber = m._tryCount - triesLeft + 1 tryNumber = m._tryCount - triesLeft + 1
LogWarnNoTelemetry("Request failed ID:", m.urlTransfer.GetIdentity(), "ErrorMessage:", response.ErrorMessage(), `\nRetrying: (`, tryNumber, "/", m._tryCount, ") in", backoffMs, "ms") LogWarnNoTelemetry("Request failed ID:", m.urlTransfer.GetIdentity(), "ErrorMessage:", response.ErrorMessage(), `\nRetrying: (`, tryNumber, "/", m._tryCount, ") in", backoffMs, "ms")
LogWarnTelemetry(response.ErrorMessage() + `\n` + m.ToCurlCommand()) LogTelemetryEvent({
level: "warning"
message: response.ErrorMessage()
attachments: [{
filename: "request.txt"
content_type: "text/plain"
data: m.ToCurlCommand()
}]
})
if IsFunction(m._retryCallback) if IsFunction(m._retryCallback)
try try
@@ -35,6 +35,12 @@ namespace Tests
m.assertEqual(PlayerCoordinatorLogic.KeyToCommand(RemoteKeys.Ok), TransportController.Command.None) m.assertEqual(PlayerCoordinatorLogic.KeyToCommand(RemoteKeys.Ok), TransportController.Command.None)
m.assertEqual(PlayerCoordinatorLogic.KeyToCommand(RemoteKeys.Back), TransportController.Command.None) m.assertEqual(PlayerCoordinatorLogic.KeyToCommand(RemoteKeys.Back), TransportController.Command.None)
m.assertEqual(PlayerCoordinatorLogic.KeyToCommand(RemoteKeys.Down), TransportController.Command.None) m.assertEqual(PlayerCoordinatorLogic.KeyToCommand(RemoteKeys.Down), TransportController.Command.None)
m.assertEqual(PlayerCoordinatorLogic.KeyToCommand(RemoteKeys.Up), TransportController.Command.None)
m.assertEqual(PlayerCoordinatorLogic.KeyToCommand(RemoteKeys.Options), TransportController.Command.None)
' the play cluster: play-state keys, and a transport command here would make them seek instead.
m.assertEqual(PlayerCoordinatorLogic.KeyToCommand(RemoteKeys.Play), TransportController.Command.None)
m.assertEqual(PlayerCoordinatorLogic.KeyToCommand(RemoteKeys.PlayOnly), TransportController.Command.None)
m.assertEqual(PlayerCoordinatorLogic.KeyToCommand(RemoteKeys.Pause), TransportController.Command.None)
m.assertEqual(PlayerCoordinatorLogic.KeyToCommand("bogus"), TransportController.Command.None) m.assertEqual(PlayerCoordinatorLogic.KeyToCommand("bogus"), TransportController.Command.None)
end function end function
-4
View File
@@ -33,10 +33,6 @@ function LogTelemetryEvent(event as object)
m.global.telemetry.LogEvent = event m.global.telemetry.LogEvent = event
end function end function
function LogWarnTelemetry(message as string)
m.global.telemetry.LogWarn = message
end function
function ToString(value as dynamic) as string function ToString(value as dynamic) as string
if getInterface(value, "ifString") <> invalid if getInterface(value, "ifString") <> invalid
return value return value
+566 -267
View File
File diff suppressed because it is too large. Load diff
+15 -15
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-web", "name": "playlet-web",
"version": "0.48.3", "version": "0.48.6",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
@@ -9,27 +9,27 @@
"lint": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings" "lint": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings"
}, },
"devDependencies": { "devDependencies": {
"@sveltejs/vite-plugin-svelte": "^7.2.0", "@sveltejs/vite-plugin-svelte": "^7.3.1",
"@tailwindcss/postcss": "^4.3.3", "@tailwindcss/postcss": "^4.3.3",
"@tailwindcss/typography": "^0.5.20", "@tailwindcss/typography": "^0.5.20",
"@tsconfig/svelte": "^5.0.8", "@tsconfig/svelte": "^5.0.8",
"@vitejs/plugin-legacy": "^8.2.2", "@vitejs/plugin-legacy": "^8.2.3",
"autoprefixer": "^10.5.4", "autoprefixer": "^10.6.1",
"bgutils-js": "^4.0.2", "bgutils-js": "^4.0.3",
"daisyui": "^5.7.0", "daisyui": "^5.7.46",
"dotenv": "^17.4.2", "dotenv": "^18.0.4",
"ip": "^2.0.1", "ip": "^2.0.1",
"jszip": "^3.10.1", "jszip": "^3.10.2",
"postcss": "^8.5.23", "postcss": "^8.5.28",
"rollup-plugin-visualizer": "^7.0.1", "rollup-plugin-visualizer": "^7.1.1",
"svelte": "^5.56.8", "svelte": "^5.57.1",
"svelte-check": "^4.7.3", "svelte-check": "^4.7.6",
"svelte-preprocess": "6.0.3", "svelte-preprocess": "^6.0.5",
"tailwindcss": "^4.3.3", "tailwindcss": "^4.3.3",
"terser": "^5.49.0", "terser": "^5.51.2",
"tslib": "^2.8.1", "tslib": "^2.8.1",
"typescript": "^5.9.3", "typescript": "^5.9.3",
"vite": "^8.1.5", "vite": "^8.3.1",
"vite-plugin-compression": "^0.5.1" "vite-plugin-compression": "^0.5.1"
} }
} }
@@ -12,6 +12,17 @@
let libUrlType; let libUrlType;
let appId = "693751"; let appId = "693751";
// Kept in step with PlayletLibUrls.MIN_VERSION in playlet-app, which drops anything older at boot.
const MIN_LIB_VERSION = "0.11.0";
function isSupported(tag) {
const version = /^v(\d+\.\d+\.\d+)$/.exec(tag ?? "")?.[1];
return (
!version ||
version.localeCompare(MIN_LIB_VERSION, undefined, { numeric: true }) >= 0
);
}
onMount(async () => { onMount(async () => {
releases = await fetchReleaseTags(); releases = await fetchReleaseTags();
setCurrentlyUsedRelease(); setCurrentlyUsedRelease();
@@ -62,17 +73,19 @@
break; break;
} }
} }
return releases.map((release) => { return releases
return { .filter((release) => isSupported(release.tag_name))
name: release.tag_name, .map((release) => {
enabled: return {
release.assets.filter( name: release.tag_name,
(asset) => enabled:
asset.name === "playlet-lib.zip" || release.assets.filter(
asset.name === "playlet-lib.squashfs.pkg" (asset) =>
).length > 0, asset.name === "playlet-lib.zip" ||
}; asset.name === "playlet-lib.squashfs.pkg"
}); ).length > 0,
};
});
} }
async function apply() { async function apply() {
+3 -2
View File
@@ -1,8 +1,9 @@
{ {
"compilerOptions": { "compilerOptions": {
"composite": true, "composite": true,
"module": "NodeNext", "target": "ESNext",
"moduleResolution": "NodeNext" "module": "ESNext",
"moduleResolution": "Bundler"
}, },
"include": [ "include": [
"vite.config.ts" "vite.config.ts"
+1 -1
View File
@@ -35,7 +35,7 @@ const config: UserConfig = {
// But the tools are not (because brighterscript is expecting CommonJs) // But the tools are not (because brighterscript is expecting CommonJs)
// so we can't import the function from the tools/get-env-vars.js. // so we can't import the function from the tools/get-env-vars.js.
function getEnvVars(requiredVars = undefined) { function getEnvVars(requiredVars = undefined) {
const envFile = joinPath(__dirname, '../.env'); const envFile = joinPath(import.meta.dirname, '../.env');
let envVars = process.env; let envVars = process.env;
if (existsSync(envFile)) { if (existsSync(envFile)) {
+1 -2
View File
@@ -7,7 +7,6 @@ const { existsSync, writeFileSync, readFileSync } = require('fs');
const json5 = require('json5'); const json5 = require('json5');
const md5 = require('crypto-js/md5'); const md5 = require('crypto-js/md5');
const path = require('path'); const path = require('path');
const { executablePath } = require('puppeteer');
const META_EXT = '.meta.json5'; const META_EXT = '.meta.json5';
@@ -118,7 +117,7 @@ function checkFileHash(file, hash) {
async function generateImage(inputImage, options, rootDir) { async function generateImage(inputImage, options, rootDir) {
const opts = { const opts = {
launch: { executablePath: await executablePath() }, launch: { channel: 'chrome' },
...options ...options
}; };
opts.outputFilePath = path.join(rootDir, opts.outputFilePath); opts.outputFilePath = path.join(rootDir, opts.outputFilePath);
+96 -58
View File
@@ -34,23 +34,27 @@ This page was automatically generated on ${formattedDate}.
fs.writeFileSync(markdownFile, markdownContent); fs.writeFileSync(markdownFile, markdownContent);
} }
async function deleteExistingAttachments() { function deleteExistingAttachments() {
try { const files = fs.readdirSync(attachmentDestination);
const files = fs.readdirSync(attachmentDestination);
for (const file of files) { for (const file of files) {
if (path.extname(file) === '.png') { if (path.extname(file) === '.png') {
fs.unlinkSync(path.join(attachmentDestination, file)); fs.unlinkSync(path.join(attachmentDestination, file));
console.log(`Deleted ${file}`); console.log(`Deleted ${file}`);
}
} }
} catch (error) {
console.error(error);
} }
} }
const config = getEnvVars(['EMAIL', 'EMAIL_APP_PASSWORD']); const config = getEnvVars(['EMAIL', 'EMAIL_APP_PASSWORD']);
// Gmail can take 15s or more to answer LOGIN, well past node-imap's 5s default,
// and throttles an account that reconnects right after a failed attempt.
const AUTH_TIMEOUT_MS = 60 * 1000;
const CONNECT_TIMEOUT_MS = 30 * 1000;
const CONNECT_ATTEMPTS = 3;
const RETRY_DELAY_MS = 30 * 1000;
const RUN_TIMEOUT_MS = 10 * 60 * 1000;
const imap = new Imap({ const imap = new Imap({
user: config.EMAIL, user: config.EMAIL,
password: config.EMAIL_APP_PASSWORD, password: config.EMAIL_APP_PASSWORD,
@@ -59,7 +63,9 @@ const imap = new Imap({
tls: true, tls: true,
tlsOptions: { tlsOptions: {
rejectUnauthorized: false rejectUnauthorized: false
} },
connTimeout: CONNECT_TIMEOUT_MS,
authTimeout: AUTH_TIMEOUT_MS
}); });
const searchAsync = promisify(imap.search).bind(imap); const searchAsync = promisify(imap.search).bind(imap);
@@ -129,59 +135,91 @@ async function moveToTrash(from, subject, since) {
console.log('Moved %d message(s) to Trash for subject "%s"', uids.length, subject); console.log('Moved %d message(s) to Trash for subject "%s"', uids.length, subject);
} }
const timeout = setTimeout(() => { function sleep(ms) {
console.log('Timeout'); return new Promise(resolve => setTimeout(resolve, ms));
}
function fail(error) {
console.error('Error:', error);
process.exit(1); process.exit(1);
}, 10 * 60 * 1000); }
imap.once('ready', async () => { function connectAsync() {
try { return new Promise((resolve, reject) => {
await openBoxAsync('INBOX'); const onReady = () => {
imap.removeListener('error', onError);
imap.on('error', fail);
resolve();
};
const onError = error => {
imap.removeListener('ready', onReady);
reject(error);
};
imap.once('ready', onReady);
imap.once('error', onError);
imap.connect();
});
}
const now = new Date(); async function connectWithRetryAsync() {
const yesterday = new Date(now - 24 * 60 * 60 * 1000); for (let attempt = 1; ; attempt++) {
const yesterdayString = yesterday.toISOString().slice(0, 19).replace('T', ' '); try {
await connectAsync();
deleteExistingAttachments(); return;
} catch (error) {
const images = [] if (attempt === CONNECT_ATTEMPTS) {
images.push({ throw error;
title: 'App Health', }
filename: await getAttachementAsync('bdp_noreply@data.roku.com', 'App Health', yesterdayString) console.error('Connection attempt %d/%d failed: %s', attempt, CONNECT_ATTEMPTS, error.message);
}) await sleep(RETRY_DELAY_MS);
images.push({ }
title: 'App Engagement',
filename: await getAttachementAsync('bdp_noreply@data.roku.com', 'App Engagement', yesterdayString)
})
images.push({
title: 'Viewership Summary',
filename: await getAttachementAsync('bdp_noreply@data.roku.com', 'Viewership Summary', yesterdayString)
})
images.push({
title: 'App Stability',
filename: await getAttachementAsync('bdp_noreply@data.roku.com', 'App Stability', yesterdayString)
})
writeMarkDownFile(images);
await moveToTrash('bdp_noreply@data.roku.com', 'App Health', yesterdayString);
await moveToTrash('bdp_noreply@data.roku.com', 'App Engagement', yesterdayString);
await moveToTrash('bdp_noreply@data.roku.com', 'Viewership Summary', yesterdayString);
await moveToTrash('bdp_noreply@data.roku.com', 'App Stability', yesterdayString);
imap.end();
} catch (error) {
console.error('Error:', error);
} }
clearTimeout(timeout); }
});
imap.once('error', err => { async function downloadStats() {
console.error(err); await connectWithRetryAsync();
}); await openBoxAsync('INBOX');
imap.once('end', () => { const now = new Date();
const yesterday = new Date(now - 24 * 60 * 60 * 1000);
const yesterdayString = yesterday.toISOString().slice(0, 19).replace('T', ' ');
deleteExistingAttachments();
const images = []
images.push({
title: 'App Health',
filename: await getAttachementAsync('bdp_noreply@data.roku.com', 'App Health', yesterdayString)
})
images.push({
title: 'App Engagement',
filename: await getAttachementAsync('bdp_noreply@data.roku.com', 'App Engagement', yesterdayString)
})
images.push({
title: 'Viewership Summary',
filename: await getAttachementAsync('bdp_noreply@data.roku.com', 'Viewership Summary', yesterdayString)
})
images.push({
title: 'App Stability',
filename: await getAttachementAsync('bdp_noreply@data.roku.com', 'App Stability', yesterdayString)
})
writeMarkDownFile(images);
await moveToTrash('bdp_noreply@data.roku.com', 'App Health', yesterdayString);
await moveToTrash('bdp_noreply@data.roku.com', 'App Engagement', yesterdayString);
await moveToTrash('bdp_noreply@data.roku.com', 'Viewership Summary', yesterdayString);
await moveToTrash('bdp_noreply@data.roku.com', 'App Stability', yesterdayString);
imap.end();
}
imap.on('end', () => {
console.log('Connection ended'); console.log('Connection ended');
}); });
imap.connect(); setTimeout(() => fail(new Error(`Gave up after ${RUN_TIMEOUT_MS / 1000}s`)), RUN_TIMEOUT_MS);
downloadStats().then(() => {
process.exit(0);
}).catch(fail);