diff --git a/CHANGELOG.md b/CHANGELOG.md index a9aa8821..c3c24d16 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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). +## [Unreleased] + +### Fixed + +- A few issues related to Playlet backend feeds and caching + ## [0.37.0] - 2025-05-16 ### Added diff --git a/package-lock.json b/package-lock.json index cb26d90f..d883bde6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -9,14 +9,14 @@ "version": "0.37.0", "hasInstallScript": true, "devDependencies": { - "@rokucommunity/bslint": "^0.8.30", + "@rokucommunity/bslint": "^0.8.31", "@types/crypto-js": "^4.2.2", "@types/fs-extra": "^11.0.4", - "@types/node": "^22.15.17", + "@types/node": "^22.15.18", "@types/xml2js": "^0.4.14", "argparse": "^2.0.1", "brighterscript": "0.68.5", - "brighterscript-formatter": "^1.7.13", + "brighterscript-formatter": "^1.7.14", "cheerio": "1.0.0-rc.11", "convert-svg-to-png": "^0.6.4", "crypto-js": "^4.2.0", @@ -32,12 +32,12 @@ "roku-test-automation": "^2.0.13", "rooibos-roku": "5.15.7", "rounded-rect-9patch": "^1.1.2", - "semver": "^7.7.1", + "semver": "^7.7.2", "shelljs": "^0.10.0", "ts-node": "^10.9.2", "typescript": "5.8.3", "xml2js": "^0.6.2", - "yaml": "^2.7.1" + "yaml": "^2.8.0" }, "engines": { "node": "20" @@ -438,9 +438,9 @@ "dev": true }, "node_modules/@rokucommunity/bslint": { - "version": "0.8.30", - "resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.30.tgz", - "integrity": "sha512-OMXmVslummcvvK7+b7abXtGZc2t6IaxcPG1Uq3ZoNj4qqJn0z2zZLnDjizDPR0c2kaZGI3wPTHehrGMjPbkR0Q==", + "version": "0.8.31", + "resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.31.tgz", + "integrity": "sha512-/VsycIH2OiEoNe7fCLqbQrDnX/JoKUV3Nufg0+auCM/DhCYzL4iM965VkSBebWzwUsnQXjILaKC4fRcMjpSBPQ==", "dev": true, "license": "MIT", "dependencies": { @@ -760,9 +760,9 @@ "license": "MIT" }, "node_modules/@types/node": { - "version": "22.15.17", - "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.17.tgz", - "integrity": "sha512-wIX2aSZL5FE+MR0JlvF87BNVrtFWf6AE6rxSE9X7OwnVvoyCQjpzSRJ+M87se/4QCkCiebQAqrJ0y6fwIyi7nw==", + "version": "22.15.18", + "resolved": "https://registry.npmjs.org/@types/node/-/node-22.15.18.tgz", + "integrity": "sha512-v1DKRfUdyW+jJhZNEI1PYy29S2YRxMV5AOO/x/SjKmW0acCIOqmbj6Haf9eHAhsPmrhlHSxEhv/1WszcLWV4cg==", "dev": true, "license": "MIT", "dependencies": { @@ -1360,13 +1360,13 @@ } }, "node_modules/brighterscript-formatter": { - "version": "1.7.13", - "resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.7.13.tgz", - "integrity": "sha512-fv2s+9CdYufQllOiE/uLayqNGq7fqy7FmCWy8gOengrNK7pUp6BV1G+3fuhRSN7A2xLNcXIB+8q6tnCGdb6qeg==", + "version": "1.7.14", + "resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.7.14.tgz", + "integrity": "sha512-rbK5lT2UZ/yD/JLryIsZC9Kng1vh4xFf9CO1tp8nMRaOTncscuD1mtMsmJXq0uQusxoRNBXB/tvSZQPKR9+SXQ==", "dev": true, "license": "MIT", "dependencies": { - "brighterscript": "^0.69.8", + "brighterscript": "^0.69.9", "glob-all": "^3.3.0", "jsonc-parser": "^3.0.0", "source-map": "^0.7.3", @@ -6712,9 +6712,9 @@ } }, "node_modules/semver": { - "version": "7.7.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.1.tgz", - "integrity": "sha512-hlq8tAfn0m/61p4BVRcPzIGr6LKiMwo4VM6dGi6pt4qcRkmNzTcWq6eCEjEh+qXjkMDvPlOFFSGwQjoEa6gyMA==", + "version": "7.7.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.2.tgz", + "integrity": "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA==", "dev": true, "license": "ISC", "bin": { @@ -7925,16 +7925,16 @@ "dev": true }, "node_modules/yaml": { - "version": "2.7.1", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.7.1.tgz", - "integrity": "sha512-10ULxpnOCQXxJvBgxsn9ptjq6uviG/htZKk9veJGhlqn3w/DxQ631zFF+nlQXLwmImeS5amR2dl2U8sg6U9jsQ==", + "version": "2.8.0", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.0.tgz", + "integrity": "sha512-4lLa/EcQCB0cJkyts+FpIRx5G/llPxfP6VQU5KByHEhLxY3IJCH0f0Hy1MHI8sClTvsIb8qwRJ6R/ZdlDJ/leQ==", "dev": true, "license": "ISC", "bin": { "yaml": "bin.mjs" }, "engines": { - "node": ">= 14" + "node": ">= 14.6" } }, "node_modules/yargs": { diff --git a/package.json b/package.json index bd66295e..8f97ef2e 100644 --- a/package.json +++ b/package.json @@ -3,14 +3,14 @@ "version": "0.37.0", "description": "Unofficial YouTube client for Roku", "devDependencies": { - "@rokucommunity/bslint": "^0.8.30", + "@rokucommunity/bslint": "^0.8.31", "@types/crypto-js": "^4.2.2", "@types/fs-extra": "^11.0.4", - "@types/node": "^22.15.17", + "@types/node": "^22.15.18", "@types/xml2js": "^0.4.14", "argparse": "^2.0.1", "brighterscript": "0.68.5", - "brighterscript-formatter": "^1.7.13", + "brighterscript-formatter": "^1.7.14", "cheerio": "1.0.0-rc.11", "convert-svg-to-png": "^0.6.4", "crypto-js": "^4.2.0", @@ -26,12 +26,12 @@ "roku-test-automation": "^2.0.13", "rooibos-roku": "5.15.7", "rounded-rect-9patch": "^1.1.2", - "semver": "^7.7.1", + "semver": "^7.7.2", "shelljs": "^0.10.0", "ts-node": "^10.9.2", "typescript": "5.8.3", "xml2js": "^0.6.2", - "yaml": "^2.7.1" + "yaml": "^2.8.0" }, "engines": { "node": "20" diff --git a/playlet-lib/src/components/Services/Innertube/InnertubeService.bs b/playlet-lib/src/components/Services/Innertube/InnertubeService.bs index 706fa26c..69e5fb9d 100644 --- a/playlet-lib/src/components/Services/Innertube/InnertubeService.bs +++ b/playlet-lib/src/components/Services/Innertube/InnertubeService.bs @@ -312,8 +312,18 @@ namespace InnertubeService } end if - json = response.Json() - return Innertube.ParseResponseDataForFeeds(json) + feeds = Innertube.ParseResponseDataForFeeds(response.Json()) + + result = { + feeds: feeds + } + + cacheControl = Innertube.ParseResponseForCacheControl(response) + if cacheControl <> invalid + result["cache-control"] = cacheControl + end if + + return result end function function AuthMarkVideoWatched(videoId as string, options as object) as boolean @@ -651,7 +661,14 @@ namespace InnertubeService return response.Json() end if - return Innertube.ParseMixPageResponseData(response.Json()) + result = Innertube.ParseMixPageResponseData(response.Json()) + + cacheControl = Innertube.ParseResponseForCacheControl(response) + if cacheControl <> invalid + result["cache-control"] = cacheControl + end if + + return result end function function ResolveUrl(url as string, options = invalid as object) as object diff --git a/playlet-lib/src/components/Services/Innertube/NodesParser.bs b/playlet-lib/src/components/Services/Innertube/NodesParser.bs index 067b63f1..33e756e3 100644 --- a/playlet-lib/src/components/Services/Innertube/NodesParser.bs +++ b/playlet-lib/src/components/Services/Innertube/NodesParser.bs @@ -106,6 +106,8 @@ namespace Innertube "genericPromoRenderer": ParseNotImplemented ' "Sign in to see the latest videos tailored to your interests" "feedNudgeRenderer": ParseNotImplemented + ' "No results found, Try different keywords or remove search filters" + "backgroundPromoRenderer": ParseNotImplemented "videoSurveyShelfRenderer": ParseNotImplemented "searchBarRenderer": ParseNotImplemented "clickTrackingParams": ParseNotImplemented diff --git a/playlet-lib/src/components/Web/PlayletWebServer/Middleware/PlayletInvidiousBackendRouter.bs b/playlet-lib/src/components/Web/PlayletWebServer/Middleware/PlayletInvidiousBackendRouter.bs index 0bbfbaf0..41cb0581 100644 --- a/playlet-lib/src/components/Web/PlayletWebServer/Middleware/PlayletInvidiousBackendRouter.bs +++ b/playlet-lib/src/components/Web/PlayletWebServer/Middleware/PlayletInvidiousBackendRouter.bs @@ -71,36 +71,35 @@ namespace Http options.continuation = continuation end if - feeds = InnertubeService.GetSubscriptions(options) - if feeds = invalid - response.Json({ - "error": "Failed to get auth feed" - }) + result = InnertubeService.GetSubscriptions(options) + if result.error <> invalid + response.Json(result) response.http_code = 500 return true end if - if IsAssociativeArray(feeds) - if feeds.error <> invalid - response.Json(feeds) - response.http_code = 500 - return true - end if + if not IsArray(result.feeds) or result.feeds.Count() = 0 + ' Not an error, just no subscriptions + response.Json({ + "videos": [] + }) return true end if - result = { - "videos": [] + responseBody = { + "videos": ValidArray(result.feeds[0].items) } - if feeds.Count() > 0 - result["videos"] = ValidArray(feeds[0].items) - if feeds[0].DoesExist("continuation") - result["continuation"] = feeds[0].continuation - end if + if result.feeds[0].DoesExist("continuation") + responseBody.continuation = result.feeds[0].continuation + end if + + response.Json(responseBody) + + if result.DoesExist("cache-control") + response.headers["cache-control"] = result["cache-control"] end if - response.Json(result) return true end function @@ -144,8 +143,14 @@ namespace Http options.continuation = continuation end if - feeds = InnertubeService.GetPlaylists(options) - if feeds = invalid + result = InnertubeService.GetPlaylists(options) + if result.error <> invalid + response.Json(result) + response.http_code = 500 + return true + end if + + if not IsArray(result.feeds) or result.feeds.Count() = 0 response.Json({ "error": "Failed to get auth playlists" }) @@ -153,23 +158,12 @@ namespace Http return true end if - if IsAssociativeArray(feeds) - if feeds.error <> invalid - response.Json(feeds) - response.http_code = 500 - return true - end if - return true + response.Json(result.feeds[0]) + + if result.DoesExist("cache-control") + response.headers["cache-control"] = result["cache-control"] end if - if feeds.Count() > 0 - response.Json(feeds[0]) - return true - end if - - response.Json({ - "items": [] - }) return true end function @@ -195,32 +189,27 @@ namespace Http options.continuation = continuation end if - feeds = InnertubeService.GetWatchHistory(options) - if feeds = invalid - response.Json({ - "error": "Failed to get auth history" - }) + result = InnertubeService.GetWatchHistory(options) + if result.error <> invalid + response.Json(result) response.http_code = 500 return true end if - if IsAssociativeArray(feeds) - if feeds.error <> invalid - response.Json(feeds) - response.http_code = 500 - return true - end if + if not IsArray(result.feeds) or result.feeds.Count() = 0 + ' Not an error, just no history + response.Json({ + "items": [] + }) return true end if - if feeds.Count() > 0 - response.Json(feeds[0]) - return true + response.Json(result.feeds[0]) + + if result.DoesExist("cache-control") + response.headers["cache-control"] = result["cache-control"] end if - response.Json({ - "items": [] - }) return true end function @@ -317,6 +306,7 @@ namespace Http end if response.Json(ValidArray(result.feeds[0].items)) + if result.DoesExist("cache-control") response.headers["cache-control"] = result["cache-control"] end if @@ -346,36 +336,27 @@ namespace Http options.continuation = continuation end if - feeds = InnertubeService.GetHome(options) - if feeds = invalid - response.Json({ - "error": "Failed to get auth home feed" - }) + result = InnertubeService.GetHome(options) + if result.error <> invalid + response.Json(result) response.http_code = 500 return true end if - if IsAssociativeArray(feeds) - if feeds.error <> invalid - response.Json(feeds) - response.http_code = 500 - return true - end if + if not IsArray(result.feeds) or result.feeds.Count() = 0 + ' Not an error, just no recommended videos, usually when there's no history + response.Json({ + "items": [] + }) return true end if - result = { - "items": [] - } + response.Json(result.feeds[0]) - if feeds.Count() > 0 - result["items"] = ValidArray(feeds[0].items) - if feeds[0].DoesExist("continuation") - result["continuation"] = feeds[0].continuation - end if + if result.DoesExist("cache-control") + response.headers["cache-control"] = result["cache-control"] end if - response.Json(result) return true end function @@ -460,7 +441,7 @@ namespace Http if not IsArray(result.feeds) or result.feeds.Count() = 0 response.Json({ - "error": "Failed to search" + "error": "Failed to search: no results found" }) response.http_code = 500 return true diff --git a/playlet-web/package-lock.json b/playlet-web/package-lock.json index 7cf52b11..dd7fe6cc 100644 --- a/playlet-web/package-lock.json +++ b/playlet-web/package-lock.json @@ -17,11 +17,11 @@ "dotenv": "^16.5.0", "ip": "^2.0.1", "postcss": "^8.5.3", - "svelte": "^5.28.2", - "svelte-check": "^4.1.7", + "svelte": "^5.30.1", + "svelte-check": "^4.2.1", "svelte-preprocess": "^6.0.3", "tailwindcss": "^3.4.17", - "terser": "^5.39.0", + "terser": "^5.39.2", "tslib": "^2.8.1", "typescript": "^5.8.3", "vite": "^6.3.5", @@ -4371,9 +4371,9 @@ } }, "node_modules/svelte": { - "version": "5.28.2", - "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.28.2.tgz", - "integrity": "sha512-FbWBxgWOpQfhKvoGJv/TFwzqb4EhJbwCD17dB0tEpQiw1XyUEKZJtgm4nA4xq3LLsMo7hu5UY/BOFmroAxKTMg==", + "version": "5.30.1", + "resolved": "https://registry.npmjs.org/svelte/-/svelte-5.30.1.tgz", + "integrity": "sha512-QIYtKnJGkubWXtNkrUBKVCvyo9gjcccdbnvXfwsGNhvbeNNdQjRDTa/BiQcJ2kWXbXPQbWKyT7CUu53KIj1rfw==", "dev": true, "license": "MIT", "dependencies": { @@ -4397,9 +4397,9 @@ } }, "node_modules/svelte-check": { - "version": "4.1.7", - "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.1.7.tgz", - "integrity": "sha512-1jX4BzXrQJhC/Jt3SqYf6Ntu//vmfc6VWp07JkRfK2nn+22yIblspVUo96gzMkg0Zov8lQicxhxsMzOctwcMQQ==", + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-4.2.1.tgz", + "integrity": "sha512-e49SU1RStvQhoipkQ/aonDhHnG3qxHSBtNfBRb9pxVXoa+N7qybAo32KgA9wEb2PCYFNaDg7bZCdhLD1vHpdYA==", "dev": true, "license": "MIT", "dependencies": { @@ -4592,14 +4592,14 @@ } }, "node_modules/terser": { - "version": "5.39.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.39.0.tgz", - "integrity": "sha512-LBAhFyLho16harJoWMg/nZsQYgTrg5jXOn2nCYjRUcZZEdE3qa2zb8QEDRUGVZBW4rlazf2fxkg8tztybTaqWw==", + "version": "5.39.2", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.39.2.tgz", + "integrity": "sha512-yEPUmWve+VA78bI71BW70Dh0TuV4HHd+I5SHOAfS1+QBOmvmCiiffgjR8ryyEd3KIfvPGFqoADt8LdQ6XpXIvg==", "dev": true, "license": "BSD-2-Clause", "dependencies": { "@jridgewell/source-map": "^0.3.3", - "acorn": "^8.8.2", + "acorn": "^8.14.0", "commander": "^2.20.0", "source-map-support": "~0.5.20" }, diff --git a/playlet-web/package.json b/playlet-web/package.json index 13e59049..c4e0c334 100644 --- a/playlet-web/package.json +++ b/playlet-web/package.json @@ -18,11 +18,11 @@ "dotenv": "^16.5.0", "ip": "^2.0.1", "postcss": "^8.5.3", - "svelte": "^5.28.2", - "svelte-check": "^4.1.7", + "svelte": "^5.30.1", + "svelte-check": "^4.2.1", "svelte-preprocess": "^6.0.3", "tailwindcss": "^3.4.17", - "terser": "^5.39.0", + "terser": "^5.39.2", "tslib": "^2.8.1", "typescript": "^5.8.3", "vite": "^6.3.5",