Compare commits

...
2 Commits
37 changed files with 75 additions and 46 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/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [0.44.3] - 2025-11-14
### Fixed
- Json parsing with invalid chars like `\u0000` preventing some channels from loading
## [0.44.2] - 2025-11-13 ## [0.44.2] - 2025-11-13
### Fixed ### Fixed
+6
View File
@@ -58,6 +58,12 @@
"regex": "\\bTr\\s*\\(\\s*\"[^\\\"]*\"\\s*\\)", "regex": "\\bTr\\s*\\(\\s*\"[^\\\"]*\"\\s*\\)",
"regexFlags": "ig", "regexFlags": "ig",
"message": "Tr(\"String\") is not allowed. Use Tr(Locale.Key) instead." "message": "Tr(\"String\") is not allowed. Use Tr(Locale.Key) instead."
},
{
"code": "NO_PARSE_JSON",
"regex": "\\s*ParseJson\\(",
"regexFlags": "ig",
"message": "ParseJson is not allowed. Use StringUtils.ParseJsonSafe() instead."
} }
], ],
"files": [ "files": [
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet", "name": "playlet",
"version": "0.44.2", "version": "0.44.3",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet", "name": "playlet",
"version": "0.44.2", "version": "0.44.3",
"hasInstallScript": true, "hasInstallScript": true,
"devDependencies": { "devDependencies": {
"@rokucommunity/bslint": "^0.8.38", "@rokucommunity/bslint": "^0.8.38",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet", "name": "playlet",
"version": "0.44.2", "version": "0.44.3",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"devDependencies": { "devDependencies": {
"@rokucommunity/bslint": "^0.8.38", "@rokucommunity/bslint": "^0.8.38",
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-app", "name": "playlet-app",
"version": "0.44.2", "version": "0.44.3",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-app", "name": "playlet-app",
"version": "0.44.2" "version": "0.44.3"
} }
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-app", "name": "playlet-app",
"version": "0.44.2", "version": "0.44.3",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"scripts": { "scripts": {
"prebuild": "node ../tools/rm.js ../build/playlet-app", "prebuild": "node ../tools/rm.js ../build/playlet-app",
@@ -37,6 +37,7 @@ function GetLoadingMessagesFromCache() as object
if messagesFile = "" if messagesFile = ""
return invalid return invalid
end if end if
' bs:disable-next-line NO_PARSE_JSON
return ParseJson(messagesFile) return ParseJson(messagesFile)
end function end function
+1 -1
View File
@@ -3,7 +3,7 @@ title=Playlet
# Do not update version manually, it is auto updated from package.json # Do not update version manually, it is auto updated from package.json
major_version=0 major_version=0
minor_version=44 minor_version=44
build_version=00002 build_version=00003
ui_resolutions=hd ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p uri_resolution_autosub=$$RES$$,480p,720p,1080p
+1
View File
@@ -28,6 +28,7 @@ namespace Registry
if urlsJson = invalid if urlsJson = invalid
return invalid return invalid
end if end if
' bs:disable-next-line NO_PARSE_JSON
urls = ParseJson(urlsJson) urls = ParseJson(urlsJson)
return urls return urls
end function end function
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.44.2", "version": "0.44.3",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.44.2" "version": "0.44.3"
} }
} }
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-lib", "name": "playlet-lib",
"version": "0.44.2", "version": "0.44.3",
"description": "Unofficial YouTube client for Roku", "description": "Unofficial YouTube client for Roku",
"scripts": { "scripts": {
"prebuild": "node ../tools/rm.js ../build/playlet-lib", "prebuild": "node ../tools/rm.js ../build/playlet-lib",
@@ -125,7 +125,7 @@ namespace DialogUtils
if hasMessageId if hasMessageId
messages = RegistryUtils.Read(RegistryUtils.MESSAGES) messages = RegistryUtils.Read(RegistryUtils.MESSAGES)
if not StringUtils.IsNullOrEmpty(messages) if not StringUtils.IsNullOrEmpty(messages)
messages = ParseJson(messages) messages = StringUtils.ParseJsonSafe(messages)
if IsAssociativeArray(messages) if IsAssociativeArray(messages)
savedMessageId = ValidString(messages["messageId"]) savedMessageId = ValidString(messages["messageId"])
if savedMessageId = messageId if savedMessageId = messageId
@@ -1,9 +1,10 @@
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
namespace HomeScreenUtils namespace HomeScreenUtils
function GetFeed(feedFileName as string, preferences as object) as object function GetFeed(feedFileName as string, preferences as object) as object
feed = ParseJson(ReadAsciiFile(feedFileName)) feed = StringUtils.ParseJsonSafe(ReadAsciiFile(feedFileName))
for each item in feed for each item in feed
item.title = Tr(item.title) item.title = Tr(item.title)
@@ -3,11 +3,12 @@ import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
import "pkg:/source/utils/Logging.bs" import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/MathUtils.bs" import "pkg:/source/utils/MathUtils.bs"
import "pkg:/source/utils/RemoteKeys.bs" import "pkg:/source/utils/RemoteKeys.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs" import "pkg:/source/utils/Types.bs"
function Init() function Init()
m.homeLayout = {} m.homeLayout = {}
homeLayout = ParseJson(ReadAsciiFile("libpkg:/config/default_home_layout.yaml")) homeLayout = StringUtils.ParseJsonSafe(ReadAsciiFile("libpkg:/config/default_home_layout.yaml"))
for each item in homeLayout for each item in homeLayout
m.homeLayout[item.id] = item m.homeLayout[item.id] = item
end for end for
@@ -20,7 +20,7 @@ function Load() as void
end if end if
m.bookmarksString = bookmarksString m.bookmarksString = bookmarksString
bookmarks = ParseJson(bookmarksString) bookmarks = StringUtils.ParseJsonSafe(bookmarksString)
if bookmarks = invalid if bookmarks = invalid
LogWarn("Failed to parse bookmarks json") LogWarn("Failed to parse bookmarks json")
return return
@@ -454,7 +454,7 @@ namespace Innertube
LogDebug(`ReadAsciiFile("tmp:/sts_cache.json")`) LogDebug(`ReadAsciiFile("tmp:/sts_cache.json")`)
cache = ReadAsciiFile("tmp:/sts_cache.json") cache = ReadAsciiFile("tmp:/sts_cache.json")
if not StringUtils.IsNullOrEmpty(cache) if not StringUtils.IsNullOrEmpty(cache)
json = ParseJson(cache) json = StringUtils.ParseJsonSafe(cache)
return json["sts"] return json["sts"]
end if end if
@@ -87,7 +87,7 @@ namespace Innertube
text = response.Text() text = response.Text()
text = text.Replace(`)]}'`, "") text = text.Replace(`)]}'`, "")
parsed = ParseJson(text) parsed = StringUtils.ParseJsonSafe(text)
if not IsArray(parsed) or parsed.Count() < 2 if not IsArray(parsed) or parsed.Count() < 2
return { return {
error: "Failed to parse search suggestions" error: "Failed to parse search suggestions"
@@ -46,7 +46,7 @@ namespace Innertube
text = response.Text() text = response.Text()
text = text.Replace(`)]}'`, "") text = text.Replace(`)]}'`, "")
json = ParseJson(text) json = StringUtils.ParseJsonSafe(text)
if json = invalid if json = invalid
return { return {
"error": "Failed to parse session data: " + text "error": "Failed to parse session data: " + text
@@ -78,7 +78,7 @@ namespace Innertube
return invalid return invalid
end if end if
sessionData = ParseJson(sessionData) sessionData = StringUtils.ParseJsonSafe(sessionData)
if sessionData = invalid if sessionData = invalid
RegistryUtils.Delete(RegistryUtils.INNERTUBE_SESSION_DATA) RegistryUtils.Delete(RegistryUtils.INNERTUBE_SESSION_DATA)
return invalid return invalid
@@ -1,7 +1,7 @@
import "InvidiousService.bs" import "InvidiousService.bs"
function Init() function Init()
m.top.apiDefinitions = ParseJson(ReadAsciiFile("libpkg:/config/invidious_video_api.yaml")) m.top.apiDefinitions = StringUtils.ParseJsonSafe(ReadAsciiFile("libpkg:/config/invidious_video_api.yaml"))
m.service = new Invidious.InvidiousService(m.top) m.service = new Invidious.InvidiousService(m.top)
end function end function
@@ -698,7 +698,7 @@ namespace Invidious
end function end function
function VerifyTokenScope(token as string) as boolean function VerifyTokenScope(token as string) as boolean
tokenObject = ParseJson(token) tokenObject = StringUtils.ParseJsonSafe(token)
if tokenObject = invalid if tokenObject = invalid
LogWarn("Failed to json parse token:", token) LogWarn("Failed to json parse token:", token)
return false return false
@@ -212,7 +212,7 @@ class LoungeApi
text = text.Mid(text.instr(`\n`) + 1) text = text.Mid(text.instr(`\n`) + 1)
messagesToSend = [] messagesToSend = []
commands = ParseJson(text) commands = StringUtils.ParseJsonSafe(text)
m.ProcessCommands(commands, messagesToSend) m.ProcessCommands(commands, messagesToSend)
m.SendMessages(messagesToSend) m.SendMessages(messagesToSend)
return true return true
@@ -268,7 +268,7 @@ class LoungeApi
payloadSize = chunk.Left(newLineIndex).trim() payloadSize = chunk.Left(newLineIndex).trim()
payloadSize = payloadSize.ToInt() payloadSize = payloadSize.ToInt()
payload = chunk.Mid(newLineIndex + 1, payloadSize) payload = chunk.Mid(newLineIndex + 1, payloadSize)
commands = ParseJson(payload) commands = StringUtils.ParseJsonSafe(payload)
m.ProcessCommands(commands, messagesToSend) m.ProcessCommands(commands, messagesToSend)
chunk = chunk.Mid(newLineIndex + payloadSize + 1) chunk = chunk.Mid(newLineIndex + payloadSize + 1)
newLineIndex = chunk.InStr(`\n`) newLineIndex = chunk.InStr(`\n`)
@@ -376,7 +376,7 @@ class LoungeApi
if not IsString(devices) if not IsString(devices)
return return
end if end if
devices = ParseJson(devices) devices = StringUtils.ParseJsonSafe(devices)
if devices = invalid if devices = invalid
return return
end if end if
@@ -618,7 +618,7 @@ class LoungeApi
RegistryUtils.Delete(RegistryUtils.LAST_LOUNGE_DATA) RegistryUtils.Delete(RegistryUtils.LAST_LOUNGE_DATA)
loungeData = ParseJson(loungeData) loungeData = StringUtils.ParseJsonSafe(loungeData)
if not IsAssociativeArray(loungeData) if not IsAssociativeArray(loungeData)
LogWarn("Can't disconnect from lounge. Invalid data:", loungeData) LogWarn("Can't disconnect from lounge. Invalid data:", loungeData)
return return
@@ -86,7 +86,7 @@ namespace LoungeVideoQueue
' - eventDetails is of the form {"eventType":"VIDEO_REMOVED","videoId":"<videoId>"} ' - eventDetails is of the form {"eventType":"VIDEO_REMOVED","videoId":"<videoId>"}
eventDetails = playlistData[FIELD_EVENT_DETAILS] eventDetails = playlistData[FIELD_EVENT_DETAILS]
if IsString(eventDetails) if IsString(eventDetails)
eventDetails = ParseJson(eventDetails) eventDetails = StringUtils.ParseJsonSafe(eventDetails)
end if end if
if eventDetails <> invalid and eventDetails["eventType"] = "VIDEO_ADDED" if eventDetails <> invalid and eventDetails["eventType"] = "VIDEO_ADDED"
eventVideoId = eventDetails[FIELD_VIDEO_ID] eventVideoId = eventDetails[FIELD_VIDEO_ID]
@@ -21,7 +21,7 @@ function Init()
end function end function
function LoadPreferencesFile() function LoadPreferencesFile()
m.top.prefsModel = ParseJson(ReadAsciiFile("libpkg:/config/preferences.json5")) m.top.prefsModel = StringUtils.ParseJsonSafe(ReadAsciiFile("libpkg:/config/preferences.json5"))
end function end function
function AddNodeFields() function AddNodeFields()
@@ -60,7 +60,7 @@ function LoadUserPreferencesFromRegistry()
if userPrefs = invalid if userPrefs = invalid
userPrefs = {} userPrefs = {}
else else
userPrefs = ParseJson(userPrefs) userPrefs = StringUtils.ParseJsonSafe(userPrefs)
end if end if
' Step 2: Migrate existing preferences to new format (if needed) ' Step 2: Migrate existing preferences to new format (if needed)
@@ -101,7 +101,7 @@ function MigrateExistingPreferences(userPrefs as object) as boolean
if not StringUtils.IsNullOrEmpty(instances) if not StringUtils.IsNullOrEmpty(instances)
currentInstance = userPrefs["invidious.instance"] currentInstance = userPrefs["invidious.instance"]
if StringUtils.IsNullOrEmpty(currentInstance) if StringUtils.IsNullOrEmpty(currentInstance)
instances = ParseJson(instances) instances = StringUtils.ParseJsonSafe(instances)
if IsArray(instances) and instances.Count() > 0 if IsArray(instances) and instances.Count() > 0
instance = instances[0] instance = instances[0]
if not StringUtils.IsNullOrEmpty(instance) if not StringUtils.IsNullOrEmpty(instance)
@@ -31,7 +31,7 @@ function LoadProfilesFromRegistry()
currentProfile: invalid currentProfile: invalid
} }
else else
userProfiles = ParseJson(userProfiles) userProfiles = StringUtils.ParseJsonSafe(userProfiles)
end if end if
' Step 2: Migrate existing profiles to new format (if needed) ' Step 2: Migrate existing profiles to new format (if needed)
@@ -98,7 +98,7 @@ function MigrateExistingProfiles(userProfiles as object) as boolean
return false return false
end if end if
authToken = ParseJson(tokenPayload) authToken = StringUtils.ParseJsonSafe(tokenPayload)
RegistryUtils.Delete(RegistryUtils.INVIDIOUS_TOKEN) RegistryUtils.Delete(RegistryUtils.INVIDIOUS_TOKEN)
if authToken = invalid or authToken.instance = invalid or authToken.token = invalid or authToken.username = invalid if authToken = invalid or authToken.instance = invalid or authToken.token = invalid or authToken.username = invalid
@@ -55,7 +55,7 @@ namespace SearchHistoryUtils
return [] return []
end if end if
history = ParseJson(history) history = StringUtils.ParseJsonSafe(history)
if not IsArray(history) if not IsArray(history)
return [] return []
end if end if
@@ -9,7 +9,7 @@ namespace SponsorBlock
class SponsorBlockService class SponsorBlockService
function new() function new()
' TODO:P2 this is being read and parsed on every skipped segment. It should be cached. ' TODO:P2 this is being read and parsed on every skipped segment. It should be cached.
m.sponsorBlockConfig = ParseJson(ReadAsciiFile("libpkg:/config/sponsorblock_config.json5")) m.sponsorBlockConfig = StringUtils.ParseJsonSafe(ReadAsciiFile("libpkg:/config/sponsorblock_config.json5"))
end function end function
function GetCategories() as object function GetCategories() as object
@@ -341,7 +341,7 @@ function SetCaptions(metadata as object, service as object, contentNode as objec
return return
end if end if
isoLanguageList = ParseJson(ReadAsciiFile("libpkg:/config/ISO-639-1-to-ISO-639-2T.json5")) isoLanguageList = StringUtils.ParseJsonSafe(ReadAsciiFile("libpkg:/config/ISO-639-1-to-ISO-639-2T.json5"))
instance = service.GetInstance() instance = service.GetInstance()
subtitleTracks = [] subtitleTracks = []
@@ -66,7 +66,7 @@ namespace Http
return true return true
end if end if
feedSource = ParseJson(feedSource) feedSource = StringUtils.ParseJsonSafe(feedSource)
if feedSource = invalid if feedSource = invalid
response.Default(400, "Expected valid JSON for feed-source") response.Default(400, "Expected valid JSON for feed-source")
return true return true
@@ -804,7 +804,7 @@ namespace Http
' (such as "newest", "oldest", etc.), we'll ignore it, as it is not supported. ' (such as "newest", "oldest", etc.), we'll ignore it, as it is not supported.
sortBy = request.query.sort_by sortBy = request.query.sort_by
if not StringUtils.IsNullOrEmpty(sortBy) and sortBy.StartsWith("{") if not StringUtils.IsNullOrEmpty(sortBy) and sortBy.StartsWith("{")
sortBy = ParseJson(sortBy) sortBy = StringUtils.ParseJsonSafe(sortBy)
if IsAssociativeArray(sortBy) if IsAssociativeArray(sortBy)
if sortBy.DoesExist("params") if sortBy.DoesExist("params")
options.params = sortBy.params options.params = sortBy.params
@@ -19,7 +19,7 @@ namespace Http
saved = RegistryUtils.Read(RegistryUtils.PLAYLET_LIB_URLS) saved = RegistryUtils.Read(RegistryUtils.PLAYLET_LIB_URLS)
if saved <> invalid if saved <> invalid
saved = ParseJson(saved) saved = StringUtils.ParseJsonSafe(saved)
end if end if
response.Json({ response.Json({
@@ -272,7 +272,7 @@ namespace Http
return invalid return invalid
end if end if
m.body_json = ParseJson(text) m.body_json = StringUtils.ParseJsonSafe(text)
return m.body_json return m.body_json
end function end function
end class end class
@@ -11,7 +11,7 @@ namespace Http
if StringUtils.IsNullOrEmpty(json) if StringUtils.IsNullOrEmpty(json)
return "application/octet-stream" return "application/octet-stream"
end if end if
map = ParseJson(json) map = StringUtils.ParseJsonSafe(json)
if not IsAssociativeArray(map) if not IsAssociativeArray(map)
return "application/octet-stream" return "application/octet-stream"
end if end if
@@ -41,7 +41,7 @@ namespace Http
if StringUtils.IsNullOrEmpty(json) if StringUtils.IsNullOrEmpty(json)
return "" return ""
end if end if
map = ParseJson(json) map = StringUtils.ParseJsonSafe(json)
if not IsAssociativeArray(map) if not IsAssociativeArray(map)
return "" return ""
end if end if
+1 -1
View File
@@ -3,7 +3,7 @@ title=PlayletLib
# Do not update version manually, it is auto updated from package.json # Do not update version manually, it is auto updated from package.json
major_version=0 major_version=0
minor_version=44 minor_version=44
build_version=00002 build_version=00003
ui_resolutions=hd ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p uri_resolution_autosub=$$RES$$,480p,720p,1080p
@@ -703,7 +703,7 @@ namespace HttpClient
if text = invalid if text = invalid
return invalid return invalid
end if end if
m._json = ParseJson(text) m._json = StringUtils.ParseJsonSafe(text)
return m._json return m._json
end function end function
@@ -813,7 +813,7 @@ namespace HttpClientCache
end if end if
metadataText = cacheText.Left(firstLineIndex) metadataText = cacheText.Left(firstLineIndex)
metadata = ParseJson(metadataText) metadata = StringUtils.ParseJsonSafe(metadataText)
if metadata = invalid if metadata = invalid
LogWarn("Failed to parse metadata from cache.") LogWarn("Failed to parse metadata from cache.")
Delete(request) Delete(request)
@@ -821,7 +821,7 @@ namespace HttpClientCache
end if end if
headersText = cacheText.Mid(firstLineIndex + 1, metadata.headers) headersText = cacheText.Mid(firstLineIndex + 1, metadata.headers)
headers = ParseJson(headersText) headers = StringUtils.ParseJsonSafe(headersText)
if headers = invalid if headers = invalid
LogWarn("Failed to parse headers from cache.") LogWarn("Failed to parse headers from cache.")
Delete(request) Delete(request)
@@ -29,5 +29,18 @@ namespace StringUtils
function RandomId() as string function RandomId() as string
return StrI(rnd(2147483647), 36) return StrI(rnd(2147483647), 36)
end function end function
function ParseJsonSafe(jsonString as dynamic) as dynamic
if IsNullOrEmpty(jsonString)
return invalid
end if
' bs:disable-next-line NO_PARSE_JSON
json = ParseJson(jsonString)
if json <> invalid
return json
end if
' bs:disable-next-line NO_PARSE_JSON
return ParseJson(jsonString.Replace("\u0000", ""))
end function
end namespace end namespace
+2 -2
View File
@@ -1,12 +1,12 @@
{ {
"name": "playlet-web", "name": "playlet-web",
"version": "0.44.2", "version": "0.44.3",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "playlet-web", "name": "playlet-web",
"version": "0.44.2", "version": "0.44.3",
"devDependencies": { "devDependencies": {
"@sveltejs/vite-plugin-svelte": "^6.2.1", "@sveltejs/vite-plugin-svelte": "^6.2.1",
"@tailwindcss/postcss": "^4.1.17", "@tailwindcss/postcss": "^4.1.17",
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "playlet-web", "name": "playlet-web",
"version": "0.44.2", "version": "0.44.3",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",