Compare commits

..
56 Commits
Author SHA1 Message Date
Brahim Hadriche 5583f55aae Release v0.36.4 (#586) 2025-04-19 11:44:28 -04:00
Brahim Hadriche d4f15e7dfb update dependencies (#585) 2025-04-19 11:38:22 -04:00
Brahim Hadriche de7c3f8a99 update dependencies (#581) 2025-04-12 16:59:10 -04:00
Brahim Hadriche b35dc4423e changelog 2025-04-12 16:55:09 -04:00
Weblate (bot)anddavbrasan 23146706ee Translated using Weblate (Portuguese (Brazil)) (#582)
Currently translated at 100.0% (319 of 319 strings)

Translation: Playlet/Playlet
Translate-URL: https://hosted.weblate.org/projects/playlet/playlet/pt_BR/

Co-authored-by: davbrasan <davidbrazps2@gmail.com>
2025-04-12 16:54:34 -04:00
Brahim Hadriche d10444b96c changelog 2025-04-10 16:27:58 -04:00
Weblate (bot)andEttore Atalan 2f7ba64488 Translated using Weblate (German) (#580)
Currently translated at 100.0% (319 of 319 strings)

Translation: Playlet/Playlet
Translate-URL: https://hosted.weblate.org/projects/playlet/playlet/de/

Co-authored-by: Ettore Atalan <atalanttore@googlemail.com>
2025-04-10 16:27:35 -04:00
Brahim Hadricheandgithub-action linter f1f50cc19e [chore] update dependencies (#579)
* update dependencies

* Lint fix

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2025-04-05 12:16:18 -04:00
Brahim Hadriche b3a9887634 [skip ci] remove announcement 2025-04-03 13:21:33 -04:00
Brahim Hadriche c56092144f [skip ci] changelog fix 2025-04-02 18:32:25 -04:00
Brahim Hadriche 750472912e Release v0.36.3 (#578) 2025-04-02 18:27:32 -04:00
Brahim Hadriche ae83c47bfe Fix bug with saving search history 2025-03-30 09:59:58 -04:00
Brahim Hadriche e08bc86334 update dependencies (#573) 2025-03-29 10:19:51 -04:00
Brahim Hadriche 10aaf74c38 update dependencies (#570) 2025-03-22 11:29:16 -04:00
Brahim Hadriche 79464a003e Fix Playlet backend parsing issue in search results 2025-03-17 19:52:51 -04:00
Brahim Hadriche f7b8aa6c29 Fix for web remote volume buttons being stuck when a Roku stick is used with Roku TV 2025-03-17 11:59:25 -04:00
Brahim Hadriche 59e378cc9c update dependencies (#568) 2025-03-17 11:57:53 -04:00
Brahim Hadriche a1c178830a [skip ci] update device script 2025-03-17 11:36:01 -04:00
Brahim Hadriche 173e6ffa6c Revert "Remove optional dep (#567)"
This reverts commit 207614ac5c.
2025-03-07 22:41:03 -05:00
Brahim Hadriche 207614ac5c Remove optional dep (#567) 2025-03-07 22:38:43 -05:00
Brahim Hadriche 5c7c6e83c3 update dependencies (#566) 2025-03-07 22:32:25 -05:00
Brahim Hadriche 9ceb1c8963 [chore] update dependencies (#565)
* update dependencies

* lock versions of bsc and daisyui
2025-03-02 14:33:32 -05:00
Brahim Hadriche 106a664c9f Transpiled files 2025-02-27 20:17:42 -05:00
Brahim Hadriche bd3ac7b9c1 App dialog signals to comply with certification 2025-02-27 20:16:58 -05:00
Brahim Hadriche afe61c2df7 Release v0.36.2 (#564) 2025-02-27 20:05:23 -05:00
Brahim Hadriche 943f348d87 [chore] update dependencies (#561)
* update dependencies

* revert bsc
2025-02-27 20:01:52 -05:00
Brahim Hadriche 30b6551356 [skip ci] comment 2025-02-27 19:00:23 -05:00
Brahim Hadriche a46397fa46 [chore] update dependencies (#556)
* update dependencies

* revert bsc
2025-02-16 17:14:10 -05:00
Brahim Hadriche 32afe5afd9 changelog 2025-02-16 15:00:05 -05:00
Weblate (bot)andJean Carton 371286344f Translated using Weblate (Spanish (Mexico)) (#557)
Currently translated at 100.0% (319 of 319 strings)

Translation: Playlet/Playlet
Translate-URL: https://hosted.weblate.org/projects/playlet/playlet/es_MX/

Co-authored-by: Jean Carton <intrinsiccyokai@users.noreply.hosted.weblate.org>
2025-02-16 14:59:07 -05:00
Brahim Hadriche ae39b8d0ab [skip ci] remove duplicate import 2025-02-03 19:40:41 -05:00
Brahim Hadriche 1c4067e7da Do not cache empty response data 2025-02-03 19:34:00 -05:00
Brahim Hadriche b327a37576 changelog 2025-02-03 14:00:03 -05:00
Weblate (bot)andBastian Veith 0d8aae6a75 Translated using Weblate (German) (#554)
Currently translated at 99.6% (318 of 319 strings)

Translation: Playlet/Playlet
Translate-URL: https://hosted.weblate.org/projects/playlet/playlet/de/

Co-authored-by: Bastian Veith <veith.bastian@pm.me>
2025-02-03 13:59:46 -05:00
Brahim Hadriche 8f79d91c29 [chore] update dependencies (#552)
* update dependencies

* Fix deps
2025-02-01 10:24:05 -05:00
Brahim Hadriche 5c02d46f1d [skip ci] enable colored logs in debug mode 2025-01-31 18:17:20 -05:00
Brahim Hadriche 83627b67ec [skip ci] oauth logout 2025-01-29 20:56:05 -05:00
Brahim Hadriche 2b11d4b71c Update profile view / thumbnail 2025-01-29 20:28:12 -05:00
Brahim Hadricheandgithub-action linter 29a3206f17 More OAuth work (#551)
* More OAuth work

* Lint fix

* tweaks

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
2025-01-28 22:20:07 -05:00
Brahim Hadriche 12231fe2ec Logo adjustment 2025-01-26 22:08:46 -05:00
Brahim Hadriche 0b6cd0294f Add account type indicator 2025-01-26 21:37:27 -05:00
Brahim Hadriche 1964040900 Move image conversion out of plugins 2025-01-26 20:38:08 -05:00
Brahim Hadriche 3cb3c4b8ab Feature/yt oauth (#550)
* feature flag

* Move view

* Service selection UI

* tweak

* tweak
2025-01-26 18:21:05 -05:00
Brahim Hadriche 4acc1bd0c6 Format 2025-01-26 15:47:52 -05:00
Brahim Hadriche 3375ce9f4f Locale tweak 2025-01-26 15:45:19 -05:00
Brahim Hadriche 75c965fd8b [skip ci] update versions 2025-01-26 15:23:08 -05:00
Brahim Hadriche 345f26f0b2 [skip ci] rename plugin file 2025-01-25 19:50:51 -05:00
Brahim Hadriche 6a9fb2755d [skip ci] fix warnings 2025-01-24 20:58:54 -05:00
Brahim Hadriche 01103f7833 [chore] update dependencies (#549)
* update dependencies

* revert tailwind package

* svelte config fix

* exclude tailwind from updates
2025-01-24 20:56:25 -05:00
Brahim Hadriche 21a653571f [skip ci] Remove mixes video thumbnails Invidious patch 2025-01-24 16:50:15 -05:00
Brahim Hadriche caa3f18fcc [skip ci] tweak with dash url for testing 2025-01-23 19:01:50 -05:00
Brahim Hadriche 6b62532b48 [skip ci] shutdown script 2025-01-22 18:04:44 -05:00
Brahim Hadriche 6fd99afd8a [skip ci] test tweak 2025-01-22 17:40:12 -05:00
Brahim Hadriche 23401e7841 [skip ci] locale 2025-01-21 19:24:35 -05:00
Brahim Hadriche 54b4750e8e Changelog 2025-01-21 12:58:06 -05:00
Weblate (bot)andLacey Anaya 1587c8fd26 Translated using Weblate (German) (#547)
Currently translated at 99.6% (316 of 317 strings)

Translation: Playlet/Playlet
Translate-URL: https://hosted.weblate.org/projects/playlet/playlet/de/

Co-authored-by: Lacey Anaya <yecakeh263@anawalls.com>
2025-01-21 12:57:48 -05:00
78 changed files with 3085 additions and 957 deletions

No files matched your search

+29 -1
View File
@@ -5,6 +5,34 @@ 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.36.4] - 2025-04-19
### Added
- Portuguese (Brazil) translations (Thanks to davbrasan)
### Removed
- Startup announcement dialog
### Fixed
- German translation (Thanks to Atalanttore)
## [0.36.3] - 2025-04-02
### Fixed
- Playlet backend parsing issue in search results
- Bug with saving search history
## [0.36.2] - 2025-02-28
### Added
- German translations (Thanks to Lacey Anaya and Bastian Veith)
- Spanish (Mexico) translations (Thanks to Jean Carton)
## [0.36.1] - 2025-01-19
### Fixed
@@ -13,7 +41,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Session data persists for 24 hours
- It reduces the privacy of the app, but can help with `Sign in to confirm you're not a bot` errors
## Changed
### Changed
- Video queue view might be missing video titles and durations
- This is done to reduce the risk of rate limiting. No video titles in the queue is better than no videos playing at all.
-1
View File
@@ -91,7 +91,6 @@
"../tools/bs-plugins/json-yaml-plugin.ts",
"../tools/bs-plugins/validation-plugin.ts",
"../tools/bs-plugins/logger-plugin.ts",
"../tools/bs-plugins/image-gen-plugin.ts",
"../tools/bs-plugins/type-gen-plugin.ts",
"../tools/bs-plugins/web-server-plugin.ts",
"../tools/bs-plugins/locale-validation-plugin.ts",
-1
View File
@@ -29,7 +29,6 @@
"../tools/bs-plugins/json-yaml-plugin.ts",
"../tools/bs-plugins/validation-plugin.ts",
"../tools/bs-plugins/logger-plugin.ts",
"../tools/bs-plugins/image-gen-plugin.ts",
"../tools/bs-plugins/type-gen-plugin.ts",
"../tools/bs-plugins/web-server-plugin.ts",
"../tools/bs-plugins/locale-validation-plugin.ts",
+1 -1
View File
@@ -2,7 +2,7 @@ openapi: 3.0.0
info:
title: Playlet Web API
version: 0.36.1
version: 0.36.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
-16
View File
@@ -1,7 +1,6 @@
# Playlet Brighterscript Plugins
- [Json5/Yaml support](#json5yaml-support)
- [Convert images](#convert-images)
- [Manifest editing](#manifest-editing)
- [Validation](#validation)
- [Includes](#includes)
@@ -33,21 +32,6 @@ Brightscript can only parse json natively using [ParseJson](https://developer.ro
At the end of the build, the plugin scans for certain files (`jsonc`, `json`, `json5` and `yaml`), and converts them to plain json, while keeping the original file name. That way they are all parsable by the [ParseJson](https://developer.roku.com/en-ca/docs/references/brightscript/language/global-utility-functions.md#parsejsonjsonstring-as-string-flags---as-string-as-object) function, even though their original format is not compatible.
## Convert images
**[Source](/tools/bs-plugins/image-gen-plugin.ts)**
This plugin allows us to convert svg files to png files.
### Why
This is used to convert splash screen, app poster, as well as icons in the app. Having svg images (or vector images in general) as the source of truth is better, in case images need to be modified or resized. Since Roku can't load them, we convert them to png.
### How
Each `.svg` file found will have an associated `.svg.meta.json5` file, which will contain the hash (MD5) of the svg, conversion paramters, and the hash of the output files. This allows us to hash existing files and see if a conversion is needed.
Notice how each `.svg` file can be configured to generate multiple png files. This is especially the case to generate the app artwork (splash screen/poster) with different sizes from the same logo `.svg` file.
## Manifest editing
**[Source](/tools/bs-plugins/manifest-edit-plugin.ts)**
+7 -2
View File
@@ -6,7 +6,12 @@ import { utils } from 'roku-test-automation';
const envFile = path.join(__dirname, '../.env');
const config = getEnvVars(['ROKU_DEV_TARGET', 'ROKU_DEVPASSWORD']);
export function setupEnvironment() {
export enum AppId {
DEV = 'dev',
PROD = '693751',
}
export function setupEnvironment(appId = AppId.DEV) {
utils.setupEnvironmentFromConfig({
RokuDevice: {
devices: [{
@@ -16,7 +21,7 @@ export function setupEnvironment() {
},
ECP: {
default: {
launchChannelId: 'dev'
launchChannelId: appId,
}
},
OnDeviceComponent: {
+36 -8
View File
@@ -1,14 +1,14 @@
// integration test to play a video on the Roku device
// 1. Run dev channel on the Roku device (Playlet (dev))
// 2. npm run restart-app && npm run test:integration
import { ecp, odc } from 'roku-test-automation';
import { setupEnvironment } from './common';
import { AppId, setupEnvironment } from './common';
import { Key } from 'roku-test-automation/client/dist/ECP';
setupEnvironment();
async function playVideoDev() {
setupEnvironment(AppId.DEV);
(async () => {
await ecp.sendInput({ params: { contentId: "jNQXAC9IVRw" } });
await ecp.sendLaunchChannel({ params: { contentId: "jNQXAC9IVRw" } });
await ecp.sleep(5000);
await odc.onFieldChangeOnce({
base: "scene",
@@ -18,7 +18,35 @@ setupEnvironment();
console.log("Video started playing");
await ecp.sendKeypress(Key.Back);
await odc.shutdown();
await ecp.sendKeypress(Key.Home);
}
async function playVideoProd() {
setupEnvironment(AppId.PROD);
let playerState = (await ecp.getMediaPlayer()).state;
await ecp.sendLaunchChannel({ params: { contentId: "jNQXAC9IVRw" } });
const TIMEOUT = 20000;
const start = Date.now();
while (Date.now() - start < TIMEOUT) {
const newPlayerState = (await ecp.getMediaPlayer()).state;
if (newPlayerState !== playerState) {
console.log("Player state changed: ", newPlayerState);
playerState = newPlayerState;
}
if (playerState === "play") {
console.log("Video started playing");
break;
}
await ecp.sleep(1000);
}
await ecp.sendKeypress(Key.Home);
}
(async () => {
await playVideoDev();
await playVideoProd();
})();
+755 -378
View File
File diff suppressed because it is too large. Load diff
+19 -15
View File
@@ -1,19 +1,20 @@
{
"name": "playlet",
"version": "0.36.1",
"version": "0.36.4",
"description": "Unofficial YouTube client for Roku",
"devDependencies": {
"@rokucommunity/bslint": "^0.8.28",
"@types/crypto-js": "^4.2.2",
"@types/fs-extra": "^11.0.4",
"@types/node": "^22.10.7",
"@types/node": "^22.14.1",
"@types/xml2js": "^0.4.14",
"argparse": "^2.0.1",
"brighterscript": "0.68.3",
"brighterscript-formatter": "^1.7.8",
"brighterscript": "0.68.5",
"brighterscript-formatter": "^1.7.12",
"cheerio": "1.0.0-rc.11",
"convert-svg-to-png": "^0.6.4",
"crypto-js": "^4.2.0",
"dotenv": "^16.4.7",
"dotenv": "^16.5.0",
"fs-extra": "^11.3.0",
"glob": "^11.0.1",
"imap": "^0.8.19",
@@ -21,16 +22,16 @@
"json5": "^2.2.3",
"mailparser": "^3.7.2",
"protocol-buffers-schema": "^3.6.0",
"roku-deploy": "^3.12.3",
"roku-test-automation": "^2.0.10",
"rooibos-roku": "5.14.0",
"roku-deploy": "^3.12.4",
"roku-test-automation": "^2.0.13",
"rooibos-roku": "5.15.7",
"rounded-rect-9patch": "^1.1.2",
"semver": "^7.6.3",
"shelljs": "^0.8.5",
"semver": "^7.7.1",
"shelljs": "^0.9.2",
"ts-node": "^10.9.2",
"typescript": "5.7.3",
"typescript": "5.8.3",
"xml2js": "^0.6.2",
"yaml": "^2.7.0"
"yaml": "^2.7.1"
},
"engines": {
"node": "20"
@@ -62,15 +63,18 @@
"sign-released-package": "node tools/sign-released-package.js",
"screenshot": "node tools/screenshot.js",
"generate-sponsorblock-config": "node tools/generate-sponsorblock-config.js",
"convert-images": "node tools/convert-images.js",
"update-rale-component": "cd tools/RALE && rm TrackerTask.xml && curl -o TrackerTask.zip https://devtools.web.roku.com/roku-advanced-layout-editor/app/TrackerTask.zip && unzip TrackerTask.zip && rm TrackerTask.zip",
"postinstall": "cd playlet-lib && npm install && cd ../playlet-app && npm install && cd ../playlet-web && npm install",
"update-deps": "npx npm-check-updates --deep --upgrade --install always",
"update-deps": "npx npm-check-updates --deep --upgrade --install always --reject tailwindcss,cheerio,brighterscript,daisyui",
"registry:write": "node tools/registry.js --input registry.json",
"registry:read": "node tools/registry.js --output registry.json",
"registry:clear": "node tools/registry.js --clear",
"restart-app": "node tools/restart-app.js"
"restart-app": "node tools/restart-app.js",
"check-for-updates": "node tools/check-for-updates.js",
"shutdown": "node tools/shutdown.js"
},
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "^4.30.1"
"@rollup/rollup-linux-x64-gnu": "^4.40.0"
}
}
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-app",
"version": "0.36.1",
"version": "0.36.4",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-app",
"version": "0.36.1"
"version": "0.36.4"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-app",
"version": "0.36.1",
"version": "0.36.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=36
build_version=00001
build_version=00004
ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-lib",
"version": "0.36.1",
"version": "0.36.4",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-lib",
"version": "0.36.1"
"version": "0.36.4"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-lib",
"version": "0.36.1",
"version": "0.36.4",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "rm -rf ../build/playlet-lib",
@@ -9,6 +9,7 @@
<field id="loadingBitmapUri" type="uri" alias="Poster.loadingBitmapUri" />
<field id="failedBitmapUri" type="uri" alias="Poster.failedBitmapUri" />
<field id="loadStatus" type="string" alias="Poster.loadStatus" />
<field id="blendColor" type="color" alias="Poster.blendColor" />
<field id="maskUri" type="uri" value="pkg:/images/white-circle.png" alias="MaskGroup.maskuri" />
<field id="maskSize" type="vector2d" alias="MaskGroup.maskSize" />
@@ -0,0 +1,5 @@
<component name="BackendTypeContentNode" extends="ContentNode">
<interface>
<field id="backendLogoUri" type="uri" />
</interface>
</component>
@@ -54,17 +54,6 @@ function PlaylistContentTask(input as object) as object
}
end if
' TODO:P2 To remove after https://github.com/iv-org/invidious/pull/5116
if IsString(metadata["mixId"]) and IsArray(metadata["videos"])
videos = metadata["videos"]
for i = 0 to videos.Count() - 1
thumbnails = videos[i].videoThumbnails
if thumbnails.Count() = 1 and IsArray(thumbnails[0])
videos[i].videoThumbnails = thumbnails[0]
end if
end for
end if
InvidiousContent.ToPlaylistContentNode(contentNode, metadata, instance)
childCount = contentNode.getChildCount()
@@ -8,6 +8,7 @@
<field id="accessToken" type="string" />
<!-- Innertube fields -->
<field id="thumbnail" type="uri" />
<field id="refreshToken" type="string" />
<field id="scope" type="string" />
<field id="tokenType" type="string" />
@@ -1,4 +1,4 @@
<component name="LoginDialog" extends="StandardDialog" initialFocus="buttonArea" includes="AutoBind">
<component name="InvidiousLoginDialog" extends="StandardDialog" initialFocus="buttonArea" includes="AutoBind">
<interface>
<field id="webServer" type="node" bind="/WebServer" />
<field id="invidious" type="node" bind="/Invidious" />
@@ -0,0 +1,51 @@
import "pkg:/source/AsyncTask/AsyncTask.bs"
import "pkg:/source/AsyncTask/Tasks.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/Types.bs"
function Init()
m.qrCode = m.top.findNode("QrCodePoster")
codeLabel = m.top.findNode("codeLabel")
if codeLabel <> invalid
codeLabel = codeLabel.getChild(0)
if codeLabel <> invalid
codeFont = m.top.findNode("codeFont")
codeLabel.font = codeFont
end if
end if
m.top.width = "920"
m.top.observeFieldScoped("buttonSelected", FuncName(Close))
m.top.observeFieldScoped("wasClosed", FuncName(OnWasClosed))
scanLabel = m.top.findNode("scanLabel")
' TODO:P2 localize all dialog items
scanLabel.text = Tr(Locale.Dialogs.ScanTheQrCode)
end function
function OnNodeReady()
m.task = AsyncTask.Start(Tasks.YouTubeLoginTask, {
dialog: m.top
profilesService: m.top.profilesService
})
end function
function OnCodeSet(event as object)
code = event.getData()
m.qrCode.text = code
end function
function Close()
m.top.close = true
end function
function OnWasClosed()
if m.task <> invalid
m.task.cancel = true
m.task = invalid
end if
end function
function OnUrlSet()
m.qrCode.text = m.top.url
end function
@@ -0,0 +1,49 @@
<component name="YouTubeLoginDialog" extends="StandardDialog" initialFocus="buttonArea" includes="AutoBind">
<interface>
<field id="profilesService" type="node" bind="/ProfilesService" />
<field id="code" type="string" alias="codeLabel.text" />
<field id="url" type="string" onChange="OnUrlSet" />
<field id="alwaysOnTop" type="boolean" />
</interface>
<children>
<Font id="codeFont" uri="font:MediumSystemFontFile" size="36" />
<StdDlgTitleArea primaryTitle="Login to YouTube" />
<StdDlgContentArea>
<StdDlgTextItem text="Open the link 'https://yt.be/activate' and enter the following code:" />
<StdDlgTextItem id="codeLabel" text="Loading..." />
</StdDlgContentArea>
<StdDlgButtonArea id="buttonArea">
<StdDlgButton text="OK" />
</StdDlgButtonArea>
<StdDlgSideCardArea
id="sideCarArea"
horizAlign="right"
width="400"
extendToDialogEdge="false"
showDivider="false">
<Label
id="scanLabel"
text="Scan the QR Code"
horizAlign="center"
wrap="true" width="400">
<Font role="font" uri="font:SystemFontFile" size="24" />
</Label>
<QrCodePoster
id="QrCodePoster"
width="300"
height="300"
loadWidth="300"
loadHeight="300"
padding="10"
translation="[50, 50]" />
<Label
horizAlign="center"
width="400"
translation="[0, 380]"
text="https://yt.be/activate">
<Font role="font" uri="font:MediumSystemFontFile" size="18" />
</Label>
</StdDlgSideCardArea>
</children>
</component>
@@ -0,0 +1,118 @@
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/Services/Innertube/InnertubeService.bs"
import "pkg:/source/utils/CancellationUtils.bs"
import "pkg:/source/utils/Logging.bs"
@asynctask
function YouTubeLoginTask(input as object) as object
profilesNode = input.profilesService
dialogNode = input.dialog
cancellation = m.top.cancellation
' TODO:P2 cache client identity
authCode = InnertubeService.AuthGetCode(cancellation)
if CancellationUtils.IsCancelled(cancellation)
return invalid
end if
if authCode.error <> invalid
LogError(authCode.error)
DialogUtils.ShowDialogEx({
title: "Error"
message: authCode.error
large: true
})
return invalid
end if
url = InnertubeService.AuthGetActivationUrl(authCode)
LogInfo("Login url:", url)
dialogNode.url = url
dialogNode.code = authCode.userCode
accessToken = InnertubeService.AuthPollForAccessToken(authCode, cancellation)
if CancellationUtils.IsCancelled(cancellation)
return invalid
end if
if accessToken.error <> invalid
LogError(accessToken.error)
DialogUtils.ShowDialogEx({
title: "Error"
message: accessToken.error
large: true
})
return invalid
end if
accounts = InnertubeService.AuthListAccounts(accessToken.accessToken, cancellation)
if CancellationUtils.IsCancelled(cancellation)
return invalid
end if
if IsAssociativeArray(accounts) and accounts.error <> invalid
LogError(accounts.error)
DialogUtils.ShowDialogEx({
title: "Error"
message: accounts.error
large: true
})
return invalid
end if
if not IsArray(accounts) or accounts.Count() = 0
LogError("No accounts found")
DialogUtils.ShowDialogEx({
title: "Error"
message: "No accounts found"
large: true
})
return invalid
end if
selectedAccount = invalid
for each account in accounts
if ValidBool(account.isSelected)
selectedAccount = account
exit for
end if
end for
if selectedAccount = invalid
selectedAccount = accounts[0]
end if
profile = CreateProfileContentNode(selectedAccount, accessToken)
profilesNode@.LoginWithProfile(profile)
dialogNode.close = true
return invalid
end function
function CreateProfileContentNode(account as object, accessToken as object) as object
profile = CreateObject("roSGNode", "ProfileContentNode")
profile.type = "youtube"
profile.serverUrl = "http://127.0.0.1:8888/playlet-invidious-backend"
username = account.channelHandle
if StringUtils.IsNullOrEmpty(username)
username = account.accountByline
end if
profile.username = username
profile.thumbnail = account.accountPhoto
profile.accessToken = accessToken.accessToken
profile.refreshToken = accessToken.refreshToken
profile.scope = accessToken.scope
profile.tokenType = accessToken.tokenType
profile.expiresIn = accessToken.expiresIn
profile.expiresTimestamp = accessToken.expiresTimestamp
profile.clientId = accessToken.clientId
profile.clientSecret = accessToken.clientSecret
return profile
end function
+13 -3
View File
@@ -40,7 +40,6 @@ function MainSceneContainerChanged()
InitEcpArgs()
m.scene.signalBeacon("AppLaunchComplete")
CopyLoadingMessagesToCache()
ShowAnnouncement()
end function
function StartWebServer()
@@ -54,8 +53,8 @@ function StartWebServer()
m.dialServer@.StartServer()
end function
function ShowAnnouncement()
DialogUtils.ShowDialogOnce({
function ShowAnnouncement() as void
dialog = DialogUtils.ShowDialogOnce({
messageId: "1736288537"
title: "Announcement - Playlet backend"
message: [
@@ -68,4 +67,15 @@ function ShowAnnouncement()
alwaysOnTop: true
marginWidth: 180
})
if dialog = invalid
return
end if
m.scene.signalBeacon("AppDialogInitiate")
m.top.observeField("wasClosed", FuncName(OnAnnouncementDialogClosed))
end function
function OnAnnouncementDialogClosed()
m.scene.signalBeacon("AppDialogComplete")
end function
@@ -39,7 +39,6 @@ function MainSceneContainerChanged()
InitEcpArgs()
m.scene.signalBeacon("AppLaunchComplete")
CopyLoadingMessagesToCache()
ShowAnnouncement()
end function
function StartWebServer()
@@ -51,8 +50,8 @@ function StartWebServer()
m.dialServer.callfunc("StartServer", invalid)
end function
function ShowAnnouncement()
DialogUtils_ShowDialogOnce({
function ShowAnnouncement() as void
dialog = DialogUtils_ShowDialogOnce({
messageId: "1736288537"
title: "Announcement - Playlet backend"
message: [
@@ -65,5 +64,14 @@ function ShowAnnouncement()
alwaysOnTop: true
marginWidth: 180
})
if dialog = invalid
return
end if
m.scene.signalBeacon("AppDialogInitiate")
m.top.observeField("wasClosed", FuncName(OnAnnouncementDialogClosed))
end function
function OnAnnouncementDialogClosed()
m.scene.signalBeacon("AppDialogComplete")
end function
'//# sourceMappingURL=./MainScene.brs.map
@@ -23,13 +23,28 @@ function OnCurrentProfile() as void
return
end if
username = currentProfile.username
if not StringUtils.IsNullOrEmpty(username)
m.letterLabel.text = UCase(username.Left(1))
else
thumbnail = currentProfile.thumbnail
if not StringUtils.IsNullOrEmpty(thumbnail)
m.circlePosterInner.uri = thumbnail
' bs:disable-next-line LINT3023
m.circlePosterInner.blendColor = "#FFFFFFFF"
m.letterLabel.text = ""
else
m.circlePosterInner.uri = "pkg:/images/white-circle.png"
m.circlePosterInner.blendColor = currentProfile.color
username = currentProfile.username
if not StringUtils.IsNullOrEmpty(username)
letter = username.Left(1)
if letter = "@" and Len(username) > 1
letter = username.Mid(1, 1)
end if
m.letterLabel.text = UCase(letter)
else
m.letterLabel.text = ""
end if
end if
m.circlePosterInner.blendColor = currentProfile.color
m.circlePoster.visible = true
m.buttonIcon.visible = false
@@ -12,7 +12,7 @@
height="40"
blendColor="#DDDDDDFF"
uri="pkg:/images/white-circle.png">
<Poster
<CirclePoster
id="circlePosterInner"
width="36"
height="36"
@@ -27,7 +27,7 @@
horizAlign="center">
<Font role="font" uri="font:SystemFontFile" size="24" />
</Label>
</Poster>
</CirclePoster>
</Poster>
</children>
</component>
@@ -0,0 +1,9 @@
function OnContentSet() as void
content = m.top.itemContent
if content = invalid
return
end if
m.top.backendName = content.title
m.top.backendLogoUri = content.backendLogoUri
end function
@@ -0,0 +1,24 @@
<component name="BackendTypeRowListCell" extends="Group">
<interface>
<field id="itemContent" type="node" onChange="OnContentSet" />
<field id="backendName" type="string" alias="BackendNameLabel.text" />
<field id="backendLogoUri" type="uri" alias="BackendLogoPoster.uri" />
</interface>
<children>
<Group translation="[20,20]">
<Poster
id="BackendLogoPoster"
width="160"
height="160"
translation="[20,20]">
</Poster>
<Label
id="BackendNameLabel"
width="200"
horizAlign="center"
translation="[0,240]">
</Label>
</Group>
</children>
</component>
@@ -0,0 +1,57 @@
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/RemoteKeys.bs"
import "pkg:/source/utils/Types.bs"
function Init()
m.rowList = m.top.FindNode("BackendRowList")
m.rowList.ObserveField("rowItemSelected", FuncName(OnRowItemSelected))
end function
function OnFocusChange() as void
if not m.top.focus
return
end if
NodeSetFocus(m.rowList, true)
end function
function OnKeyEvent(key as string, press as boolean) as boolean
if key = RemoteKeys.Options or key = RemoteKeys.Play or key = RemoteKeys.Pause or key = RemoteKeys.PlayOnly
' A pass-through to the app controller, so it can toggle picture-in-picture and pause/play
return false
end if
if key = RemoteKeys.Back and press
Close()
return true
end if
return true
end function
function Close()
m.top.appController@.PopScreen()
end function
function OnRowItemSelected(event as object) as void
index = event.GetData()
if index = invalid or index.count() <> 2
LogWarn("Invalid index:", index)
return
end if
Close()
content = m.rowList.content
rowIndex = index[0]
rowItemIndex = index[1]
row = content.GetChild(rowIndex)
rowItem = row.GetChild(rowItemIndex)
m.top.selectedBackendType = rowItem.id
end function
@@ -0,0 +1,46 @@
<component name="BackendTypeSelectionView" extends="Group" includes="AutoBind,Focus">
<interface>
<field id="selectedBackendType" type="string" />
<field id="appController" type="node" bind="/AppController" />
</interface>
<children>
<Rectangle
width="1280"
height="720"
color="#000000"
opacity="0.5">
</Rectangle>
<Rectangle
width="720"
height="420"
translation="[280,150]"
color="#242424">
<Label
width="720"
horizAlign="center"
translation="[0,38]"
text="Select a service to login">
<Font role="font" uri="font:SystemFontFile" size="24" />
</Label>
<RowList
id="BackendRowList"
translation="[120,100]"
numRows="2"
rowitemSize="[[240,240]]"
rowItemSpacing="[[0,0]]"
itemSize="[500,500]"
itemComponentName="BackendTypeRowListCell"
rowFocusAnimationStyle="floatingfocus"
focusBitmapUri="pkg:/images/focus-glow-padding-19.9.png">
<ContentNode role="content">
<ContentNode>
<BackendTypeContentNode id="BackendTypeYouTube" title="YouTube" backendLogoUri="pkg:/images/youtube-logo.png" />
<BackendTypeContentNode id="BackendTypeInvidious" title="Invidious" backendLogoUri="pkg:/images/invidious-logo.png" />
</ContentNode>
</ContentNode>
</RowList>
</Rectangle>
</children>
</component>
@@ -0,0 +1,11 @@
namespace BackendTypeSelectionViewUtils
function Open(appController as object) as object
backendTypeSelectionView = CreateObject("roSGNode", "BackendTypeSelectionView")
appController@.PushScreen(backendTypeSelectionView)
backendTypeSelectionView@.BindNode()
return backendTypeSelectionView
end function
end namespace
@@ -1,2 +0,0 @@
<component name="ProfileRowList" extends="RowList">
</component>
@@ -14,6 +14,7 @@ function OnContentSet() as void
if content.type = "login"
m.top.circlePosterInnerUri = "pkg:/images/icons/user-200.png"
m.top.backendTypePosterUri = ""
' bs:disable-next-line LINT3023
m.top.circlePosterInnerBlendColor = "#FFFFFFFF"
m.top.letter = ""
@@ -23,17 +24,43 @@ function OnContentSet() as void
return
end if
m.top.circlePosterInnerUri = "pkg:/images/white-circle.png"
m.top.circlePosterInnerBlendColor = content.color
username = content.username
m.top.username = username
if not StringUtils.IsNullOrEmpty(username)
m.top.letter = UCase(username.Left(1))
else
thumbnail = content.thumbnail
if not StringUtils.IsNullOrEmpty(thumbnail)
m.top.circlePosterInnerUri = thumbnail
' bs:disable-next-line LINT3023
m.top.circlePosterInnerBlendColor = "#FFFFFFFF"
m.top.letter = ""
else
m.top.circlePosterInnerUri = "pkg:/images/white-circle.png"
m.top.circlePosterInnerBlendColor = content.color
if not StringUtils.IsNullOrEmpty(username)
letter = username.Left(1)
if letter = "@" and Len(username) > 1
letter = username.Mid(1, 1)
end if
m.top.letter = UCase(letter)
else
m.top.letter = ""
end if
end if
m.top.serverUrl = content.serverUrl
m.top.crownVisible = content.isSelected
backendType = content.type
if backendType = "invidious"
m.top.serverUrl = content.serverUrl
m.top.backendTypePosterUri = "pkg:/images/invidious-logo.png"
else if backendType = "youtube"
m.top.serverUrl = "YouTube"
m.top.backendTypePosterUri = "pkg:/images/youtube-logo.png"
else
m.top.serverUrl = ""
m.top.backendTypePosterUri = ""
end if
end function
function OnRowListHasFocus()
@@ -6,6 +6,7 @@
<field id="serverUrl" type="string" alias="ServerLabel.text" />
<field id="circlePosterInnerUri" type="uri" alias="circlePosterInner.uri" />
<field id="circlePosterInnerBlendColor" type="uri" alias="circlePosterInner.blendColor" />
<field id="backendTypePosterUri" type="uri" alias="backendTypePoster.uri" />
<field id="UsernameLabelFont" type="boolean" alias="UsernameLabel.font" />
<field id="rowListHasFocus" type="boolean" onChange="OnRowListHasFocus" />
<field id="itemHasFocus" type="boolean" onChange="OnItemHasFocus" />
@@ -45,7 +46,7 @@
translation="[20,20]"
blendColor="#DDDDDDFF"
uri="pkg:/images/white-circle.png">
<Poster
<CirclePoster
id="circlePosterInner"
width="152"
height="152"
@@ -60,7 +61,13 @@
horizAlign="center">
<Font role="font" uri="font:SystemFontFile" size="120" />
</Label>
</Poster>
<Poster
id="backendTypePoster"
width="60"
height="60"
translation="[110,110]"
/>
</CirclePoster>
<Poster
id="CrownPoster"
width="60"
@@ -1,7 +1,9 @@
import "pkg:/components/Dialog/DialogUtils.bs"
import "pkg:/components/Navigation/Navigation.bs"
import "pkg:/components/ProfileView/ProfileViewUtils.bs"
import "pkg:/components/Screens/ProfileScreen/BackendTypeSelectionView/BackendTypeSelectionViewUtils.bs"
import "pkg:/components/Screens/ProfileScreen/ProfileView/ProfileViewUtils.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/RemoteKeys.bs"
import "pkg:/source/utils/Types.bs"
@@ -38,26 +40,79 @@ function OnRowItemSelected() as void
row = m.profileRowList.content.GetChild(0)
selectedProfile = row.GetChild(index)
if selectedProfile.type = "login"
invidiousInstance = m.preferences["invidious.instance"]
if StringUtils.IsNullOrEmpty(invidiousInstance)
DialogUtils.ShowDialogEx({
title: "No Invidious Instance"
message: [
"Playlet built-in backend does not support login yet.",
"Can only login if an Invidious instance is set in the settings."
]
})
#if YT_OAUTH_SUPPORT
backendTypeSelectionView = BackendTypeSelectionViewUtils.Open(m.appController)
backendTypeSelectionView.observeFieldScoped("selectedBackendType", FuncName(OnBackEndSelected))
return
end if
dialog = CreateObject("roSGNode", "LoginDialog")
dialog@.BindNode()
m.top.getScene().dialog = dialog
return
#else
LoginWithInvidious()
return
#end if
end if
ProfileViewUtils.Open(selectedProfile, m.appController)
end function
function OnBackEndSelected(event as object) as void
backendTypeSelectionView = event.GetRoSGNode()
backendTypeSelectionView.unobserveFieldScoped("selectedBackendType")
selectedBackendType = event.getData()
if selectedBackendType = "BackendTypeInvidious"
LoginWithInvidious()
else if selectedBackendType = "BackendTypeYouTube"
ShowLoginWithYouTubeDialog()
else
LogError("Unknown backend type:", selectedBackendType)
end if
end function
function LoginWithInvidious() as void
invidiousInstance = m.preferences["invidious.instance"]
if StringUtils.IsNullOrEmpty(invidiousInstance)
DialogUtils.ShowDialogEx({
title: "No Invidious Instance"
message: [
"Playlet built-in backend does not support login yet.",
"Can only login if an Invidious instance is set in the settings."
]
})
return
end if
dialog = CreateObject("roSGNode", "InvidiousLoginDialog")
dialog@.BindNode()
m.top.getScene().dialog = dialog
end function
function ShowLoginWithYouTubeDialog() as void
' TODO:P2 localize
dialog = DialogUtils.ShowDialogEx({
title: "Disclaimer"
message: "Playlet authors acknowledge that all trademarks and registered trademarks mentioned in this application and related pages are the property of their respective owners. The use of these trademarks or trade names is for identification purposes only and does not imply any endorsement, affiliation, or sponsorship by the trademark owner."
buttons: [
Tr(Locale.Buttons.OK)
Tr(Locale.Buttons.Cancel)
]
})
dialog.ObserveField("buttonSelected", FuncName(OnLoginWithYouTubeDialogButtonSelected))
end function
function OnLoginWithYouTubeDialogButtonSelected(event as object) as void
buttonSelected = event.getData()
if buttonSelected <> 0
return
end if
LoginWithYouTube()
end function
function LoginWithYouTube() as void
dialog = CreateObject("roSGNode", "YouTubeLoginDialog")
dialog@.BindNode()
m.top.getScene().dialog = dialog
end function
function OnCurrentProfileChanged() as void
currentProfile = m.profilesService.currentProfile
if currentProfile = invalid
@@ -7,7 +7,7 @@
</interface>
<children>
<ProfileRowList
<RowList
id="ProfileRowList"
translation="[0,160]"
numRows="2"
@@ -32,17 +32,44 @@ function OnContentSet() as void
return
end if
m.top.circlePosterInnerUri = "pkg:/images/white-circle.png"
m.top.circlePosterInnerBlendColor = content.color
username = content.username
m.top.username = username
if not StringUtils.IsNullOrEmpty(username)
m.top.letter = UCase(username.Left(1))
else
thumbnail = content.thumbnail
if not StringUtils.IsNullOrEmpty(thumbnail)
m.top.circlePosterInnerUri = thumbnail
' bs:disable-next-line LINT3023
m.top.circlePosterInnerBlendColor = "#FFFFFFFF"
m.top.letter = ""
else
m.top.circlePosterInnerUri = "pkg:/images/white-circle.png"
m.top.circlePosterInnerBlendColor = content.color
if not StringUtils.IsNullOrEmpty(username)
letter = username.Left(1)
if letter = "@" and Len(username) > 1
letter = username.Mid(1, 1)
end if
m.top.letter = UCase(letter)
else
m.top.letter = ""
end if
end if
m.top.serverUrl = content.serverUrl
m.top.crownVisible = content.isSelected
backendType = content.type
if backendType = "invidious"
m.top.serverUrl = content.serverUrl
m.top.backendTypePosterUri = "pkg:/images/invidious-logo.png"
else if backendType = "youtube"
m.top.serverUrl = "YouTube"
m.top.backendTypePosterUri = "pkg:/images/youtube-logo.png"
else
m.top.serverUrl = ""
m.top.backendTypePosterUri = ""
end if
UpdateActivateButton()
end function
@@ -5,6 +5,7 @@
<field id="username" type="string" alias="UsernameLabel.text" />
<field id="serverUrl" type="string" alias="ServerLabel.text" />
<field id="circlePosterInnerUri" type="uri" alias="circlePosterInner.uri" />
<field id="backendTypePosterUri" type="uri" alias="backendTypePoster.uri" />
<field id="circlePosterInnerBlendColor" type="uri" alias="circlePosterInner.blendColor" />
<field id="crownVisible" type="boolean" alias="CrownPoster.visible" />
@@ -32,7 +33,7 @@
translation="[20,20]"
blendColor="#DDDDDDFF"
uri="pkg:/images/white-circle.png">
<Poster
<CirclePoster
id="circlePosterInner"
width="152"
height="152"
@@ -47,7 +48,13 @@
horizAlign="center">
<Font role="font" uri="font:SystemFontFile" size="120" />
</Label>
</Poster>
<Poster
id="backendTypePoster"
width="60"
height="60"
translation="[110,110]"
/>
</CirclePoster>
<Poster
id="CrownPoster"
width="60"
@@ -1,6 +1,7 @@
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/source/utils/FocusManagement.bs"
import "pkg:/source/utils/Locale.bs"
import "pkg:/source/utils/StringUtils.bs"
import "pkg:/source/utils/Types.bs"
@@ -9,7 +10,7 @@ function Init()
m.top.itemSpacings = [8]
m.button = m.top.findNode("button")
m.button.text = Invidious.DEFAULT_INSTANCE_NAME
m.button.text = Tr(Locale.Settings.PlayletBuiltinBackend)
AdjustButtonLabel(m.button)
m.button.observeField("buttonSelected", FuncName(OpenInvidiousInstanceSettings))
@@ -81,7 +82,7 @@ function OnValueChange() as void
m.preferences[m.key] = value
if StringUtils.IsNullOrEmpty(value)
m.button.text = Invidious.DEFAULT_INSTANCE_NAME
m.button.text = Tr(Locale.Settings.PlayletBuiltinBackend)
else
m.button.text = value
end if
@@ -1,20 +1,21 @@
const INNERTUBE_IOS_CLIENT_NAME = "5"
const INNERTUBE_IOS_CLIENT_VERSION = "19.49.7"
const INNERTUBE_IOS_OS_VERSION = "15.6"
const INNERTUBE_IOS_USER_AGENT = "com.google.ios.youtube/19.49.7 (iPhone14,3; U; CPU iOS 15_6 like Mac OS X)"
const INNERTUBE_IOS_DEVICE_MODEL = "iPhone16,2"
const INNERTUBE_IOS_OS_VERSION = "18.1"
const INNERTUBE_IOS_USER_AGENT = "com.google.ios.youtube/19.49.7 (iPhone16,2; U; CPU iOS 18_1_0 like Mac OS X)"
const INNERTUBE_WEB_CLIENT_NAME = "1"
const INNERTUBE_WEB_CLIENT_VERSION = "2.20241230.09.00"
const INNERTUBE_WEB_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0"
const INNERTUBE_WEB_BROWSER_NAME = "Chrome"
const INNERTUBE_WEB_BROWSER_VERSION = "131.0.0.0"
const INNERTUBE_WEB_BROWSER_VERSION = "134.0.0.0"
const INNERTUBE_WEB_CLIENT_NAME = "1"
const INNERTUBE_WEB_CLIENT_VERSION = "2.20250317.01.00"
const INNERTUBE_WEB_USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0"
const INNERTUBE_TV_BROWSER_NAME = "LG Browser"
const INNERTUBE_TV_BROWSER_VERSION = "7.00.00"
const INNERTUBE_TV_CLIENT_NAME = "2"
const INNERTUBE_TV_CLIENT_VERSION = "7.20241211.14.01"
const INNERTUBE_TV_USER_AGENT = "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/538.2 (KHTML, like Gecko) Large Screen Safari/538.2 LG Browser/7.00.00(LGE; 24LF4820-BU; 03.20.14; 1; DTV_W15L); webOS.TV-2015; LG NetCast.TV-2013 Compatible (LGE, 24LF4820-BU, wireless)"
const INNERTUBE_TV_DEVICE_MAKE = "LGE"
const INNERTUBE_TV_DEVICE_MODEL = "24LF4820-BU"
const INNERTUBE_TV_OS_NAME = "webOS"
const INNERTUBE_TV_OS_VERSION = "2015"
const INNERTUBE_TV_BROWSER_NAME = "LG Browser"
const INNERTUBE_TV_BROWSER_VERSION = "7.00.00"
const INNERTUBE_TV_USER_AGENT = "Mozilla/5.0 (Web0S; Linux/SmartTV) AppleWebKit/538.2 (KHTML, like Gecko) Large Screen Safari/538.2 LG Browser/7.00.00(LGE; 24LF4820-BU; 03.20.14; 1; DTV_W15L); webOS.TV-2015; LG NetCast.TV-2013 Compatible (LGE, 24LF4820-BU, wireless)"
@@ -123,7 +123,7 @@ namespace Innertube
"timeZone": deviceInfo.GetTimeZone()
"originalUrl": "https://www.youtube.com"
"deviceMake": "Apple"
"deviceModel": "iPhone10,6"
"deviceModel": INNERTUBE_IOS_DEVICE_MODEL
"utcOffsetMinutes": -240
"memoryTotalKbytes": "8000000"
}
@@ -209,10 +209,13 @@ namespace InnertubeService
trendingType = LCase(ValidString(options.type))
if trendingType = "music"
' {"44:proto": {"3:string": "ytma_charts"}}
params = "4gINGgt5dG1hX2NoYXJ0cw%3D%3D"
else if trendingType = "gaming"
' {"44:proto": {"3:string": "gaming_corpus_most_popular"}}
params = "4gIcGhpnYW1pbmdfY29ycHVzX21vc3RfcG9wdWxhcg%3D%3D"
else if trendingType = "movies"
' {"44:proto": {"3:string": "trailers"}}
params = "4gIKGgh0cmFpbGVycw%3D%3D"
end if
end if
@@ -452,14 +455,14 @@ namespace InnertubeService
function AuthGetCode(cancellation = invalid as object) as object
result = Innertube.GetClientIdentity(cancellation)
if CancellationUtils.IsCancelled(cancellation)
return invalid
if CancellationUtils.IsCancelled(cancellation) or result.error <> invalid
return result
end if
result2 = Innertube.GetDeviceAndUserCode(result.clientId, cancellation)
if CancellationUtils.IsCancelled(cancellation)
return invalid
if CancellationUtils.IsCancelled(cancellation) or result2.error <> invalid
return result2
end if
result.Append(result2)
@@ -505,4 +508,7 @@ namespace InnertubeService
return Innertube.RevokeAccessToken(accessToken["accessToken"], cancellation)
end function
function AuthListAccounts(accessToken as string, cancellation = invalid as object) as object
return Innertube.ListAccounts(accessToken, cancellation)
end function
end namespace
@@ -1,3 +1,7 @@
' Throw an error if an unknown node is encountered.
' Only used in debug mode.
#const THROW_ON_UNKNOWN_NODES = true
import "pkg:/source/utils/Logging.bs"
import "pkg:/source/utils/ObjectUtils.bs"
import "pkg:/source/utils/StringUtils.bs"
@@ -22,6 +26,11 @@ namespace Innertube
directive = directives[key]
if directive = invalid
LogWarn("Unknown node", key)
#if THROW_ON_UNKNOWN_NODES
#if DEBUG
throw "Unknown node: " + key
#end if
#end if
continue for
end if
@@ -80,6 +89,10 @@ namespace Innertube
"horizontalCardListRenderer": ParseNotImplemented
' expandableTabRenderer contains the search tab with a channel. Ignored.
"expandableTabRenderer": ParseNotImplemented
' Shows a view of an official channel (like an artist) with tracks or albums.
' Shows up in search results. Safe to ignore since the channel itself will also
' be shown in the search results, so this is kind of a duplicate.
"officialCardViewModel": ParseNotImplemented
' Usually contains a "X unavailable video(s) are hidden" message. Ignored.
"messageRenderer": ParseNotImplemented
"clickTrackingParams": ParseNotImplemented
@@ -140,7 +153,7 @@ namespace Innertube
return nodeData["content"]
end function
function ParseRichShelfRenderer(nodeData as object, context as object) as object
function ParseRichShelfRenderer(nodeData as object, _context as object) as object
' TODO: handle richShelfRenderer.title
return nodeData["contents"]
end function
@@ -672,6 +685,11 @@ namespace Innertube
end if
LogWarn("Unknown content type:", contentType, `\n`, nodeData)
#if THROW_ON_UNKNOWN_NODES
#if DEBUG
throw "Unknown content type: " + contentType
#end if
#end if
return invalid
end function
@@ -857,6 +875,11 @@ namespace Innertube
end if
LogWarn("Unknown content type:", contentType, `\n`, nodeData)
#if THROW_ON_UNKNOWN_NODES
#if DEBUG
throw "Unknown content type: " + contentType
#end if
#end if
return invalid
end function
@@ -978,7 +1001,7 @@ namespace Innertube
return nodeData["items"]
end function
function ParseTvSurfaceContentContinuation(nodeData as object, context as object) as object
function ParseTvSurfaceContentContinuation(nodeData as object, _context as object) as object
' title = ParseText(ObjectUtils.Dig(nodeData, ["header", "tvSurfaceHeaderRenderer", "title"]))
return nodeData["content"]
end function
@@ -1,4 +1,5 @@
import "pkg:/source/services/HttpClient.bs"
import "pkg:/source/utils/ObjectUtils.bs"
import "pkg:/source/utils/TimeUtils.bs"
namespace Innertube
@@ -14,7 +15,9 @@ namespace Innertube
response = request.Await()
if not response.IsSuccess()
throw `Failed to get client id: ${response.ErrorMessage()}`
return {
"error": `Failed to get client id: ${response.ErrorMessage()}`
}
end if
text = response.Text()
@@ -23,7 +26,9 @@ namespace Innertube
match = scriptRegex.Match(text)
if match.Count() < 2
throw "Could not find base-js script"
return {
"error": "Could not find base-js script"
}
end if
baseJsUrl = "https://www.youtube.com" + match[1]
@@ -33,7 +38,9 @@ namespace Innertube
response = request.Await()
if not response.IsSuccess()
throw `Failed to get base js: ${response.ErrorMessage()}`
return {
"error": `Failed to get base js: ${response.ErrorMessage()}`
}
end if
text = response.Text()
@@ -42,7 +49,9 @@ namespace Innertube
match = clientIdRegex.Match(text)
if match.Count() < 3
throw "Could not find client id"
return {
"error": "Could not find client id and secret"
}
end if
return {
@@ -66,13 +75,17 @@ namespace Innertube
response = request.Await()
if not response.IsSuccess()
throw `Failed to get device code: ${response.ErrorMessage()}`
return {
"error": `Failed to get device code: ${response.ErrorMessage()}`
}
end if
responseData = ToCamelCase(response.Json())
if responseData.DoesExist("errorCode")
throw "Failed to get device code: " + ToString(responseData)
return {
"error": "Failed to get device code: " + ToString(responseData)
}
end if
if responseData.DoesExist("expiresIn")
@@ -130,11 +143,13 @@ namespace Innertube
end if
continue while
else if responseData.error = "expired_token"
throw "Failed to get access token: " + ToString(responseData)
return responseData
else if responseData.error = "access_denied"
throw "Failed to get access token: " + ToString(responseData)
return responseData
else
throw "Failed to get access token: " + ToString(responseData)
return {
"error": "Failed to get access token: " + ToString(responseData)
}
end if
end while
@@ -171,12 +186,70 @@ namespace Innertube
request.Cancellation(cancellation)
response = request.Await()
success = response.IsSuccess()
if success
if not success
LogError(`Failed to revoke token: ${response.ErrorMessage()}`)
end if
return success
end function
function ListAccounts(accessToken as string, cancellation = invalid as dynamic) as object
deviceInfo = CreateObject("roDeviceInfo")
payload = {
"context": Innertube.CreateContext(Innertube.ClientType.Tv, deviceInfo, "", "")
"accountReadMask": {
"returnOwner": true
"returnBrandAccounts": true
"returnPersonaAccounts": true
"returnFamilyChildAccounts": true
}
}
request = HttpClient.PostJson("https://www.youtube.com/youtubei/v1/account/accounts_list", payload)
headers = {
"Authorization": `Bearer ${accessToken}`
}
headers.Append(Innertube.CreateHeaders(Innertube.ClientType.Tv))
request.Headers(headers)
request.Cancellation(cancellation)
response = request.Await()
if not response.IsSuccess()
return {
"error": `Failed to list accounts: ${response.ErrorMessage()}`
}
end if
accounts = ObjectUtils.Dig(response.Json(), ["contents", 0, "accountSectionListRenderer", "contents", 0, "accountItemSectionRenderer", "contents"])
if not IsArray(accounts)
return {
"error": "Could not parse accounts"
}
end if
parsedAccounts = []
for each account in accounts
accountItem = account["accountItem"]
if not IsAssociativeArray(accountItem)
continue for
end if
parsedAccount = {
"accountName": ParseText(accountItem["accountName"])
"accountPhoto": ObjectUtils.Dig(accountItem, ["accountPhoto", "thumbnails", 0, "url"])
"isSelected": ValidBool(accountItem["isSelected"])
"isDisabled": ValidBool(accountItem["isDisabled"])
"hasChannel": ValidBool(accountItem["hasChannel"])
"accountByline": ParseText(accountItem["accountByline"])
"channelHandle": ParseText(accountItem["channelHandle"])
}
parsedAccounts.Push(parsedAccount)
end for
return parsedAccounts
end function
function ToCamelCase(obj as object) as object
if not IsAssociativeArray(obj)
return obj
@@ -14,7 +14,6 @@ namespace Invidious
const INSTANCES_API = "https://api.invidious.io/instances.json?sort_by=type,users"
const DEFAULT_INSTANCE = "http://127.0.0.1:8888/playlet-invidious-backend"
const DEFAULT_INSTANCE_NAME = "Playlet built-in backend"
const INSTANCE_EXAMPLE = "https://invidious.example.com"
const TOKEN_CALLBACK = "/invidious/token_callback"
@@ -50,6 +50,7 @@ function LoadProfilesFromRegistry()
profileNode.type = profile.type
profileNode.username = profile.username
profileNode.serverUrl = profile.serverUrl
profileNode.thumbnail = profile.thumbnail
profileNode.accessToken = profile.accessToken
profileNode.refreshToken = profile.refreshToken
@@ -161,6 +162,7 @@ function GetProfilesDto(includeAccessToken as boolean) as object
"type": profileNode.type
"username": profileNode.username
"serverUrl": profileNode.serverUrl
"thumbnail": profileNode.thumbnail
"color": color
}
@@ -203,8 +205,17 @@ function LoginWithProfile(newProfile as object)
end for
if not isNewProfile
' Refresh token of existing profile
existingProfile.username = newProfile.username
existingProfile.thumbnail = newProfile.thumbnail
existingProfile.accessToken = newProfile.accessToken
existingProfile.refreshToken = newProfile.refreshToken
existingProfile.scope = newProfile.scope
existingProfile.tokenType = newProfile.tokenType
existingProfile.expiresIn = newProfile.expiresIn
existingProfile.expiresTimestamp = newProfile.expiresTimestamp
existingProfile.clientId = newProfile.clientId
existingProfile.clientSecret = newProfile.clientSecret
newProfile = existingProfile
end if
@@ -54,7 +54,13 @@ namespace SearchHistoryUtils
if history = invalid
return []
end if
return ParseJson(history)
history = ParseJson(history)
if not IsArray(history)
return []
end if
return history
end function
function Clear()
@@ -92,6 +92,8 @@ function CreateStreamUrls(metadata as object, service as Invidious.InvidiousServ
metadata.hlsUrl = AddInstanceToUrlIfNeeded(metadata.hlsUrl, instance)
AddHlsUrls(streamUrls, metadata, preferredQuality, backend, proxyVideos, playletServerPort)
else
' Not that we're using dashUrl, but why not, it useful when testing it
metadata.dashUrl = AddInstanceToUrlIfNeeded(metadata.dashUrl, instance)
AddDashUrls(streamUrls, metadata, preferredQuality, backend, proxyVideos, playletServerPort)
end if
@@ -22,6 +22,33 @@ namespace Http
return true
end function
@post("/playlet-invidious-backend/api/v1/auth/tokens/unregister")
function UnregisterToken(context as object) as boolean
request = context.request
response = context.response
accessToken = request.body
if StringUtils.IsNullOrEmpty(accessToken)
response.Json({
"error": "Missing 'accessToken' body parameter"
})
response.http_code = 400
return true
end if
if not InnertubeService.AuthRevokeAccessToken({ "accessToken": accessToken })
response.Json({
"error": "Failed to unregister token"
})
response.http_code = 500
return true
end if
response.Default(204, "OK")
return true
end function
@get("/playlet-invidious-backend/api/v1/auth/feed")
function GetAuthFeed(context as object) as boolean
request = context.request
@@ -166,8 +166,6 @@ channel_releases:
paginationType: Continuation
tryCount: 3
# This is implemented only by Playlet backend.
# https://github.com/iv-org/invidious/issues/5144
channel_courses:
title: Channel courses
url: /api/v1/channels/{ucid}/courses
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.6 KiB

+10
View File
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg width="512pt" height="512pt" version="1.0" viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg">
<g transform="matrix(1.256 0 0 1.256 -65.668 -67.101)">
<path d="m247.17 455.95c-19.792-0.78921-38.719-4.2564-57.154-10.47-60.968-20.55-108.68-68.579-127-127.86-7.8955-25.538-10.062-53.943-6.2586-82.067 3.7105-27.439 13.603-53.515 29.342-77.344 12.069-18.273 29.138-36.277 47.228-49.816 36.891-27.61 85.944-42.49 132.38-40.157 25.88 1.3001 49.939 6.765 73.106 16.606 8.1948 3.481 20.024 9.6845 27.696 14.525 14.15 8.9272 22.367 15.498 34.482 27.573 13.254 13.211 22.128 24.276 30.398 37.906 7.2081 11.879 14.099 27.15 18.229 40.397 1.5996 5.1305 4.442 16.456 5.6852 22.653 2.3908 11.917 2.6998 15.722 2.7049 33.312 6e-3 18.515-0.46256 24.413-2.9166 36.758-9.3274 46.92-35.58 88.167-74.872 117.64-22.814 17.112-50.027 29.535-78.547 35.858-16.714 3.7059-35.421 5.2453-54.498 4.4846zm-35.1-78.786c-5.3e-4 -0.52647-0.0741-2.0564-0.16311-3.3999l-0.16178-2.4427-4.7018-0.26271c-4.0477-0.22614-4.7968-0.33363-5.3847-0.77253-2.0235-1.5108-1.4679-6.0695 2.2494-18.457 0.8637-2.8781 3.3371-11.321 5.4966-18.762 2.1594-7.4409 5.2002-17.836 6.7573-23.101 1.5571-5.2648 4.1948-14.282 5.8615-20.038 1.6667-5.7562 3.6145-12.4 4.3284-14.764 0.71391-2.3641 3.2583-11.037 5.6542-19.272 4.9475-17.007 8.1626-27.723 8.9438-29.811 0.51852-1.3858 0.54785-1.4139 0.99761-0.95317 0.25486 0.26106 3.8462 7.3667 7.9807 15.79 4.1345 8.4236 13.089 26.573 19.898 40.331 17.188 34.73 37.849 76.578 43.261 87.622l4.5356 9.257 11.359-0.0895c6.2475-0.0492 11.615-0.19623 11.929-0.32672 0.5614-0.23385 0.54167-0.2959-1.3723-4.3176-1.068-2.2442-8.1436-16.601-15.724-31.904-48.687-98.293-61.22-123.86-67.889-138.48-4.7022-10.309-6.9031-14.807-7.7139-15.762-0.82931-0.97742-1.6319-1.0638-2.3704-0.25525-1.1993 1.313-4.1046 10.063-9.3869 28.27-2.0569 7.0899-6.5372 22.425-9.9562 34.077-6.6396 22.629-8.5182 29.037-14.33 48.883-2.0354 6.9495-4.7977 16.369-6.1385 20.931-1.3408 4.5628-4.033 13.81-5.9826 20.549-4.304 14.877-6.136 20.889-7.3886 24.25-2.1371 5.7334-2.5723 6.3292-4.9216 6.7384-0.88855 0.15472-2.4102 0.28196-3.3815 0.28275-2.1993 3e-3 -3.5494 0.36339-4.0558 1.0863-0.42176 0.60215-0.56421 4.8802-0.18251 5.4812 0.20573 0.32388 2.4672 0.37414 23.34 0.51873l8.6151 0.0597-7e-4 -0.95723zm36.751-205.59c4.3282-0.92335 8.4607-4.943 9.4374-9.1796 0.36569-1.5862 0.32543-4.9758-0.077-6.4799-0.85108-3.1813-3.2688-6.291-6.039-7.7675-3.8111-2.0313-9.456-2.0295-13.272 5e-3 -5.9828 3.1888-8.1556 11.089-4.7878 17.408 2.6995 5.0648 8.3611 7.3754 14.738 6.015z" fill="#f0f0f0" stroke-width=".025526"/>
</g>
<g transform="matrix(.087787 0 0 -.087787 -10.105 528.87)">
<path d="m2787 4669c-124-65-123-255 3-319 86-44 196-16 247 62 58 87 26 211-67 258-51 26-132 26-183-1z" fill="#00b6f0" stroke="#00b6f0" stroke-width="4.25"/>
<path d="m2882 4108c-12-16-63-166-102-303-30-104-101-350-165-565-20-69-58-199-85-290-26-91-64-221-85-290-20-69-58-199-85-290-26-91-64-221-85-290-20-69-57-195-81-280-59-207-93-299-115-310-10-6-35-10-56-10-73 0-84-8-81-54l3-41 228-3 228-2-3 47-3 48-73 3c-66 3-74 5-84 27-13 28 0 104 37 225 13 41 47 156 75 255s66 230 85 290c18 61 56 191 85 290 28 99 66 230 85 290 18 61 56 191 85 290 85 297 123 419 131 429 5 5 17-11 28-35 10-24 192-393 403-819s447-902 523-1058l139-282h168c92 0 168 4 168 8s-75 158-166 342c-588 1183-969 1958-1033 2100-29 63-69 151-89 195-44 95-58 110-80 83z" fill="#575757"/>
</g>
</svg>

After

Width:  |  Height:  |  Size: 3.4 KiB

@@ -0,0 +1,11 @@
{
inputHash: 'f38944bd940b191cb7e9b1fed6e14aeb',
outputs: [
{
outputFilePath: 'images/invidious-logo.png',
outputHash: '0b593b648652e09fcf97fac09bbbf9f2',
width: 256,
height: 256,
},
],
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 6.7 KiB

+5
View File
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg xmlns="http://www.w3.org/2000/svg" viewbox="0 0 300 300">
<rect width="300" height="300" fill="red" ry="150" />
<path fill="#fff" d="M149.93750587 79.22267364s-63.21885.000059-79.08593926 4.12304707c-8.49578714 2.37380204-15.49140825 9.36950015-17.86523429 17.99023729-4.12295306 15.86710025-4.12304706 48.72656078-4.12304706 48.72656078s.000094 32.98420052 4.12304706 48.60156077c2.37382604 8.62062014 9.24450615 15.49138025 17.86523429 17.86524029 15.99203025 4.24788007 79.08593926 4.24804007 79.08593926 4.24804007s63.34418101-.00005 79.21094127-4.12304007c8.62079014-2.37381004 15.49133025-9.11966015 17.74023028-17.86524029 4.24793007-15.74232025 4.24805007-48.60156077 4.24805007-48.60156077s.12484-32.98446053-4.24805007-48.85156078c-2.24890003-8.62073714-9.11944014-15.49133425-17.74023028-17.74023729-15.86676026-4.37284707-79.21094127-4.37304707-79.21094127-4.37304707zm-20.11523032 40.48046465 52.59961084 30.35938049-52.59961084 30.23438048v-60.59376097z" />
</svg>

After

Width:  |  Height:  |  Size: 1.0 KiB

@@ -0,0 +1,11 @@
{
inputHash: 'b9448ffdbf4982eed1f4e85867a846d1',
outputs: [
{
outputFilePath: 'images/youtube-logo.png',
outputHash: '853532c887464153c4e0f924932d85fe',
width: 256,
height: 256,
},
],
}
+13 -1
View File
@@ -1266,7 +1266,19 @@
</message>
<message>
<source>Buffering</source>
<translation type="unfinished">Puffert</translation>
<translation>Pufferung</translation>
</message>
<message>
<source>Do not show again</source>
<translation>Nicht wieder anzeigen</translation>
</message>
<message>
<source>Courses</source>
<translation>Kurse</translation>
</message>
<message>
<source>Playlet built-in backend</source>
<translation>Playlet eingebautes Backend</translation>
</message>
</context>
</TS>
@@ -124,6 +124,10 @@
<source>Podcasts</source>
<translation>Podcasts</translation>
</message>
<message>
<source>Courses</source>
<translation>Courses</translation>
</message>
<message>
<source>Edit</source>
<translation>Edit</translation>
@@ -752,6 +756,10 @@
<source>Instance</source>
<translation>Instance</translation>
</message>
<message>
<source>Playlet built-in backend</source>
<translation>Playlet built-in backend</translation>
</message>
<message>
<source>Invidious instance to use. Example: https://example.com</source>
<translation>Invidious instance to use. Example: https://example.com</translation>
+73 -1
View File
@@ -266,7 +266,7 @@
</message>
<message>
<source>Show notifications when a segment is skipped</source>
<translation>Monstrar notificaciones cuando un segmento es saltado</translation>
<translation>Mostrar notificaciones cuando un segmento es saltado</translation>
</message>
<message>
<source>This year</source>
@@ -1208,5 +1208,77 @@
<source>The instance can fetch with CORS from %1</source>
<translation>La instancia puede obtener con CORS desde %1</translation>
</message>
<message>
<source>Courses</source>
<translation>Cursos</translation>
</message>
<message>
<source>Playlet built-in backend</source>
<translation>Backend de Playlet</translation>
</message>
<message>
<source>Filler</source>
<translation>Relleno</translation>
</message>
<message>
<source>Preview/Recap</source>
<translation>Avance/Resumen</translation>
</message>
<message>
<source>Preview/Recap/Hook</source>
<translation>Avance/Resumen/Gancho</translation>
</message>
<message>
<source>Sponsor</source>
<translation>Mensaje patrocinado</translation>
</message>
<message>
<source>Intermission</source>
<translation>Pausa</translation>
</message>
<message>
<source>Endcards/Credits</source>
<translation>Tarjeta final/Créditos</translation>
</message>
<message>
<source>Filler Tangent/Jokes</source>
<translation>Digresión/Chistes</translation>
</message>
<message>
<source>Intermission/Intro Animation</source>
<translation>Animación de Intermedio/Intro</translation>
</message>
<message>
<source>Non-Music</source>
<translation>Sin música</translation>
</message>
<message>
<source>Interaction Reminder (Subscribe)</source>
<translation>Recordatorio de interacción (Suscribete)</translation>
</message>
<message>
<source>Unpaid/Self Promotion</source>
<translation>Promoción propia/No pagada</translation>
</message>
<message>
<source>Music: Non-Music Section</source>
<translation>Música: Parte no musical</translation>
</message>
<message>
<source>Buffering</source>
<translation>Cargando</translation>
</message>
<message>
<source>Interaction Reminder</source>
<translation>Recordatorio de interacción</translation>
</message>
<message>
<source>Highlight</source>
<translation>Momento destacado</translation>
</message>
<message>
<source>Do not show again</source>
<translation>No mostrar de nuevo</translation>
</message>
</context>
</TS>
@@ -1268,5 +1268,17 @@
<source>Add to %1 bookmark</source>
<translation>Adicionar %1 ao marcadores</translation>
</message>
<message>
<source>Courses</source>
<translation>Cursos</translation>
</message>
<message>
<source>Playlet built-in backend</source>
<translation>Back-end integrado do playlet</translation>
</message>
<message>
<source>Do not show again</source>
<translation>Não mostrar novamente</translation>
</message>
</context>
</TS>
+2 -2
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=36
build_version=00001
build_version=00004
ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p
@@ -13,4 +13,4 @@ hidden=1
git_commit_sha=unknown
bs_const=DEBUG=false
bs_const=DEBUG=false;YT_OAUTH_SUPPORT=false
@@ -5,7 +5,6 @@
' Only use this for debugging purposes.
#const NETWORK_THROTTLE = false
import "pkg:/source/utils/CancellationUtils.bs"
import "pkg:/source/utils/CancellationUtils.bs"
import "pkg:/source/utils/CryptoUtils.bs"
import "pkg:/source/utils/ErrorUtils.bs"
@@ -842,6 +841,11 @@ namespace HttpClientCache
return
end if
body = ValidString(response.Text())
if body = ""
return
end if
date = CreateObject("roDateTime")
timestamp = date.AsSeconds()
@@ -857,7 +861,6 @@ namespace HttpClientCache
' {body} ' the body as is, string size matching metadata.body
jsonHeaders = FormatJson(response.Headers())
body = ValidString(response.Text())
cacheMetadata = {
timestamp: timestamp
+2
View File
@@ -50,6 +50,7 @@ namespace Locale
Live = "Live"
Releases = "Releases"
Podcasts = "Podcasts"
Courses = "Courses"
end enum
@locale
@@ -248,6 +249,7 @@ namespace Locale
' Invidious = "Invidious"
InvidiousPreferences = "Invidious preferences"
Instance = "Instance"
PlayletBuiltinBackend = "Playlet built-in backend"
InstanceDescriptionTV = "Invidious instance to use. Example: https://example.com"
ProxyVideos = "Proxy videos"
ProxyVideosDescription = "Proxy videos through the Invidious server. This is useful if videos are geoblocked."
+1068 -256
View File
File diff suppressed because it is too large. Load diff
+10 -10
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-web",
"version": "0.36.1",
"version": "0.36.4",
"type": "module",
"scripts": {
"dev": "vite",
@@ -12,20 +12,20 @@
"@sveltejs/vite-plugin-svelte": "^5.0.3",
"@tailwindcss/typography": "^0.5.16",
"@tsconfig/svelte": "^5.0.4",
"@vitejs/plugin-legacy": "^6.0.0",
"autoprefixer": "^10.4.20",
"@vitejs/plugin-legacy": "^6.1.0",
"autoprefixer": "^10.4.21",
"daisyui": "^4.12.23",
"dotenv": "^16.4.7",
"dotenv": "^16.5.0",
"ip": "^2.0.1",
"postcss": "^8.5.1",
"svelte": "^5.19.0",
"svelte-check": "^4.1.4",
"postcss": "^8.5.3",
"svelte": "^5.28.1",
"svelte-check": "^4.1.6",
"svelte-preprocess": "^6.0.3",
"tailwindcss": "^3.4.17",
"terser": "^5.37.0",
"terser": "^5.39.0",
"tslib": "^2.8.1",
"typescript": "^5.7.3",
"vite": "^6.0.7",
"typescript": "^5.8.3",
"vite": "^6.3.2",
"vite-plugin-compression": "^0.5.1",
"vite-tsconfig-paths": "^5.1.4"
}
+12 -2
View File
@@ -2,6 +2,9 @@
import { playletStateStore, translate } from "lib/Stores";
import { PlayletApi } from "./Api/PlayletApi";
import { get } from "svelte/store";
import { getHost } from "./Api/Host";
const host = () => `http://${getHost()}`;
export function show() {
modal.showModal();
@@ -23,12 +26,19 @@
let authUrl;
let currentInstance;
let currentInstanceName;
let accordionState = null;
playletStateStore.subscribe((value) => {
authUrl = value?.invidious?.auth_url;
currentInstance = value?.invidious?.current_instance;
currentInstance = value?.invidious?.current_instance || "";
if (currentInstance === `${host()}/playlet-invidious-backend`) {
const trFn = get(translate);
currentInstanceName = trFn("Playlet built-in backend");
} else {
currentInstanceName = currentInstance;
}
profiles = value?.profiles?.profiles ?? [];
currentProfile = profiles.find(
(p) => p.id === value?.profiles?.currentProfile
@@ -126,7 +136,7 @@
<button class="btn btn-primary" on:click={login}>
<div class="">
<div class="text-m">{$translate("Login to Invidious")}</div>
<div class="text-xs font-light">{currentInstance}</div>
<div class="text-xs font-light">{currentInstanceName}</div>
</div>
</button>
<button class="btn m-6">{$translate("Close")}</button>
@@ -5,6 +5,7 @@
export let key: string;
export let icon;
export let small: boolean = false;
export let singlePressEvent: boolean = false;
let button;
@@ -37,11 +38,18 @@
let isDown = false;
function pressKeyDown() {
isDown = true;
ExternalControlProtocol.pressKeyDown(key);
if (singlePressEvent) {
ExternalControlProtocol.pressKey(key);
} else {
ExternalControlProtocol.pressKeyDown(key);
}
}
function pressKeyUp() {
isDown = false;
if (singlePressEvent) {
return;
}
ExternalControlProtocol.pressKeyUp(key);
}
@@ -153,9 +153,24 @@ And set it to "Enabled".`;
<RemoteButton key={BUTTONS.fwd} icon={FastForwardIcon} small />
</div>
<div class="flex space-x-2 m-1">
<RemoteButton key={BUTTONS.volumeMute} icon={VolumeMuteIcon} small />
<RemoteButton key={BUTTONS.volumeDown} icon={VolumeDownIcon} small />
<RemoteButton key={BUTTONS.volumeUp} icon={VolumeUpIcon} small />
<RemoteButton
key={BUTTONS.volumeMute}
icon={VolumeMuteIcon}
small
singlePressEvent
/>
<RemoteButton
key={BUTTONS.volumeDown}
icon={VolumeDownIcon}
small
singlePressEvent
/>
<RemoteButton
key={BUTTONS.volumeUp}
icon={VolumeUpIcon}
small
singlePressEvent
/>
</div>
<button
on:click={showRemoteNotWorkingDialog}
+1 -1
View File
@@ -1,4 +1,4 @@
import sveltePreprocess from 'svelte-preprocess'
import { sveltePreprocess } from 'svelte-preprocess'
export default {
// Consult https://github.com/sveltejs/svelte-preprocess
-124
View File
@@ -1,124 +0,0 @@
// This plugin converts svg files to png/jpeg files
import {
CompilerPlugin, FileObj, ProgramBuilder,
} from 'brighterscript';
import { readFileSync, writeFileSync } from 'fs';
import { existsSync } from 'fs-extra';
import { globSync } from 'glob';
import md5 from 'crypto-js/md5';
import { join as joinPath } from 'path';
import json5 from 'json5';
const shell = require('shelljs');
const META_EXT = '.meta.json5';
export class ImageGenPlugin implements CompilerPlugin {
public name = 'ImageGenPlugin';
beforePrepublish(builder: ProgramBuilder, files: FileObj[]) {
// Force generate flag
// @ts-ignore
const forceGenerateImages = !!builder.options.forceGenerateImages;
// Debug flag
// @ts-ignore
const debug = !!builder.options.debug;
if (debug && !forceGenerateImages) {
// Since the plugin does a lot of scanning of files, it is fine not to run it in debug mode
// The change will be picked up on release
return;
}
const rootDir = builder.options.rootDir!;
const svgFiles = globSync(`**/*.svg`, { cwd: rootDir });
svgFiles.forEach((svgFile) => {
// Web app can use svg files, no need to convert
if (svgFile.includes('www')) {
return;
}
const metafile = joinPath(rootDir, `${svgFile}${META_EXT}`);
if (!existsSync(metafile)) {
this.createDefaultMetaFile(svgFile, metafile);
}
const meta = json5.parse(readFileSync(metafile, 'utf8'));
this.generateImages(svgFile, meta, metafile, rootDir, files, forceGenerateImages);
});
}
createDefaultMetaFile(svgFile: string, metafile: string) {
const meta = {
inputHash: '',
outputs: [{
outputFilePath: svgFile.replace('.svg', '.png'),
outputHash: '',
width: 64,
height: 64,
}]
}
writeFileSync(metafile, json5.stringify(meta, null, 2));
}
generateImages(svgFile: string, meta: any, metafile: string, rootDir: string, files: FileObj[], forceGenerateImages: boolean) {
let metaChanged = false;
const inputHash = this.checkFileHash(joinPath(rootDir, svgFile), meta.inputHash);
if (!inputHash.valid) {
meta.inputHash = inputHash.hash;
metaChanged = true;
}
for (var i in meta.outputs) {
const output = meta.outputs[i];
const outputFilePath = joinPath(rootDir, output.outputFilePath);
let outputHash = this.checkFileHash(outputFilePath, output.outputHash);
if (inputHash.valid && outputHash.valid && !forceGenerateImages) {
continue;
}
this.generateImage(svgFile, output, rootDir);
outputHash = this.checkFileHash(outputFilePath, output.outputHash);
files.push({ src: outputFilePath, dest: output.outputFilePath })
output.outputHash = outputHash.hash;
metaChanged = true;
}
if (metaChanged) {
writeFileSync(metafile, json5.stringify(meta, null, 2));
}
}
generateImage(svgFile: string, output: any, rootDir: string) {
shell.exec(`node ../../tools/convert-image.js --input "${svgFile}" --options '${JSON.stringify(output)}'`, {
cwd: rootDir
})
}
checkFileHash(file: string, hash: string) {
if (!existsSync(file)) {
return {
valid: false,
hash: ''
}
}
const outputHash = md5(readFileSync(file, 'binary')).toString();
return {
valid: outputHash === hash,
hash: outputHash
}
}
}
export default () => {
return new ImageGenPlugin();
};
+10 -13
View File
@@ -162,21 +162,18 @@ export class LoggerPlugin implements CompilerPlugin {
const func = logFunctions[level as 'LogError' | 'LogWarn' | 'LogInfo' | 'LogDebug'];
// https://github.com/microsoft/vscode/issues/571
const USE_COLOR = false;
const RED = '[31m';
const YELLOW = '[33m';
const GREEN = '[32m';
const BOLD = '[1m';
const BOLD_RED = '[1;31m';
const BOLD_YELLOW = '[1;33m';
const BOLD_GREEN = '[1;32m';
const CLEAR = '[0m';
let logLine = '';
if (isDebug && USE_COLOR) {
if (isDebug) {
const RED = '[31m';
const YELLOW = '[33m';
const GREEN = '[32m';
const BOLD = '[1m';
const BOLD_RED = '[1;31m';
const BOLD_YELLOW = '[1;33m';
const BOLD_GREEN = '[1;32m';
const CLEAR = '[0m';
switch (func.stringLevel) {
case 'ERROR':
logLine = `Chr(27) + "${BOLD_RED}" + "[${func.stringLevel}]" + Chr(27) + "${RED}" + ${msg} + Chr(27) + "${CLEAR}"`;
+53
View File
@@ -0,0 +1,53 @@
// Check for updates on Roku device
const rokuTestAutomation = require('roku-test-automation');
const ecp = rokuTestAutomation.ecp;
const utils = rokuTestAutomation.utils;
const Key = rokuTestAutomation.ECP.Key;
const getEnvVars = require('./get-env-vars');
const config = getEnvVars(['ROKU_DEV_TARGET']);
(async () => {
utils.setupEnvironmentFromConfig({
RokuDevice: {
devices: [{
host: config.ROKU_DEV_TARGET,
password: ''
}]
}
});
// Go to the home screen
await ecp.sendKeypress(Key.Home);
await utils.sleep(2000);
await ecp.sendKeypress(Key.Home);
await utils.sleep(2000);
// Settings menu
await ecp.sendKeypress(Key.Up);
await utils.sleep(500);
await ecp.sendKeypress(Key.Right);
await utils.sleep(500);
// System
await ecp.sendKeypress(Key.Up);
await utils.sleep(500);
await ecp.sendKeypress(Key.Right);
await utils.sleep(500);
// Software update
await ecp.sendKeypress(Key.Up);
await utils.sleep(500);
await ecp.sendKeypress(Key.Up);
await utils.sleep(500);
await ecp.sendKeypress(Key.Up);
await utils.sleep(500);
await ecp.sendKeypress(Key.Right);
await utils.sleep(2000);
// Check for updates
await ecp.sendKeypress(Key.Ok);
await utils.sleep(500);
})();
-19
View File
@@ -1,19 +0,0 @@
// Description: Converts SVGs to PNGs and resizes them to the correct dimensions.
const { ArgumentParser } = require('argparse')
const { convertFile } = require('convert-svg-to-png');
(async () => {
const parser = new ArgumentParser({
description: 'Sync YouTube profile with Invidious'
});
parser.add_argument('--input', { help: 'Input file path' });
parser.add_argument('--options', { help: 'Options as json string' });
const args = parser.parse_args()
const input = args.input
const options = JSON.parse(args.options)
await convertFile(input, options);
})();
+122
View File
@@ -0,0 +1,122 @@
// Description: Converts SVGs to PNGs and resizes them to the correct dimensions.
const { ArgumentParser, BooleanOptionalAction } = require('argparse')
const { globSync } = require('glob');
const { convertFile } = require('convert-svg-to-png');
const { existsSync, writeFileSync, readFileSync } = require('fs');
const json5 = require('json5');
const md5 = require('crypto-js/md5');
const path = require('path');
const META_EXT = '.meta.json5';
(async () => {
const parser = new ArgumentParser({
description: 'Converts SVGs to PNGs'
});
parser.add_argument('--force', { help: 'Force convert all images', action: BooleanOptionalAction, default: false });
const args = parser.parse_args()
const force = args.force
const svgFiles = findSvgFiles();
console.log(`Found ${svgFiles.length} SVG files`);
for (const svgFile of svgFiles) {
const metafile = `${svgFile.file}${META_EXT}`;
if (!existsSync(metafile)) {
createDefaultMetaFile(svgFile, metafile);
}
const meta = json5.parse(readFileSync(metafile, 'utf8'));
await generateImages(svgFile, meta, metafile, force);
}
console.log('Done.');
})();
function findSvgFiles() {
return [
...findSvgFilesForProject('playlet-app/src'),
...findSvgFilesForProject('playlet-lib/src')
];
}
function findSvgFilesForProject(project) {
return globSync(`**/*.svg`, { cwd: project })
// Web app can use svg files, no need to convert
.filter(file => !file.startsWith('www'))
.map(file => path.join(project, file))
.map(file => { return { file: file, rootDir: project } });
}
function createDefaultMetaFile(svgFile, metafile) {
const meta = {
inputHash: '',
outputs: [{
outputFilePath: svgFile.file.replace(`${svgFile.rootDir}/`, '').replace('.svg', '.png'),
outputHash: '',
width: 64,
height: 64,
}]
}
writeFileSync(metafile, json5.stringify(meta, null, 2));
}
async function generateImages(svgFile, meta, metafile, force) {
let metaChanged = false;
const inputHash = checkFileHash(svgFile.file, meta.inputHash);
if (!inputHash.valid) {
meta.inputHash = inputHash.hash;
metaChanged = true;
}
for (var i in meta.outputs) {
const output = meta.outputs[i];
const outputFilePath = path.join(svgFile.rootDir, output.outputFilePath);
let outputHash = checkFileHash(outputFilePath, output.outputHash);
if (inputHash.valid && outputHash.valid && !force) {
continue;
}
await generateImage(svgFile.file, output, svgFile.rootDir);
outputHash = checkFileHash(outputFilePath, output.outputHash);
console.log(`Generated ${outputFilePath} (${output.width}x${output.height})`);
output.outputHash = outputHash.hash;
metaChanged = true;
}
if (metaChanged) {
writeFileSync(metafile, json5.stringify(meta, null, 2));
console.log(`Updated ${metafile}`);
}
}
function checkFileHash(file, hash) {
if (!existsSync(file)) {
return {
valid: false,
hash: ''
}
}
const outputHash = md5(readFileSync(file, 'binary')).toString();
return {
valid: outputHash === hash,
hash: outputHash
}
}
async function generateImage(inputImage, options, rootDir) {
const opts = { ...options };
opts.outputFilePath = path.join(rootDir, opts.outputFilePath);
await convertFile(inputImage, opts);
}
+22
View File
@@ -0,0 +1,22 @@
// Shutdown a Roku device
const rokuTestAutomation = require('roku-test-automation');
const ecp = rokuTestAutomation.ecp;
const utils = rokuTestAutomation.utils;
const Key = rokuTestAutomation.ECP.Key;
const getEnvVars = require('./get-env-vars');
const config = getEnvVars(['ROKU_DEV_TARGET']);
(async () => {
utils.setupEnvironmentFromConfig({
RokuDevice: {
devices: [{
host: config.ROKU_DEV_TARGET,
password: ''
}]
}
});
await ecp.sendKeypress(Key.PowerOff);
})();