Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e93f9a02c2 | ||
|
|
37a1fffb8d | ||
|
|
6ae6f6cb68 | ||
|
|
510d81b872 | ||
|
|
ebabb6ca99 | ||
|
|
1678bee3b5 | ||
|
|
c055260023 | ||
|
|
e0f5c9691b | ||
|
|
9da9bdf06f | ||
|
|
fea1c22aa9 | ||
|
|
48b10e8618 | ||
|
|
7286c099a0 | ||
|
|
f29b0f0af8 | ||
|
|
a07d92eaa9 | ||
|
|
4218dc7fd2 | ||
|
|
95deab6ca4 | ||
|
|
156a4b5172 | ||
|
|
a974670f8d | ||
|
|
e7cce7e71b | ||
|
|
d09facc9ff | ||
|
|
78102e747b |
No files matched your search
@@ -8,6 +8,7 @@ on:
|
||||
jobs:
|
||||
update_wiki_stats:
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 20
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
@@ -5,6 +5,26 @@ 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/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [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
|
||||
|
||||
### Fixed
|
||||
|
||||
- Display issues for 720p devices
|
||||
- Attempt to fix session data fetch errors
|
||||
- Remove volume handing from cast, to avoid a possible "mute softlock" - feature will be added back later.
|
||||
|
||||
## [0.48.2] - 2026-07-11
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
1010
|
||||
],
|
||||
"diagnosticLevel": "hint",
|
||||
"minFirmwareVersion": "11.5.0",
|
||||
// The validation regex rules are validated using the validation-plugin.ts plugin
|
||||
"validation": [
|
||||
{
|
||||
|
||||
@@ -1,39 +1,37 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.48.2",
|
||||
"version": "0.48.5",
|
||||
"description": "Unofficial YouTube client for Roku",
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.8.44",
|
||||
"@rokucommunity/bslint": "^0.8.46",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/node": "^26.1.1",
|
||||
"@types/node": "^26.6.3",
|
||||
"@types/xml2js": "^0.4.14",
|
||||
"argparse": "^2.0.1",
|
||||
"brighterscript": "0.73.0",
|
||||
"brighterscript-formatter": "^1.8.1",
|
||||
"argparse": "^3.0.2",
|
||||
"brighterscript": "0.73.5",
|
||||
"brighterscript-formatter": "^1.8.3",
|
||||
"convert-svg-to-png": "^0.7.1",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dotenv": "^17.4.2",
|
||||
"fs-extra": "^11.3.6",
|
||||
"dotenv": "^18.0.4",
|
||||
"fs-extra": "^11.4.1",
|
||||
"glob": "^13.0.6",
|
||||
"imap": "^0.8.19",
|
||||
"ip": "^2.0.1",
|
||||
"json5": "^2.2.3",
|
||||
"mailparser": "^3.9.14",
|
||||
"mailparser": "^3.9.28",
|
||||
"protocol-buffers-schema": "^3.6.1",
|
||||
"puppeteer": "^25.3.0",
|
||||
"roku-deploy": "^3.17.7",
|
||||
"roku-deploy": "^3.18.4",
|
||||
"roku-test-automation": "^2.2.2",
|
||||
"rooibos-roku": "5.16.4",
|
||||
"rounded-rect-9patch": "^1.1.2",
|
||||
"rooibos-roku": "5.16.5",
|
||||
"semver": "^7.8.5",
|
||||
"shelljs": "^0.10.0",
|
||||
"telnet-client": "^2.2.13",
|
||||
"telnet-client": "^2.2.14",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "6.0.3",
|
||||
"xml2js": "^0.6.2",
|
||||
"yaml": "^2.9.0",
|
||||
"youtubei.js": "^17.2.0"
|
||||
"yaml": "^2.9.1",
|
||||
"youtubei.js": "^18.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "22"
|
||||
@@ -68,20 +66,16 @@
|
||||
"test:integration:player": "npx tsx ./integration-tests/vpd-run-player.ts",
|
||||
"version-sync": "node tools/version-sync.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",
|
||||
"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",
|
||||
"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:read": "node tools/registry.js --output registry.json",
|
||||
"registry:clear": "node tools/registry.js --clear",
|
||||
"restart-app": "node tools/restart-app.js",
|
||||
"check-for-updates": "node tools/check-for-updates.js",
|
||||
"shutdown": "node tools/shutdown.js"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rollup/rollup-linux-x64-gnu": "^4.62.2"
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.48.2",
|
||||
"version": "0.48.5",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-app",
|
||||
"version": "0.48.2"
|
||||
"version": "0.48.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.48.2",
|
||||
"version": "0.48.5",
|
||||
"description": "Unofficial YouTube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "node ../tools/rm.js ../build/playlet-app",
|
||||
|
||||
@@ -3,7 +3,7 @@ title=Playlet
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=48
|
||||
build_version=00002
|
||||
build_version=00005
|
||||
|
||||
ui_resolutions=hd
|
||||
uri_resolution_autosub=$$RES$$,480p,720p,1080p
|
||||
|
||||
@@ -23,6 +23,7 @@ function Main(args as object) as void
|
||||
|
||||
Registry.ClearPlayletLibUrlsIfNeeded(args)
|
||||
Registry.ClearRegistryIfNeeded(args)
|
||||
Registry.ClearUnsupportedPlayletLibUrls()
|
||||
|
||||
scene = screen.CreateScene("BootstrapScene")
|
||||
screen.show()
|
||||
|
||||
@@ -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
|
||||
@@ -1,3 +1,5 @@
|
||||
import "pkg:/source/PlayletLibUrls.bs"
|
||||
|
||||
namespace Registry
|
||||
|
||||
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")
|
||||
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
|
||||
if launchArgs = invalid or launchArgs.clearRegistry = invalid
|
||||
return
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.48.2",
|
||||
"version": "0.48.5",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-lib",
|
||||
"version": "0.48.2"
|
||||
"version": "0.48.5"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.48.2",
|
||||
"version": "0.48.5",
|
||||
"description": "Unofficial YouTube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "node ../tools/rm.js ../build/playlet-lib",
|
||||
|
||||
@@ -38,7 +38,7 @@
|
||||
<Group id="anchor">
|
||||
<Poster
|
||||
id="background"
|
||||
uri="pkg:/images/button-ex.9.png">
|
||||
uri="pkg:/images/button-ex.$$RES$$.9.png">
|
||||
<Poster id="icon" />
|
||||
<Label
|
||||
id="label"
|
||||
|
||||
@@ -73,7 +73,7 @@
|
||||
showRowLabel="[true]"
|
||||
rowFocusAnimationStyle="floatingfocus"
|
||||
variableWidthItems="true"
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png" />
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-30.$$RES$$.9.png" />
|
||||
|
||||
<Animation
|
||||
id="scrollAnimation"
|
||||
|
||||
@@ -2,51 +2,20 @@ import "pkg:/source/utils/MessagePortUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.jobQueueTaskReady = false
|
||||
m.jobQueueTask = CreateObject("roSGNode", "JobQueueTask")
|
||||
m.jobQueueTask.observeFieldScoped("ready", FuncName(OnJobQueueTaskReady))
|
||||
m.jobQueueTask.control = "run"
|
||||
m.top.observeField("shutdown", FuncName(OnShutdown))
|
||||
m.top.observeField("request", FuncName(OnRequest))
|
||||
end function
|
||||
|
||||
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
|
||||
m.jobQueueTask.control = "run"
|
||||
end function
|
||||
|
||||
function OnShutdown() as void
|
||||
m.top.unobserveField("shutdown")
|
||||
m.top.unobserveField("request")
|
||||
m.jobQueueTaskReady = false
|
||||
m.jobQueueTask.unobserveField("ready")
|
||||
m.jobQueueTask.shutdown = true
|
||||
m.jobQueueTask = invalid
|
||||
m.pendingRequestEvents = invalid
|
||||
end function
|
||||
|
||||
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()
|
||||
if not IsAssociativeArray(request)
|
||||
LogError("JobQueue: Invalid request data", request)
|
||||
|
||||
@@ -9,65 +9,57 @@ import "pkg:/source/utils/StringUtils.bs"
|
||||
const MAX_JOB_TASK_COUNT = 30
|
||||
' Minimum number of JobTasks that will be kept alive
|
||||
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
|
||||
' 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()
|
||||
m.top.functionName = "JobQueueTaskLoop"
|
||||
m.port = CreateObject("roMessagePort")
|
||||
m.top.observeField("shutdown", m.port)
|
||||
m.top.observeField("request", m.port)
|
||||
end function
|
||||
|
||||
function JobQueueTaskLoop() as void
|
||||
messagePort = CreateObject("roMessagePort")
|
||||
|
||||
m.top.observeField("shutdown", messagePort)
|
||||
m.top.observeField("request", messagePort)
|
||||
|
||||
m.top.ready = true
|
||||
port = m.port
|
||||
|
||||
m.busyJobTasks = {}
|
||||
m.idleJobTasks = []
|
||||
|
||||
requests = []
|
||||
startup = CreateObject("roTimespan")
|
||||
scaleDownTimer = CreateObject("roTimespan")
|
||||
|
||||
while true
|
||||
while requests.count() > 0
|
||||
if m.idleJobTasks.Count() > 0
|
||||
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
|
||||
while requests.Count() > 0 and m.idleJobTasks.Count() > 0
|
||||
ScheduleRequest(requests.Shift(), m.idleJobTasks.Pop())
|
||||
end while
|
||||
|
||||
scaleDownThresholdMs = m.idleJobTasks.Count() > MIN_JOB_TASK_COUNT ? SCALE_DOWN_THRESHOLD_MS : 0
|
||||
message = wait(scaleDownThresholdMs, messagePort)
|
||||
if requests.Count() > 0 and m.idleJobTasks.Count() + m.busyJobTasks.Count() < MAX_JOB_TASK_COUNT
|
||||
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 m.idleJobTasks.Count() > 0
|
||||
if m.idleJobTasks.Count() > MIN_JOB_TASK_COUNT and scaleDownTimer.TotalMilliseconds() >= SCALE_DOWN_THRESHOLD_MS
|
||||
jobTaskObject = m.idleJobTasks.Pop()
|
||||
jobTaskObject.node.UnobserveFieldScoped("ready")
|
||||
jobTaskObject.node.shutdown = true
|
||||
LogDebug("Scaled down JobTasks. Idle:", m.idleJobTasks.Count(), ", Busy:", m.busyJobTasks.Count())
|
||||
scaleDownTimer.Mark()
|
||||
end if
|
||||
continue while
|
||||
end if
|
||||
scaleDownTimer.Mark()
|
||||
|
||||
messageType = Type(message)
|
||||
if messageType = "roSGNodeEvent"
|
||||
@@ -89,16 +81,32 @@ function JobQueueTaskLoop() as void
|
||||
end while
|
||||
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)
|
||||
m.busyJobTasks[jobTaskObject.id] = jobTaskObject
|
||||
jobTaskObject.node.request = request
|
||||
end function
|
||||
|
||||
function Shutdown()
|
||||
m.top.UnobserveFieldScoped("request")
|
||||
m.top.UnobserveFieldScoped("shutdown")
|
||||
m.top.UnobserveField("request")
|
||||
m.top.UnobserveField("shutdown")
|
||||
m.top.request = invalid
|
||||
m.top.ready = false
|
||||
|
||||
for each jobTaskId in m.busyJobTasks
|
||||
jobTask = m.busyJobTasks[jobTaskId]
|
||||
|
||||
@@ -2,6 +2,5 @@
|
||||
<interface>
|
||||
<field id="request" type="assocarray" />
|
||||
<field id="shutdown" type="boolean" />
|
||||
<field id="ready" type="boolean" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -2,20 +2,21 @@ import "pkg:/components/JobSystem/JobRequest.bs"
|
||||
import "pkg:/source/utils/Logging.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()
|
||||
m.top.functionName = "JobTaskLoop"
|
||||
m.port = CreateObject("roMessagePort")
|
||||
m.top.observeField("shutdown", m.port)
|
||||
m.top.observeField("request", m.port)
|
||||
end function
|
||||
|
||||
function JobTaskLoop() as void
|
||||
msgPort = CreateObject("roMessagePort")
|
||||
|
||||
m.top.observeField("shutdown", msgPort)
|
||||
m.top.observeField("request", msgPort)
|
||||
|
||||
m.top.ready = true
|
||||
port = m.port
|
||||
|
||||
while true
|
||||
msg = wait(0, msgPort)
|
||||
msg = wait(POLL_MS, port)
|
||||
msgType = type(msg)
|
||||
|
||||
if msgType = "roSGNodeEvent"
|
||||
|
||||
@@ -15,14 +15,14 @@
|
||||
height="720"
|
||||
color="#242424"
|
||||
opacity="0.9"
|
||||
translation="[80,0]"
|
||||
translation="[62,0]"
|
||||
visible="false">
|
||||
</Rectangle>
|
||||
|
||||
<Rectangle
|
||||
id="Background"
|
||||
height="720"
|
||||
width="80"
|
||||
width="62"
|
||||
color="#242424"
|
||||
opacity="0.9">
|
||||
|
||||
@@ -30,13 +30,13 @@
|
||||
id="LogoFav"
|
||||
width="42"
|
||||
height="42"
|
||||
translation="[20, 48]"
|
||||
translation="[16, 48]"
|
||||
uri="pkg:/images/logo-fav.png" />
|
||||
<Poster
|
||||
id="Logo"
|
||||
width="106"
|
||||
height="42"
|
||||
translation="[20, 48]"
|
||||
translation="[16, 48]"
|
||||
opacity="0"
|
||||
uri="pkg:/images/logo-dark.png">
|
||||
<AppVersionLabel
|
||||
@@ -50,13 +50,13 @@
|
||||
itemSize="[190,50]"
|
||||
itemComponentName="NavBarComponent"
|
||||
focusFootprintBitmapUri=""
|
||||
focusBitmapUri="pkg:/images/white.9.png"
|
||||
focusBitmapUri="pkg:/images/white.$$RES$$.9.png"
|
||||
focusBitmapBlendColor="0xFF1C30FF"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
numRows="7"
|
||||
scrollSpeed="99999"
|
||||
itemSpacing="[0, 16]"
|
||||
translation="[15, 150]">
|
||||
translation="[13, 150]">
|
||||
</MarkupList>
|
||||
</Rectangle>
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@
|
||||
numRows="5"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
translation="[620,90]"
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-27.9.png" />
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-42.$$RES$$.9.png" />
|
||||
</Poster>
|
||||
</children>
|
||||
</component>
|
||||
@@ -43,7 +43,7 @@
|
||||
showRowLabel="[true]"
|
||||
rowFocusAnimationStyle="floatingfocus"
|
||||
variableWidthItems="true"
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png" />
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-30.$$RES$$.9.png" />
|
||||
</Group>
|
||||
</children>
|
||||
</component>
|
||||
@@ -20,7 +20,7 @@
|
||||
showRowLabel="[true]"
|
||||
rowFocusAnimationStyle="floatingfocus"
|
||||
variableWidthItems="true"
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png"
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-30.$$RES$$.9.png"
|
||||
/>
|
||||
</children>
|
||||
</component>
|
||||
@@ -33,7 +33,7 @@
|
||||
itemSize="[500,500]"
|
||||
itemComponentName="BackendTypeRowListCell"
|
||||
rowFocusAnimationStyle="floatingfocus"
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png">
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-30.$$RES$$.9.png">
|
||||
<ContentNode role="content">
|
||||
<ContentNode>
|
||||
<!-- bs:disable-next-line LOCALE_MISSING_TRANSLATIONS -->
|
||||
|
||||
@@ -17,6 +17,6 @@
|
||||
focusXOffset="[165]"
|
||||
itemComponentName="ProfileRowListCell"
|
||||
rowFocusAnimationStyle="floatingfocus"
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png" />
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-30.$$RES$$.9.png" />
|
||||
</children>
|
||||
</component>
|
||||
@@ -35,7 +35,7 @@
|
||||
numRows="4"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
translation="[40,120]"
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-27.9.png" />
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-42.$$RES$$.9.png" />
|
||||
</Rectangle>
|
||||
</children>
|
||||
</component>
|
||||
@@ -44,7 +44,7 @@
|
||||
showRowLabel="[true]"
|
||||
rowFocusAnimationStyle="floatingfocus"
|
||||
variableWidthItems="true"
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png" />
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-30.$$RES$$.9.png" />
|
||||
<Animation
|
||||
id="scrollAnimation"
|
||||
duration="0.3">
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
numRows="7"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
translation="[0,46]"
|
||||
focusBitmapUri="pkg:/images/white-border.9.png" />
|
||||
focusBitmapUri="pkg:/images/white-border.$$RES$$.9.png" />
|
||||
|
||||
</children>
|
||||
</component>
|
||||
@@ -15,11 +15,11 @@
|
||||
<children>
|
||||
<Poster
|
||||
id="BackgroundFocused"
|
||||
uri="pkg:/images/white.9.png"
|
||||
uri="pkg:/images/white.$$RES$$.9.png"
|
||||
visible="false" />
|
||||
<Poster
|
||||
id="Background"
|
||||
uri="pkg:/images/white-border.9.png" />
|
||||
uri="pkg:/images/white-border.$$RES$$.9.png" />
|
||||
<LayoutGroup id="Container" itemSpacings="[5]">
|
||||
<Label id="DisplayTextLabel">
|
||||
<Font role="font" uri="font:SystemFontFile" size="34" />
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
numRows="10"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
translation="[40,90]"
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png" />
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-30.$$RES$$.9.png" />
|
||||
|
||||
<ButtonEx
|
||||
id="saveButton"
|
||||
|
||||
@@ -255,6 +255,7 @@ class DashManifest
|
||||
xtagsInfo = m.GetXtagsInfo(format)
|
||||
format.xtagsInfo = xtagsInfo
|
||||
format.isDrc = xtagsInfo.isDrc
|
||||
format.isVoiceBoost = xtagsInfo.isVoiceBoost
|
||||
format.isDubbed = xtagsInfo.isDubbed
|
||||
format.isAutoDubbed = xtagsInfo.isAutoDubbed
|
||||
format.isDescriptive = xtagsInfo.isDescriptive
|
||||
@@ -277,12 +278,7 @@ class DashManifest
|
||||
audioTrackId = format.audioTrack.id
|
||||
end if
|
||||
|
||||
drc = ""
|
||||
if format.isDrc = true
|
||||
drc = "drc"
|
||||
end if
|
||||
|
||||
groupId = `${mimeType}-${justCodec}-${colorInfo}-${audioTrackId}-${drc}`
|
||||
groupId = `${mimeType}-${justCodec}-${colorInfo}-${audioTrackId}${m.GetAudioVariantSuffix(format)}`
|
||||
|
||||
if groupInfo[groupId] = invalid
|
||||
groupInfo[groupId] = []
|
||||
@@ -441,7 +437,7 @@ class DashManifest
|
||||
end for
|
||||
end if
|
||||
|
||||
if IsAssociativeArray(firstFormat.audioTrack) or firstFormat.isDrc = true
|
||||
if IsAssociativeArray(firstFormat.audioTrack) or firstFormat.isDrc = true or firstFormat.isVoiceBoost = true
|
||||
' Roles
|
||||
roles = m.GetTrackRoles(firstFormat)
|
||||
for each role in roles
|
||||
@@ -474,9 +470,7 @@ class DashManifest
|
||||
if IsAssociativeArray(stream.audioTrack) and IsString(stream.audioTrack.id)
|
||||
representationId = `${representationId}-${stream.audioTrack.id}`
|
||||
end if
|
||||
if stream.isDrc = true
|
||||
representationId = `${representationId}-drc`
|
||||
end if
|
||||
representationId = `${representationId}${m.GetAudioVariantSuffix(stream)}`
|
||||
|
||||
representationAttributes = {
|
||||
"id": representationId
|
||||
@@ -739,7 +733,10 @@ class DashManifest
|
||||
|
||||
function GetTrackRoles(format as object) as object
|
||||
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")
|
||||
else
|
||||
roles.Push("alternate")
|
||||
@@ -753,13 +750,28 @@ class DashManifest
|
||||
roles.Push("description")
|
||||
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")
|
||||
end if
|
||||
|
||||
return roles
|
||||
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
|
||||
' 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
|
||||
@@ -885,6 +897,7 @@ class DashManifest
|
||||
lang: ""
|
||||
acont: ""
|
||||
isDrc: false
|
||||
isVoiceBoost: false
|
||||
isDubbed: false
|
||||
isAutoDubbed: false
|
||||
isDescriptive: false
|
||||
@@ -921,6 +934,8 @@ class DashManifest
|
||||
result.acont = tags[key]
|
||||
else if key = "drc" and tags[key] = "1"
|
||||
result.isDrc = true
|
||||
else if key = "vb" and tags[key] = "1"
|
||||
result.isVoiceBoost = true
|
||||
end if
|
||||
end for
|
||||
|
||||
|
||||
@@ -1,22 +1,17 @@
|
||||
import "pkg:/components/JobSystem/Jobs.bs"
|
||||
import "pkg:/components/JobSystem/JobSystem.bs"
|
||||
import "pkg:/components/Services/Innertube/Constants.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
function Init()
|
||||
m.top.observeField("requestSessionData", FuncName(OnRequestSessionData))
|
||||
end function
|
||||
|
||||
function OnNodeReady()
|
||||
QueueSessionDataJob()
|
||||
end function
|
||||
|
||||
function OnRequestSessionData() as void
|
||||
sessionData = m.top.sessionData
|
||||
if IsAssociativeArray(sessionData) and not StringUtils.IsNullOrEmpty(sessionData.visitorData) and not StringUtils.IsNullOrEmpty(sessionData.livingRoomPoTokenId)
|
||||
return
|
||||
end if
|
||||
function EnsureSessionDataJob(_unused as dynamic) as object
|
||||
QueueSessionDataJob()
|
||||
return m.innertubeSessionDataJob
|
||||
end function
|
||||
|
||||
function QueueSessionDataJob() as void
|
||||
@@ -33,6 +28,9 @@ function QueueSessionDataJob() as void
|
||||
end function
|
||||
|
||||
function OnInnertubeSessionDataJobDone(event as object) as void
|
||||
JobSystem.UnobserveCallback(event.getRoSGNode())
|
||||
m.innertubeSessionDataJob = invalid
|
||||
node = event.getRoSGNode()
|
||||
JobSystem.UnobserveCallback(node)
|
||||
if m.innertubeSessionDataJob <> invalid and m.innertubeSessionDataJob.isSameNode(node)
|
||||
m.innertubeSessionDataJob = invalid
|
||||
end if
|
||||
end function
|
||||
@@ -1,7 +1,7 @@
|
||||
<component name="Innertube" extends="Node" includes="AutoBind">
|
||||
<interface>
|
||||
<field id="sessionData" type="assocarray" alwaysNotify="true" />
|
||||
<field id="requestSessionData" type="boolean" alwaysNotify="true" />
|
||||
<field id="jobQueue" type="node" />
|
||||
<function name="EnsureSessionDataJob" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1496,6 +1496,12 @@ namespace Innertube
|
||||
return invalid
|
||||
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)
|
||||
return invalid
|
||||
end if
|
||||
@@ -1526,6 +1532,29 @@ namespace Innertube
|
||||
return invalid
|
||||
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
|
||||
videoId = nodeData["contentId"]
|
||||
if not IsString(videoId)
|
||||
|
||||
@@ -17,6 +17,9 @@ namespace Innertube
|
||||
if sessionData = invalid or not IsInt(sessionData.timestamp)
|
||||
return false
|
||||
end if
|
||||
if StringUtils.IsNullOrEmpty(sessionData.visitorData)
|
||||
return false
|
||||
end if
|
||||
nowSeconds = TimeUtils.Now().AsSeconds()
|
||||
return nowSeconds - sessionData.timestamp <= INNERTUBE_VISITOR_DATA_LIFESPAN_SECONDS
|
||||
end function
|
||||
|
||||
@@ -58,6 +58,7 @@ class LoungeApi
|
||||
commandHandlers = {}
|
||||
commandHandlers[COMMAND_TYPE_NOOP] = m.HandleIgnoreCommand
|
||||
commandHandlers[COMMAND_TYPE_GET_VOLUME] = m.HandleIgnoreCommand
|
||||
commandHandlers[COMMAND_TYPE_SET_VOLUME] = m.HandleIgnoreCommand
|
||||
commandHandlers[COMMAND_TYPE_GET_SUBTITLES_TRACK] = m.HandleIgnoreCommand
|
||||
commandHandlers[COMMAND_TYPE_SET_SUBTITLES] = m.HandleIgnoreCommand
|
||||
commandHandlers[COMMAND_TYPE_SET_AUDIO_TRACK] = m.HandleIgnoreCommand
|
||||
@@ -78,7 +79,6 @@ class LoungeApi
|
||||
commandHandlers[COMMAND_TYPE_G_SESSION_ID] = m.HandleGSessionId
|
||||
commandHandlers[COMMAND_TYPE_LOUNGE_STATUS] = m.HandleLoungeStatus
|
||||
commandHandlers[COMMAND_TYPE_REMOTE_CONNECTED] = m.HandleRemoteConnected
|
||||
commandHandlers[COMMAND_TYPE_SET_VOLUME] = m.HandleSetVolume
|
||||
commandHandlers[COMMAND_TYPE_SET_PLAYLIST] = m.HandleSetPlaylist
|
||||
commandHandlers[COMMAND_TYPE_UPDATE_PLAYLIST] = m.HandleUpdatePlaylist
|
||||
commandHandlers[COMMAND_TYPE_PAUSE] = m.HandlePause
|
||||
@@ -422,20 +422,6 @@ class LoungeApi
|
||||
LoungeDeviceConnected.ShowNotifcation(m.notificationsNode, deviceName, userName, userAvatarUri)
|
||||
end function
|
||||
|
||||
function HandleSetVolume(_commandId as integer, _commandType as string, commandArgs as object, _messagesToSend as object) as void
|
||||
player = m.videoQueueNode.player
|
||||
if player = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
volume = Val(commandArgs["volume"])
|
||||
isMute = volume = 0
|
||||
LogInfo("Setting volume is not supported:", volume, "but can mute:", isMute)
|
||||
' TODO:P2 volume should be set to the lounge state.
|
||||
' Also the state needs to be separate from the player, since SponsorBlock can mute sections.
|
||||
player.mute = isMute
|
||||
end function
|
||||
|
||||
function HandleSetPlaylist(_commandId as integer, commandType as string, commandArgs as object, _messagesToSend as object)
|
||||
LogDebug(commandType, commandArgs)
|
||||
' TODO:P2 ctt: credentialTransferToken
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
' Outgoing commands
|
||||
const COMMAND_NOW_PLAYING = "nowPlaying"
|
||||
const COMMAND_ON_STATE_CHANGE = "onStateChange"
|
||||
const COMMAND_ON_VOLUME_CHANGED = "onVolumeChanged"
|
||||
const COMMAND_ON_PREVIOUS_NEXT_CHANGE = "onHasPreviousNextChanged"
|
||||
const COMMAND_ON_PLAYBACK_SPEED_CHANGED = "onPlaybackSpeedChanged"
|
||||
const COMMAND_LOUNGE_SCREEN_DISCONNECTED = "loungeScreenDisconnected"
|
||||
@@ -58,8 +57,6 @@ const FIELD_LIST_ID = "listId"
|
||||
const FIELD_MDX_EXPANDED_RECEIVER_VIDEO_ID_LIST = "mdxExpandedReceiverVideoIdList"
|
||||
const FIELD_CURRENT_TIME = "currentTime"
|
||||
const FIELD_DURATION = "duration"
|
||||
const FIELD_VOLUME = "volume"
|
||||
const FIELD_MUTED = "muted"
|
||||
const FIELD_CPN = "cpn"
|
||||
const FIELD_CTT = "ctt"
|
||||
const FIELD_CURRENT_INDEX = "currentIndex"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
height="100"
|
||||
opacity="0.9"
|
||||
blendColor="#414141"
|
||||
uri="pkg:/images/white.9.png">
|
||||
uri="pkg:/images/white.$$RES$$.9.png">
|
||||
|
||||
<CirclePoster
|
||||
id="thumbnailPoster"
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
height="70"
|
||||
opacity="0.8"
|
||||
blendColor="#414141"
|
||||
uri="pkg:/images/white.9.png">
|
||||
uri="pkg:/images/white.$$RES$$.9.png">
|
||||
<Poster
|
||||
uri="libpkg:/images/LogoSponsorBlockSimple256px.png"
|
||||
width="50"
|
||||
|
||||
@@ -48,13 +48,14 @@ function TelemetryLoop() as void
|
||||
m.dist = GetDist(m.tags)
|
||||
m.userId = GetUserId()
|
||||
|
||||
ReportLastExitCrash()
|
||||
|
||||
m.top.observeField("LogInfo", msgPort)
|
||||
m.top.observeField("LogWarn", msgPort)
|
||||
m.top.observeField("LogError", msgPort)
|
||||
m.top.observeField("LogEvent", msgPort)
|
||||
|
||||
ReportSessionStart()
|
||||
ReportLastExitCrash()
|
||||
|
||||
#if SUPPORTS_BATCHING
|
||||
debouceMs = 2000
|
||||
debounceCountLimit = 20
|
||||
@@ -153,6 +154,18 @@ function TelemetryLoop() as void
|
||||
end while
|
||||
end function
|
||||
|
||||
function ReportSessionStart() as void
|
||||
Sentry.SendEvents([{
|
||||
level: "info"
|
||||
message: "[SESSION] start"
|
||||
fingerprint: ["session start"]
|
||||
release: m.release
|
||||
dist: m.dist
|
||||
tags: m.tags
|
||||
userId: m.userId
|
||||
}])
|
||||
end function
|
||||
|
||||
function GetTags() as object
|
||||
appInfo = m.applicationInfo
|
||||
tags = appInfo@.GetAppInfo()
|
||||
|
||||
@@ -33,58 +33,59 @@ function ExecuteJob() as void
|
||||
service = new Invidious.InvidiousService(invidiousNode)
|
||||
backend = preferencesNode["backend.selected"]
|
||||
|
||||
metadata = contentNode.metadata
|
||||
if not IsAssociativeArray(metadata)
|
||||
cancellation = JobGetCancellation()
|
||||
if backend = "playlet"
|
||||
backendId = ResolveBackendId(backend, service)
|
||||
contentNode.addFields({ backend: backendId })
|
||||
contentNode.backend = backendId
|
||||
|
||||
sessionData = GetSessionData(innertubeNode, cancellation)
|
||||
if sessionData.cancel = true
|
||||
JobCancel()
|
||||
return
|
||||
end if
|
||||
if sessionData.error <> invalid
|
||||
JobError(sessionData.error)
|
||||
return
|
||||
end if
|
||||
cancellation = JobGetCancellation()
|
||||
if backend = "playlet"
|
||||
|
||||
accessToken = invalid
|
||||
onBehalfOfUser = invalid
|
||||
profileNode = invalid
|
||||
profile = profilesService.currentProfile
|
||||
if profile <> invalid and profile.type = "youtube"
|
||||
auth = ProfileContentAuthTokenUtils.EnsureFreshAccessToken(profile)
|
||||
if auth.state = ProfileContentAuthTokenUtils.AccessTokenState.NeedsReauth
|
||||
JobError(Locale.Dialogs.ProfileNeedsReauthMessage)
|
||||
return
|
||||
end if
|
||||
if auth.state = ProfileContentAuthTokenUtils.AccessTokenState.Ok
|
||||
accessToken = auth.token
|
||||
onBehalfOfUser = auth.activeIdentifyToken
|
||||
profileNode = profile
|
||||
end if
|
||||
end if
|
||||
|
||||
metadata = InnertubeService.GetVideoMetadata(contentNode.videoId, {
|
||||
"cancellation": cancellation
|
||||
"credentialTransferToken": loungeServiceNode.credentialTransferToken
|
||||
"visitorData": sessionData.visitorData
|
||||
"livingRoomPoTokenId": sessionData.livingRoomPoTokenId
|
||||
"accessToken": accessToken
|
||||
"onBehalfOfUser": onBehalfOfUser
|
||||
"profileNode": profileNode
|
||||
"profilesService": profilesService
|
||||
})
|
||||
if IsAssociativeArray(metadata)
|
||||
contentNode.addFields({
|
||||
potAttached: ValidBool(metadata.potAttached)
|
||||
potSource: ValidString(metadata.potSource)
|
||||
loggedIn: not StringUtils.IsNullOrEmpty(accessToken)
|
||||
})
|
||||
end if
|
||||
else
|
||||
metadata = service.GetVideoMetadata(contentNode.videoId, { cancellation: m.top.cancellation })
|
||||
sessionData = GetSessionData(innertubeNode, cancellation)
|
||||
if sessionData.cancel = true
|
||||
JobCancel()
|
||||
return
|
||||
end if
|
||||
if sessionData.error <> invalid
|
||||
JobError(sessionData.error)
|
||||
return
|
||||
end if
|
||||
|
||||
accessToken = invalid
|
||||
onBehalfOfUser = invalid
|
||||
profileNode = invalid
|
||||
profile = profilesService.currentProfile
|
||||
if profile <> invalid and profile.type = "youtube"
|
||||
auth = ProfileContentAuthTokenUtils.EnsureFreshAccessToken(profile)
|
||||
if auth.state = ProfileContentAuthTokenUtils.AccessTokenState.NeedsReauth
|
||||
JobError(Locale.Dialogs.ProfileNeedsReauthMessage)
|
||||
return
|
||||
end if
|
||||
if auth.state = ProfileContentAuthTokenUtils.AccessTokenState.Ok
|
||||
accessToken = auth.token
|
||||
onBehalfOfUser = auth.activeIdentifyToken
|
||||
profileNode = profile
|
||||
end if
|
||||
end if
|
||||
|
||||
metadata = InnertubeService.GetVideoMetadata(contentNode.videoId, {
|
||||
"cancellation": cancellation
|
||||
"credentialTransferToken": loungeServiceNode.credentialTransferToken
|
||||
"visitorData": sessionData.visitorData
|
||||
"livingRoomPoTokenId": sessionData.livingRoomPoTokenId
|
||||
"accessToken": accessToken
|
||||
"onBehalfOfUser": onBehalfOfUser
|
||||
"profileNode": profileNode
|
||||
"profilesService": profilesService
|
||||
})
|
||||
if IsAssociativeArray(metadata)
|
||||
contentNode.addFields({
|
||||
potAttached: ValidBool(metadata.potAttached)
|
||||
potSource: ValidString(metadata.potSource)
|
||||
loggedIn: not StringUtils.IsNullOrEmpty(accessToken)
|
||||
})
|
||||
end if
|
||||
else
|
||||
metadata = service.GetVideoMetadata(contentNode.videoId, { cancellation: m.top.cancellation })
|
||||
end if
|
||||
|
||||
if JobIsCancelled()
|
||||
@@ -180,17 +181,30 @@ function GetSessionData(innertubeNode as object, cancellation as object) as obje
|
||||
return sessionData
|
||||
end if
|
||||
|
||||
callback = innertubeNode.callFunc("EnsureSessionDataJob", invalid)
|
||||
|
||||
port = CreateObject("roMessagePort")
|
||||
MessagePortUtils.ObserveFieldScopedExSafe(innertubeNode, "sessionData", port)
|
||||
MessagePortUtils.ObserveFieldScopedExSafe(callback, "done", port)
|
||||
CancellationUtils.ObserveCancellationScoped(cancellation, port)
|
||||
|
||||
innertubeNode.requestSessionData = true
|
||||
message = wait(30000, port)
|
||||
cancelled = false
|
||||
while not SessionDataComplete(innertubeNode.sessionData) and callback.done <> true
|
||||
message = wait(30000, port)
|
||||
if message = invalid
|
||||
exit while
|
||||
end if
|
||||
if CancellationUtils.IsCancellationEvent(cancellation, message)
|
||||
cancelled = true
|
||||
exit while
|
||||
end if
|
||||
end while
|
||||
|
||||
innertubeNode.unobserveFieldScoped("sessionData")
|
||||
callback.unobserveFieldScoped("done")
|
||||
CancellationUtils.UnobserveCancellationScoped(cancellation)
|
||||
|
||||
if message <> invalid and CancellationUtils.IsCancellationEvent(cancellation, message)
|
||||
if cancelled
|
||||
return {
|
||||
cancel: true
|
||||
}
|
||||
@@ -210,6 +224,16 @@ function SessionDataComplete(sessionData as object) as boolean
|
||||
return IsAssociativeArray(sessionData) and not StringUtils.IsNullOrEmpty(sessionData.visitorData) and not StringUtils.IsNullOrEmpty(sessionData.livingRoomPoTokenId)
|
||||
end function
|
||||
|
||||
function ResolveBackendId(backend as string, service as Invidious.InvidiousService) as string
|
||||
if backend = "playlet"
|
||||
return "playlet"
|
||||
end if
|
||||
if service.GetInstance() = Invidious.PLAYLET_BUILT_IN_INSTANCE
|
||||
return "built-in"
|
||||
end if
|
||||
return "invidious"
|
||||
end function
|
||||
|
||||
function CreateStreamUrls(metadata as object, service as Invidious.InvidiousService, preferences as object, backend as string, playletServerPort as integer) as object
|
||||
instance = service.GetInstance()
|
||||
proxyVideos = preferences["invidious.proxy_videos"]
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
# VideoPlayerDev
|
||||
|
||||
The custom video player intended to replace `components/VideoPlayer` — a stock-OS-trickplay replica plus a
|
||||
control button row. It is selected at **compile time** by `#const USE_DEV_PLAYER` in `VideoQueue.bs` (default
|
||||
`false`). Build with the flag `true` to run it (and the integration suite).
|
||||
The custom video player that replaced `components/VideoPlayer` — a stock-OS-trickplay replica plus a control
|
||||
button row. It is selected at **compile time** by `#const USE_DEV_PLAYER` in `VideoQueue.bs`, currently `true`:
|
||||
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
|
||||
|
||||
|
||||
@@ -418,7 +418,7 @@ function TrySponsorBlockSkip() as boolean
|
||||
end function
|
||||
|
||||
' 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).
|
||||
function OnOkPress() as boolean
|
||||
' commit an active transport.
|
||||
@@ -805,7 +805,7 @@ function EnforceTransportFreeze(source as string) as void
|
||||
LogErrorNoTelemetry(healInfo)
|
||||
if m.healCount <= INV_D1_TELEMETRY_CAP
|
||||
LogTelemetryEvent({
|
||||
level: "error"
|
||||
level: "warning"
|
||||
message: healInfo
|
||||
fingerprint: ["INV-D1 heal", m.transport.transportMode, source]
|
||||
})
|
||||
@@ -842,7 +842,7 @@ end function
|
||||
function SendHealSummary() as void
|
||||
if m.healCount > INV_D1_TELEMETRY_CAP
|
||||
LogTelemetryEvent({
|
||||
level: "error"
|
||||
level: "warning"
|
||||
message: `INV-D1 heal: ${m.healCount} heals over one content (${m.healCount - INV_D1_TELEMETRY_CAP} past the telemetry cap)`
|
||||
fingerprint: ["INV-D1 heal suppressed"]
|
||||
})
|
||||
@@ -1152,7 +1152,7 @@ function OnVideoContentJobDone(event as object) as void
|
||||
content = m.top.content
|
||||
|
||||
if not info.success
|
||||
LogError("VideoContentJob FAILED:", info.error)
|
||||
LogError(`VideoContentJob FAILED: ${info.error}\nbackend: ${ContentBackend(content)}`)
|
||||
decision = ErrorDialogController.DecideContentJobFailure(content, info.error)
|
||||
ShowErrorDialog(decision)
|
||||
Lounge.SendOnStateChange()
|
||||
@@ -1442,6 +1442,13 @@ function GetPlayerErrorData(videoId as string, errorInfo as object) as object
|
||||
return { title: title, body: body, fingerprint: fingerprint }
|
||||
end function
|
||||
|
||||
function ContentBackend(content as object) as string
|
||||
if content <> invalid and not StringUtils.IsNullOrEmpty(content.backend)
|
||||
return content.backend
|
||||
end if
|
||||
return "unknown"
|
||||
end function
|
||||
|
||||
' Send a stream error to telemetry. For malformed-data errors, attach the last generated DASH/HLS manifest and
|
||||
' player response so the failure can be diagnosed from the report.
|
||||
function ReportVideoError(errorData as object, url as dynamic, urls as object, urlIndex as dynamic, shownInDialog as boolean) as void
|
||||
@@ -1464,21 +1471,19 @@ function ReportVideoError(errorData as object, url as dynamic, urls as object, u
|
||||
data: ValidString(ReadAsciiFile("cachefs:/last_player_response.json"))
|
||||
}]
|
||||
end if
|
||||
potAttached = "false"
|
||||
potAttached = false
|
||||
potSource = "none"
|
||||
loggedIn = "false"
|
||||
loggedIn = false
|
||||
content = m.top.content
|
||||
if content <> invalid
|
||||
if ValidBool(content.potAttached)
|
||||
potAttached = "true"
|
||||
end if
|
||||
potAttached = ValidBool(content.potAttached)
|
||||
loggedIn = ValidBool(content.loggedIn)
|
||||
if not StringUtils.IsNullOrEmpty(content.potSource)
|
||||
potSource = content.potSource
|
||||
end if
|
||||
if ValidBool(content.loggedIn)
|
||||
loggedIn = "true"
|
||||
end if
|
||||
end if
|
||||
backend = ContentBackend(content)
|
||||
isLive = m.transport.isLive
|
||||
message = [
|
||||
errorData.title
|
||||
errorData.body
|
||||
@@ -1491,11 +1496,15 @@ function ReportVideoError(errorData as object, url as dynamic, urls as object, u
|
||||
`pot_attached: ${potAttached}`
|
||||
`pot_source: ${potSource}`
|
||||
`logged_in: ${loggedIn}`
|
||||
`backend: ${backend}`
|
||||
`is_live: ${isLive}`
|
||||
].Join(Chr(10))
|
||||
errorData.fingerprint.Push(shownInDialog)
|
||||
errorData.fingerprint.Push(potAttached)
|
||||
errorData.fingerprint.Push(potSource)
|
||||
errorData.fingerprint.Push(loggedIn)
|
||||
errorData.fingerprint.Push(backend)
|
||||
errorData.fingerprint.Push(isLive)
|
||||
if shownInDialog
|
||||
level = "error"
|
||||
else
|
||||
|
||||
@@ -84,6 +84,14 @@ function TestSetup() as void
|
||||
m.top.unobserveField(deviceField)
|
||||
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()
|
||||
end function
|
||||
|
||||
@@ -118,6 +126,13 @@ function TestSetLive(edgeMs as integer) as void
|
||||
m.transport.OnPosition(edgeMs)
|
||||
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).
|
||||
function TestFireLiveBadgeHold() as void
|
||||
OnLiveBadgeHoldFire()
|
||||
@@ -151,6 +166,10 @@ function TestPlaybackErrorDialog(errorFields as object) as object
|
||||
playletStreamUrls: []
|
||||
playletStreamUrlIndex: 0
|
||||
})
|
||||
if errorFields.backend <> invalid
|
||||
content.addField("backend", "string", false)
|
||||
content.backend = errorFields.backend
|
||||
end if
|
||||
m.top.content = content
|
||||
|
||||
m.top.errorMsg = errorFields.errorMsg
|
||||
@@ -210,6 +229,7 @@ function TestSnapshot() as object
|
||||
focusTarget: m.focusTarget
|
||||
focusedButton: m.focusedButton
|
||||
nudgeCount: m.top.nudgeCount
|
||||
sponsorNoticeShown: SponsorBlock.GetCurrentNotification(m.notifications) <> invalid
|
||||
forceLiveBadge: m.trickPlayBar.forceLiveBadge
|
||||
liveBadgeShown: m.trickPlayBar.findNode("liveLabel").visible
|
||||
barRemainingText: m.trickPlayBar.findNode("remainingLabel").text
|
||||
|
||||
@@ -52,6 +52,7 @@
|
||||
<function name="TestWireQueueClose" />
|
||||
<function name="TestSetControl" />
|
||||
<function name="TestSetLive" />
|
||||
<function name="TestSeedSponsorBlock" />
|
||||
<function name="TestFireLiveBadgeHold" />
|
||||
<function name="TestKillAutoHide" />
|
||||
<function name="TestFinishChromeFadeOut" />
|
||||
|
||||
@@ -183,12 +183,51 @@ namespace Tests
|
||||
m.assertTrue(snap.title.Instr("dQw4w9WgXcQ") >= 0, "dialog title dropped the videoId")
|
||||
end function
|
||||
|
||||
@it("the reported playback error carries the serving backend and the live flag")
|
||||
function _()
|
||||
m.top.callFunc("TestPlaybackErrorDialog", {
|
||||
videoId: "dQw4w9WgXcQ"
|
||||
errorMsg: "no valid bitrates"
|
||||
errorCode: -5
|
||||
errorStr: "buffer:loop:demux:Errors seen on all bitrates:last_err:503"
|
||||
errorInfo: { category: "mediaerror", source: "buffer:loop:demux", ignored: false }
|
||||
backend: "built-in"
|
||||
})
|
||||
|
||||
reported = m.global.telemetry.LogEvent
|
||||
m.assertTrue(reported.message.Instr("backend: built-in") > 0, "got: " + reported.message)
|
||||
m.assertTrue(reported.message.Instr("is_live: false") > 0, "got: " + reported.message)
|
||||
m.assertTrue(reported.message.Instr("pot_attached: false") > 0, "got: " + reported.message)
|
||||
m.assertArrayContains(reported.fingerprint, "built-in")
|
||||
end function
|
||||
|
||||
@it("a playback error on a content node with no backend reports it as unknown")
|
||||
function _()
|
||||
m.top.callFunc("TestPlaybackErrorDialog", {
|
||||
videoId: "dQw4w9WgXcQ"
|
||||
errorMsg: "no valid bitrates"
|
||||
errorCode: -5
|
||||
errorStr: "buffer:loop:demux:Errors seen on all bitrates:last_err:403"
|
||||
errorInfo: { category: "mediaerror", source: "buffer:loop:demux", ignored: false }
|
||||
})
|
||||
|
||||
reported = m.global.telemetry.LogEvent
|
||||
m.assertTrue(reported.message.Instr("backend: unknown") > 0, "got: " + reported.message)
|
||||
end function
|
||||
|
||||
' 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 _()
|
||||
m.assertFalse(m.Snap().chromeShown) ' starts hidden after setup
|
||||
m.top.callFunc("TestKey", RemoteKeys.Up, true)
|
||||
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
|
||||
|
||||
' =========================================================================================
|
||||
@@ -317,6 +356,121 @@ namespace Tests
|
||||
m.assertTrue(m.top.videoQueue.closePlayer, "rung 4: Back closes")
|
||||
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
|
||||
' 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")
|
||||
@@ -523,6 +677,61 @@ namespace Tests
|
||||
m.assertEqual(snap.focusedButton, 1, "the highlight is untouched")
|
||||
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
|
||||
' 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.
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
width="500"
|
||||
height="144"
|
||||
opacity="0.9"
|
||||
uri="pkg:/images/white.9.png">
|
||||
uri="pkg:/images/white.$$RES$$.9.png">
|
||||
|
||||
<Poster
|
||||
id="thumbnailPoster"
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
numRows="6"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
translation="[20,90]"
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-27.9.png" />
|
||||
focusBitmapUri="pkg:/images/focus-glow-padding-42.$$RES$$.9.png" />
|
||||
</Rectangle>
|
||||
|
||||
<Animation id="showAnimation"
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<Poster
|
||||
id="highlightPoster"
|
||||
blendColor="0xFF1C30"
|
||||
uri="pkg:/images/queue-highlight.9.png"
|
||||
uri="pkg:/images/queue-highlight.$$RES$$.9.png"
|
||||
width="164"
|
||||
height="94" />
|
||||
<Label
|
||||
|
||||
@@ -91,9 +91,6 @@ namespace Http
|
||||
instance = m.invidiousService.GetInstance()
|
||||
|
||||
contentNode = InvidiousContent.ToRowCellContentNode(payload, instance)
|
||||
if IsAssociativeArray(payload.metadata)
|
||||
contentNode.addFields({ metadata: payload.metadata })
|
||||
end if
|
||||
|
||||
nodeType = contentNode.type
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 1.9 KiB |
|
After Width: | Height: | Size: 873 B |
|
After Width: | Height: | Size: 1.6 KiB |
|
Before Width: | Height: | Size: 7.3 KiB |
|
Before Width: | Height: | Size: 7.3 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 861 B |
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 2.3 KiB |
|
After Width: | Height: | Size: 897 B |
|
After Width: | Height: | Size: 1.4 KiB |
@@ -1,4 +1,3 @@
|
||||
<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"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 533 B After Width: | Height: | Size: 365 B |
@@ -1,5 +1,5 @@
|
||||
{
|
||||
inputHash: 'c4e2899f8a5e58f6ae711e91e518b4f3',
|
||||
inputHash: '020c780cc50d3bc4ed9fc56f03bd1b21',
|
||||
outputs: [
|
||||
{
|
||||
outputFilePath: 'images/icons/search.png',
|
||||
|
||||
|
Before Width: | Height: | Size: 292 B After Width: | Height: | Size: 292 B |
|
After Width: | Height: | Size: 518 B |
|
After Width: | Height: | Size: 665 B |
|
Before Width: | Height: | Size: 1017 B After Width: | Height: | Size: 1017 B |
|
After Width: | Height: | Size: 496 B |
|
After Width: | Height: | Size: 722 B |
|
Before Width: | Height: | Size: 985 B After Width: | Height: | Size: 985 B |
|
After Width: | Height: | Size: 488 B |
|
After Width: | Height: | Size: 721 B |
@@ -3,7 +3,7 @@ title=PlayletLib
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=48
|
||||
build_version=00002
|
||||
build_version=00005
|
||||
|
||||
ui_resolutions=hd
|
||||
uri_resolution_autosub=$$RES$$,480p,720p,1080p
|
||||
|
||||
@@ -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:
|
||||
' - Removed Kanji, because it added a significant amount of size, while the use
|
||||
' cases of this app does not include Kanji
|
||||
@@ -7,4 +30,4 @@
|
||||
' the generation more thread friendly (we can generate the qrcode in a task) without
|
||||
' freezing the UI.
|
||||
' - Added a simple cachefs cache file to avoid regenerating the same QRCode images
|
||||
' TODO:P2 add original tests
|
||||
' TODO:P2 add original tests
|
||||
@@ -38,7 +38,7 @@ namespace Tests
|
||||
msg = wait(1000, messagePort)
|
||||
|
||||
if msg = invalid
|
||||
m.testSuite.fail("Waiting for job messages timed out after 1000ms")
|
||||
m.fail("Waiting for job messages timed out after 1000ms")
|
||||
exit while
|
||||
end if
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Tests
|
||||
msg = wait(1000, messagePort)
|
||||
|
||||
if msg = invalid
|
||||
m.testSuite.fail("Waiting for job messages timed out after 1000ms")
|
||||
m.fail("Waiting for job messages timed out after 1000ms")
|
||||
exit while
|
||||
end if
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace Tests
|
||||
if info.cancel and not info.success
|
||||
cancelCalls += 1
|
||||
else if info.success
|
||||
m.testSuite.fail("Job should not have succeeded after cancellation")
|
||||
m.fail("Job should not have succeeded after cancellation")
|
||||
exit while
|
||||
end if
|
||||
end if
|
||||
@@ -126,7 +126,7 @@ namespace Tests
|
||||
msg = wait(1000, messagePort)
|
||||
|
||||
if msg = invalid
|
||||
m.testSuite.fail("Waiting for job messages timed out after 1000ms")
|
||||
m.fail("Waiting for job messages timed out after 1000ms")
|
||||
exit while
|
||||
end if
|
||||
|
||||
@@ -136,7 +136,7 @@ namespace Tests
|
||||
if info.cancel and not info.success
|
||||
cancelCalls += 1
|
||||
else if info.success
|
||||
m.testSuite.fail("Job should not have succeeded after cancellation")
|
||||
m.fail("Job should not have succeeded after cancellation")
|
||||
exit while
|
||||
end if
|
||||
end if
|
||||
@@ -161,11 +161,11 @@ namespace Tests
|
||||
msg = wait(1000, messagePort)
|
||||
|
||||
if msg = invalid
|
||||
m.testSuite.fail("Waiting for job error message timed out after 1000ms")
|
||||
m.fail("Waiting for job error message timed out after 1000ms")
|
||||
end if
|
||||
|
||||
if type(msg) <> "roSGNodeEvent" or msg.getField() <> "done"
|
||||
m.testSuite.fail("Expected a done event for the job error")
|
||||
m.fail("Expected a done event for the job error")
|
||||
end if
|
||||
|
||||
done = msg.getData()
|
||||
|
||||
@@ -471,7 +471,15 @@ namespace HttpClient
|
||||
backoffMs = 1000 + Rnd(2000)
|
||||
tryNumber = m._tryCount - triesLeft + 1
|
||||
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)
|
||||
try
|
||||
|
||||
@@ -35,6 +35,12 @@ namespace Tests
|
||||
m.assertEqual(PlayerCoordinatorLogic.KeyToCommand(RemoteKeys.Ok), 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.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)
|
||||
end function
|
||||
|
||||
|
||||
@@ -33,10 +33,6 @@ function LogTelemetryEvent(event as object)
|
||||
m.global.telemetry.LogEvent = event
|
||||
end function
|
||||
|
||||
function LogWarnTelemetry(message as string)
|
||||
m.global.telemetry.LogWarn = message
|
||||
end function
|
||||
|
||||
function ToString(value as dynamic) as string
|
||||
if getInterface(value, "ifString") <> invalid
|
||||
return value
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-web",
|
||||
"version": "0.48.2",
|
||||
"version": "0.48.5",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -9,27 +9,27 @@
|
||||
"lint": "svelte-check --tsconfig ./tsconfig.json --fail-on-warnings"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^7.2.0",
|
||||
"@tailwindcss/postcss": "^4.3.2",
|
||||
"@sveltejs/vite-plugin-svelte": "^7.3.1",
|
||||
"@tailwindcss/postcss": "^4.3.3",
|
||||
"@tailwindcss/typography": "^0.5.20",
|
||||
"@tsconfig/svelte": "^5.0.8",
|
||||
"@vitejs/plugin-legacy": "^8.2.0",
|
||||
"autoprefixer": "^10.5.2",
|
||||
"bgutils-js": "^3.2.0",
|
||||
"daisyui": "^5.6.16",
|
||||
"dotenv": "^17.4.2",
|
||||
"@vitejs/plugin-legacy": "^8.2.3",
|
||||
"autoprefixer": "^10.6.1",
|
||||
"bgutils-js": "^4.0.3",
|
||||
"daisyui": "^5.7.46",
|
||||
"dotenv": "^18.0.4",
|
||||
"ip": "^2.0.1",
|
||||
"jszip": "^3.10.1",
|
||||
"postcss": "^8.5.16",
|
||||
"rollup-plugin-visualizer": "^7.0.1",
|
||||
"svelte": "^5.56.4",
|
||||
"svelte-check": "^4.7.2",
|
||||
"svelte-preprocess": "6.0.3",
|
||||
"tailwindcss": "^4.3.2",
|
||||
"terser": "^5.49.0",
|
||||
"jszip": "^3.10.2",
|
||||
"postcss": "^8.5.28",
|
||||
"rollup-plugin-visualizer": "^7.1.1",
|
||||
"svelte": "^5.57.1",
|
||||
"svelte-check": "^4.7.6",
|
||||
"svelte-preprocess": "^6.0.5",
|
||||
"tailwindcss": "^4.3.3",
|
||||
"terser": "^5.51.2",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.9.3",
|
||||
"vite": "^8.1.4",
|
||||
"vite": "^8.3.1",
|
||||
"vite-plugin-compression": "^0.5.1"
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
import { getHost } from "lib/Api/Host";
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { BG, buildURL, GOOG_API_KEY, type WebPoSignalOutput, type BgConfig } from "bgutils-js";
|
||||
import { BotGuardClient, getChallenge } from "bgutils-js/botguard";
|
||||
import { WebPoMinter } from "bgutils-js/webpo";
|
||||
import { buildURL, getHeaders } from "bgutils-js/utils";
|
||||
import type { WebPoSignalOutput } from "bgutils-js/shared-types";
|
||||
|
||||
// Fallback lifetime when GenerateIT reports no TTL.
|
||||
const DEFAULT_POTOKEN_TTL_SECONDS = 60 * 60 * 6;
|
||||
@@ -23,7 +26,7 @@ interface DevicePoToken {
|
||||
|
||||
// Mints a GVS poToken in the browser (BotGuard) and hands it to the Roku.
|
||||
export class PoTokenMinter {
|
||||
static webPoMinter: BG.WebPoMinter;
|
||||
static webPoMinter: WebPoMinter;
|
||||
static webPoMinterPromise: Promise<void>;
|
||||
static integrityTokenExpiresAtMs = 0;
|
||||
|
||||
@@ -93,41 +96,30 @@ export class PoTokenMinter {
|
||||
try {
|
||||
const requestKey = 'O43z0dpjhgX20SCx4KAo';
|
||||
|
||||
const bgConfig: BgConfig = {
|
||||
fetch: (input: string | URL | globalThis.Request, init?: RequestInit) => PoTokenMinter.fetch(input, init),
|
||||
globalObj: globalThis,
|
||||
const bgChallenge = await getChallenge({
|
||||
requestKey,
|
||||
identifier: ''
|
||||
};
|
||||
fetchFunction: PoTokenMinter.fetch
|
||||
});
|
||||
|
||||
const bgChallenge = await BG.Challenge.create(bgConfig);
|
||||
if (!bgChallenge) {
|
||||
throw new Error('Could not get challenge');
|
||||
}
|
||||
|
||||
const interpreterJavascript = bgChallenge.interpreterJavascript.privateDoNotAccessOrElseSafeScriptWrappedValue;
|
||||
const interpreterJavascript = bgChallenge.interpreterJavascript?.privateDoNotAccessOrElseSafeScriptWrappedValue;
|
||||
if (interpreterJavascript) {
|
||||
new Function(interpreterJavascript)();
|
||||
} else {
|
||||
throw new Error('Could not load VM');
|
||||
}
|
||||
|
||||
const botguard = await BG.BotGuardClient.create({
|
||||
const botguard = await BotGuardClient.create({
|
||||
globalName: bgChallenge.globalName,
|
||||
globalObj: globalThis,
|
||||
globalObject: globalThis,
|
||||
program: bgChallenge.program
|
||||
});
|
||||
|
||||
const webPoSignalOutput: WebPoSignalOutput = [];
|
||||
const botguardResponse = await botguard.snapshot({ webPoSignalOutput });
|
||||
|
||||
const integrityTokenResponse = await bgConfig.fetch(buildURL('GenerateIT', true), {
|
||||
const integrityTokenResponse = await PoTokenMinter.fetch(buildURL('GenerateIT', true), {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'content-type': 'application/json+protobuf',
|
||||
'x-goog-api-key': GOOG_API_KEY,
|
||||
'x-user-agent': 'grpc-web-javascript/0.1'
|
||||
},
|
||||
headers: getHeaders(),
|
||||
body: JSON.stringify([requestKey, botguardResponse])
|
||||
});
|
||||
|
||||
@@ -142,7 +134,7 @@ export class PoTokenMinter {
|
||||
: DEFAULT_POTOKEN_TTL_SECONDS;
|
||||
PoTokenMinter.integrityTokenExpiresAtMs = Date.now() + ttlSeconds * 1000;
|
||||
|
||||
PoTokenMinter.webPoMinter = await BG.WebPoMinter.create({ integrityToken: response[0] }, webPoSignalOutput);
|
||||
PoTokenMinter.webPoMinter = await WebPoMinter.create({ integrityToken: response[0] }, webPoSignalOutput);
|
||||
PoTokenMinter.webPoMinterPromise = null;
|
||||
resolve();
|
||||
} catch (error) {
|
||||
|
||||
@@ -12,6 +12,17 @@
|
||||
let libUrlType;
|
||||
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 () => {
|
||||
releases = await fetchReleaseTags();
|
||||
setCurrentlyUsedRelease();
|
||||
@@ -62,17 +73,19 @@
|
||||
break;
|
||||
}
|
||||
}
|
||||
return releases.map((release) => {
|
||||
return {
|
||||
name: release.tag_name,
|
||||
enabled:
|
||||
release.assets.filter(
|
||||
(asset) =>
|
||||
asset.name === "playlet-lib.zip" ||
|
||||
asset.name === "playlet-lib.squashfs.pkg"
|
||||
).length > 0,
|
||||
};
|
||||
});
|
||||
return releases
|
||||
.filter((release) => isSupported(release.tag_name))
|
||||
.map((release) => {
|
||||
return {
|
||||
name: release.tag_name,
|
||||
enabled:
|
||||
release.assets.filter(
|
||||
(asset) =>
|
||||
asset.name === "playlet-lib.zip" ||
|
||||
asset.name === "playlet-lib.squashfs.pkg"
|
||||
).length > 0,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
async function apply() {
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
"composite": true,
|
||||
"module": "NodeNext",
|
||||
"moduleResolution": "NodeNext"
|
||||
"target": "ESNext",
|
||||
"module": "ESNext",
|
||||
"moduleResolution": "Bundler"
|
||||
},
|
||||
"include": [
|
||||
"vite.config.ts"
|
||||
|
||||
@@ -35,7 +35,7 @@ const config: UserConfig = {
|
||||
// But the tools are not (because brighterscript is expecting CommonJs)
|
||||
// so we can't import the function from the tools/get-env-vars.js.
|
||||
function getEnvVars(requiredVars = undefined) {
|
||||
const envFile = joinPath(__dirname, '../.env');
|
||||
const envFile = joinPath(import.meta.dirname, '../.env');
|
||||
|
||||
let envVars = process.env;
|
||||
if (existsSync(envFile)) {
|
||||
|
||||
@@ -7,7 +7,6 @@ const { existsSync, writeFileSync, readFileSync } = require('fs');
|
||||
const json5 = require('json5');
|
||||
const md5 = require('crypto-js/md5');
|
||||
const path = require('path');
|
||||
const { executablePath } = require('puppeteer');
|
||||
|
||||
const META_EXT = '.meta.json5';
|
||||
|
||||
@@ -118,7 +117,7 @@ function checkFileHash(file, hash) {
|
||||
|
||||
async function generateImage(inputImage, options, rootDir) {
|
||||
const opts = {
|
||||
launch: { executablePath: await executablePath() },
|
||||
launch: { channel: 'chrome' },
|
||||
...options
|
||||
};
|
||||
opts.outputFilePath = path.join(rootDir, opts.outputFilePath);
|
||||
|
||||
@@ -34,23 +34,27 @@ This page was automatically generated on ${formattedDate}.
|
||||
fs.writeFileSync(markdownFile, markdownContent);
|
||||
}
|
||||
|
||||
async function deleteExistingAttachments() {
|
||||
try {
|
||||
const files = fs.readdirSync(attachmentDestination);
|
||||
function deleteExistingAttachments() {
|
||||
const files = fs.readdirSync(attachmentDestination);
|
||||
|
||||
for (const file of files) {
|
||||
if (path.extname(file) === '.png') {
|
||||
fs.unlinkSync(path.join(attachmentDestination, file));
|
||||
console.log(`Deleted ${file}`);
|
||||
}
|
||||
for (const file of files) {
|
||||
if (path.extname(file) === '.png') {
|
||||
fs.unlinkSync(path.join(attachmentDestination, file));
|
||||
console.log(`Deleted ${file}`);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
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({
|
||||
user: config.EMAIL,
|
||||
password: config.EMAIL_APP_PASSWORD,
|
||||
@@ -59,7 +63,9 @@ const imap = new Imap({
|
||||
tls: true,
|
||||
tlsOptions: {
|
||||
rejectUnauthorized: false
|
||||
}
|
||||
},
|
||||
connTimeout: CONNECT_TIMEOUT_MS,
|
||||
authTimeout: AUTH_TIMEOUT_MS
|
||||
});
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
const timeout = setTimeout(() => {
|
||||
console.log('Timeout');
|
||||
function sleep(ms) {
|
||||
return new Promise(resolve => setTimeout(resolve, ms));
|
||||
}
|
||||
|
||||
function fail(error) {
|
||||
console.error('Error:', error);
|
||||
process.exit(1);
|
||||
}, 10 * 60 * 1000);
|
||||
}
|
||||
|
||||
imap.once('ready', async () => {
|
||||
try {
|
||||
await openBoxAsync('INBOX');
|
||||
function connectAsync() {
|
||||
return new Promise((resolve, reject) => {
|
||||
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();
|
||||
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();
|
||||
} catch (error) {
|
||||
console.error('Error:', error);
|
||||
async function connectWithRetryAsync() {
|
||||
for (let attempt = 1; ; attempt++) {
|
||||
try {
|
||||
await connectAsync();
|
||||
return;
|
||||
} catch (error) {
|
||||
if (attempt === CONNECT_ATTEMPTS) {
|
||||
throw error;
|
||||
}
|
||||
console.error('Connection attempt %d/%d failed: %s', attempt, CONNECT_ATTEMPTS, error.message);
|
||||
await sleep(RETRY_DELAY_MS);
|
||||
}
|
||||
}
|
||||
clearTimeout(timeout);
|
||||
});
|
||||
}
|
||||
|
||||
imap.once('error', err => {
|
||||
console.error(err);
|
||||
});
|
||||
async function downloadStats() {
|
||||
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');
|
||||
});
|
||||
|
||||
imap.connect();
|
||||
setTimeout(() => fail(new Error(`Gave up after ${RUN_TIMEOUT_MS / 1000}s`)), RUN_TIMEOUT_MS);
|
||||
|
||||
downloadStats().then(() => {
|
||||
process.exit(0);
|
||||
}).catch(fail);
|
||||