Compare commits

...
9 Commits
24 changed files with 135 additions and 34 deletions

No files matched your search

+12 -1
View File
@@ -5,11 +5,22 @@ 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.23.4] - 2024-05-04
### Added
- An invidious instance "fetch with CORS" test
### Fixed
- a bug where public Invidious instances all showed `N/A` in the health column
- a bug where trending and search wouldn't work in certain countries
## [0.23.3] - 2024-04-28
### Changed
- Removed announcement - most public instances are not updated
- Removed announcement - most public instances are now updated
## [0.23.2] - 2024-04-27
+1 -1
View File
@@ -2,7 +2,7 @@ openapi: 3.0.0
info:
title: Playlet Web API
version: 0.23.3
version: 0.23.4
description:
Playlet Web API is a RESTful API for controlling the Playlet app on
Roku devices. The API is intended to be used by the Playlet web app, but can
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet",
"version": "0.23.3",
"version": "0.23.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "playlet",
"version": "0.23.3",
"version": "0.23.4",
"hasInstallScript": true,
"devDependencies": {
"@rokucommunity/bslint": "^0.8.20",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet",
"version": "0.23.3",
"version": "0.23.4",
"description": "Unofficial YouTube client for Roku",
"devDependencies": {
"@rokucommunity/bslint": "^0.8.20",
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-app",
"version": "0.23.3",
"version": "0.23.4",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-app",
"version": "0.23.3"
"version": "0.23.4"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-app",
"version": "0.23.3",
"version": "0.23.4",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "rm -rf ../build/playlet-app",
+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=23
build_version=00003
build_version=00004
ui_resolutions=hd
+1 -2
View File
@@ -46,10 +46,9 @@ function Main(args as object) as void
input = CreateObject("roInput")
input.setMessagePort(port)
' TODO:P2 follow up on bug where roSystemLog does not fire for a video player in ComponentLibrary
' https://community.roku.com/t5/Roku-Developer-Program/BUG-roSystemLog-not-firing-with-ComponentLibrary/td-p/906075
systemLog = CreateObject("roSystemLog")
systemLog.SetMessagePort(port)
' Although all types are enabled, they are filtered in Playlet Lib to avoid spamming the logs
systemLog.EnableType("http.connect")
systemLog.EnableType("http.error")
systemLog.EnableType("http.complete")
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-lib",
"version": "0.23.3",
"version": "0.23.4",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-lib",
"version": "0.23.3"
"version": "0.23.4"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-lib",
"version": "0.23.3",
"version": "0.23.4",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "rm -rf ../build/playlet-lib",
+1 -3
View File
@@ -9,9 +9,7 @@ function Init()
m.top.ObserveField("logLine", port)
scene = m.top.getScene()
if scene.hasField("systemLogEvent")
scene.ObserveFieldScoped("systemLogEvent", port)
end if
scene.ObserveFieldScoped("systemLogEvent", port)
m.port = port
@@ -29,13 +29,15 @@
<Label
id="titleLabel"
width="500"
maxLines="2"
maxLines="3"
wrap="true">
<Font role="font" uri="font:BoldSystemFontFile" size="36" />
</Label>
<Label
id="subtitleLabel"
width="500"
maxLines="2"
wrap="true"
font="font:SmallestBoldSystemFont" />
<Label
id="updatedLabel"
@@ -38,7 +38,7 @@
iconVisible="false"
anchor="[0.5,0.5]"
padding="[30,30]"
translation="[580,530]" />
translation="[580,545]" />
</Rectangle>
</children>
</component>
@@ -32,6 +32,7 @@ function PrepareTests() as object
content.AppendChild(CreateTestNode(Tr(Locale.InvidiousTesting.FetchVideoComments), CanFetchVideoComments))
content.AppendChild(CreateTestNode(Tr(Locale.InvidiousTesting.FetchVideoCaptions), CanFetchVideoCaptions))
content.AppendChild(CreateTestNode(Tr(Locale.InvidiousTesting.FetchVideoThumbnails), CanFetchVideoThumbails))
content.AppendChild(CreateTestNode(Tr(Locale.InvidiousTesting.FetchWithCors), CanFetchWithCors))
return content
end function
@@ -312,3 +313,37 @@ function CanFetchVideoThumbails(instance as string, testNode as object, cancella
testNode.details = ErrorUtils.Format(e)
end try
end function
function CanFetchWithCors(instance as string, testNode as object, cancellation as object) as void
try
url = `${instance}/api/v1/trending`
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
if not response.IsSuccess()
testNode.state = "failed"
testNode.details = response.ErrorMessage()
return
end if
json = response.Json()
if json = invalid
testNode.state = "failed"
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFrom).Replace("%1", url)
return
end if
headers = response.Headers()
corsHeader = headers["Access-Control-Allow-Origin"]
if not IsString(corsHeader) or corsHeader <> "*"
testNode.state = "failed"
testNode.details = Tr(Locale.InvidiousTesting.CorsHeaderNotSetCorrectly).Replace("%1", url)
return
end if
testNode.state = "passed"
testNode.details = Tr(Locale.InvidiousTesting.TheInstanceCanFetchWithCors).Replace("%1", url)
catch e
testNode.state = "failed"
testNode.details = ErrorUtils.Format(e)
end try
end function
@@ -77,7 +77,7 @@ function CreateListItemContent(instance as object, fieldWidths as object) as obj
' Leave 5 spaces for the flag, just to simplify the layout
location: ` ${DrillIntoObject(instance[1], ["region"], "N/A")}`
flag: GetFlagUrl(DrillIntoObject(instance[1], ["flag"], ""))
health: DrillIntoObject(instance[1], ["monitor", "30dRatio", "ratio"], "N/A")
health: DrillIntoObject(instance[1], ["monitor", "uptime"], "N/A")
uri: instance[1].uri
fieldWidths: fieldWidths
})
@@ -34,7 +34,7 @@ class DashManifest
function fromVideoMetadata(metadata as object, local as boolean) as string
adaptiveFormats = []
adaptiveFormats.Append (metadata.adaptiveFormats)
adaptiveFormats.Append(metadata.adaptiveFormats)
if local
for i = 0 to adaptiveFormats.Count() - 1
@@ -43,11 +43,17 @@ namespace Invidious
m.invidiousNode = invidiousNode
end function
function GetUserRegion() as string
if m._userRegion = invalid
m._userRegion = m.invidiousNode.applicationInfo@.GetUserCountryCode()
function GetUserCountryCode() as string
if m._userCountryCode = invalid
m._userCountryCode = m.invidiousNode.applicationInfo@.GetUserCountryCode()
' GetUserCountryCode() can return OT, which is not a valid country code.
' https://github.com/iBicha/playlet/issues/372
if ValidString(m._userCountryCode) = "OT"
m._userCountryCode = "US"
end if
end if
return m._userRegion
return m._userCountryCode
end function
function GetAuthenticationHeaders(token as string) as object
@@ -89,7 +95,7 @@ namespace Invidious
url = `${instance}${Invidious.SEARCH_SUGGEST_ENDPOINT}`
request = HttpClient.Get(url)
request.QueryParam("region", m.GetUserRegion())
request.QueryParam("region", m.GetUserCountryCode())
request.QueryParam("q", q)
request.CacheSeconds(60 * 60 * 24)
@@ -266,7 +272,7 @@ namespace Invidious
if queryParam.default <> invalid
if IsString(queryParam.type) and queryParam.type = "#ISO3166"
if queryParam.default = "GetUserCountryCode"
request.QueryParam(queryParamKey, m.GetUserRegion())
request.QueryParam(queryParamKey, m.GetUserCountryCode())
else
request.QueryParam(queryParamKey, queryParam.default)
end if
@@ -364,6 +364,10 @@
<source>Fetch video thumbnails</source>
<translation>Fetch video thumbnails</translation>
</message>
<message>
<source>Fetch with CORS</source>
<translation>Fetch with CORS</translation>
</message>
<message>
<source>Press 'OK' for details</source>
<translation>Press 'OK' for details</translation>
@@ -432,6 +436,14 @@
<source>The instance can fetch video thumbnail for ID %1 (%2)</source>
<translation>The instance can fetch video thumbnail for ID %1 (%2)</translation>
</message>
<message>
<source>CORS header not set correctly from %1</source>
<translation>CORS header not set correctly from %1</translation>
</message>
<message>
<source>The instance can fetch with CORS from %1</source>
<translation>The instance can fetch with CORS from %1</translation>
</message>
<message>
<source>Passed</source>
<translation>Passed</translation>
+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=23
build_version=00003
build_version=00004
ui_resolutions=hd
+4 -3
View File
@@ -69,20 +69,21 @@ class XmlObject
for i = 0 to node.children.count() - 1
child = node.children[i]
childIsString = IsString(child)
if i = 0
if not IsString(child)
if not childIsString
xmlString += `\n`
end if
end if
if IsString(child)
if childIsString
xmlString += m.XmlEscape(child)
else
xmlString += m.NodeToXmlString(child, indentLevel + 1)
end if
if i = node.children.count() - 1
if not IsString(child)
if not childIsString
xmlString += `${indentString}`
end if
end if
@@ -0,0 +1,34 @@
namespace Tests
@suite
class XmlObjectTests extends Rooibos.BaseTestSuite
@describe("XmlObject")
@it("creates valid XML")
function _()
xml = new XmlObject()
if xml.Node("Person", { "name": `John "Joker" Doe`, "age": 30 })
xml.EmptyNode("Address", { "street": "123 Main St", "city": "Anytown", "state": "NY" })
if xml.Node("Metadata")
xml.TextNode("Data", "Some data")
xml.End()
end if
xml.End()
end if
expected = `<?xml version="1.0" encoding="UTF-8"?>
<Person age="30" name="John &quot;Joker&quot; Doe">
<Address city="Anytown" state="NY" street="123 Main St" />
<Metadata>
<Data>Some data</Data>
</Metadata>
</Person>
`
m.assertEqual(xml.ToXmlString(), expected)
end function
end class
end namespace
+3
View File
@@ -118,6 +118,7 @@ namespace Locale
FetchVideoComments = "Fetch video comments"
FetchVideoCaptions = "Fetch video captions"
FetchVideoThumbnails = "Fetch video thumbnails"
FetchWithCors = "Fetch with CORS"
PressOkForDetails = "Press 'OK' for details"
@@ -138,6 +139,8 @@ namespace Locale
ThumbnailNotReachable = "%1 is not reachable"
InvalidThumbnailData = "Invalid thumbnail data %1 (Content-Type is not image/*)"
TheInstanceCanFetchVideoThumbnails = "The instance can fetch video thumbnail for ID %1 (%2)"
CorsHeaderNotSetCorrectly = "CORS header not set correctly from %1"
TheInstanceCanFetchWithCors = "The instance can fetch with CORS from %1"
Passed = "Passed"
Failed = "Failed"
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-web",
"version": "0.23.3",
"version": "0.23.4",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "playlet-web",
"version": "0.23.3",
"version": "0.23.4",
"devDependencies": {
"@sveltejs/vite-plugin-svelte": "^3.1.0",
"@tailwindcss/typography": "^0.5.13",
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-web",
"version": "0.23.3",
"version": "0.23.4",
"type": "module",
"scripts": {
"dev": "vite",