Compare commits

...
2 Commits
Author SHA1 Message Date
Brahim Hadriche 34adf51ebb Release v0.41.0 (#705) 2025-08-29 15:51:19 -04:00
Brahim Hadriche b657664546 Add Telemetry (#704) 2025-08-29 15:22:57 -04:00
24 changed files with 202 additions and 18 deletions

No files matched your search

+6
View File
@@ -5,6 +5,12 @@ 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.41.0] - 2025-08-29
### Added
- Telemetry to collect anonymous diagnostics data. Can be turned off from the settings.
## [0.40.15] - 2025-08-28
### Fixed
+2
View File
@@ -6,6 +6,8 @@ Playlet, the Roku app, does not collect any user personal information whatsoever
Playlet does not show advertising, whether personalized or non personalized.
Playlet may integrate with 3rd party telemetry services in order to capture anonymous diagnostics data. The only purpose of this data is to diagnose issues and improve the app.
## Invidious
Playlet may request information from one or more [Invidious](https://invidious.io/)
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet",
"version": "0.40.15",
"version": "0.41.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "playlet",
"version": "0.40.15",
"version": "0.41.0",
"hasInstallScript": true,
"devDependencies": {
"@rokucommunity/bslint": "^0.8.34",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet",
"version": "0.40.15",
"version": "0.41.0",
"description": "Unofficial YouTube client for Roku",
"devDependencies": {
"@rokucommunity/bslint": "^0.8.34",
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-app",
"version": "0.40.15",
"version": "0.41.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-app",
"version": "0.40.15"
"version": "0.41.0"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-app",
"version": "0.40.15",
"version": "0.41.0",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "rm -rf ../build/playlet-app",
+2 -2
View File
@@ -2,8 +2,8 @@ title=Playlet
# Do not update version manually, it is auto updated from package.json
major_version=0
minor_version=40
build_version=00015
minor_version=41
build_version=00000
ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-lib",
"version": "0.40.15",
"version": "0.41.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-lib",
"version": "0.40.15"
"version": "0.41.0"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-lib",
"version": "0.40.15",
"version": "0.41.0",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "rm -rf ../build/playlet-lib",
@@ -112,6 +112,7 @@ function OnLineSysLog(event as object, dateTime as object, logsFile as string, b
print line
buffer.FromAsciiString(line + `\n`)
buffer.AppendFile(logsFile)
m.global.telemetry.logError = line
end function
function OnLineLogMonitorMemoryWarning(event as object, dateTime as object, logsFile as string, buffer as object) as void
@@ -120,6 +121,7 @@ function OnLineLogMonitorMemoryWarning(event as object, dateTime as object, logs
print line
buffer.FromAsciiString(line + `\n`)
buffer.AppendFile(logsFile)
m.global.telemetry.logWarn = line
end function
function OnLineLogDeviceInfoMemoryWarning(event as object, dateTime as object, logsFile as string, buffer as object) as void
@@ -138,6 +140,7 @@ function OnLineLogDeviceInfoMemoryWarning(event as object, dateTime as object, l
print line
buffer.FromAsciiString(line + `\n`)
buffer.AppendFile(logsFile)
m.global.telemetry.logWarn = line
end function
' Note: although the timestamp should be captured in the caller, not the logger,
@@ -53,6 +53,7 @@
<PlayletWebServer id="WebServer" port="8888" />
<DialServer id="DialServer" />
<LoungeService id="LoungeService" />
<Telemetry id="Telemetry" />
</AppController>
</children>
</component>
+3
View File
@@ -103,6 +103,9 @@
videoQueue="bind:../VideoQueue"
notifications="bind:../Notifications"
invidious="bind:../Invidious" />
<Telemetry id="Telemetry"
preferences="bind:../Preferences"
applicationInfo="bind:../ApplicationInfo" />
</AppController>
</children>
</component>
@@ -64,6 +64,10 @@ function InitializeBindings()
"videoQueue": "../VideoQueue",
"notifications": "../Notifications",
"invidious": "../Invidious"
},
"Telemetry": {
"preferences": "../Preferences",
"applicationInfo": "../ApplicationInfo"
}
}
}
@@ -107,9 +107,13 @@ namespace InnertubeService
try
parsedResponse = Innertube.ParseInnertubePlayerResponse(playerResponse.Json(), playerRequest.signatureTimestamp, cancellation)
catch exception
if ValidString(exception.code) = "STS_MISMATCH"
code = ValidString(exception.code)
if code = "STS_MISMATCH"
return GetVideoMetadata(videoId, options)
end if
if code = "MISSING_FORMAT_FIELD"
m.global.telemetry.LogError = code + `\n` + playerRequest.ToCurlCommand() + `\n` + playerResponse.Text()
end if
throw exception
end try
if parsedResponse.error <> invalid
@@ -0,0 +1,62 @@
import "pkg:/source/services/HttpClient.bs"
const SENTRY_ENVELOPE_URL = "https://o4509923566288896.ingest.us.sentry.io/api/4509923579265024/envelope/"
const SENTRY_KEY = "0bda23ffe3634745f57a0edbffdd18be"
namespace Sentry
function SendLogEvent(level as string, message as string, tags as object) as void
eventId = GenerateEventId()
timestamp = CreateObject("roDateTime").ToISOString()
header = FormatJson({
event_id: eventId
sent_at: timestamp
sdk: {
name: "sentry.roku.playlet"
version: "1.0.0"
}
})
event = `{"type":"event"}`
eventPayload = FormatJson({
event_id: eventId
timestamp: timestamp
platform: "roku"
#if DEBUG
environment: "development"
#else
environment: "production"
#end if
tags: tags
level: level
logentry: {
formatted: message
}
})
payload = header + `\n` + event + `\n` + eventPayload
request = HttpClient.Post(SENTRY_ENVELOPE_URL, payload)
request.QueryParam("sentry_key", SENTRY_KEY)
request.Header("Content-Type", "text/plain;charset=UTF-8")
response = request.Await()
if not response.IsSuccess()
#if DEBUG
LogError("Failed to send event to Sentry:", response.ErrorMessage())
#end if
return
end if
LogDebug("Sent event to Sentry with ID:", eventId, "Response:", response.Text())
end function
function GenerateEventId() as string
hexChars = "0123456789abcdef"
eventId = ""
for i = 0 to 31
eventId = eventId + hexChars.Mid(rnd(16) - 1, 1)
end for
return eventId
end function
end namespace
@@ -0,0 +1,75 @@
import "pkg:/components/Telemetry/Sentry.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/Types.bs"
function Init() as void
if m.global.telemetry <> invalid
return
end if
m.global.addFields({ telemetry: m.top })
m.top.functionName = "TelemetryLoop"
end function
function OnNodeReady() as void
m.tags = GetTags()
m.top.ObserveField("enabled", FuncName(OnEnabledChanged))
m.preferences.ObserveFieldScoped("dev.diagnostics.enabled", FuncName(OnPreferencesChanged))
enabled = m.preferences["dev.diagnostics.enabled"]
OnPreferencesChanged({
enabled: enabled
getData: function() as boolean
return m.enabled
end function
})
end function
function OnPreferencesChanged(event as object) as void
m.top.enabled = event.getData()
end function
function OnEnabledChanged(event as object) as void
enabled = event.getData()
LogInfo("Telemetry enabled:", enabled)
if enabled
m.top.control = "run"
else
m.top.control = "stop"
end if
end function
function TelemetryLoop() as void
msgPort = CreateObject("roMessagePort")
m.top.observeField("LogInfo", msgPort)
m.top.observeField("LogWarn", msgPort)
m.top.observeField("LogError", msgPort)
levelMap = {
"LogInfo": "info"
"LogWarn": "warning"
"LogError": "error"
}
while true
msg = wait(0, msgPort)
msgType = type(msg)
if msgType = "roSGNodeEvent"
level = levelMap[msg.getField()]
if level <> invalid
Sentry.SendLogEvent(level, msg.getData(), m.tags)
end if
end if
end while
end function
function GetTags() as object
appInfo = m.applicationInfo
tags = appInfo@.GetAppInfo()
tags.Append(appInfo@.GetDeviceInfo())
for each key in tags
if not IsString(tags[key])
tags[key] = ToString(tags[key])
end if
end for
return tags
end function
@@ -0,0 +1,10 @@
<component name="Telemetry" extends="Task" includes="AutoBind">
<interface>
<field id="enabled" type="boolean" />
<field id="applicationInfo" type="node" />
<field id="preferences" type="node" />
<field id="LogInfo" type="string" alwaysNotify="true" />
<field id="LogWarn" type="string" alwaysNotify="true" />
<field id="LogError" type="string" alwaysNotify="true" />
</interface>
</component>
@@ -105,6 +105,8 @@ function ExecuteJob() as void
if metadata.liveNow = true
contentNode.Live = true
end if
m.global.telemetry.logInfo = "[VideoContentJob] success"
end function
function CreateStreamUrls(metadata as object, service as Invidious.InvidiousService, preferences as object, backend as string, playletServerPort as integer) as object
@@ -431,6 +431,7 @@ function OnVideoPlayerStateChange() as void
' This is to reduce false positives, as we do not want retry another link if the first link is working fine.
if state = "playing" and not m.videoPlayingSuccess
LogInfo(`Now playing video ${content.url}`)
m.global.telemetry.logInfo = "[VideoPlayer] state=playing"
m.videoPlayingSuccess = true
end if
+7
View File
@@ -297,6 +297,13 @@
visibility: "tv",
rokuComponent: "ClearCacheControl",
},
{
displayText: "Enable Diagnostics",
key: "dev.diagnostics.enabled",
description: "Help improve Playlet by enabling diagnostics. This will send anonymous diagnotics data to the developer.",
type: "boolean",
defaultValue: true,
},
],
},
]
+2 -2
View File
@@ -2,8 +2,8 @@ title=PlayletLib
# Do not update version manually, it is auto updated from package.json
major_version=0
minor_version=40
build_version=00015
minor_version=41
build_version=00000
ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-web",
"version": "0.40.15",
"version": "0.41.0",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "playlet-web",
"version": "0.40.15",
"version": "0.41.0",
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^6.1.3",
"@tailwindcss/typography": "^0.5.16",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-web",
"version": "0.40.15",
"version": "0.41.0",
"type": "module",
"scripts": {
"dev": "vite",
+5 -1
View File
@@ -180,6 +180,8 @@ export class LoggerPlugin implements CompilerPlugin {
let logLine = '';
const telemetryEnabled = level === 'LogError' || level === 'LogWarn';
if (isDebug) {
const RED = '[31m';
const YELLOW = '[33m';
@@ -217,7 +219,9 @@ function ${newFunctionName}(${args.join(', ')}) as void
if logger.logLevel < ${func.level}
return
end if
logger.logLine = ${logLine}
line = ${logLine}
logger.logLine = line
${(telemetryEnabled ? `m.global.telemetry.${level} = line` : '')}
end function
`;
}