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