Compare commits

..
12 Commits
63 changed files with 487 additions and 135 deletions

No files matched your search

+6
View File
@@ -8,4 +8,10 @@
"editor.formatOnSave": true,
"xml.format.maxLineWidth": 0,
"svelte.enable-ts-plugin": true,
"brightscript.projects": [
"playlet-app/bsconfig.json",
"playlet-app/bsconfig.tests.json",
"playlet-lib/bsconfig.json",
"playlet-lib/bsconfig.tests.json"
]
}
+15
View File
@@ -5,6 +5,21 @@ 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.47.0] - 2026-06-18
### Added
- Support for 4K video
- Playlet already supported 4K videos. This adds a support check, and quality selectors in the settings, for the devices that support it.
- Not all 4k supporting devices - only with AV1 support (usually newer devices)
- Not all 4k videos are playable, only AV1 encoded videos
- SponsorBlock "Hook/Greetings" category
### Fixed
- Missing video durations in channel pages, when using Playlet backend
- Captions on some videos (from TV broadcasts) displaying vertically instead of horizontally
## [0.46.0] - 2026-06-12
### Added
+3 -1
View File
@@ -98,7 +98,9 @@
"../tools/bs-plugins/logger-plugin.ts",
"../tools/bs-plugins/web-server-plugin.ts",
"../tools/bs-plugins/locale-validation-plugin.ts",
"../tools/bs-plugins/proto-gen-plugin.ts"
"../tools/bs-plugins/proto-gen-plugin.ts",
// Must be last: fails the command if any plugin above failed to load
"../tools/bs-plugins/critical-exit-guard-plugin.ts"
],
"retainStagingDir": true,
"require": [
+3 -1
View File
@@ -28,7 +28,9 @@
"../tools/bs-plugins/logger-plugin.ts",
"../tools/bs-plugins/web-server-plugin.ts",
"../tools/bs-plugins/locale-validation-plugin.ts",
"../tools/bs-plugins/proto-gen-plugin.ts"
"../tools/bs-plugins/proto-gen-plugin.ts",
// Must be last: fails the command if any plugin above failed to load
"../tools/bs-plugins/critical-exit-guard-plugin.ts"
],
"rooibos": {
"logLevel": 2,
+1
View File
@@ -2,6 +2,7 @@
"globals": [],
"ignores": [
"**/roku_modules/**/*",
"**/components/rooibos/**/*",
"**/bslib.brs"
],
"rules": {
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet",
"version": "0.46.0",
"version": "0.47.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "playlet",
"version": "0.46.0",
"version": "0.47.0",
"hasInstallScript": true,
"devDependencies": {
"@rokucommunity/bslint": "^0.8.43",
+5 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet",
"version": "0.46.0",
"version": "0.47.0",
"description": "Unofficial YouTube client for Roku",
"devDependencies": {
"@rokucommunity/bslint": "^0.8.43",
@@ -42,6 +42,7 @@
"dev:web": "cd playlet-web && npm run dev",
"prebuild": "node tools/rm.js dist",
"build:dev": "npm run prebuild && npm run build:web && npm run build:lib:dev && npm run build:app:dev",
"build:dev:v2": "PLAYLET_DEVTOOLS=1 npm run build:dev",
"build:prod": "npm run prebuild && npm run build:web && npm run build:lib:prod && npm run build:app:prod",
"build:release": "npm run prebuild && npm run format:fix && npm run lint:fix && npm run version-sync && npm run manifest-git-hash && npm run build:prod",
"build:app:dev": "cd playlet-app && npm run build:dev",
@@ -55,6 +56,9 @@
"format": "cd playlet-lib && npm run format && cd ../playlet-app && npm run format",
"format:fix": "cd playlet-lib && npm run format:fix && cd ../playlet-app && npm run format:fix",
"test": "npm run test:lib && npm run test:app",
"test:v2": "npm run test:v2:lib && npm run test:v2:app",
"test:v2:lib": "cd playlet-lib && npm run test:v2",
"test:v2:app": "cd playlet-app && npm run test:v2",
"test:build": "npm run test:build:lib && npm run test:build:app",
"test:app": "cd playlet-app && npm run test",
"test:build:app": "cd playlet-app && npm run test:build",
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-app",
"version": "0.46.0",
"version": "0.47.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-app",
"version": "0.46.0"
"version": "0.47.0"
}
}
}
+5 -2
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-app",
"version": "0.46.0",
"version": "0.47.0",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "node ../tools/rm.js ../build/playlet-app",
@@ -18,6 +18,9 @@
"format:fix": "npm run format:base -- --write",
"test": "npm run test:build && npm run test:run",
"test:build": "bsc --project bsconfig.tests.json --create-package --sourceMap=true --debug --test-mode --lintConfig ../config/bslint.jsonc",
"test:run": "node ../tools/run-test-app.js --package ../build/playlet-app-tests.zip"
"test:run": "node ../tools/run-test-app.js --package ../build/playlet-app-tests.zip",
"test:v2": "npm run test:build && npm run test:run:v2",
"pretest:run:v2": "../../../dev-tools/bin/ensure-service.sh",
"test:run:v2": "../../../dev-tools/bin/test-app.sh --package ../build/playlet-app-tests.zip --output ../build/playlet-app-tests.txt"
}
}
+1 -1
View File
@@ -2,7 +2,7 @@ title=Playlet
# Do not update version manually, it is auto updated from package.json
major_version=0
minor_version=46
minor_version=47
build_version=00000
ui_resolutions=hd
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-lib",
"version": "0.46.0",
"version": "0.47.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-lib",
"version": "0.46.0"
"version": "0.47.0"
}
}
}
+5 -2
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-lib",
"version": "0.46.0",
"version": "0.47.0",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "node ../tools/rm.js ../build/playlet-lib",
@@ -20,6 +20,9 @@
"format:fix": "npm run format:base -- --write",
"test": "npm run test:build && npm run test:run",
"test:build": "bsc --project bsconfig.tests.json --create-package --sourceMap=true --debug --test-mode --lintConfig ../config/bslint.jsonc",
"test:run": "node ../tools/run-test-app.js --package ../build/playlet-lib-tests.zip"
"test:run": "node ../tools/run-test-app.js --package ../build/playlet-lib-tests.zip",
"test:v2": "npm run test:build && npm run test:run:v2",
"pretest:run:v2": "../../../dev-tools/bin/ensure-service.sh",
"test:run:v2": "../../../dev-tools/bin/test-app.sh --package ../build/playlet-lib-tests.zip --output ../build/playlet-lib-tests.txt"
}
}
@@ -1,5 +1,6 @@
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
import "pkg:/source/utils/CodecCapabilities.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/MathUtils.bs"
import "pkg:/source/utils/RemoteKeys.bs"
@@ -19,12 +20,48 @@ function Init()
m.saveButton.observeField("buttonSelected", FuncName(OnSaveButtonSelected))
m.closeButton.observeField("buttonSelected", FuncName(Close))
m.lastCheckedState = [false, false, false, false, false, false, false]
AddHighQualityOptions()
m.lastCheckedState = NewCheckedState(false, false)
m.checkList.observeField("checkedState", FuncName(OnCheckedStateChange))
SetButtonPositions()
end function
' 1440p/2160p exist on YouTube only as AV1 (mp4) and VP9 (webm) streams, and the
' player only plays fragmented MP4 in DASH, so the options only work with an AV1 decoder.
function AddHighQualityOptions() as void
if not CodecCapabilities.CanDecodeAv1()
return
end if
content = m.checkList.content
for each quality in ["1440p", "2160p"]
node = CreateObject("roSGNode", "ContentNode")
node.id = quality
node.title = quality
content.insertChild(node, 1)
end for
end function
function NewCheckedState(autoChecked as boolean, othersChecked as boolean) as object
checkedState = [autoChecked]
count = m.checkList.content.getChildCount()
for i = 1 to count - 1
checkedState.push(othersChecked)
end for
return checkedState
end function
function AllQualitiesValue() as string
values = []
checkboxes = m.checkList.content.getChildren(-1, 0)
for i = 1 to checkboxes.Count() - 1
values.push(checkboxes[i].id)
end for
return values.Join(",")
end function
function SetButtonPositions()
saveButtonWidth = m.saveButton.width
closeButtonWidth = m.closeButton.width
@@ -99,16 +136,16 @@ function OnCheckedStateChange() as void
if autoChanged
if hasAuto
checkedState = [true, false, false, false, false, false, false]
checkedState = NewCheckedState(true, false)
m.lastCheckedState = checkedState
m.checkList.checkedState = checkedState
m.top.value = "auto"
return
else
checkedState = [false, true, true, true, true, true, true]
checkedState = NewCheckedState(false, true)
m.lastCheckedState = checkedState
m.checkList.checkedState = checkedState
m.top.value = "1080p,720p,480p,360p,240p,144p"
m.top.value = AllQualitiesValue()
return
end if
end if
@@ -128,7 +165,7 @@ function OnCheckedStateChange() as void
end for
if values.Count() = 0
checkedState = [true, false, false, false, false, false, false]
checkedState = NewCheckedState(true, false)
m.lastCheckedState = checkedState
m.checkList.checkedState = checkedState
m.top.value = "auto"
@@ -13,8 +13,8 @@
</Rectangle>
<Rectangle
width="780"
height="600"
translation="[250,60]"
height="640"
translation="[250,40]"
color="#242424">
<CheckList
id="checkList"
@@ -43,13 +43,13 @@
iconVisible="false"
text="Save"
padding="[30,30]"
translation="[340,500]" />
translation="[340,555]" />
<ButtonEx
id="closeButton"
iconVisible="false"
text="Close"
padding="[30,30]"
translation="[496,500]" />
translation="[496,555]" />
</Rectangle>
</children>
</component>
@@ -32,7 +32,7 @@
numColumns="1"
numRows="10"
vertFocusAnimationStyle="floatingFocus"
translation="[40,100]"
translation="[40,90]"
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png" />
<ButtonEx
@@ -40,13 +40,13 @@
iconVisible="false"
text="Save"
padding="[30,30]"
translation="[340,500]" />
translation="[340,520]" />
<ButtonEx
id="closeButton"
iconVisible="false"
text="Close"
padding="[30,30]"
translation="[496,500]" />
translation="[496,520]" />
</Rectangle>
</children>
</component>
@@ -1,5 +1,6 @@
import "pkg:/components/Web/WebServer/Http/HttpUtils.bs"
import "pkg:/source/services/XmlObject.bs"
import "pkg:/source/utils/CodecCapabilities.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/UrlUtils.bs"
@@ -14,6 +15,7 @@ class DashManifest
' Backend the metadata came from, echoed onto every live-seg URL so the
' DashRouter cache keys on it without reading the prefs node. Set by DashRouter.
public liveBackend as string = ""
private canDecodeAv1Cache as dynamic
function new(invidiousInstance as string, disableAutoDubbed = false as boolean)
m.invidiousInstance = invidiousInstance
@@ -64,8 +66,11 @@ class DashManifest
videoGroups = groupings.video
filteredVideoGroups = m.FilterVideoGroups(videoGroups, qualityFilter)
if filteredVideoGroups.Count() = 0 and videoGroups.Count() > 0
LogWarnNoTelemetry("No video streams found using quality filter:", qualityFilter, "Falling back to all video streams")
' The player skips video sets it can't play (webm container, undecodable codec).
' A filter that leaves only such sets - e.g. 2160p-only when the 4K streams are
' VP9/webm - would play audio with no video, so fall back to all streams.
if not m.HasPlayableVideoGroup(filteredVideoGroups) and videoGroups.Count() > 0
LogWarnNoTelemetry("No playable video streams using quality filter:", qualityFilter, "Falling back to all video streams")
filteredVideoGroups = videoGroups
end if
@@ -331,6 +336,30 @@ class DashManifest
return filteredGroups
end function
function HasPlayableVideoGroup(videoGroups as object) as boolean
for each group in videoGroups
mimeType = ValidString(group[0].type)
' DASH chunks must be fragmented MP4: the player never picks webm sets.
if not mimeType.startsWith("video/mp4")
continue for
end if
if mimeType.inStr("avc1") <> -1
return true
end if
if mimeType.inStr("av01") <> -1 and m.CanDecodeAv1()
return true
end if
end for
return false
end function
function CanDecodeAv1() as boolean
if m.canDecodeAv1Cache = invalid
m.canDecodeAv1Cache = CodecCapabilities.CanDecodeAv1()
end if
return m.canDecodeAv1Cache
end function
function IsVideoFormatIncluded(stream as object, qualityFilter as object) as boolean
if qualityFilter.Count() = 0
return true
@@ -11,13 +11,13 @@ const INNERTUBE_IOS_USER_AGENT = "com.google.ios.youtube/21.16.2 (iPhone16,2; U;
const INNERTUBE_WEB_BROWSER_NAME = "Chrome"
const INNERTUBE_WEB_BROWSER_VERSION = "147.0.0.0"
const INNERTUBE_WEB_CLIENT_NAME = "1"
const INNERTUBE_WEB_CLIENT_VERSION = "2.20260424.01.00"
const INNERTUBE_WEB_CLIENT_VERSION = "2.20260612.01.00"
const INNERTUBE_WEB_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/147.0.0.0 Safari/537.36"
const INNERTUBE_TV_BROWSER_NAME = "SamsungBrowser"
const INNERTUBE_TV_BROWSER_VERSION = "9.2"
const INNERTUBE_TV_CLIENT_NAME = "2"
const INNERTUBE_TV_CLIENT_VERSION = "7.20260422.12.00"
const INNERTUBE_TV_CLIENT_VERSION = "7.20260611.00.00"
const INNERTUBE_TV_DEVICE_MAKE = "Samsung"
const INNERTUBE_TV_DEVICE_MODEL = "SmartTV"
const INNERTUBE_TV_OS_NAME = "Tizen"
@@ -1103,6 +1103,32 @@ namespace Innertube
return invalid
end function
' The badge overlay has two shapes: thumbnailOverlayBadgeViewModel.thumbnailBadges (older, still
' used on playlist/podcast/album lockups) and thumbnailBottomOverlayViewModel.badges (video lockups)
function GetThumbnailBadgeText(thumbnailViewModel as object) as string
overlays = ObjectUtils.Dig(thumbnailViewModel, ["overlays"])
if not IsArray(overlays)
return ""
end if
for each overlay in overlays
badges = ObjectUtils.Dig(overlay, ["thumbnailBottomOverlayViewModel", "badges"])
if not IsArray(badges)
badges = ObjectUtils.Dig(overlay, ["thumbnailOverlayBadgeViewModel", "thumbnailBadges"])
end if
if IsArray(badges)
for each badge in badges
text = ValidString(ObjectUtils.Dig(badge, ["thumbnailBadgeViewModel", "text"]))
if text <> ""
return text
end if
end for
end if
end for
return ""
end function
function LockupViewModelTypeVideo(nodeData as object, context as object) as object
videoId = nodeData["contentId"]
if not IsString(videoId)
@@ -1124,7 +1150,7 @@ namespace Innertube
end if
end if
lengthText = ValidString(ObjectUtils.Dig(thumbnailViewModel, ["overlays", 0, "thumbnailOverlayBadgeViewModel", "thumbnailBadges", 0, "thumbnailBadgeViewModel", "text"]))
lengthText = GetThumbnailBadgeText(thumbnailViewModel)
authorId = ObjectUtils.Dig(metadata, ["image", "decoratedAvatarViewModel", "rendererContext", "commandContext", "onTap", "innertubeCommand", "browseEndpoint", "browseId"])
@@ -1155,7 +1181,7 @@ namespace Innertube
"authorId": authorId
"lines": lines
"videoThumbnails": videoThumbnails
"videoCountText": lengthText
"lengthText": lengthText
}
PushFeedItem(video, context)
@@ -1234,7 +1260,7 @@ namespace Innertube
title = ObjectUtils.Dig(metadata, ["title", "content"])
thumbnailViewModel = ObjectUtils.Dig(nodeData, ["contentImage", "collectionThumbnailViewModel", "primaryThumbnail", "thumbnailViewModel"])
thumbnail = ObjectUtils.Dig(thumbnailViewModel, ["image", "sources", 0, "url"])
videoCountText = ObjectUtils.Dig(thumbnailViewModel, ["overlays", 0, "thumbnailOverlayBadgeViewModel", "thumbnailBadges", 0, "thumbnailBadgeViewModel", "text"])
videoCountText = GetThumbnailBadgeText(thumbnailViewModel)
author = invalid
authorId = invalid
@@ -1283,7 +1309,7 @@ namespace Innertube
title = ObjectUtils.Dig(metadata, ["title", "content"])
thumbnailViewModel = ObjectUtils.Dig(nodeData, ["contentImage", "collectionThumbnailViewModel", "primaryThumbnail", "thumbnailViewModel"])
thumbnail = ObjectUtils.Dig(thumbnailViewModel, ["image", "sources", 0, "url"])
videoCountText = ObjectUtils.Dig(thumbnailViewModel, ["overlays", 0, "thumbnailOverlayBadgeViewModel", "thumbnailBadges", 0, "thumbnailBadgeViewModel", "text"])
videoCountText = GetThumbnailBadgeText(thumbnailViewModel)
author = invalid
authorId = invalid
@@ -1318,7 +1344,7 @@ namespace Innertube
title = ObjectUtils.Dig(metadata, ["title", "content"])
thumbnailViewModel = ObjectUtils.Dig(nodeData, ["contentImage", "collectionThumbnailViewModel", "primaryThumbnail", "thumbnailViewModel"])
thumbnail = ObjectUtils.Dig(thumbnailViewModel, ["image", "sources", 0, "url"])
videoCountText = ObjectUtils.Dig(thumbnailViewModel, ["overlays", 0, "thumbnailOverlayBadgeViewModel", "thumbnailBadges", 0, "thumbnailBadgeViewModel", "text"])
videoCountText = GetThumbnailBadgeText(thumbnailViewModel)
author = invalid
authorId = invalid
@@ -336,7 +336,15 @@ namespace Innertube
' vtt has "align:start position:0%" on auto-generated captions
' srt has large spacing between lines on auto-generated captions
' ttml has default styling, with smaller font than the default size
queryComponents["fmt"] = "ttml"
' CEA-608 broadcast channels (CC1-CC4) encode their paint-on reveal as
' per-segment timed spans; Roku's ttml renderer stacks each span on its own
' line (vertical text). vtt expresses the same timing inline, so it wraps.
captionName = queryComponents["name"]
if captionName = "CC1" or captionName = "CC2" or captionName = "CC3" or captionName = "CC4"
queryComponents["fmt"] = "vtt"
else
queryComponents["fmt"] = "ttml"
end if
baseUrl = UrlUtils.SetQueryParams(baseUrl, queryComponents)
languageCode = track["languageCode"]
@@ -1,5 +1,5 @@
' Auto-generated file - do not modify manually
' md5:1dc03998a561a4b1270454e10a4d7ead
' md5:6966cee321cfa827e09c0f49b10a3fa8
import "pkg:/source/Protobuf/BinaryReader.bs"
import "pkg:/source/Protobuf/BinaryWriter.bs"
@@ -178,6 +178,16 @@ function MigrateExistingPreferences(userPrefs as object) as boolean
isDirty = true
end if
if userPrefs.__version = 6
' Hook was split out of Preview. Existing users inherit their Preview setting.
categories = userPrefs["sponsorblock.categories"]
if IsAssociativeArray(categories) and not categories.DoesExist("hook") and IsAssociativeArray(categories["preview"])
categories["hook"] = { option: categories["preview"].option }
end if
userPrefs.__version = 7
isDirty = true
end if
' TODO:P2 handle case where saved preferences version is higher than current version (e.g. user downgraded)
#if DEBUG
@@ -5,7 +5,7 @@
user prefs saved need to be migrated. If the version is less than the
current version, a migration is needed.
-->
<field id="__version" type="integer" value="6" />
<field id="__version" type="integer" value="7" />
<field id="prefsModel" type="array" />
<field id="preferenceFields" type="assocarray" />
<function name="GetUserPreferences" />
@@ -92,7 +92,7 @@ end function
function GetOptionForSegment(segment as object, categories as object) as string
category = categories[segment.category]
if not IsAssociativeArray(category)
return false
return SponsorBlock.SegmentAction.Disable
end if
option = category.option
@@ -74,8 +74,8 @@ namespace SponsorBlock
return invalid
end if
' categories = ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "music_offtopic", "poi_highlight", "filler", "exclusive_access"]
categories = ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "music_offtopic", "poi_highlight", "filler"]
' categories = ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "hook", "music_offtopic", "poi_highlight", "filler", "exclusive_access"]
categories = ["sponsor", "selfpromo", "interaction", "intro", "outro", "preview", "hook", "music_offtopic", "poi_highlight", "filler"]
' actionTypes = ["skip", "mute", "chapter", "full", "poi"]
actionTypes = ["skip", "mute", "poi"]
@@ -69,6 +69,19 @@ namespace Tests
m.assertEqual(anim.control, "start")
end function
@it("a nudge with an out-of-range focusedIndex is a safe no-op")
function _()
m.top.rowFocused = true
m.top.focusedIndex = 5
playAnim = m.top.findNode("PlayPauseButton").findNode("nudgeAnim")
minimizeAnim = m.top.findNode("MinimizeButton").findNode("nudgeAnim")
playAnim.control = "stop"
minimizeAnim.control = "stop"
m.top.nudge = true
m.assertEqual(playAnim.control, "stop")
m.assertEqual(minimizeAnim.control, "stop")
end function
@describe("play/pause icon tracks the play state")
@it("shows the pause icon while playing, the play icon while paused")
@@ -18,7 +18,8 @@
<field id="focusedIndex" type="integer" value="0" />
<field id="playing" type="boolean" value="true" /> <!-- selects the play vs pause icon -->
<field id="buttonCount" type="integer" value="0" /> <!-- read-only: set in Init from m.buttons -->
<!-- pulse the focused button's scale nudge (a Left/Right that couldn't move focus). -->
<!-- pulse the focused button's scale nudge (a press that couldn't move focus: Left/Right clamped at
the row's ends, Up at the top tier). -->
<field id="nudge" type="boolean" alwaysNotify="true" />
</interface>
<children>
@@ -2,6 +2,7 @@
' INPUT fields, and asserts the rendered child fields: fill clip width, playhead translation, M:SS labels,
' the raised handle while a transport is active, the glyph swap, and the live layout (Rewind live TV / offset
' / ● LIVE swap). clippingRect reads back as {x,y,width,height} on the render thread.
import "pkg:/source/utils/Locale.bs"
namespace Tests
@@ -198,7 +199,7 @@ namespace Tests
m.assertEqual(m.top.findNode("remainingLabel").text, "")
' the badge styling: red bullet + bold size-30 LIVE. blendColor reads back as a signed 32-bit int.
m.AssertBlend(m.top.findNode("bullet").blendColor, &hD53E5AFF)
m.assertEqual(m.top.findNode("liveLabel").text, Tr("LIVE"))
m.assertEqual(m.top.findNode("liveLabel").text, Tr(Locale.RowCell.Live))
' the badge is right-aligned to the track end whatever the language ("EN DIRECT" >> "LIVE").
lbl = m.top.findNode("liveLabel")
m.assertTrue(Abs((lbl.translation[0] + lbl.boundingRect().width) - 1144) < 2, "badge right edge pinned to the track end")
@@ -13,7 +13,8 @@
<field id="focusedIconColor" type="color" value="#262626" />
<field id="focused" type="boolean" value="false" />
<!-- pulse the scale nudge: confirms a press that didn't move focus (Left/Right at the row's end). -->
<!-- pulse the scale nudge: confirms a press that didn't move focus (Left/Right at the row's end,
Up at the top tier). -->
<field id="nudge" type="boolean" alwaysNotify="true" />
</interface>
<children>
@@ -337,11 +337,15 @@ function OnKeyEvent(key as string, press as boolean) as boolean
' BAR tier takes Up (back to the buttons) and lets the transport keys through. Rev/Fwd/Replay are not owned
' by the buttons, so they fall through to the transport and move focus to the bar.
if press and CanFocusInteract()
' Up/Down move between the two tiers; a no-op at the ends is still consumed.
' Up/Down move between the two tiers; a no-op at the ends is still consumed — Up at the top tier
' (the buttons) pulses the focused button so the press visibly lands somewhere.
if key = RemoteKeys.Up or key = RemoteKeys.Down
newTarget = PlayerCoordinatorLogic.NextFocusTarget(m.focusTarget, key)
if newTarget <> m.focusTarget
SetFocusTarget(newTarget)
else if m.focusTarget = PlayerCoordinatorLogic.FocusTarget.Buttons
m.buttonRow.nudge = true
ArmAutoHide()
end if
return true
end if
@@ -11,7 +11,7 @@ end function
' getHttpAgent — Initialize does `m.top.getHttpAgent().AddHeader(...)`; a Group has no such method. No-op stub.
function getHttpAgent() as object
return {
AddHeader: function(name as string, value as string)
AddHeader: function(_name as string, _value as string)
end function
}
end function
@@ -37,6 +37,13 @@ function TestSetup() as void
Initialize() ' the real coordinator init body (m.transport, findNode children, timer observers, getHttpAgent)
' count ButtonRow nudge pulses (the field is a sticky alwaysNotify boolean, so the count — not the value —
' is what tells the spec whether a given press pulsed). Scoped + unobserve-first: the suite node is shared
' across tests, so a plain ObserveField here would stack one counter observer per TestSetup call.
m.top.nudgeCount = 0
m.buttonRow.unobserveFieldScoped("nudge")
m.buttonRow.observeFieldScoped("nudge", FuncName(OnTestNudge))
container = createObject("roSGNode", "Node")
container.addField("fullscreen", "boolean", false)
container.fullscreen = true
@@ -72,6 +79,10 @@ function TestSetup() as void
OnNodeReady()
end function
function OnTestNudge() as void
m.top.nudgeCount += 1
end function
' TestKey — drive a remote key through the REAL OnKeyEvent (scrub/scan/commit/etc).
function TestKey(key as string, down as boolean) as boolean
return OnKeyEvent(key, down)
@@ -170,6 +181,7 @@ function TestSnapshot() as object
chromeShown: (m.chromeMode = ChromeMode.Shown or m.chromeMode = ChromeMode.FadingIn)
focusTarget: m.focusTarget
focusedButton: m.focusedButton
nudgeCount: m.top.nudgeCount
forceLiveBadge: m.trickPlayBar.forceLiveBadge
liveBadgeShown: m.trickPlayBar.findNode("liveLabel").visible
barRemainingText: m.trickPlayBar.findNode("remainingLabel").text
@@ -40,6 +40,8 @@
<field id="minRect" type="rect2D" value="[834,460,426,240]" />
<field id="maxRect" type="rect2D" value="[0,0,1280,720]" />
<field id="close" type="boolean" alwaysNotify="true" />
<!-- test-only probe: how many times the coordinator pulsed ButtonRow.nudge (TestSetup observes it). -->
<field id="nudgeCount" type="integer" />
<!-- the Video-only method Initialize calls, plus the spec's drivers (callFunc reaches only interface funcs). -->
<function name="getHttpAgent" />
<function name="TestSetup" />
@@ -2,6 +2,7 @@
' inert and spec-driven) through scripted device-state sequences the real Roku Video won't produce on command.
' This is the harness that would have caught the reported wedge: the existing INV-D* are blind to it (during the
' wedge state="buffering", so "transport => state<>playing" was SATISFIED). The NEW property is P-seam.
import "pkg:/components/VideoPlayerDev/PlayerCoordinatorLogic.bs"
import "pkg:/components/VideoPlayerDev/TransportController.bs"
import "pkg:/components/VideoPlayerDev/VideoNode.bs"
import "pkg:/source/utils/RemoteKeys.bs"
@@ -214,6 +215,56 @@ namespace Tests
m.assertEqual(m.Snap().focusedButton, 0, "a fresh reveal resets the highlight")
end function
' Up at the top tier (the buttons) has nowhere to go; the press must still visibly land — it pulses
' (nudges) the focused button instead of being swallowed.
@it("Up at the buttons tier nudges the focused button instead of moving focus")
function _()
m.top.callFunc("TestKey", RemoteKeys.Up, true) ' reveal -> buttons tier
before = m.Snap()
m.assertEqual(before.focusTarget, PlayerCoordinatorLogic.FocusTarget.Buttons)
m.assertEqual(before.nudgeCount, 0, "the reveal itself does not nudge")
m.top.callFunc("TestKey", RemoteKeys.Up, true) ' nowhere to go up
after = m.Snap()
m.assertEqual(after.nudgeCount, 1, "the no-op Up pulsed the focused button")
m.assertEqual(after.focusTarget, PlayerCoordinatorLogic.FocusTarget.Buttons, "focus stays on the buttons")
m.assertEqual(after.focusedButton, before.focusedButton, "the highlight is untouched")
end function
' A press that GOES somewhere must not nudge: Left/Right inside the row, Up/Down between the tiers.
@it("a press that moves focus does not nudge")
function _()
m.top.callFunc("TestKey", RemoteKeys.Up, true) ' reveal -> buttons tier, play/pause
m.top.callFunc("TestKey", RemoteKeys.Right, true) ' play/pause -> minimize
m.top.callFunc("TestKey", RemoteKeys.Down, true) ' buttons -> bar
m.top.callFunc("TestKey", RemoteKeys.Up, true) ' bar -> buttons
m.top.callFunc("TestKey", RemoteKeys.Left, true) ' minimize -> play/pause
m.assertEqual(m.Snap().nudgeCount, 0, "every press moved focus; none may pulse")
end function
' Left/Right clamped at the row's ends pulse the focused button (the original nudge path, at the seam).
@it("Left/Right clamped at the row ends nudge the focused button")
function _()
m.top.callFunc("TestKey", RemoteKeys.Up, true) ' reveal -> play/pause (leftmost)
m.top.callFunc("TestKey", RemoteKeys.Left, true) ' clamped at the left end
m.assertEqual(m.Snap().nudgeCount, 1)
m.top.callFunc("TestKey", RemoteKeys.Right, true) ' -> minimize (rightmost)
m.top.callFunc("TestKey", RemoteKeys.Right, true) ' clamped at the right end
snap = m.Snap()
m.assertEqual(snap.nudgeCount, 2)
m.assertEqual(snap.focusedButton, 1, "the clamp held the highlight at the end")
end function
' Down at the bar tier (the bottom) is also a no-op, but the bar is not a button: consumed, no nudge.
@it("Down at the bar tier is consumed without a nudge")
function _()
m.top.callFunc("TestKey", RemoteKeys.Up, true) ' reveal -> buttons tier
m.top.callFunc("TestKey", RemoteKeys.Down, true) ' buttons -> bar
m.top.callFunc("TestKey", RemoteKeys.Down, true) ' nowhere to go down
snap = m.Snap()
m.assertEqual(snap.focusTarget, PlayerCoordinatorLogic.FocusTarget.Bar, "focus stays on the bar")
m.assertEqual(snap.nudgeCount, 0)
end function
' A keep-playing seek issued while PAUSED must preserve the pause: the device auto-resumes on any seek
' (autoplayAfterSeek only governs rebuffer-resume per the Video docs), so the coordinator re-pauses on
' the playing edge the auto-resume produces.
+3
View File
@@ -166,6 +166,9 @@
preview: {
option: "manual_skip",
},
hook: {
option: "manual_skip",
},
filler: {
option: "manual_skip",
},
@@ -8,6 +8,7 @@
"intro",
"outro",
"preview",
"hook",
"filler",
"music_offtopic",
],
@@ -49,11 +50,17 @@
color: "#0202EDB3",
},
preview: {
title: "Preview/Recap/Hook",
title: "Preview/Recap",
short_title: "Preview/Recap",
options: ["auto_skip", "manual_skip", "show_in_seekbar", "disable"],
color: "#008FD6B3",
},
hook: {
title: "Hook/Greetings",
short_title: "Hook/Greetings",
options: ["auto_skip", "manual_skip", "show_in_seekbar", "disable"],
color: "#395699B3",
},
filler: {
title: "Filler Tangent/Jokes",
short_title: "Filler",
+4 -4
View File
@@ -720,14 +720,14 @@
<source>Endcards/Credits</source>
<translation>Endcard/Abspann</translation>
</message>
<message>
<source>Preview/Recap/Hook</source>
<translation>Vorschau/Rückschau/Hook</translation>
</message>
<message>
<source>Preview/Recap</source>
<translation>Vorschau/Rückschau</translation>
</message>
<message>
<source>Hook/Greetings</source>
<translation>Hook/Begrüßungen</translation>
</message>
<message>
<source>Filler</source>
<translation>Füllwörter/ Zeitverschwendung</translation>
+4 -4
View File
@@ -1060,14 +1060,14 @@
<source>Endcards/Credits</source>
<translation>Endcards/Credits</translation>
</message>
<message>
<source>Preview/Recap/Hook</source>
<translation>Preview/Recap/Hook</translation>
</message>
<message>
<source>Preview/Recap</source>
<translation>Preview/Recap</translation>
</message>
<message>
<source>Hook/Greetings</source>
<translation>Hook/Greetings</translation>
</message>
<message>
<source>Filler Tangent/Jokes</source>
<translation>Filler Tangent/Jokes</translation>
+4 -4
View File
@@ -624,6 +624,10 @@
<source>Preview/Recap</source>
<translation>Vista previa/Resumen</translation>
</message>
<message>
<source>Hook/Greetings</source>
<translation>Gancho/Saludos</translation>
</message>
<message>
<source>Added to queue</source>
<translation>Añadir a la cola</translation>
@@ -1128,10 +1132,6 @@
<source>Endcards/Credits</source>
<translation>Tarjeta final/Créditos</translation>
</message>
<message>
<source>Preview/Recap/Hook</source>
<translation>Vista previa/Resumen/Gancho</translation>
</message>
<message>
<source>Press and hold Options (*) to open the queue</source>
<translation>Mantén pulsado Opciones (*) para abrir la cola</translation>
+2 -2
View File
@@ -1201,8 +1201,8 @@
<translation>Avance/Resumen</translation>
</message>
<message>
<source>Preview/Recap/Hook</source>
<translation>Avance/Resumen/Gancho</translation>
<source>Hook/Greetings</source>
<translation>Gancho/Saludos</translation>
</message>
<message>
<source>Sponsor</source>
+4 -4
View File
@@ -912,14 +912,14 @@
<source>Endcards/Credits</source>
<translation>Écrans de fin/Crédits</translation>
</message>
<message>
<source>Preview/Recap/Hook</source>
<translation>Aperçu/Récapitulatif/Accroche</translation>
</message>
<message>
<source>Preview/Recap</source>
<translation>Aperçu/Récapitulatif</translation>
</message>
<message>
<source>Hook/Greetings</source>
<translation>Accroche/Salutations</translation>
</message>
<message>
<source>Filler Tangent/Jokes</source>
<translation>Digressions/Blagues</translation>
+4 -4
View File
@@ -788,10 +788,6 @@
<source>Endcards/Credits</source>
<translation>Cards finais/Créditos</translation>
</message>
<message>
<source>Preview/Recap/Hook</source>
<translation>Pré-visualização/Recapitulação/Gancho</translation>
</message>
<message>
<source>Intermission/Intro Animation</source>
<translation>Intermissão/Animação de introdução</translation>
@@ -800,6 +796,10 @@
<source>Preview/Recap</source>
<translation>Pré-visualização/Recapitulação</translation>
</message>
<message>
<source>Hook/Greetings</source>
<translation>Gancho/Saudações</translation>
</message>
<message>
<source>Filler Tangent/Jokes</source>
<translation>Preenchimento Tangente/Piadas</translation>
+1 -1
View File
@@ -2,7 +2,7 @@ title=PlayletLib
# Do not update version manually, it is auto updated from package.json
major_version=0
minor_version=46
minor_version=47
build_version=00000
ui_resolutions=hd
@@ -1,3 +1,4 @@
import "pkg:/source/utils/CodecCapabilities.bs"
import "pkg:/source/utils/StringUtils.bs"
class ApplicationInfo
@@ -80,6 +81,7 @@ class ApplicationInfo
user_country_code: m.roDeviceInfo.GetUserCountryCode()
friendly_name: m.roDeviceInfo.GetFriendlyName()
current_locale: m.roDeviceInfo.GetCurrentLocale()
can_decode_av1: CodecCapabilities.CanDecodeAv1()
}
end if
return m.deviceInfo
@@ -0,0 +1,10 @@
namespace CodecCapabilities
' YouTube serves streams above 1080p only as AV1 (mp4) and VP9 (webm), and the
' player only plays fragmented MP4 in DASH - so AV1 decoding is what decides
' whether the device can play 4K.
function CanDecodeAv1() as boolean
devInfo = CreateObject("roDeviceInfo")
canDecode = devInfo.CanDecodeVideo({ "codec": "av1" })
return canDecode.result = true
end function
end namespace
+2 -2
View File
@@ -353,8 +353,8 @@ namespace Locale
IntroTitle = "Intermission/Intro Animation"
IntroShortTitle = "Intermission"
OutroTitle = "Endcards/Credits"
PreviewTitle = "Preview/Recap/Hook"
PreviewShortTitle = "Preview/Recap"
PreviewTitle = "Preview/Recap"
HookTitle = "Hook/Greetings"
FillerTitle = "Filler Tangent/Jokes"
FillerShortTitle = "Filler"
ChapterTitle = "Chapter"
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-web",
"version": "0.46.0",
"version": "0.47.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "playlet-web",
"version": "0.46.0",
"version": "0.47.0",
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^7.1.2",
"@tailwindcss/postcss": "^4.3.0",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-web",
"version": "0.46.0",
"version": "0.47.0",
"type": "module",
"scripts": {
"dev": "vite",
@@ -1,17 +1,29 @@
<script lang="ts">
import { PlayletApi } from "lib/Api/PlayletApi";
import { translate, userPreferencesStore } from "lib/Stores";
import { playletStateStore, translate, userPreferencesStore } from "lib/Stores";
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
const qualityLabels = {
auto: "Auto",
"1080p": "1080p",
"720p": "720p",
"480p": "480p",
"360p": "360p",
"240p": "240p",
"144p": "144p",
};
function makeQualityLabels(canDecodeAv1: boolean) {
return {
auto: "Auto",
...(canDecodeAv1 ? { "2160p": "2160p", "1440p": "1440p" } : {}),
"1080p": "1080p",
"720p": "720p",
"480p": "480p",
"360p": "360p",
"240p": "240p",
"144p": "144p",
};
}
let qualityLabels = makeQualityLabels(false);
playletStateStore.subscribe((state) => {
qualityLabels = makeQualityLabels(
(state.device || {})["can_decode_av1"] === true
);
});
export let displayText: string = "";
export let key: string = "";
+2 -1
View File
@@ -13,6 +13,7 @@ import {
import path from "path";
import { SGNode, SGScript } from "brighterscript/dist/parser/SGTypes";
import { RawCodeStatement } from "./Classes/RawCodeStatement";
import { exitOnCriticalErrors } from './critical-exit';
const bindings_function_name = 'InitializeBindings';
@@ -198,5 +199,5 @@ export class BindingsPlugin implements CompilerPlugin {
}
export default () => {
return new BindingsPlugin();
return exitOnCriticalErrors(new BindingsPlugin());
};
@@ -13,6 +13,7 @@ import { SGChildren, SGComponent, SGInterface, SGScript } from 'brighterscript/d
import { globSync } from 'glob';
import fs from 'fs-extra'
import path from 'path';
import { exitOnCriticalErrors } from './critical-exit';
export class ComponentIncludesPlugin implements CompilerPlugin {
public name = 'ComponentIncludesPlugin';
@@ -160,5 +161,5 @@ export class ComponentIncludesPlugin implements CompilerPlugin {
}
export default () => {
return new ComponentIncludesPlugin();
return exitOnCriticalErrors(new ComponentIncludesPlugin());
};
@@ -0,0 +1,28 @@
import { CompilerPlugin, ProgramBuilder } from 'brighterscript';
// A plugin that fails to load (e.g. a TypeScript error in its file) is only logged
// by bsc and the build continues without it, exiting 0 (rokucommunity/brighterscript#1675).
// Listed last in the plugins array, this guard fails the command when any configured
// plugin is missing from the loaded set. It deliberately imports nothing from the
// other plugin files, so it still loads when one of them is broken.
const exitOnError = !!process.env.npm_lifecycle_event && !process.argv.includes('--lsp');
export class CriticalExitGuardPlugin implements CompilerPlugin {
public name = 'CriticalExitGuardPlugin';
beforeProgramCreate(builder: ProgramBuilder) {
if (!exitOnError) {
return;
}
const configured = (builder as any)?.options?.plugins?.length ?? 0;
const loaded = (builder as any)?.plugins?.plugins?.length ?? 0;
if (loaded < configured) {
console.error(`${configured - loaded} of ${configured} configured plugins failed to load (see "Error when loading plugin" above)`);
process.exit(1);
}
}
}
export default () => {
return new CriticalExitGuardPlugin();
};
+37
View File
@@ -0,0 +1,37 @@
import { Plugin } from 'brighterscript';
// bsc catches plugin exceptions and only logs them (rokucommunity/brighterscript#1675),
// so a crashing plugin still yields a passing build/lint. When running under an npm
// script (build, lint, test) an uncaught plugin error must fail the command, so every
// hook is wrapped to exit non-zero. Long-lived hosts (LSP) keep log-and-continue.
const exitOnError = !!process.env.npm_lifecycle_event && !process.argv.includes('--lsp');
export function exitOnCriticalErrors<T extends Plugin>(plugin: T): T {
if (!exitOnError) {
return plugin;
}
return new Proxy(plugin, {
get(target, prop) {
const value = (target as any)[prop];
if (typeof value !== 'function') {
return value;
}
return (...args: unknown[]) => {
try {
const result = value.apply(target, args);
if (result instanceof Promise) {
return result.catch((err: unknown) => exitCritically(target.name, prop, err));
}
return result;
} catch (err) {
exitCritically(target.name, prop, err);
}
};
},
});
}
function exitCritically(pluginName: string, hook: PropertyKey, err: unknown): never {
console.error(`Plugin ${pluginName} failed in ${String(hook)}:`, err instanceof Error ? (err.stack || err.message) : err);
process.exit(1);
}
+2 -1
View File
@@ -11,6 +11,7 @@ import {
} from 'brighterscript';
import { existsSync } from 'fs-extra';
import path from 'path';
import { exitOnCriticalErrors } from './critical-exit';
export class ImportValidationPlugin implements CompilerPlugin {
public name = 'ImportValidationPlugin';
@@ -45,5 +46,5 @@ export class ImportValidationPlugin implements CompilerPlugin {
}
export default () => {
return new ImportValidationPlugin();
return exitOnCriticalErrors(new ImportValidationPlugin());
};
+2 -1
View File
@@ -11,6 +11,7 @@ import {
DiagnosticSeverity,
} from 'brighterscript';
import path from 'path';
import { exitOnCriticalErrors } from './critical-exit';
export class JobSystemPlugin implements CompilerPlugin {
public name = 'JobSystemPlugin';
@@ -115,5 +116,5 @@ export class JobSystemPlugin implements CompilerPlugin {
}
export default () => {
return new JobSystemPlugin();
return exitOnCriticalErrors(new JobSystemPlugin());
};
+2 -1
View File
@@ -7,6 +7,7 @@ import path from 'path';
import fs from 'fs-extra'
import json5 from 'json5';
import YAML from "yaml";
import { exitOnCriticalErrors } from './critical-exit';
const jsonExtensions = ['.json', '.jsonc', '.json5'];
const yamlExtensions = ['.yaml', '.yml'];
@@ -40,5 +41,5 @@ export class JsonYamlPlugin implements CompilerPlugin {
}
export default () => {
return new JsonYamlPlugin();
return exitOnCriticalErrors(new JsonYamlPlugin());
};
+2 -1
View File
@@ -27,6 +27,7 @@ import { globSync } from 'glob';
import { SGNode } from "brighterscript/dist/parser/SGTypes";
import json5 from 'json5';
import YAML from "yaml";
import { exitOnCriticalErrors } from './critical-exit';
const translatableXmlAttributes = ["text", "title", "short_title", "primaryTitle", "displayText", "description"];
@@ -417,5 +418,5 @@ export class LocaleValidationPlugin implements CompilerPlugin {
}
export default () => {
return new LocaleValidationPlugin();
return exitOnCriticalErrors(new LocaleValidationPlugin());
};
+2 -1
View File
@@ -16,6 +16,7 @@ import {
isBrsFile,
} from 'brighterscript';
import path from 'path';
import { exitOnCriticalErrors } from './critical-exit';
const loggingFilePath = path.join('source', 'utils', 'Logging.bs');
const logFunctions = {
@@ -250,5 +251,5 @@ function ${newFunctionName}(${args.join(', ')}) as void
}
export default () => {
return new LoggerPlugin();
return exitOnCriticalErrors(new LoggerPlugin());
};
+33 -3
View File
@@ -6,6 +6,10 @@
// - DEBUG_HOST_IP_ADDRESS would be replaced with the host IP address in the manifest file
// - This is to playlet app to pull playlet lib from the locally hosted server
// - This is only done when --debug is set
// - PLAYLET_DEVTOOLS (env) instead points playlet_lib_zip_debug_url at the dev-tools service:
// the freshly-built lib zip is registered with it and its URL baked in, so rebuilding the lib
// and relaunching hot-reloads it with no app redeploy. Opt-in; only the app manifest has the
// key, so the lib build and every normal build keep the :8086 host the VSCode launch serves.
import {
BeforeProgramDisposeEvent,
@@ -15,6 +19,8 @@ import {
} from 'brighterscript';
import path from 'path';
import fs from 'fs';
import { execFileSync } from 'child_process';
import { exitOnCriticalErrors } from './critical-exit';
const ip = require('ip');
export class ManifestEditPlugin implements CompilerPlugin {
@@ -23,6 +29,15 @@ export class ManifestEditPlugin implements CompilerPlugin {
private originalManifestContent?: string;
beforeProgramCreate(builder: ProgramBuilder) {
// The language server loads this plugin too (VS Code + bsc-lsp), and its revalidate cycle would
// restore a stale cached copy of the manifest over genuine build edits. The LSP builds no-emit
// with showDiagnosticsInConsole off (it reports over the protocol); builds and bslint leave it
// on. So that flag marks the analysis-only editor pass — skip the manifest rewrite there.
// @ts-ignore
if (builder.options.showDiagnosticsInConsole === false) {
return;
}
const manifestPath = path.join(builder.options.rootDir!, "manifest")
let originalManifestContent = fs.readFileSync(manifestPath, { encoding: 'utf8', flag: 'r' })
@@ -35,8 +50,23 @@ export class ManifestEditPlugin implements CompilerPlugin {
manifestContent = manifestContent.replace(/DEBUG=(true|false)/i, `DEBUG=${debug}`);
if (debug) {
// Host IP address
manifestContent = manifestContent.replace(/DEBUG_HOST_IP_ADDRESS/i, `${ip.address()}`)
// dev-tools service hosts the lib (opt-in via PLAYLET_DEVTOOLS); the key lives only in
// the app manifest, so the lib build and normal builds fall through to the :8086 host.
if (process.env.PLAYLET_DEVTOOLS && /playlet_lib_zip_debug_url=/.test(manifestContent)) {
const serveScript = path.resolve(builder.options.rootDir!, '../../../../dev-tools/bin/serve.sh')
const libZip = path.resolve(builder.options.rootDir!, '../../dist/playlet-lib.zip')
let url: string
try {
url = execFileSync(serveScript, ['add', libZip], { encoding: 'utf8' }).trim()
} catch (err: any) {
throw new Error(`Could not host ${libZip} via the dev-tools service (is it running? cd dev-tools && npm start): ${err?.message ?? err}`)
}
builder.logger.log(`Hosting playlet-lib.zip via dev-tools service: ${url}`)
manifestContent = manifestContent.replace(/playlet_lib_zip_debug_url=.*/i, `playlet_lib_zip_debug_url=${url}`)
} else {
// Host IP address
manifestContent = manifestContent.replace(/DEBUG_HOST_IP_ADDRESS/i, `${ip.address()}`)
}
}
// Test flag
@@ -76,5 +106,5 @@ export class ManifestEditPlugin implements CompilerPlugin {
}
export default () => {
return new ManifestEditPlugin();
return exitOnCriticalErrors(new ManifestEditPlugin());
};
+2 -1
View File
@@ -18,6 +18,7 @@ import {
} from 'brighterscript';
import path from 'path';
import fs from 'fs';
import { exitOnCriticalErrors } from './critical-exit';
function copyDirSync(src: string, dest: string): void {
fs.mkdirSync(dest, { recursive: true });
@@ -82,5 +83,5 @@ export class OdcPlugin implements CompilerPlugin {
}
export default () => {
return new OdcPlugin();
return exitOnCriticalErrors(new OdcPlugin());
};
+2 -1
View File
@@ -17,6 +17,7 @@ import {
} from 'brighterscript';
import { RawCodeStatement } from './Classes/RawCodeStatement';
import { exitOnCriticalErrors } from './critical-exit';
// The plugin processes the file that includes the Init function, not the file that includes the @oninit functions
// This is because the modifications will be made to the Init function.
@@ -209,5 +210,5 @@ export class OnInitPlugin implements CompilerPlugin {
}
export default () => {
return new OnInitPlugin();
return exitOnCriticalErrors(new OnInitPlugin());
};
+2 -1
View File
@@ -9,6 +9,7 @@ import { globSync } from 'glob';
import path from 'path';
import md5 from 'crypto-js/md5';
import { Formatter, Runner } from 'brighterscript-formatter';
import { exitOnCriticalErrors } from './critical-exit';
const protobufSchema = require('protocol-buffers-schema')
export class ProtoGenPlugin implements CompilerPlugin {
@@ -275,5 +276,5 @@ end function`;
}
export default () => {
return new ProtoGenPlugin();
return exitOnCriticalErrors(new ProtoGenPlugin());
};
+2 -1
View File
@@ -9,6 +9,7 @@ import {
Range,
isBrsFile
} from 'brighterscript';
import { exitOnCriticalErrors } from './critical-exit';
type Validation = {
code: number | string | undefined;
@@ -76,5 +77,5 @@ export class ValidationPlugin implements CompilerPlugin {
}
export default () => {
return new ValidationPlugin();
return exitOnCriticalErrors(new ValidationPlugin());
};
+2 -1
View File
@@ -16,6 +16,7 @@ import {
isBrsFile
} from "brighterscript";
import { RawCodeStatement } from "./Classes/RawCodeStatement";
import { exitOnCriticalErrors } from './critical-exit';
const annotationNames = ['all', 'get', 'post', 'put', 'delete', 'patch', 'head', 'options'];
const httpRouterBaseClass = 'HttpRouter';
@@ -155,5 +156,5 @@ export class WebServerPlugin implements CompilerPlugin {
}
export default () => {
return new WebServerPlugin();
return exitOnCriticalErrors(new WebServerPlugin());
};
+15 -35
View File
@@ -64,6 +64,7 @@ const imap = new Imap({
const searchAsync = promisify(imap.search).bind(imap);
const openBoxAsync = promisify(imap.openBox).bind(imap);
const moveAsync = promisify(imap.move).bind(imap);
async function getAttachementAsync(from, subject, since) {
return new Promise(async (resolve, reject) => {
@@ -116,36 +117,16 @@ async function getAttachementAsync(from, subject, since) {
}
async function moveToTrash(from, subject, since) {
return new Promise(async (resolve, reject) => {
const results = await searchAsync([['FROM', from], ['SUBJECT', subject], ['SINCE', since]]);
const fetch = imap.fetch(results, { bodies: '' });
fetch.on('message', function (msg, seqno) {
console.log('Processing message #%d', seqno);
msg.on('attributes', attributes => {
imap.move([attributes.uid], '[Gmail]/Trash', function (err) {
if (err) {
console.error(err);
reject(err);
} else {
console.log('Moved message #%d to Trash', seqno);
}
});
});
msg.once('error', err => reject(err));
msg.once('end', function () {
console.log('Finished processing message #%d', seqno);
});
});
fetch.once('end', function () {
console.log('All messages processed');
resolve();
});
});
// imap.search returns UIDs (UID SEARCH), so move them directly with a single
// UID MOVE command. Moving inside an active imap.fetch loop expunges messages
// from INBOX mid-fetch, which desyncs sequence numbers and hangs the connection.
const uids = await searchAsync([['FROM', from], ['SUBJECT', subject], ['SINCE', since]]);
if (uids.length === 0) {
console.log('No messages to move to Trash for subject "%s"', subject);
return;
}
await moveAsync(uids, '[Gmail]/Trash');
console.log('Moved %d message(s) to Trash for subject "%s"', uids.length, subject);
}
const timeout = setTimeout(() => {
@@ -183,11 +164,10 @@ imap.once('ready', async () => {
writeMarkDownFile(images);
// TODO:P0 deleting emails hangs the process, so it's disabled for now
// 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);
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) {