Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
93ea822f27 | ||
|
|
d73a03d3bf | ||
|
|
45736dd8ec | ||
|
|
90565ccb07 | ||
|
|
b72173f588 | ||
|
|
2d759c1c39 | ||
|
|
11fb644fc6 | ||
|
|
b076517c1b | ||
|
|
74082f406a | ||
|
|
f3aeb58b38 | ||
|
|
44ee6681c5 | ||
|
|
85e30c8b22 | ||
|
|
80d3d24e39 | ||
|
|
a7bdab30bc | ||
|
|
3858681b80 | ||
|
|
e0cf59d90f | ||
|
|
d9b8aaa222 | ||
|
|
b1a373f98d | ||
|
|
1078459eb7 | ||
|
|
14cc537032 | ||
|
|
db755c4158 | ||
|
|
ed068f6599 | ||
|
|
45011a54f0 | ||
|
|
8c71a5be88 | ||
|
|
d059fced58 | ||
|
|
ea2be153b0 | ||
|
|
7e5b2246fa | ||
|
|
a710a23444 | ||
|
|
a3b3a143a5 | ||
|
|
1172a82a26 | ||
|
|
c002028727 | ||
|
|
3ab65587df | ||
|
|
4d4fab4e06 | ||
|
|
9cfe14e87e | ||
|
|
e80a41ca72 | ||
|
|
4e8dfe1a23 | ||
|
|
e6302e48fe | ||
|
|
7796c63291 | ||
|
|
dc148a7c59 | ||
|
|
9df1b70e49 | ||
|
|
bb471a5cde | ||
|
|
b68aad7d4a | ||
|
|
73b6314ec7 | ||
|
|
29969db3e4 | ||
|
|
5335a0273b | ||
|
|
641c9ef5bf | ||
|
|
b0257d97e0 | ||
|
|
5c9c1c204f | ||
|
|
11afc34ecc | ||
|
|
3edfce1366 | ||
|
|
5ff02af7ac | ||
|
|
0cc8cdf2be | ||
|
|
3ecac831bf | ||
|
|
86d5710969 | ||
|
|
575935f5ac | ||
|
|
7eb20dfe2c | ||
|
|
0b01830ad9 | ||
|
|
33fdf796a2 | ||
|
|
fd7bdde733 | ||
|
|
e7324495fe | ||
|
|
2e7b3d0aa5 | ||
|
|
20f345593e | ||
|
|
754da7e836 | ||
|
|
85c3eb8321 |
No files matched your search
@@ -5,6 +5,43 @@ 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.0.0/),
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||||
|
|
||||||
|
## [0.19.2] - 2024-02-11
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- [Attempt #2] to fix a crash caused by execution timeout when stopping a video takes too long
|
||||||
|
- Wrong hint on the "added to queue" notification when in fullscreen
|
||||||
|
- A rare crash when listing Invidious public instances
|
||||||
|
- Restoring video to full screen not working when on certain screens
|
||||||
|
|
||||||
|
## [0.19.1] - 2024-01-13
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- A hint on how to restore video to full screen
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
|
||||||
|
- Bookmarks are now added to the top of the list
|
||||||
|
- The search screen keyboard to make it easier to clear the search field
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- A bug with request retry mechanism introduced in 0.19.0
|
||||||
|
|
||||||
|
## [0.19.0] - 2024-01-10
|
||||||
|
|
||||||
|
### Added
|
||||||
|
|
||||||
|
- A home screen editor allowing to enable/disable feeds, and change their order.
|
||||||
|
- The editor can be accessed from the Settings screen.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- `HTTP/0.9 when not allowed` errors by adding a retry to web requests
|
||||||
|
- Issue where a bookmarked video is no longer valid (such as a video made private, or a live stream that ended)
|
||||||
|
- [Perf] App loads slightly faster (~500ms)
|
||||||
|
|
||||||
## [0.18.1] - 2024-01-02
|
## [0.18.1] - 2024-01-02
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
@@ -12,7 +49,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- A rare bug that causes the app to crash when displaying video cells
|
- A rare bug that causes the app to crash when displaying video cells
|
||||||
- A rare bug where a long press can cause a crash
|
- A rare bug where a long press can cause a crash
|
||||||
- [Attempt] to fix a crash caused by execution timeout when stopping a video takes too long
|
- [Attempt] to fix a crash caused by execution timeout when stopping a video takes too long
|
||||||
- Unsupported subtitles (subtitles that can be rendered will not be used)
|
- Unsupported subtitles (subtitles that can't be rendered will not be used)
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
@@ -320,7 +357,7 @@ This version went through a major refactor, which resulted in a different arcite
|
|||||||
- Dark mode
|
- Dark mode
|
||||||
- Also includes a dev menu
|
- Also includes a dev menu
|
||||||
- Hidden by default, use `dev=1` in the browser to show it
|
- Hidden by default, use `dev=1` in the browser to show it
|
||||||
- Improved drag and drop functionality (drag and drop a link from Youtube into the web app)
|
- Improved drag and drop functionality (drag and drop a link from YouTube into the web app)
|
||||||
- New settings page, available on TV and web app
|
- New settings page, available on TV and web app
|
||||||
- New preferences system
|
- New preferences system
|
||||||
- Unified settings between TV and web app
|
- Unified settings between TV and web app
|
||||||
@@ -377,7 +414,7 @@ This version went through a major refactor, which resulted in a different arcite
|
|||||||
|
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- A script to sync between Youtube profile and and Invidious profile
|
- A script to sync between YouTube profile and and Invidious profile
|
||||||
- Moved most of Playlet logic to Playlet Lib
|
- Moved most of Playlet logic to Playlet Lib
|
||||||
- Support for multiple caption languages
|
- Support for multiple caption languages
|
||||||
|
|
||||||
@@ -425,7 +462,7 @@ This version went through a major refactor, which resulted in a different arcite
|
|||||||
- Loading spinner
|
- Loading spinner
|
||||||
- Picture in picture support
|
- Picture in picture support
|
||||||
- [Deep linking support](https://developer.roku.com/en-ca/docs/developer-program/discovery/implementing-deep-linking.md)
|
- [Deep linking support](https://developer.roku.com/en-ca/docs/developer-program/discovery/implementing-deep-linking.md)
|
||||||
- Both Launch arguments and Input arguments are supported, using the "contentId" key as the Youtube video id
|
- Both Launch arguments and Input arguments are supported, using the "contentId" key as the YouTube video id
|
||||||
- Error and Exit dialogs
|
- Error and Exit dialogs
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
# Playlet
|
# Playlet
|
||||||
|
|
||||||
Playlet is an unofficial Youtube client for Roku 📺
|
Playlet is an unofficial YouTube client for Roku 📺
|
||||||
|
|
||||||
## Screenshots
|
## Screenshots
|
||||||
|
|
||||||
@@ -44,7 +44,7 @@ More under [Screenshots](./docs/screenshots/README.md)
|
|||||||
- ⚔️ SponsorBlock integration (skips undesirable sections in videos)
|
- ⚔️ SponsorBlock integration (skips undesirable sections in videos)
|
||||||
- 📱 Browse, search, and cast from phone using the web app
|
- 📱 Browse, search, and cast from phone using the web app
|
||||||
- 🔮 Picture-in-picture mode
|
- 🔮 Picture-in-picture mode
|
||||||
- ⚡ Fast! [Check out how we compare with the official Youtube app](https://youtu.be/qmSvA-QQW20)
|
- ⚡ Fast! [Check out how we compare with the official YouTube app](https://youtu.be/qmSvA-QQW20)
|
||||||
|
|
||||||
### Cast from phone
|
### Cast from phone
|
||||||
|
|
||||||
@@ -89,10 +89,10 @@ play•let /ˈplālət/
|
|||||||
: a short play
|
: a short play
|
||||||
```
|
```
|
||||||
|
|
||||||
**Playlet** is about keeping the time you spend on Youtube short and useful. It values your time, so it does not show you ads, and allows you to skip sponsored sections and other irrelevant information that's designed to monitize you and/or waste your time.
|
**Playlet** is about keeping the time you spend on YouTube short and useful. It values your time, so it does not show you ads, and allows you to skip sponsored sections and other irrelevant information that's designed to monitize you and/or waste your time.
|
||||||
|
|
||||||
There's a cliché about how a lot of open source software is **`"Made with ♡"`**. This project in particular is **not**.<br/>
|
There's a cliché about how a lot of open source software is **`"Made with ♡"`**. This project in particular is **not**.<br/>
|
||||||
**Playlet** was created out of **spite**, because I believe I have watched enough back-to-back, unskippable Youtube ads for a lifetime.
|
**Playlet** was created out of **spite**, because I believe I have watched enough back-to-back, unskippable YouTube ads for a lifetime.
|
||||||
|
|
||||||
By removing all the bloat, the ads, the tracking, we could end up with an even faster app than the official one.
|
By removing all the bloat, the ads, the tracking, we could end up with an even faster app than the official one.
|
||||||
|
|
||||||
@@ -101,6 +101,7 @@ In any case, I hope you find **Playlet** useful, and pleasant to use.
|
|||||||
## Disclaimer
|
## Disclaimer
|
||||||
|
|
||||||
**Playlet** does not serve or distribute any material from unauthorized sources.<br/>
|
**Playlet** does not serve or distribute any material from unauthorized sources.<br/>
|
||||||
**Playlet** is simply a frontend to other systems (such as [Invidious](https://github.com/iv-org/invidious)), bringing the watching experience to the TV, as opposed to the existing frontends that are web and mobile focused.
|
**Playlet** is simply a frontend to other systems (such as [Invidious](https://github.com/iv-org/invidious)), bringing the watching experience to the TV, as opposed to the existing frontends that are web and mobile focused.<br/>
|
||||||
|
**Playlet** authors acknowledge that all trademarks and registered trademarks mentioned in this repository 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.
|
||||||
|
|
||||||
<!-- markdownlint-configure-file {"MD024": { "siblings_only": true } } -->
|
<!-- markdownlint-configure-file {"MD024": { "siblings_only": true } } -->
|
||||||
@@ -3,7 +3,7 @@
|
|||||||
"createPackage": false,
|
"createPackage": false,
|
||||||
"diagnosticFilters": [
|
"diagnosticFilters": [
|
||||||
{
|
{
|
||||||
"src": "**/*.part.xml",
|
"src": "components/**/*.part.xml",
|
||||||
"codes": [
|
"codes": [
|
||||||
// 1067 - Cannot find function with name '${name}' in component scope
|
// 1067 - Cannot find function with name '${name}' in component scope
|
||||||
// This is to prevent errors where the onChange function is not found in the component scope
|
// This is to prevent errors where the onChange function is not found in the component scope
|
||||||
@@ -45,10 +45,11 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"source/**",
|
"source/**",
|
||||||
"components/**",
|
"components/**",
|
||||||
|
"!components/**/*.part.xml",
|
||||||
"images/**",
|
"images/**",
|
||||||
|
"!**/*.psd",
|
||||||
"!**/*.svg",
|
"!**/*.svg",
|
||||||
"!**/*.svg.meta.json5",
|
"!**/*.svg.meta.json5",
|
||||||
"fonts/**",
|
|
||||||
"config/**",
|
"config/**",
|
||||||
"lib/**",
|
"lib/**",
|
||||||
"www/**",
|
"www/**",
|
||||||
@@ -70,11 +71,14 @@
|
|||||||
"../tools/bs-plugins/json-yaml-plugin.ts",
|
"../tools/bs-plugins/json-yaml-plugin.ts",
|
||||||
"../tools/bs-plugins/validation-plugin.ts",
|
"../tools/bs-plugins/validation-plugin.ts",
|
||||||
"../tools/bs-plugins/logger-plugin.ts",
|
"../tools/bs-plugins/logger-plugin.ts",
|
||||||
"../tools/bs-plugins/image-gen-plugin.ts"
|
"../tools/bs-plugins/image-gen-plugin.ts",
|
||||||
|
"../tools/bs-plugins/type-gen-plugin.ts",
|
||||||
|
"../tools/bs-plugins/web-server-plugin.ts"
|
||||||
],
|
],
|
||||||
"retainStagingDir": true,
|
"retainStagingDir": true,
|
||||||
"require": [
|
"require": [
|
||||||
"ts-node/register"
|
"ts-node/register"
|
||||||
],
|
],
|
||||||
"sourceMap": true
|
"sourceMap": true,
|
||||||
|
"pruneEmptyCodeFiles": true
|
||||||
}
|
}
|
||||||
@@ -3,10 +3,11 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"source/**",
|
"source/**",
|
||||||
"components/**",
|
"components/**",
|
||||||
|
"!components/**/*.part.xml",
|
||||||
"images/**",
|
"images/**",
|
||||||
|
"!**/*.psd",
|
||||||
"!**/*.svg",
|
"!**/*.svg",
|
||||||
"!**/*.svg.meta.json5",
|
"!**/*.svg.meta.json5",
|
||||||
"fonts/**",
|
|
||||||
"config/**",
|
"config/**",
|
||||||
"lib/**",
|
"lib/**",
|
||||||
"www/**",
|
"www/**",
|
||||||
@@ -26,7 +27,9 @@
|
|||||||
"../tools/bs-plugins/json-yaml-plugin.ts",
|
"../tools/bs-plugins/json-yaml-plugin.ts",
|
||||||
"../tools/bs-plugins/validation-plugin.ts",
|
"../tools/bs-plugins/validation-plugin.ts",
|
||||||
"../tools/bs-plugins/logger-plugin.ts",
|
"../tools/bs-plugins/logger-plugin.ts",
|
||||||
"../tools/bs-plugins/image-gen-plugin.ts"
|
"../tools/bs-plugins/image-gen-plugin.ts",
|
||||||
|
"../tools/bs-plugins/type-gen-plugin.ts",
|
||||||
|
"../tools/bs-plugins/web-server-plugin.ts"
|
||||||
],
|
],
|
||||||
"rooibos": {
|
"rooibos": {
|
||||||
"logLevel": 2,
|
"logLevel": 2,
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ That's pretty much it.
|
|||||||
|
|
||||||
There are a few reasons we made this separation:
|
There are a few reasons we made this separation:
|
||||||
|
|
||||||
- Playlet relies on [Invidious](https://github.com/iv-org/invidious). Invidious tries to keep up with Youtube making changes to their platform, but sometimes, a breaking change happens that requires Playlet to react quickly. Releasing through the Roku Channel store can take days, or a week. During this time, Playlet would be not functional, and that's not acceptable.
|
- Playlet relies on [Invidious](https://github.com/iv-org/invidious). Invidious tries to keep up with YouTube making changes to their platform, but sometimes, a breaking change happens that requires Playlet to react quickly. Releasing through the Roku Channel store can take days, or a week. During this time, Playlet would be not functional, and that's not acceptable.
|
||||||
- The ability to roll back: Sometimes an app breaking bug gets released. Allowing users to choose a seperate version is a flexible way to keep things working. For example, it's possible to choose a different verrsion from the developer settings in the web app.
|
- The ability to roll back: Sometimes an app breaking bug gets released. Allowing users to choose a seperate version is a flexible way to keep things working. For example, it's possible to choose a different verrsion from the developer settings in the web app.
|
||||||
- It is simply easier to release: Releasing Playlet Lib on Github, and everyone receives the latest version immediately, is very conveninct and less of a hassle, than going through the Roku Channel store.
|
- It is simply easier to release: Releasing Playlet Lib on Github, and everyone receives the latest version immediately, is very conveninct and less of a hassle, than going through the Roku Channel store.
|
||||||
- I've had instances where I was trying to pass the certfication for Playlet to publish it. One of the criterias is to pass a some automated tests. But the tests were failing because their system could not connect to their Roku test devices (connection keeps timing out). My only option was to keep trying over and over until it worked.
|
- I've had instances where I was trying to pass the certfication for Playlet to publish it. One of the criterias is to pass a some automated tests. But the tests were failing because their system could not connect to their Roku test devices (connection keeps timing out). My only option was to keep trying over and over until it worked.
|
||||||
@@ -163,7 +163,7 @@ Playlet lib comes equipped with a web server that runs on port 8888 when the app
|
|||||||
- Allows remotely casting videos, change preferences, etc.
|
- Allows remotely casting videos, change preferences, etc.
|
||||||
- Authentication using Invidious
|
- Authentication using Invidious
|
||||||
|
|
||||||
The web server runs on a continiously running [Task](https://developer.roku.com/en-ca/docs/references/scenegraph/control-nodes/task.md) and uses a middeware system to manage routes, serve static files, [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS), and more.
|
The web server runs on a continuously running [Task](https://developer.roku.com/en-ca/docs/references/scenegraph/control-nodes/task.md) and uses a middeware system to manage routes, serve static files, [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS), and more.
|
||||||
|
|
||||||
The server's API enpoints are described through the Open API spec file [playlet-web-api.yml](./playlet-web-api.yml)
|
The server's API enpoints are described through the Open API spec file [playlet-web-api.yml](./playlet-web-api.yml)
|
||||||
|
|
||||||
|
|||||||
@@ -4,8 +4,7 @@ This is an automated release. It is generated when new code is pushed to the mai
|
|||||||
|
|
||||||
To test this release:
|
To test this release:
|
||||||
|
|
||||||
- Open Playlet web app in a browser (`http://ROKU_IP_ADDRESS:8888/index.html`)
|
- Open Playlet web app settings in a browser (`http://ROKU_IP_ADDRESS:8888/index.html#settings`)
|
||||||
- Go to settings, and scroll down to `Developer settings`
|
- Scroll down to `Developer settings` and set `Playlet Library version` to `canary` and click `Apply`
|
||||||
- Set `Playlet Library version` to `canary` and click `Apply`
|
|
||||||
- Restart Playlet
|
- Restart Playlet
|
||||||
- You can verify that you're testing the `canary` release in the `Info` tab in Playlet or the web app
|
- You can verify that you're testing the `canary` release in the `Info` tab in Playlet or the web app
|
||||||
@@ -2,7 +2,7 @@ openapi: 3.0.0
|
|||||||
|
|
||||||
info:
|
info:
|
||||||
title: Playlet Web API
|
title: Playlet Web API
|
||||||
version: 0.18.1
|
version: 0.19.2
|
||||||
description:
|
description:
|
||||||
Playlet Web API is a RESTful API for controlling the Playlet app on
|
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
|
Roku devices. The API is intended to be used by the Playlet web app, but can
|
||||||
@@ -106,7 +106,7 @@ paths:
|
|||||||
type: array
|
type: array
|
||||||
items:
|
items:
|
||||||
type: string
|
type: string
|
||||||
put:
|
post:
|
||||||
summary: Add to search history
|
summary: Add to search history
|
||||||
description: |
|
description: |
|
||||||
Add a query to the search history.
|
Add a query to the search history.
|
||||||
@@ -153,7 +153,7 @@ paths:
|
|||||||
properties:
|
properties:
|
||||||
index:
|
index:
|
||||||
type: integer
|
type: integer
|
||||||
playlistIndex
|
playlistIndex:
|
||||||
type: integer
|
type: integer
|
||||||
items:
|
items:
|
||||||
type: array
|
type: array
|
||||||
@@ -178,7 +178,7 @@ paths:
|
|||||||
properties:
|
properties:
|
||||||
index:
|
index:
|
||||||
type: integer
|
type: integer
|
||||||
playlistIndex
|
playlistIndex:
|
||||||
type: integer
|
type: integer
|
||||||
items:
|
items:
|
||||||
type: array
|
type: array
|
||||||
@@ -227,6 +227,41 @@ paths:
|
|||||||
description: No Content
|
description: No Content
|
||||||
"400":
|
"400":
|
||||||
description: Bad Request
|
description: Bad Request
|
||||||
|
/api/home-layout:
|
||||||
|
get:
|
||||||
|
summary: Get home layout
|
||||||
|
description: Get the current home layout. This is the layout of the home screen, based on user preferences.
|
||||||
|
operationId: getHomeLayout
|
||||||
|
responses:
|
||||||
|
"200":
|
||||||
|
description: OK
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
title:
|
||||||
|
type: string
|
||||||
|
feedSources:
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
apiType:
|
||||||
|
type: string
|
||||||
|
endpoint:
|
||||||
|
type: string
|
||||||
|
id:
|
||||||
|
type: string
|
||||||
|
queryParams:
|
||||||
|
type: object
|
||||||
|
additionalProperties: true
|
||||||
|
title:
|
||||||
|
type: string
|
||||||
/api/playlet-lib-urls:
|
/api/playlet-lib-urls:
|
||||||
get:
|
get:
|
||||||
summary: Get Playlet lib URLs
|
summary: Get Playlet lib URLs
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
- [Async Task Generator](#async-task-generator)
|
- [Async Task Generator](#async-task-generator)
|
||||||
- [Tracking transpilied files](#tracking-transpilied-files)
|
- [Tracking transpilied files](#tracking-transpilied-files)
|
||||||
- [Logger](#logger)
|
- [Logger](#logger)
|
||||||
|
- [Type Gen](#type-gen)
|
||||||
|
- [Web Server](#web-server)
|
||||||
|
|
||||||
Playlet implements a few [Brighterscript Plugins](https://github.com/rokucommunity/brighterscript/blob/master/docs/plugins.md). The plugins inject themselves in the compilation process, allowing the modification of bs scripts, xml components, and even assets or the app manifest. Let's start with a simple one:
|
Playlet implements a few [Brighterscript Plugins](https://github.com/rokucommunity/brighterscript/blob/master/docs/plugins.md). The plugins inject themselves in the compilation process, allowing the modification of bs scripts, xml components, and even assets or the app manifest. Let's start with a simple one:
|
||||||
|
|
||||||
@@ -469,7 +471,10 @@ end function
|
|||||||
And use the function like so
|
And use the function like so
|
||||||
|
|
||||||
```brighterscript
|
```brighterscript
|
||||||
StartAsyncTask(MyBackgroundTask, {myVar: "some input"}, function(output as object) as void
|
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||||
|
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||||
|
|
||||||
|
AsyncTask.Start(Tasks.MyBackgroundTask, {myVar: "some input"}, function(output as object) as void
|
||||||
if output.success
|
if output.success
|
||||||
print(output.result.value)
|
print(output.result.value)
|
||||||
end if
|
end if
|
||||||
@@ -478,7 +483,7 @@ end function)
|
|||||||
|
|
||||||
The rest will be taken care of by the plugin, which will generate an `xml` file containing the task component, and a script that handles calling the function.
|
The rest will be taken care of by the plugin, which will generate an `xml` file containing the task component, and a script that handles calling the function.
|
||||||
|
|
||||||
Although very useful, this pattern might not be the best for long running tasks (like the Web Server) or other tasks that require task reuse. This is because `StartAsyncTask` create a new instance of the task every time.
|
Although very useful, this pattern might not be the best for long running tasks (like the Web Server) or other tasks that require task reuse. This is because `AsyncTask.Start` create a new instance of the task every time.
|
||||||
|
|
||||||
## Tracking transpilied files
|
## Tracking transpilied files
|
||||||
|
|
||||||
@@ -517,7 +522,7 @@ The logger plugin searches for calls to the predefined functions `LogError`, `Lo
|
|||||||
- For example, it replaces `LogError("Cannot complete operation:", error)` with `LogError2("Cannot complete operation:", error)`
|
- For example, it replaces `LogError("Cannot complete operation:", error)` with `LogError2("Cannot complete operation:", error)`
|
||||||
- Based on usage, it generates `LogErrorX` functions used. Example:
|
- Based on usage, it generates `LogErrorX` functions used. Example:
|
||||||
|
|
||||||
```
|
```brs
|
||||||
function LogError2(arg0, arg1) as void
|
function LogError2(arg0, arg1) as void
|
||||||
logger = m.global.logger
|
logger = m.global.logger
|
||||||
if logger.logLevel < 0
|
if logger.logLevel < 0
|
||||||
@@ -537,3 +542,63 @@ This is implemented to make it easy to identify where logs came from, and to gen
|
|||||||
To understand more about what's being generated, download `playlet-lib.zip` from [releases](https://github.com/iBicha/playlet/releases), extract, and inspect the file `source/utils/Logging.brs`. You will see it contains log functions in the form `LogVerbX`, that are generated based on usage.
|
To understand more about what's being generated, download `playlet-lib.zip` from [releases](https://github.com/iBicha/playlet/releases), extract, and inspect the file `source/utils/Logging.brs`. You will see it contains log functions in the form `LogVerbX`, that are generated based on usage.
|
||||||
|
|
||||||
To give credit where credit is due, some of the ideas here (like adding the source location to the log) came from [roku-log](https://github.com/georgejecook/roku-log)
|
To give credit where credit is due, some of the ideas here (like adding the source location to the log) came from [roku-log](https://github.com/georgejecook/roku-log)
|
||||||
|
|
||||||
|
## Type Gen
|
||||||
|
|
||||||
|
**[Source](/tools/bs-plugins/type-gen-plugin.ts)**
|
||||||
|
|
||||||
|
### Why
|
||||||
|
|
||||||
|
I found myself implementing type checking functions like `IsBool`, `IsInt`, and `IsString`, and functions for getting a valid type, like `ValidBool`, `ValidInt`, and `ValidString`. The implementation is the same, why not generate them?
|
||||||
|
|
||||||
|
### How
|
||||||
|
|
||||||
|
Simply we declare them in an object describing the type, the interface, and the default value, and generate all corresponding functions.
|
||||||
|
|
||||||
|
Sample output:
|
||||||
|
|
||||||
|
```brs
|
||||||
|
' Returns true if the given object is of type Bool, false otherwise
|
||||||
|
function IsBool(obj as dynamic) as boolean
|
||||||
|
return obj <> invalid and GetInterface(obj, "ifBoolean") <> invalid
|
||||||
|
end function
|
||||||
|
|
||||||
|
' Returns the given object if it is of type Bool, otherwise returns the default value `false`
|
||||||
|
function ValidBool(obj as dynamic) as boolean
|
||||||
|
if obj <> invalid and GetInterface(obj, "ifBoolean") <> invalid
|
||||||
|
return obj
|
||||||
|
else
|
||||||
|
return false
|
||||||
|
end if
|
||||||
|
end function
|
||||||
|
```
|
||||||
|
|
||||||
|
## Web Server
|
||||||
|
|
||||||
|
**[Source](/tools/bs-plugins/web-server-plugin.ts)**
|
||||||
|
|
||||||
|
### Why
|
||||||
|
|
||||||
|
Handles routing annotations (e.g. `@get("/api/something")) so that they are handled by the routers/middlewares. It's nicer than having to register things by hand.
|
||||||
|
|
||||||
|
### How
|
||||||
|
|
||||||
|
Routers need to inherit from `Http.HttpRouter`. Then, once a request handled is annotated, e.g.
|
||||||
|
|
||||||
|
```bs
|
||||||
|
@get("/")
|
||||||
|
function GoHome(context as object) as boolean
|
||||||
|
response = context.response
|
||||||
|
response.Redirect("/index.html")
|
||||||
|
return true
|
||||||
|
end function
|
||||||
|
```
|
||||||
|
|
||||||
|
The route and the handler are added to the router. In this example, the `/` route redirects to `index/html`.
|
||||||
|
|
||||||
|
There one special annotation, and one special route:
|
||||||
|
|
||||||
|
- `@all` matches all methods
|
||||||
|
- `*` matches all paths
|
||||||
|
|
||||||
|
So `@all(*)` would be a middleware that will be matched with any request.
|
||||||
@@ -1,30 +1,37 @@
|
|||||||
# Screenshots
|
# Screenshots
|
||||||
|
|
||||||
## Home
|
## Playlet
|
||||||
|
|
||||||

|
| Home | Search |
|
||||||
|
| ------------------- | ----------------------- |
|
||||||
|
|  |  |
|
||||||
|
|
||||||
## Search
|
| Bookmarks | Queue + Picture-in-picture |
|
||||||
|
| ----------------------------- | ----------------------------------------------------- |
|
||||||
|
|  |  |
|
||||||
|
|
||||||

|
| Channel | Playlist |
|
||||||
|
| ------------------------- | --------------------------- |
|
||||||
|
|  |  |
|
||||||
|
|
||||||
## Settings
|
| Settings | Invidious instances | Invidious testing |
|
||||||
|
| --------------------------- | ------------------------------------------------ | --------------------------------------------- |
|
||||||
|
|  |  |  |
|
||||||
|
|
||||||

|
| Link to web app | App info |
|
||||||
|
| ----------------------------------- | --------------------------- |
|
||||||
|
|  |  |
|
||||||
|
|
||||||
## Playlist
|
## Playlet web app
|
||||||
|
|
||||||

|
| Home | Search | Settings |
|
||||||
|
|
||||||
## Link to web app
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## App info
|
|
||||||
|
|
||||||

|
|
||||||
|
|
||||||
## Web app
|
|
||||||
|
|
||||||
|  |  |  |
|
|
||||||
| ---------------------------------- | -------------------------------------- | ------------------------------------------ |
|
| ---------------------------------- | -------------------------------------- | ------------------------------------------ |
|
||||||
|
|  |  |  |
|
||||||
|
|
||||||
|
| Bookmarks | Remote | Cast video |
|
||||||
|
| ------------------------------------ | ------------------------------ | -------------------------------- |
|
||||||
|
|  |  |  |
|
||||||
|
|
||||||
|
| App info | | |
|
||||||
|
| ------------------------------ | --- | --- |
|
||||||
|
|  | | |
|
||||||
|
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 37 KiB |
|
After Width: | Height: | Size: 78 KiB |
|
After Width: | Height: | Size: 123 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 124 KiB |
|
After Width: | Height: | Size: 62 KiB |
|
After Width: | Height: | Size: 41 KiB |
|
After Width: | Height: | Size: 106 KiB |
|
Before Width: | Height: | Size: 80 KiB After Width: | Height: | Size: 83 KiB |
|
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 39 KiB |
|
After Width: | Height: | Size: 639 KiB |
|
After Width: | Height: | Size: 982 KiB |
|
Before Width: | Height: | Size: 358 KiB After Width: | Height: | Size: 1.2 MiB |
|
After Width: | Height: | Size: 244 KiB |
|
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 52 KiB |
|
After Width: | Height: | Size: 154 KiB |
|
Before Width: | Height: | Size: 362 KiB After Width: | Height: | Size: 751 KiB |
|
Before Width: | Height: | Size: 99 KiB After Width: | Height: | Size: 256 KiB |
@@ -1,36 +1,36 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet",
|
"name": "playlet",
|
||||||
"version": "0.18.1",
|
"version": "0.19.2",
|
||||||
"lockfileVersion": 3,
|
"lockfileVersion": 3,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "playlet",
|
"name": "playlet",
|
||||||
"version": "0.18.1",
|
"version": "0.19.2",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rokucommunity/bslint": "^0.8.13",
|
"@rokucommunity/bslint": "^0.8.17",
|
||||||
"@types/crypto-js": "^4.2.1",
|
"@types/crypto-js": "^4.2.2",
|
||||||
"@types/fs-extra": "^11.0.4",
|
"@types/fs-extra": "^11.0.4",
|
||||||
"@types/node": "^20.10.6",
|
"@types/node": "^20.11.17",
|
||||||
"@types/xml2js": "^0.4.14",
|
"@types/xml2js": "^0.4.14",
|
||||||
"argparse": "^2.0.1",
|
"argparse": "^2.0.1",
|
||||||
"brighterscript": "0.65.15",
|
"brighterscript": "0.65.22",
|
||||||
"brighterscript-formatter": "^1.6.36",
|
"brighterscript-formatter": "^1.6.40",
|
||||||
"convert-svg-to-png": "^0.6.4",
|
"convert-svg-to-png": "^0.6.4",
|
||||||
"cross-fetch": "^4.0.0",
|
"cross-fetch": "^4.0.0",
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.4.1",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"fs-extra": "^11.2.0",
|
"fs-extra": "^11.2.0",
|
||||||
"glob": "^10.3.10",
|
"glob": "^10.3.10",
|
||||||
"imap": "^0.8.19",
|
"imap": "^0.8.19",
|
||||||
"ip": "^1.1.8",
|
"ip": "^1.1.8",
|
||||||
"json5": "^2.2.3",
|
"json5": "^2.2.3",
|
||||||
"mailparser": "^3.6.5",
|
"mailparser": "^3.6.7",
|
||||||
"roku-deploy": "^3.11.2",
|
"roku-deploy": "^3.11.2",
|
||||||
"rooibos-roku": "^5.8.0",
|
"rooibos-roku": "^5.11.0",
|
||||||
"semver": "^7.5.4",
|
"semver": "^7.6.0",
|
||||||
"shelljs": "^0.8.5",
|
"shelljs": "^0.8.5",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "^5.3.3",
|
"typescript": "^5.3.3",
|
||||||
@@ -276,9 +276,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@rokucommunity/bslint": {
|
"node_modules/@rokucommunity/bslint": {
|
||||||
"version": "0.8.13",
|
"version": "0.8.17",
|
||||||
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.13.tgz",
|
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.17.tgz",
|
||||||
"integrity": "sha512-EC5tQdtRFTJxOo+9lnZz6yLcsyctuchCzUNJX391ZgCN0EKJTjGigyqTsdsFprINmr0pBojUiys/ZpS/Bv3ROQ==",
|
"integrity": "sha512-e0ksPVYnN+QkhzuV97yPTf1NxSkBQZNMJRhlCFnMJf6gfps+VdY1HwYn3IlqDz3XJxfYcRSDa3v3fQ5dQynVEA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"fs-extra": "^10.0.0",
|
"fs-extra": "^10.0.0",
|
||||||
@@ -345,9 +345,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/crypto-js": {
|
"node_modules/@types/crypto-js": {
|
||||||
"version": "4.2.1",
|
"version": "4.2.2",
|
||||||
"resolved": "https://registry.npmjs.org/@types/crypto-js/-/crypto-js-4.2.1.tgz",
|
"resolved": "https://registry.npmjs.org/@types/crypto-js/-/crypto-js-4.2.2.tgz",
|
||||||
"integrity": "sha512-FSPGd9+OcSok3RsM0UZ/9fcvMOXJ1ENE/ZbLfOPlBWj7BgXtEAM8VYfTtT760GiLbQIMoVozwVuisjvsVwqYWw==",
|
"integrity": "sha512-sDOLlVbHhXpAUAL0YHDUUwDZf3iN4Bwi4W6a0W0b+QcAezUbRtH4FVb+9J4h+XFPW7l/gQ9F8qC7P+Ec4k8QVQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/@types/fs-extra": {
|
"node_modules/@types/fs-extra": {
|
||||||
@@ -370,9 +370,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@types/node": {
|
"node_modules/@types/node": {
|
||||||
"version": "20.10.6",
|
"version": "20.11.17",
|
||||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.6.tgz",
|
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.17.tgz",
|
||||||
"integrity": "sha512-Vac8H+NlRNNlAmDfGUP7b5h/KA+AtWIzuXy0E6OyP8f1tCLYAtPvKRRDJjAPqhpCb0t6U2j7/xqAuLEebW2kiw==",
|
"integrity": "sha512-QmgQZGWu1Yw9TDyAP9ZzpFJKynYNeOvwMJmaxABfieQoVoiVOS6MN1WSpqpRcbeA5+RW82kraAVxCCJg+780Qw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"undici-types": "~5.26.4"
|
"undici-types": "~5.26.4"
|
||||||
@@ -728,9 +728,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/brighterscript": {
|
"node_modules/brighterscript": {
|
||||||
"version": "0.65.15",
|
"version": "0.65.22",
|
||||||
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.65.15.tgz",
|
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.65.22.tgz",
|
||||||
"integrity": "sha512-WDnHaeCQclDG8wic1SCLYavnZDSjjzHcWxo+efwYkvyTjZivPoGWXbEulsYM3Nm9VawPuWWwzVqzHiN0Y4RvxQ==",
|
"integrity": "sha512-rDSdO33xRnFGB9nr54awTUucpd4oZpZmDMvVUSAb6jmFU1jz+SYhwV9ezc8U5m3Kswap7uV+BmS1O69QZ9MuSw==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@rokucommunity/bslib": "^0.1.1",
|
"@rokucommunity/bslib": "^0.1.1",
|
||||||
@@ -740,7 +740,6 @@
|
|||||||
"chevrotain": "^7.0.1",
|
"chevrotain": "^7.0.1",
|
||||||
"chokidar": "^3.5.1",
|
"chokidar": "^3.5.1",
|
||||||
"clear": "^0.1.0",
|
"clear": "^0.1.0",
|
||||||
"coveralls-next": "^4.2.0",
|
|
||||||
"cross-platform-clear-console": "^2.3.0",
|
"cross-platform-clear-console": "^2.3.0",
|
||||||
"debounce-promise": "^3.1.0",
|
"debounce-promise": "^3.1.0",
|
||||||
"eventemitter3": "^4.0.0",
|
"eventemitter3": "^4.0.0",
|
||||||
@@ -771,12 +770,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/brighterscript-formatter": {
|
"node_modules/brighterscript-formatter": {
|
||||||
"version": "1.6.36",
|
"version": "1.6.40",
|
||||||
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.6.36.tgz",
|
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.6.40.tgz",
|
||||||
"integrity": "sha512-f9Y3Re6egB1MCUftph8AT8RxWTtXmeMjwigRv1biNGmEuGeSOipoBnCbwY4U1CFz46L7W39/TL4n1JMV9URD6w==",
|
"integrity": "sha512-cxvGGluNfxy6p3khtcMt/3AschwqEnERjLRIEt3XVU0R0l2QgwXelDp8ViqgnQ2hQYa8LnfnOiV1u7OCqbiZPA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"brighterscript": "^0.65.12",
|
"brighterscript": "^0.65.19",
|
||||||
"glob-all": "^3.3.0",
|
"glob-all": "^3.3.0",
|
||||||
"jsonc-parser": "^3.0.0",
|
"jsonc-parser": "^3.0.0",
|
||||||
"source-map": "^0.7.3",
|
"source-map": "^0.7.3",
|
||||||
@@ -1479,25 +1478,6 @@
|
|||||||
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
|
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/coveralls-next": {
|
|
||||||
"version": "4.2.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/coveralls-next/-/coveralls-next-4.2.0.tgz",
|
|
||||||
"integrity": "sha512-zg41a/4QDSASPtlV6gp+6owoU43U5CguxuPZR3nPZ26M5ZYdEK3MdUe7HwE+AnCZPkucudfhqqJZehCNkz2rYg==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"form-data": "4.0.0",
|
|
||||||
"js-yaml": "4.1.0",
|
|
||||||
"lcov-parse": "1.0.0",
|
|
||||||
"log-driver": "1.2.7",
|
|
||||||
"minimist": "1.2.7"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"coveralls": "bin/coveralls.js"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">=14"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/create-require": {
|
"node_modules/create-require": {
|
||||||
"version": "1.1.1",
|
"version": "1.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||||
@@ -1726,9 +1706,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/dotenv": {
|
"node_modules/dotenv": {
|
||||||
"version": "16.3.1",
|
"version": "16.4.1",
|
||||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
|
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.4.1.tgz",
|
||||||
"integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==",
|
"integrity": "sha512-CjA3y+Dr3FyFDOAMnxZEGtnW9KBR2M0JvvUtXNW+dYJL5ROWxP9DUHCwgFqpMk0OXCc0ljhaNTr2w/kutYIcHQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=12"
|
"node": ">=12"
|
||||||
@@ -2103,20 +2083,6 @@
|
|||||||
"node": "*"
|
"node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/form-data": {
|
|
||||||
"version": "4.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
|
||||||
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"asynckit": "^0.4.0",
|
|
||||||
"combined-stream": "^1.0.8",
|
|
||||||
"mime-types": "^2.1.12"
|
|
||||||
},
|
|
||||||
"engines": {
|
|
||||||
"node": ">= 6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/forwarded": {
|
"node_modules/forwarded": {
|
||||||
"version": "0.2.0",
|
"version": "0.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
|
||||||
@@ -2745,18 +2711,6 @@
|
|||||||
"@pkgjs/parseargs": "^0.11.0"
|
"@pkgjs/parseargs": "^0.11.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/js-yaml": {
|
|
||||||
"version": "4.1.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
|
||||||
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
|
||||||
"dev": true,
|
|
||||||
"dependencies": {
|
|
||||||
"argparse": "^2.0.1"
|
|
||||||
},
|
|
||||||
"bin": {
|
|
||||||
"js-yaml": "bin/js-yaml.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/jsbn": {
|
"node_modules/jsbn": {
|
||||||
"version": "0.1.1",
|
"version": "0.1.1",
|
||||||
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
|
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
|
||||||
@@ -2838,15 +2792,6 @@
|
|||||||
"setimmediate": "^1.0.5"
|
"setimmediate": "^1.0.5"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/lcov-parse": {
|
|
||||||
"version": "1.0.0",
|
|
||||||
"resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-1.0.0.tgz",
|
|
||||||
"integrity": "sha512-aprLII/vPzuQvYZnDRU78Fns9I2Ag3gi4Ipga/hxnVMCZC8DnR2nI7XBqrPoywGfxqIx/DgarGvDJZAD3YBTgQ==",
|
|
||||||
"dev": true,
|
|
||||||
"bin": {
|
|
||||||
"lcov-parse": "bin/cli.js"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/leac": {
|
"node_modules/leac": {
|
||||||
"version": "0.6.0",
|
"version": "0.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/leac/-/leac-0.6.0.tgz",
|
"resolved": "https://registry.npmjs.org/leac/-/leac-0.6.0.tgz",
|
||||||
@@ -2902,12 +2847,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/linkify-it": {
|
"node_modules/linkify-it": {
|
||||||
"version": "4.0.1",
|
"version": "5.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz",
|
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz",
|
||||||
"integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==",
|
"integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"uc.micro": "^1.0.1"
|
"uc.micro": "^2.0.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/locate-path": {
|
"node_modules/locate-path": {
|
||||||
@@ -2940,15 +2885,6 @@
|
|||||||
"integrity": "sha512-hXt6Ul/5yWjfklSGvLQl8vM//l3FtyHZeuelpzK6mm99pNvN9yTDruNZPEJZD1oWrqo+izBmB7oUfWgcCX7s4Q==",
|
"integrity": "sha512-hXt6Ul/5yWjfklSGvLQl8vM//l3FtyHZeuelpzK6mm99pNvN9yTDruNZPEJZD1oWrqo+izBmB7oUfWgcCX7s4Q==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/log-driver": {
|
|
||||||
"version": "1.2.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz",
|
|
||||||
"integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==",
|
|
||||||
"dev": true,
|
|
||||||
"engines": {
|
|
||||||
"node": ">=0.8.6"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/long": {
|
"node_modules/long": {
|
||||||
"version": "3.2.0",
|
"version": "3.2.0",
|
||||||
"resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz",
|
"resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz",
|
||||||
@@ -2980,9 +2916,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mailparser": {
|
"node_modules/mailparser": {
|
||||||
"version": "3.6.5",
|
"version": "3.6.7",
|
||||||
"resolved": "https://registry.npmjs.org/mailparser/-/mailparser-3.6.5.tgz",
|
"resolved": "https://registry.npmjs.org/mailparser/-/mailparser-3.6.7.tgz",
|
||||||
"integrity": "sha512-nteTpF0Khm5JLOnt4sigmzNdUH/6mO7PZ4KEnvxf4mckyXYFFhrtAWZzbq/V5aQMH+049gA7ZjfLdh+QiX2Uqg==",
|
"integrity": "sha512-/3x8HW70DNehw+3vdOPKdlLuxOHoWcGB5jfx5vJ5XUbY9/2jUJbrrhda5Si8Dj/3w08U0y5uGAkqs5+SPTPKoA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"encoding-japanese": "2.0.0",
|
"encoding-japanese": "2.0.0",
|
||||||
@@ -2990,10 +2926,10 @@
|
|||||||
"html-to-text": "9.0.5",
|
"html-to-text": "9.0.5",
|
||||||
"iconv-lite": "0.6.3",
|
"iconv-lite": "0.6.3",
|
||||||
"libmime": "5.2.1",
|
"libmime": "5.2.1",
|
||||||
"linkify-it": "4.0.1",
|
"linkify-it": "5.0.0",
|
||||||
"mailsplit": "5.4.0",
|
"mailsplit": "5.4.0",
|
||||||
"nodemailer": "6.9.3",
|
"nodemailer": "6.9.9",
|
||||||
"tlds": "1.240.0"
|
"tlds": "1.248.0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/mailparser/node_modules/iconv-lite": {
|
"node_modules/mailparser/node_modules/iconv-lite": {
|
||||||
@@ -3140,15 +3076,6 @@
|
|||||||
"node": "*"
|
"node": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/minimist": {
|
|
||||||
"version": "1.2.7",
|
|
||||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz",
|
|
||||||
"integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==",
|
|
||||||
"dev": true,
|
|
||||||
"funding": {
|
|
||||||
"url": "https://github.com/sponsors/ljharb"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/mkdirp-classic": {
|
"node_modules/mkdirp-classic": {
|
||||||
"version": "0.5.3",
|
"version": "0.5.3",
|
||||||
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
|
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
|
||||||
@@ -3200,9 +3127,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/nodemailer": {
|
"node_modules/nodemailer": {
|
||||||
"version": "6.9.3",
|
"version": "6.9.9",
|
||||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.3.tgz",
|
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.9.tgz",
|
||||||
"integrity": "sha512-fy9v3NgTzBngrMFkDsKEj0r02U7jm6XfC3b52eoNV+GCrGj+s8pt5OqhiJdWKuw51zCTdiNR/IUD1z33LIIGpg==",
|
"integrity": "sha512-dexTll8zqQoVJEZPwQAKzxxtFn0qTnjdQTchoU6Re9BUUGBJiOy3YMn/0ShTW6J5M0dfQ1NeDeRTTl4oIWgQMA==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"engines": {
|
"engines": {
|
||||||
"node": ">=6.0.0"
|
"node": ">=6.0.0"
|
||||||
@@ -3994,9 +3921,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/rooibos-roku": {
|
"node_modules/rooibos-roku": {
|
||||||
"version": "5.8.0",
|
"version": "5.11.0",
|
||||||
"resolved": "https://registry.npmjs.org/rooibos-roku/-/rooibos-roku-5.8.0.tgz",
|
"resolved": "https://registry.npmjs.org/rooibos-roku/-/rooibos-roku-5.11.0.tgz",
|
||||||
"integrity": "sha512-mPAszwOH1VdxMgSaoXQ/CgpAZ3RQ0A+d3BoxyY8axMsYS5kPO/8dL8fa7iFTGEZYA7803Ur52zlyN8GXqV5nLg==",
|
"integrity": "sha512-qxTYwsyp6Ihb6B8tmFm+24DE/s2gMCxagvdABElGWgqL834M+kZtmwrQXvSrMkM+0gkmQfIDuw1M4v484gycYQ==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"source-map": "^0.7.3",
|
"source-map": "^0.7.3",
|
||||||
@@ -4110,9 +4037,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/semver": {
|
"node_modules/semver": {
|
||||||
"version": "7.5.4",
|
"version": "7.6.0",
|
||||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.4.tgz",
|
"resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz",
|
||||||
"integrity": "sha512-1bCSESV6Pv+i21Hvpxp3Dx+pSD8lIPt8uVjRrxAUt/nbswYc+tK6Y2btiULjd4+fnq15PX+nqQDC7Oft7WkwcA==",
|
"integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"lru-cache": "^6.0.0"
|
"lru-cache": "^6.0.0"
|
||||||
@@ -4477,9 +4404,9 @@
|
|||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/tlds": {
|
"node_modules/tlds": {
|
||||||
"version": "1.240.0",
|
"version": "1.248.0",
|
||||||
"resolved": "https://registry.npmjs.org/tlds/-/tlds-1.240.0.tgz",
|
"resolved": "https://registry.npmjs.org/tlds/-/tlds-1.248.0.tgz",
|
||||||
"integrity": "sha512-1OYJQenswGZSOdRw7Bql5Qu7uf75b+F3HFBXbqnG/ifHa0fev1XcG+3pJf3pA/KC6RtHQzfKgIf1vkMlMG7mtQ==",
|
"integrity": "sha512-noj0KdpWTBhwsKxMOXk0rN9otg4kTgLm4WohERRHbJ9IY+kSDKr3RmjitaQ3JFzny+DyvBOQKlFZhp0G0qNSfg==",
|
||||||
"dev": true,
|
"dev": true,
|
||||||
"bin": {
|
"bin": {
|
||||||
"tlds": "bin.js"
|
"tlds": "bin.js"
|
||||||
@@ -4612,9 +4539,9 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/uc.micro": {
|
"node_modules/uc.micro": {
|
||||||
"version": "1.0.6",
|
"version": "2.0.0",
|
||||||
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
|
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.0.0.tgz",
|
||||||
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==",
|
"integrity": "sha512-DffL94LsNOccVn4hyfRe5rdKa273swqeA5DJpMOeFmEn1wCDc7nAbbB0gXlgBCL7TNzeTv6G7XVWzan7iJtfig==",
|
||||||
"dev": true
|
"dev": true
|
||||||
},
|
},
|
||||||
"node_modules/unbzip2-stream": {
|
"node_modules/unbzip2-stream": {
|
||||||
|
|||||||
@@ -1,30 +1,30 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet",
|
"name": "playlet",
|
||||||
"version": "0.18.1",
|
"version": "0.19.2",
|
||||||
"description": "Unofficial Youtube client for Roku",
|
"description": "Unofficial YouTube client for Roku",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@rokucommunity/bslint": "^0.8.13",
|
"@rokucommunity/bslint": "^0.8.17",
|
||||||
"@types/crypto-js": "^4.2.1",
|
"@types/crypto-js": "^4.2.2",
|
||||||
"@types/fs-extra": "^11.0.4",
|
"@types/fs-extra": "^11.0.4",
|
||||||
"@types/node": "^20.10.6",
|
"@types/node": "^20.11.17",
|
||||||
"@types/xml2js": "^0.4.14",
|
"@types/xml2js": "^0.4.14",
|
||||||
"argparse": "^2.0.1",
|
"argparse": "^2.0.1",
|
||||||
"brighterscript": "0.65.15",
|
"brighterscript": "0.65.22",
|
||||||
"brighterscript-formatter": "^1.6.36",
|
"brighterscript-formatter": "^1.6.40",
|
||||||
"convert-svg-to-png": "^0.6.4",
|
"convert-svg-to-png": "^0.6.4",
|
||||||
"cross-fetch": "^4.0.0",
|
"cross-fetch": "^4.0.0",
|
||||||
"crypto-js": "^4.2.0",
|
"crypto-js": "^4.2.0",
|
||||||
"dotenv": "^16.3.1",
|
"dotenv": "^16.4.1",
|
||||||
"express": "^4.18.2",
|
"express": "^4.18.2",
|
||||||
"fs-extra": "^11.2.0",
|
"fs-extra": "^11.2.0",
|
||||||
"glob": "^10.3.10",
|
"glob": "^10.3.10",
|
||||||
"imap": "^0.8.19",
|
"imap": "^0.8.19",
|
||||||
"ip": "^1.1.8",
|
"ip": "^1.1.8",
|
||||||
"json5": "^2.2.3",
|
"json5": "^2.2.3",
|
||||||
"mailparser": "^3.6.5",
|
"mailparser": "^3.6.7",
|
||||||
"roku-deploy": "^3.11.2",
|
"roku-deploy": "^3.11.2",
|
||||||
"rooibos-roku": "^5.8.0",
|
"rooibos-roku": "^5.11.0",
|
||||||
"semver": "^7.5.4",
|
"semver": "^7.6.0",
|
||||||
"shelljs": "^0.8.5",
|
"shelljs": "^0.8.5",
|
||||||
"ts-node": "^10.9.2",
|
"ts-node": "^10.9.2",
|
||||||
"typescript": "^5.3.3",
|
"typescript": "^5.3.3",
|
||||||
@@ -65,6 +65,9 @@
|
|||||||
"generate-sponsorblock-config": "node tools/generate-sponsorblock-config.js",
|
"generate-sponsorblock-config": "node tools/generate-sponsorblock-config.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",
|
"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",
|
"postinstall": "cd playlet-lib && npm install && cd ../playlet-app && npm install && cd ../playlet-web && npm install",
|
||||||
"update-deps": "npx npm-check-updates -u && cd playlet-app && npx npm-check-updates -u && cd ../playlet-lib && npx npm-check-updates -u && cd ../playlet-web && npx npm-check-updates -u"
|
"update-deps": "npx npm-check-updates -u && cd playlet-app && npx npm-check-updates -u && cd ../playlet-lib && npx npm-check-updates -u && cd ../playlet-web && npx npm-check-updates -u",
|
||||||
|
"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"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-app",
|
"name": "playlet-app",
|
||||||
"version": "0.18.1",
|
"version": "0.19.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "playlet-app",
|
"name": "playlet-app",
|
||||||
"version": "0.18.1"
|
"version": "0.19.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-app",
|
"name": "playlet-app",
|
||||||
"version": "0.18.1",
|
"version": "0.19.2",
|
||||||
"description": "Unofficial Youtube client for Roku",
|
"description": "Unofficial YouTube client for Roku",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "rm -rf build/playlet-app",
|
"prebuild": "rm -rf build/playlet-app",
|
||||||
"prebuild:dev": "npm run prebuild",
|
"prebuild:dev": "npm run prebuild",
|
||||||
|
|||||||
@@ -1,8 +1,6 @@
|
|||||||
import "LoadingMessages.bs"
|
import "LoadingMessages.bs"
|
||||||
|
import "pkg:/source/Logger.bs"
|
||||||
|
|
||||||
' TODO:P2 Add a "logQueue" field to the scene, and push it to the logger later when playlet-lib is loaded
|
|
||||||
' Alternatively, just log to the console and the known log file in cachefs
|
|
||||||
' TODO:P2 log the playlet-lib load status and load speed to the log queue
|
|
||||||
function Init() as void
|
function Init() as void
|
||||||
m.scene = m.top.getScene()
|
m.scene = m.top.getScene()
|
||||||
m.top.backgroundColor = "#242424FF"
|
m.top.backgroundColor = "#242424FF"
|
||||||
@@ -24,17 +22,17 @@ end function
|
|||||||
|
|
||||||
function GetPlayletLibUrls() as object
|
function GetPlayletLibUrls() as object
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
debug = { type: "debug", link: ReadManifestValue("playlet_lib_debug_url") }
|
debug = { type: "debug", link: Manifest.ReadValue("playlet_lib_debug_url") }
|
||||||
return [debug]
|
return [debug]
|
||||||
#else
|
#else
|
||||||
savedUrls = GetPlayletLibUrlsFromRegistry()
|
savedUrls = Registry.GetPlayletLibUrlsFromRegistry()
|
||||||
if savedUrls <> invalid
|
if savedUrls <> invalid
|
||||||
m.shouldClearRegistryOnLoadFail = true
|
m.shouldClearRegistryOnLoadFail = true
|
||||||
return savedUrls
|
return savedUrls
|
||||||
end if
|
end if
|
||||||
|
|
||||||
github = { type: "github", link: ReadManifestValue("playlet_lib_remote_url") }
|
github = { type: "github", link: Manifest.ReadValue("playlet_lib_remote_url") }
|
||||||
embedded = { type: "embedded", link: ReadManifestValue("playlet_lib_embedded_url") }
|
embedded = { type: "embedded", link: Manifest.ReadValue("playlet_lib_embedded_url") }
|
||||||
return [github, embedded]
|
return [github, embedded]
|
||||||
#end if
|
#end if
|
||||||
end function
|
end function
|
||||||
@@ -43,7 +41,7 @@ function LoadPlayletLib() as void
|
|||||||
if m.playletLibUrlIndex >= m.playletLibUrls.Count()
|
if m.playletLibUrlIndex >= m.playletLibUrls.Count()
|
||||||
m.loadingIndicator.visible = false
|
m.loadingIndicator.visible = false
|
||||||
if m.shouldClearRegistryOnLoadFail = true
|
if m.shouldClearRegistryOnLoadFail = true
|
||||||
DeleteRegistryKey("playlet_lib_urls", "Playlet")
|
Registry.DeleteKey("playlet_lib_urls", "Playlet")
|
||||||
end if
|
end if
|
||||||
ShowPlayletLibLoadErrorDialog()
|
ShowPlayletLibLoadErrorDialog()
|
||||||
return
|
return
|
||||||
@@ -58,8 +56,8 @@ function OnLoadStatusChanged() as void
|
|||||||
libUrl = m.playletLibUrls[m.playletLibUrlIndex]
|
libUrl = m.playletLibUrls[m.playletLibUrlIndex]
|
||||||
if m.lib.loadStatus = "ready"
|
if m.lib.loadStatus = "ready"
|
||||||
RemoveComponentLibrary()
|
RemoveComponentLibrary()
|
||||||
' bs:disable-next-line LINT3012
|
Logger.Log(`Playlet lib loaded from ${libUrl.link} in ${m.timer.TotalMilliseconds()} ms`)
|
||||||
?"Playlet lib loaded from " libUrl.link
|
m.timer = invalid
|
||||||
m.scene.playletLibLoadedUrl = libUrl
|
m.scene.playletLibLoadedUrl = libUrl
|
||||||
container = m.scene.findNode("MainSceneContainer")
|
container = m.scene.findNode("MainSceneContainer")
|
||||||
container.createChild("PlayletLib:MainScene")
|
container.createChild("PlayletLib:MainScene")
|
||||||
@@ -67,8 +65,7 @@ function OnLoadStatusChanged() as void
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
if m.lib.loadStatus = "failed"
|
if m.lib.loadStatus = "failed"
|
||||||
' bs:disable-next-line LINT3012
|
Logger.Log(`Playlet lib failed to load from ${libUrl.link}`)
|
||||||
?"Playlet lib failed to load from " libUrl.link
|
|
||||||
' Try next url
|
' Try next url
|
||||||
m.playletLibUrlIndex += 1
|
m.playletLibUrlIndex += 1
|
||||||
LoadPlayletLib()
|
LoadPlayletLib()
|
||||||
@@ -86,11 +83,14 @@ function RemoveComponentLibrary() as void
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function LoadComponentLibrary(uri as string)
|
function LoadComponentLibrary(uri as string)
|
||||||
|
m.timer = CreateObject("roTimespan")
|
||||||
|
m.timer.mark()
|
||||||
|
|
||||||
m.lib = m.scene.createChild("ComponentLibrary")
|
m.lib = m.scene.createChild("ComponentLibrary")
|
||||||
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
||||||
m.lib.observeField("loadStatus", "OnLoadStatusChanged")
|
m.lib.observeField("loadStatus", "OnLoadStatusChanged")
|
||||||
' bs:disable-next-line LINT3012
|
|
||||||
?"Loading Playlet lib from " uri
|
Logger.Log(`Loading Playlet lib from ${uri}`)
|
||||||
m.lib.uri = uri
|
m.lib.uri = uri
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -109,5 +109,5 @@ function ShowPlayletLibLoadErrorDialog()
|
|||||||
"If the problem persist, contact Playlet authors."
|
"If the problem persist, contact Playlet authors."
|
||||||
]
|
]
|
||||||
|
|
||||||
ShowErrorDialog(message, bulletText, bottomText)
|
DialogShowError(message, bulletText, bottomText)
|
||||||
end function
|
end function
|
||||||
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 76 KiB |
@@ -2,8 +2,8 @@ title=Playlet
|
|||||||
|
|
||||||
# Do not update version manually, it is auto updated from package.json
|
# Do not update version manually, it is auto updated from package.json
|
||||||
major_version=0
|
major_version=0
|
||||||
minor_version=18
|
minor_version=19
|
||||||
build_version=00001
|
build_version=00002
|
||||||
|
|
||||||
ui_resolutions=hd
|
ui_resolutions=hd
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,22 @@
|
|||||||
function ShowErrorDialog(message as object, bulletText as object, bottomMessage as object)
|
function DialogShowError(message as object, bulletText as object, bottomMessage as object)
|
||||||
' Note: dialog can be null since StandardMessageDialog is only available on 10.0 and later
|
' Note: dialog can be null since StandardMessageDialog is only available on 10.0 and later
|
||||||
dialog = CreateObject("roSGNode", "StandardMessageDialog")
|
msgDialog = CreateObject("roSGNode", "StandardMessageDialog")
|
||||||
SetPalette(dialog)
|
DialogSetPalette(msgDialog)
|
||||||
dialog.message = message
|
msgDialog.message = message
|
||||||
dialog.bulletText = bulletText
|
msgDialog.bulletText = bulletText
|
||||||
dialog.bottomMessage = bottomMessage
|
msgDialog.bottomMessage = bottomMessage
|
||||||
dialog.title = "Error loading Playlet"
|
msgDialog.title = "Error loading Playlet"
|
||||||
dialog.buttons = ["Exit"]
|
msgDialog.buttons = ["Exit"]
|
||||||
|
|
||||||
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
||||||
dialog.observeField("buttonSelected", "OnButtonSelected")
|
msgDialog.observeField("buttonSelected", "DialogOnButtonSelected")
|
||||||
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
||||||
dialog.observeField("wasClosed", "OnDialogClosed")
|
msgDialog.observeField("wasClosed", "DialogOnClosed")
|
||||||
|
|
||||||
m.top.getScene().dialog = dialog
|
m.top.getScene().dialog = msgDialog
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function SetPalette(dialog as object)
|
function DialogSetPalette(msgDialog as object)
|
||||||
palette = createObject("roSGNode", "RSGPalette")
|
palette = createObject("roSGNode", "RSGPalette")
|
||||||
palette.colors = {
|
palette.colors = {
|
||||||
DialogBackgroundColor: "#242424FF"
|
DialogBackgroundColor: "#242424FF"
|
||||||
@@ -26,15 +26,13 @@ function SetPalette(dialog as object)
|
|||||||
DialogSecondaryItemColor: "#FF1C30FF"
|
DialogSecondaryItemColor: "#FF1C30FF"
|
||||||
DialogTextColor: "#DBDBDBFF"
|
DialogTextColor: "#DBDBDBFF"
|
||||||
}
|
}
|
||||||
dialog.palette = palette
|
msgDialog.palette = palette
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnButtonSelected()
|
function DialogOnButtonSelected()
|
||||||
m.top.getScene().dialog.close = true
|
m.top.getScene().dialog.close = true
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnDialogClosed()
|
function DialogOnClosed()
|
||||||
' TODO:P1 throw an exception to cause a crash report to be generated
|
|
||||||
' Should include which playlet lib failed to load
|
|
||||||
m.top.getScene().exitChannel = true
|
m.top.getScene().exitChannel = true
|
||||||
end function
|
end function
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
namespace Logger
|
||||||
|
|
||||||
|
' Put the file at the root directry to avoid needing to create a folder
|
||||||
|
const LOGS_FILE_PATH = "cachefs:/playlet_startup_logs.txt"
|
||||||
|
|
||||||
|
function Init()
|
||||||
|
DeleteFile(LOGS_FILE_PATH)
|
||||||
|
end function
|
||||||
|
|
||||||
|
function Log(msg as string)
|
||||||
|
msg = "[APP] " + msg
|
||||||
|
' bs:disable-next-line LINT3012
|
||||||
|
print(msg)
|
||||||
|
|
||||||
|
buffer = CreateObject("roByteArray")
|
||||||
|
buffer.FromAsciiString(msg + `\n`)
|
||||||
|
buffer.AppendFile(LOGS_FILE_PATH)
|
||||||
|
end function
|
||||||
|
|
||||||
|
end namespace
|
||||||
@@ -19,8 +19,9 @@ function Main(args as object) as void
|
|||||||
port = CreateObject("roMessagePort")
|
port = CreateObject("roMessagePort")
|
||||||
screen.setMessagePort(port)
|
screen.setMessagePort(port)
|
||||||
m.global = screen.getGlobalNode()
|
m.global = screen.getGlobalNode()
|
||||||
|
Logger.Init()
|
||||||
|
|
||||||
ClearPlayletLibUrlsIfNeeded(args)
|
Registry.ClearPlayletLibUrlsIfNeeded(args)
|
||||||
|
|
||||||
scene = screen.CreateScene("BootstrapScene")
|
scene = screen.CreateScene("BootstrapScene")
|
||||||
screen.show()
|
screen.show()
|
||||||
@@ -44,7 +45,7 @@ function Main(args as object) as void
|
|||||||
input = CreateObject("roInput")
|
input = CreateObject("roInput")
|
||||||
input.setMessagePort(port)
|
input.setMessagePort(port)
|
||||||
|
|
||||||
' TODO:P1 follow up on bug where roSystemLog does not fire for a video player in ComponentLibrary
|
' 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
|
' https://community.roku.com/t5/Roku-Developer-Program/BUG-roSystemLog-not-firing-with-ComponentLibrary/td-p/906075
|
||||||
systemLog = CreateObject("roSystemLog")
|
systemLog = CreateObject("roSystemLog")
|
||||||
systemLog.SetMessagePort(port)
|
systemLog.SetMessagePort(port)
|
||||||
@@ -77,7 +78,7 @@ function Main(args as object) as void
|
|||||||
field = msg.getField()
|
field = msg.getField()
|
||||||
data = msg.getData()
|
data = msg.getData()
|
||||||
if field = "exitChannel" and data = true
|
if field = "exitChannel" and data = true
|
||||||
END
|
return
|
||||||
end if
|
end if
|
||||||
else if msgType = "roInputEvent"
|
else if msgType = "roInputEvent"
|
||||||
scene.inputArgs = msg.getInfo()
|
scene.inputArgs = msg.getInfo()
|
||||||
|
|||||||
@@ -1,4 +1,9 @@
|
|||||||
function ReadManifestValue(key as string) as string
|
namespace Manifest
|
||||||
|
|
||||||
|
function ReadValue(key as string) as string
|
||||||
appInfo = CreateObject("roAppInfo")
|
appInfo = CreateObject("roAppInfo")
|
||||||
return appInfo.GetValue(key)
|
return appInfo.GetValue(key)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
end namespace
|
||||||
|
|
||||||
@@ -11,7 +11,7 @@ namespace Tests
|
|||||||
@params("playlet_lib_remote_url", "https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip")
|
@params("playlet_lib_remote_url", "https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip")
|
||||||
@params("playlet_lib_embedded_url", "pkg:/lib/playlet-lib.zip")
|
@params("playlet_lib_embedded_url", "pkg:/lib/playlet-lib.zip")
|
||||||
function _(key as string, expectedValue as string)
|
function _(key as string, expectedValue as string)
|
||||||
m.assertEqual(ReadManifestValue(key), expectedValue)
|
m.assertEqual(Manifest.ReadValue(key), expectedValue)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
end class
|
end class
|
||||||
|
|||||||
@@ -1,29 +1,34 @@
|
|||||||
function ReadRegistryKey(key as string, section as string) as dynamic
|
namespace Registry
|
||||||
|
|
||||||
|
function ReadKey(key as string, section as string) as dynamic
|
||||||
sec = CreateObject("roRegistrySection", section)
|
sec = CreateObject("roRegistrySection", section)
|
||||||
if not sec.Exists(key)
|
if not sec.Exists(key)
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
return sec.Read(key)
|
return sec.Read(key)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function DeleteRegistryKey(key as string, section as string)
|
function DeleteKey(key as string, section as string)
|
||||||
sec = CreateObject("roRegistrySection", section)
|
sec = CreateObject("roRegistrySection", section)
|
||||||
sec.Delete(key)
|
sec.Delete(key)
|
||||||
sec.Flush()
|
sec.Flush()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function GetPlayletLibUrlsFromRegistry() as object
|
function GetPlayletLibUrlsFromRegistry() as object
|
||||||
urlsJson = ReadRegistryKey("playlet_lib_urls", "Playlet")
|
urlsJson = ReadKey("playlet_lib_urls", "Playlet")
|
||||||
if urlsJson = invalid
|
if urlsJson = invalid
|
||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
urls = ParseJson(urlsJson)
|
urls = ParseJson(urlsJson)
|
||||||
return urls
|
return urls
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function ClearPlayletLibUrlsIfNeeded(launchArgs as object) as void
|
function ClearPlayletLibUrlsIfNeeded(launchArgs as object) as void
|
||||||
if launchArgs = invalid or launchArgs.clearPlayletLibUrls = invalid
|
if launchArgs = invalid or launchArgs.clearPlayletLibUrls = invalid
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
DeleteRegistryKey("playlet_lib_urls", "Playlet")
|
DeleteKey("playlet_lib_urls", "Playlet")
|
||||||
end function
|
Logger.Log("Cleared key playlet_lib_urls from registry")
|
||||||
|
end function
|
||||||
|
|
||||||
|
end namespace
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-lib",
|
"name": "playlet-lib",
|
||||||
"version": "0.18.1",
|
"version": "0.19.2",
|
||||||
"lockfileVersion": 2,
|
"lockfileVersion": 2,
|
||||||
"requires": true,
|
"requires": true,
|
||||||
"packages": {
|
"packages": {
|
||||||
"": {
|
"": {
|
||||||
"name": "playlet-lib",
|
"name": "playlet-lib",
|
||||||
"version": "0.18.1"
|
"version": "0.19.2"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"name": "playlet-lib",
|
"name": "playlet-lib",
|
||||||
"version": "0.18.1",
|
"version": "0.19.2",
|
||||||
"description": "Unofficial Youtube client for Roku",
|
"description": "Unofficial YouTube client for Roku",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"prebuild": "rm -rf build/playlet-lib",
|
"prebuild": "rm -rf build/playlet-lib",
|
||||||
"prebuild:dev": "npm run prebuild",
|
"prebuild:dev": "npm run prebuild",
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
import "pkg:/components/Navigation/Navigation.bs"
|
import "pkg:/components/Navigation/Navigation.bs"
|
||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||||
|
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||||
import "pkg:/source/utils/DisposableObserve.bs"
|
import "pkg:/source/utils/DisposableObserve.bs"
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
import "pkg:/source/utils/Logging.bs"
|
import "pkg:/source/utils/Logging.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
import "SubscribeTask.bs"
|
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
m.container = m.top.findNode("container")
|
m.container = m.top.findNode("container")
|
||||||
@@ -134,7 +134,7 @@ function OnSubscribeButtonSelected()
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
isSubbed = IsSubscribed()
|
isSubbed = IsSubscribed()
|
||||||
m.subscribeTask = StartAsyncTask(SubscribeTask, {
|
m.subscribeTask = AsyncTask.Start(Tasks.SubscribeTask, {
|
||||||
invidious: m.invidious
|
invidious: m.invidious
|
||||||
ucid: m.authorId
|
ucid: m.authorId
|
||||||
subscribe: not isSubbed
|
subscribe: not isSubbed
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
translation="[115,20]"
|
translation="[115,20]"
|
||||||
width="104"
|
width="104"
|
||||||
height="104"
|
height="104"
|
||||||
uri="pkg:/images/circle-mask-500.png">
|
uri="pkg:/images/white-circle.png">
|
||||||
|
|
||||||
<CirclePoster
|
<CirclePoster
|
||||||
id="thumbnail"
|
id="thumbnail"
|
||||||
|
|||||||
@@ -10,13 +10,13 @@
|
|||||||
<field id="failedBitmapUri" type="uri" alias="Poster.failedBitmapUri" />
|
<field id="failedBitmapUri" type="uri" alias="Poster.failedBitmapUri" />
|
||||||
<field id="loadStatus" type="string" alias="Poster.loadStatus" />
|
<field id="loadStatus" type="string" alias="Poster.loadStatus" />
|
||||||
|
|
||||||
<field id="maskUri" type="uri" value="pkg:/images/circle-mask-500.png" alias="MaskGroup.maskuri" />
|
<field id="maskUri" type="uri" value="pkg:/images/white-circle.png" alias="MaskGroup.maskuri" />
|
||||||
<field id="maskSize" type="vector2d" alias="MaskGroup.maskSize" />
|
<field id="maskSize" type="vector2d" alias="MaskGroup.maskSize" />
|
||||||
</interface>
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
<MaskGroup
|
<MaskGroup
|
||||||
id="MaskGroup"
|
id="MaskGroup"
|
||||||
maskuri="pkg:/images/circle-mask-500.png">
|
maskuri="pkg:/images/white-circle.png">
|
||||||
<Poster
|
<Poster
|
||||||
id="Poster" />
|
id="Poster" />
|
||||||
</MaskGroup>
|
</MaskGroup>
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
import "pkg:/components/ContentNode/ChannelContentTask.bs"
|
|
||||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/components/VideoFeed/FeedLoadState.bs"
|
||||||
|
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||||
|
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||||
import "pkg:/source/utils/ErrorUtils.bs"
|
import "pkg:/source/utils/ErrorUtils.bs"
|
||||||
|
import "pkg:/source/utils/Logging.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
end function
|
end function
|
||||||
@@ -17,7 +19,7 @@ function LoadChannel(invidiousNode as object) as void
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
m.top.loadState = FeedLoadState.Loading
|
m.top.loadState = FeedLoadState.Loading
|
||||||
m.contentTask = StartAsyncTask(ChannelContentTask, {
|
m.contentTask = AsyncTask.Start(Tasks.ChannelContentTask, {
|
||||||
content: m.top
|
content: m.top
|
||||||
invidious: invidiousNode
|
invidious: invidiousNode
|
||||||
}, OnChannelContentTaskResult)
|
}, OnChannelContentTaskResult)
|
||||||
|
|||||||
@@ -163,6 +163,17 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
|||||||
Close()
|
Close()
|
||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
|
if key = "up"
|
||||||
|
m.optionsList.jumpToItem = m.optionsList.content.getChildCount() - 1
|
||||||
|
return true
|
||||||
|
end if
|
||||||
|
|
||||||
|
if key = "down"
|
||||||
|
m.optionsList.jumpToItem = 0
|
||||||
|
return true
|
||||||
|
end if
|
||||||
|
|
||||||
return false
|
return false
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import "DialogPalette.bs"
|
import "DialogPalette.bs"
|
||||||
import "pkg:/components/Screens/WebAppScreen/GenerateQrCodeTask.bs"
|
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
@@ -33,7 +33,7 @@ function OnUrlSet()
|
|||||||
url = m.top.url
|
url = m.top.url
|
||||||
|
|
||||||
m.urlLabel.text = url
|
m.urlLabel.text = url
|
||||||
StartAsyncTask(GenerateQrCodeTask, {
|
AsyncTask.Start(Tasks.GenerateQrCodeTask, {
|
||||||
poster: m.qrCode
|
poster: m.qrCode
|
||||||
text: url
|
text: url
|
||||||
size: m.qrCode.loadWidth
|
size: m.qrCode.loadWidth
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
<StdDlgTitleArea primaryTitle="Login to Invidious" />
|
<StdDlgTitleArea primaryTitle="Login to Invidious" />
|
||||||
<StdDlgContentArea>
|
<StdDlgContentArea>
|
||||||
<StdDlgTextItem
|
<StdDlgTextItem
|
||||||
text="Login to Invidious in order to view Subscriptions, Playlists, and use the Watch history." />
|
text="Login to Invidious in order to view Subscriptions, Playlists, and use the Watch history.

Please note that an Invidious account is different from a YouTube account." />
|
||||||
</StdDlgContentArea>
|
</StdDlgContentArea>
|
||||||
<StdDlgButtonArea id="buttonArea">
|
<StdDlgButtonArea id="buttonArea">
|
||||||
<StdDlgButton text="OK" />
|
<StdDlgButton text="OK" />
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "pkg:/source/utils/Logging.bs"
|
import "pkg:/source/utils/Logging.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
m.top.functionName = "LoggerLoop"
|
m.top.functionName = "LoggerLoop"
|
||||||
@@ -15,7 +15,11 @@ function Init()
|
|||||||
|
|
||||||
m.port = port
|
m.port = port
|
||||||
|
|
||||||
StartLogger(m.top)
|
#if DEBUG
|
||||||
|
StartLogger(m.top, LogLevel.Debug)
|
||||||
|
#else
|
||||||
|
StartLogger(m.top, LogLevel.Info)
|
||||||
|
#end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function StartLogger(logger as object, logLevel = LogLevel.Info as LogLevel) as void
|
function StartLogger(logger as object, logLevel = LogLevel.Info as LogLevel) as void
|
||||||
@@ -32,13 +36,23 @@ function LoggerLoop()
|
|||||||
port = m.port
|
port = m.port
|
||||||
|
|
||||||
buffer = CreateObject("roByteArray")
|
buffer = CreateObject("roByteArray")
|
||||||
previousLogsFile = m.top.folder + "/" + m.top.filenamePrevious
|
|
||||||
logsFile = m.top.folder + "/" + m.top.filename
|
logsFile = m.top.folder + "/" + m.top.filename
|
||||||
|
previousLogsFile = m.top.folder + "/" + m.top.filenamePrevious
|
||||||
|
filenameStartup = m.top.filenameStartup
|
||||||
|
|
||||||
CreateDirectory(m.top.folder)
|
CreateDirectory(m.top.folder)
|
||||||
DeleteFile(previousLogsFile)
|
DeleteFile(previousLogsFile)
|
||||||
MoveFile(logsFile, previousLogsFile)
|
MoveFile(logsFile, previousLogsFile)
|
||||||
|
|
||||||
|
startUpLogs = ReadAsciiFile(filenameStartup)
|
||||||
|
if not StringUtils.IsNullOrEmpty(startUpLogs)
|
||||||
|
line = `************* Startup Logs *************\n${startUpLogs}*********** End Startup Logs ***********\n`
|
||||||
|
' bs:disable-next-line LINT3012
|
||||||
|
print line
|
||||||
|
buffer.FromAsciiString(line)
|
||||||
|
buffer.AppendFile(logsFile)
|
||||||
|
end if
|
||||||
|
|
||||||
while true
|
while true
|
||||||
msg = wait(0, port)
|
msg = wait(0, port)
|
||||||
msgType = type(msg)
|
msgType = type(msg)
|
||||||
|
|||||||
@@ -5,5 +5,6 @@
|
|||||||
<field id="folder" type="string" value="cachefs:/logs" />
|
<field id="folder" type="string" value="cachefs:/logs" />
|
||||||
<field id="filename" type="string" value="app_logs.txt" />
|
<field id="filename" type="string" value="app_logs.txt" />
|
||||||
<field id="filenamePrevious" type="string" value="app_logs_previous.txt" />
|
<field id="filenamePrevious" type="string" value="app_logs_previous.txt" />
|
||||||
|
<field id="filenameStartup" type="string" value="cachefs:/playlet_startup_logs.txt" />
|
||||||
</interface>
|
</interface>
|
||||||
</component>
|
</component>
|
||||||
@@ -24,4 +24,5 @@ end function
|
|||||||
function StartWebServer()
|
function StartWebServer()
|
||||||
m.webServer = m.top.findNode("WebServer")
|
m.webServer = m.top.findNode("WebServer")
|
||||||
m.webServer.callfunc("StartServer", invalid)
|
m.webServer.callfunc("StartServer", invalid)
|
||||||
end function'//# sourceMappingURL=./MainScene.bs.map
|
end function
|
||||||
|
'//# sourceMappingURL=./MainScene.brs.map
|
||||||
@@ -8,6 +8,7 @@
|
|||||||
</interface>
|
</interface>
|
||||||
<script type="text/brightscript" uri="pkg:/components/parts/AutoBind/AutoBind.part.brs" />
|
<script type="text/brightscript" uri="pkg:/components/parts/AutoBind/AutoBind.part.brs" />
|
||||||
<script type="text/brightscript" uri="pkg:/components/MainScene_bindings.brs" />
|
<script type="text/brightscript" uri="pkg:/components/MainScene_bindings.brs" />
|
||||||
|
<script type="text/brightscript" uri="pkg:/source/utils/NodePathUtils.brs" />
|
||||||
<script type="text/brightscript" uri="pkg:/components/MainScene.brs" />
|
<script type="text/brightscript" uri="pkg:/components/MainScene.brs" />
|
||||||
<script type="text/brightscript" uri="pkg:/source/utils/LoadingScreen.brs" />
|
<script type="text/brightscript" uri="pkg:/source/utils/LoadingScreen.brs" />
|
||||||
<script type="text/brightscript" uri="pkg:/components/parts/AutoBind/OnNodeReadyNoOp.brs" />
|
<script type="text/brightscript" uri="pkg:/components/parts/AutoBind/OnNodeReadyNoOp.brs" />
|
||||||
|
|||||||
@@ -36,4 +36,5 @@ function InitializeBindings()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
end function'//# sourceMappingURL=./MainScene_bindings.bs.map
|
end function
|
||||||
|
'//# sourceMappingURL=./MainScene_bindings.brs.map
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
<field id="content" type="node" onChange="OnContentSet" />
|
<field id="content" type="node" onChange="OnContentSet" />
|
||||||
<field id="thumbnail" type="uri" alias="thumbnailPoster.uri" />
|
<field id="thumbnail" type="uri" alias="thumbnailPoster.uri" />
|
||||||
<field id="line1" type="string" alias="line1Label.text" />
|
<field id="line1" type="string" alias="line1Label.text" />
|
||||||
|
<field id="hintVisible" type="boolean" alias="hintLabel.visible" />
|
||||||
<field id="show" type="boolean" alwaysNotify="true" onChange="OnShow" />
|
<field id="show" type="boolean" alwaysNotify="true" onChange="OnShow" />
|
||||||
</interface>
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
@@ -41,6 +42,7 @@
|
|||||||
wrap="true" />
|
wrap="true" />
|
||||||
</LayoutGroup>
|
</LayoutGroup>
|
||||||
<Label
|
<Label
|
||||||
|
id="hintLabel"
|
||||||
width="480"
|
width="480"
|
||||||
font="font:SmallestSystemFont"
|
font="font:SmallestSystemFont"
|
||||||
color="0x262626ff"
|
color="0x262626ff"
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
namespace PlayQueue
|
namespace PlayQueue
|
||||||
const NOTIFICATION_NODE_ID = "PlayQueueNotification"
|
const NOTIFICATION_NODE_ID = "PlayQueueNotification"
|
||||||
|
|
||||||
function ShowNotifcation(notifications as object, contentNode as object) as void
|
function ShowNotifcation(notifications as object, contentNode as object, hintVisible as boolean) as void
|
||||||
notification = notifications.findNode(NOTIFICATION_NODE_ID)
|
notification = notifications.findNode(NOTIFICATION_NODE_ID)
|
||||||
if notification = invalid
|
if notification = invalid
|
||||||
notification = notifications.createChild("PlayQueueNotification")
|
notification = notifications.createChild("PlayQueueNotification")
|
||||||
notification.id = NOTIFICATION_NODE_ID
|
notification.id = NOTIFICATION_NODE_ID
|
||||||
end if
|
end if
|
||||||
notification.content = contentNode
|
notification.content = contentNode
|
||||||
|
notification.hintVisible = hintVisible
|
||||||
notification.show = true
|
notification.show = true
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
import "pkg:/components/NodeByRef/NodeByRef.bs"
|
import "pkg:/components/NodeByRef/NodeByRef.bs"
|
||||||
import "pkg:/components/PlaylistView/PlaylistContentTask.bs"
|
|
||||||
import "pkg:/components/PlayQueue/Notifications/PlayQueueNotificationUtils.bs"
|
import "pkg:/components/PlayQueue/Notifications/PlayQueueNotificationUtils.bs"
|
||||||
import "pkg:/components/VideoFeed/FeedLoadState.bs"
|
import "pkg:/components/VideoFeed/FeedLoadState.bs"
|
||||||
import "pkg:/components/VideoPlayer/VideoUtils.bs"
|
import "pkg:/components/VideoPlayer/VideoUtils.bs"
|
||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||||
|
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||||
import "pkg:/source/utils/ArrayUtils.bs"
|
import "pkg:/source/utils/ArrayUtils.bs"
|
||||||
import "pkg:/source/utils/ErrorUtils.bs"
|
import "pkg:/source/utils/ErrorUtils.bs"
|
||||||
import "pkg:/source/utils/Logging.bs"
|
import "pkg:/source/utils/Logging.bs"
|
||||||
@@ -42,7 +42,8 @@ function AddToQueue(node as object)
|
|||||||
m.content.appendChild(node)
|
m.content.appendChild(node)
|
||||||
queueNotifications = m.top.preferences["misc.queue_notifications"]
|
queueNotifications = m.top.preferences["misc.queue_notifications"]
|
||||||
if queueNotifications
|
if queueNotifications
|
||||||
PlayQueue.ShowNotifcation(m.top.notifications, node)
|
hintVisible = VideoUtils.GetVideoPlayer() = invalid or not VideoUtils.IsVideoPlayerFullScreen()
|
||||||
|
PlayQueue.ShowNotifcation(m.top.notifications, node, hintVisible)
|
||||||
end if
|
end if
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -188,7 +189,7 @@ function LoadPlaylist(playlist as object) as void
|
|||||||
|
|
||||||
playlist.loadState = FeedLoadState.Loading
|
playlist.loadState = FeedLoadState.Loading
|
||||||
|
|
||||||
task = StartAsyncTask(PlaylistContentTask, {
|
task = AsyncTask.Start(Tasks.PlaylistContentTask, {
|
||||||
content: playlist
|
content: playlist
|
||||||
invidious: m.top.invidious
|
invidious: m.top.invidious
|
||||||
}, OnPlaylistContentTaskResult)
|
}, OnPlaylistContentTaskResult)
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ import "pkg:/components/ChannelView/ChannelUtils.bs"
|
|||||||
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
||||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
import "pkg:/components/Navigation/LongPress.bs"
|
import "pkg:/components/Navigation/LongPress.bs"
|
||||||
import "pkg:/components/PlaylistView/PlaylistContentTask.bs"
|
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||||
import "pkg:/components/VideoFeed/FeedLoadState.bs"
|
import "pkg:/components/VideoFeed/FeedLoadState.bs"
|
||||||
import "pkg:/components/VideoPlayer/VideoUtils.bs"
|
import "pkg:/components/VideoPlayer/VideoUtils.bs"
|
||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||||
|
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||||
import "pkg:/source/utils/ErrorUtils.bs"
|
import "pkg:/source/utils/ErrorUtils.bs"
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
import "pkg:/source/utils/Logging.bs"
|
import "pkg:/source/utils/Logging.bs"
|
||||||
@@ -222,7 +223,7 @@ function LoadPlaylist() as void
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
m.top.content.loadState = FeedLoadState.Loading
|
m.top.content.loadState = FeedLoadState.Loading
|
||||||
m.playlistLoadTask = StartAsyncTask(PlaylistContentTask, {
|
m.playlistLoadTask = AsyncTask.Start(Tasks.PlaylistContentTask, {
|
||||||
content: m.top.content
|
content: m.top.content
|
||||||
invidious: m.top.invidious
|
invidious: m.top.invidious
|
||||||
}, OnPlaylistContentTaskResult)
|
}, OnPlaylistContentTaskResult)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
' TODO:P2 Add tooltip to each field with description of what it means
|
' TODO:P2 Add tooltip to each field with description of what it means
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
import "HomeScreenUtils.bs"
|
||||||
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
||||||
import "pkg:/components/Navigation/Navigation.bs"
|
import "pkg:/components/Navigation/Navigation.bs"
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
@@ -14,7 +15,15 @@ function OnNodeReady()
|
|||||||
SetNavigation(invalid, "left", m.navBar)
|
SetNavigation(invalid, "left", m.navBar)
|
||||||
|
|
||||||
m.rowList@.BindNode()
|
m.rowList@.BindNode()
|
||||||
m.rowList.feeds = ParseJson(ReadAsciiFile(m.top.feedFile))
|
|
||||||
|
' TODO:P1 home screen should only be refreshed when the user navigates to it
|
||||||
|
' (similar to bookmarks screen)
|
||||||
|
m.preferences.observeFieldScoped("misc.home_screen_layout", FuncName(OnHomeLayoutChange))
|
||||||
|
OnHomeLayoutChange()
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnHomeLayoutChange() as void
|
||||||
|
m.rowList.feeds = HomeScreenUtils.GetFeed(m.top.feedFile, m.preferences)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnFocusChange() as void
|
function OnFocusChange() as void
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
<interface>
|
<interface>
|
||||||
<field id="navBar" type="node" bind="/NavBar" />
|
<field id="navBar" type="node" bind="/NavBar" />
|
||||||
<field id="invidious" type="node" bind="/Invidious" />
|
<field id="invidious" type="node" bind="/Invidious" />
|
||||||
|
<field id="preferences" type="node" bind="/Preferences" />
|
||||||
<field id="feedFile" type="string" value="libpkg:/config/default_home_layout.yaml" />
|
<field id="feedFile" type="string" value="libpkg:/config/default_home_layout.yaml" />
|
||||||
</interface>
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
|
|||||||
@@ -0,0 +1,28 @@
|
|||||||
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
|
namespace HomeScreenUtils
|
||||||
|
|
||||||
|
function GetFeed(feedFileName as string, preferences as object) as object
|
||||||
|
feed = ParseJson(ReadAsciiFile(feedFileName))
|
||||||
|
|
||||||
|
homeLayout = preferences["misc.home_screen_layout"]
|
||||||
|
if not IsArray(homeLayout) or homeLayout.Count() = 0
|
||||||
|
return feed
|
||||||
|
end if
|
||||||
|
|
||||||
|
feedItems = {}
|
||||||
|
for each item in feed
|
||||||
|
feedItems[item["id"]] = item
|
||||||
|
end for
|
||||||
|
|
||||||
|
filteredFeed = []
|
||||||
|
for each item in homeLayout
|
||||||
|
if item.enabled = true
|
||||||
|
filteredFeed.push(feedItems[item.id])
|
||||||
|
end if
|
||||||
|
end for
|
||||||
|
|
||||||
|
return filteredFeed
|
||||||
|
end function
|
||||||
|
|
||||||
|
end namespace
|
||||||
@@ -252,7 +252,7 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
|||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if key = "options" and press
|
if key = "options"
|
||||||
' A pass-through to the app controller, so it can toggle picture-in-picture
|
' A pass-through to the app controller, so it can toggle picture-in-picture
|
||||||
return false
|
return false
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -1,7 +1,8 @@
|
|||||||
import "pkg:/components/Navigation/Navigation.bs"
|
import "pkg:/components/Navigation/Navigation.bs"
|
||||||
import "pkg:/components/Screens/SearchScreen/SearchSuggestionsTask.bs"
|
|
||||||
import "pkg:/components/Services/SearchHistory/SearchHistoryUtils.bs"
|
import "pkg:/components/Services/SearchHistory/SearchHistoryUtils.bs"
|
||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||||
|
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||||
|
import "pkg:/source/utils/CryptoUtils.bs"
|
||||||
import "pkg:/source/utils/ErrorUtils.bs"
|
import "pkg:/source/utils/ErrorUtils.bs"
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
import "pkg:/source/utils/LoadingScreen.bs"
|
import "pkg:/source/utils/LoadingScreen.bs"
|
||||||
@@ -20,6 +21,8 @@ function Init()
|
|||||||
|
|
||||||
m.rowList.screen = m.top
|
m.rowList.screen = m.top
|
||||||
|
|
||||||
|
m.keyboard.keyGrid.keyDefinitionUri = "libpkg:/config/search-keyboard-layout.json5"
|
||||||
|
|
||||||
textEditBox = m.keyboard.textEditBox
|
textEditBox = m.keyboard.textEditBox
|
||||||
textEditBox.voiceEntryType = "generic"
|
textEditBox.voiceEntryType = "generic"
|
||||||
textEditBox.voiceEnabled = true
|
textEditBox.voiceEnabled = true
|
||||||
@@ -98,7 +101,7 @@ function OnTextChange() as void
|
|||||||
m.searchSuggestionsTask.cancel = true
|
m.searchSuggestionsTask.cancel = true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.searchSuggestionsTask = StartAsyncTask(SearchSuggestionsTask, {
|
m.searchSuggestionsTask = AsyncTask.Start(Tasks.SearchSuggestionsTask, {
|
||||||
q: m.keyboard.text
|
q: m.keyboard.text
|
||||||
invidious: m.invidious
|
invidious: m.invidious
|
||||||
preferences: m.preferences
|
preferences: m.preferences
|
||||||
@@ -300,6 +303,10 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
|||||||
if m.currentNavigtionNode.isSameNode(m.suggestions)
|
if m.currentNavigtionNode.isSameNode(m.suggestions)
|
||||||
OnSearchButtonFocused()
|
OnSearchButtonFocused()
|
||||||
end if
|
end if
|
||||||
|
if m.currentNavigtionNode.isSameNode(m.keyboard)
|
||||||
|
' First section, grid, row and key
|
||||||
|
m.keyboard.keyGrid.jumpToKey = [0, 0, 0, 0]
|
||||||
|
end if
|
||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
return false
|
return false
|
||||||
|
|||||||
@@ -0,0 +1,58 @@
|
|||||||
|
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||||
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
|
function Init()
|
||||||
|
m.top.focusable = true
|
||||||
|
m.top.itemSpacings = [8]
|
||||||
|
|
||||||
|
m.button = m.top.findNode("button")
|
||||||
|
m.button.observeField("buttonSelected", FuncName(OpenHomeScreenEditor))
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnFocusChange() as void
|
||||||
|
if not m.top.focus
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
NodeSetFocus(m.button, true)
|
||||||
|
end function
|
||||||
|
|
||||||
|
function BindPreference(preferences as object, key as string)
|
||||||
|
if m.preferences <> invalid and m.key <> invalid
|
||||||
|
m.preferences.unobserveFieldScoped(m.key)
|
||||||
|
end if
|
||||||
|
|
||||||
|
m.preferences = preferences
|
||||||
|
m.key = key
|
||||||
|
|
||||||
|
if preferences <> invalid and key <> invalid
|
||||||
|
preferences.observeFieldScoped(key, FuncName(OnPreferenceChange))
|
||||||
|
OnPreferenceChange()
|
||||||
|
end if
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OpenHomeScreenEditor()
|
||||||
|
editor = CreateObject("roSGNode", "HomeScreenEditor")
|
||||||
|
m.appController@.PushScreen(editor)
|
||||||
|
editor@.BindNode()
|
||||||
|
editor.value = m.top.value
|
||||||
|
editor.observeField("save", FuncName(OnSaveHomeScreenEditor))
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnSaveHomeScreenEditor(event as object)
|
||||||
|
editor = event.GetRoSGNode()
|
||||||
|
m.top.value = editor.value
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnPreferenceChange()
|
||||||
|
m.top.value = m.preferences[m.key]
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnValueChange() as void
|
||||||
|
if m.preferences = invalid or m.key = invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
m.preferences[m.key] = m.top.value
|
||||||
|
end function
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
<component name="EditHomeScreenControl" extends="LayoutGroup" includes="AutoBind,Focus">
|
||||||
|
<interface>
|
||||||
|
<field id="displayText" type="string" alias="Button.text" />
|
||||||
|
<field id="description" type="string" alias="DescriptionLabel.text" />
|
||||||
|
<field id="value" type="array" onChange="OnValueChange" />
|
||||||
|
<field id="appController" type="node" bind="/AppController" />
|
||||||
|
<function name="BindPreference" />
|
||||||
|
</interface>
|
||||||
|
<children>
|
||||||
|
<Button
|
||||||
|
id="button"
|
||||||
|
minWidth="300"
|
||||||
|
showFocusFootprint="true" />
|
||||||
|
<Label id="DescriptionLabel"
|
||||||
|
width="450"
|
||||||
|
color="0xb4b4b4ff"
|
||||||
|
wrap="true">
|
||||||
|
<Font role="font" uri="font:SystemFontFile" size="18" />
|
||||||
|
</Label>
|
||||||
|
</children>
|
||||||
|
</component>
|
||||||
@@ -0,0 +1,162 @@
|
|||||||
|
import "pkg:/components/Navigation/Navigation.bs"
|
||||||
|
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||||
|
import "pkg:/source/utils/Logging.bs"
|
||||||
|
import "pkg:/source/utils/MathUtils.bs"
|
||||||
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
|
function Init()
|
||||||
|
m.homeLayout = {}
|
||||||
|
homeLayout = ParseJson(ReadAsciiFile("libpkg:/config/default_home_layout.yaml"))
|
||||||
|
for each item in homeLayout
|
||||||
|
m.homeLayout[item.id] = item
|
||||||
|
end for
|
||||||
|
|
||||||
|
m.checkList = m.top.findNode("checkList")
|
||||||
|
m.moveUpButton = m.top.findNode("moveUpButton")
|
||||||
|
m.moveDownButton = m.top.findNode("moveDownButton")
|
||||||
|
m.closeButton = m.top.findNode("closeButton")
|
||||||
|
m.saveButton = m.top.findNode("saveButton")
|
||||||
|
|
||||||
|
SetNavigation(m.checkList, "down", m.saveButton)
|
||||||
|
SetNavigation(m.saveButton, "up", m.checkList)
|
||||||
|
SetNavigation(m.closeButton, "up", m.checkList)
|
||||||
|
SetNavigation(m.saveButton, "right", m.closeButton)
|
||||||
|
SetNavigation(m.closeButton, "left", m.saveButton)
|
||||||
|
SetNavigation(m.moveUpButton, "left", m.checkList)
|
||||||
|
SetNavigation(m.moveDownButton, "left", m.checkList)
|
||||||
|
SetNavigation(m.checkList, "right", m.moveUpButton)
|
||||||
|
SetNavigation(m.moveUpButton, "down", m.moveDownButton)
|
||||||
|
SetNavigation(m.moveDownButton, "up", m.moveUpButton)
|
||||||
|
SetNavigation(m.moveDownButton, "down", m.closeButton)
|
||||||
|
|
||||||
|
m.moveUpButton.observeField("buttonSelected", FuncName(OnMoveUpButtonSelected))
|
||||||
|
m.moveDownButton.observeField("buttonSelected", FuncName(OnMoveDownButtonSelected))
|
||||||
|
m.saveButton.observeField("buttonSelected", FuncName(OnSaveButtonSelected))
|
||||||
|
m.closeButton.observeField("buttonSelected", FuncName(Close))
|
||||||
|
|
||||||
|
m.checkList.observeField("checkedState", FuncName(OnCheckedStateChange))
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnFocusChange() as void
|
||||||
|
if not m.top.focus
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
NodeSetFocus(m.checkList, true)
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||||
|
if NavigationKeyHandler(key, press).handled
|
||||||
|
return true
|
||||||
|
end if
|
||||||
|
|
||||||
|
if key = "options"
|
||||||
|
' A pass-through to the app controller, so it can toggle picture-in-picture
|
||||||
|
return false
|
||||||
|
end if
|
||||||
|
|
||||||
|
if key = "back" and press
|
||||||
|
Close()
|
||||||
|
return true
|
||||||
|
end if
|
||||||
|
|
||||||
|
return true
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnValueChange()
|
||||||
|
content = m.checkList.content
|
||||||
|
value = m.top.value
|
||||||
|
|
||||||
|
nodes = []
|
||||||
|
checkedState = []
|
||||||
|
for each item in value
|
||||||
|
feed = m.homeLayout[item.id]
|
||||||
|
if feed = invalid
|
||||||
|
LogWarn("unknown feed id:", item.id)
|
||||||
|
continue for
|
||||||
|
end if
|
||||||
|
node = CreateObject("roSGNode", "ContentNode")
|
||||||
|
node.id = feed.id
|
||||||
|
node.title = feed.title
|
||||||
|
nodes.push(node)
|
||||||
|
checkedState.push(item.enabled)
|
||||||
|
end for
|
||||||
|
|
||||||
|
labelCount = content.getChildCount()
|
||||||
|
if labelCount > 0
|
||||||
|
content.removeChildrenIndex(labelCount, 0)
|
||||||
|
end if
|
||||||
|
|
||||||
|
content.appendChildren(nodes)
|
||||||
|
m.checkList.checkedState = checkedState
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnCheckedStateChange() as void
|
||||||
|
content = m.checkList.content
|
||||||
|
if content = invalid or content.getChildCount() = 0
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
checkedState = m.checkList.checkedState
|
||||||
|
if checkedState = invalid or checkedState.Count() = 0
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
value = []
|
||||||
|
checkboxes = content.getChildren(-1, 0)
|
||||||
|
|
||||||
|
for i = 0 to checkboxes.Count() - 1
|
||||||
|
checkbox = checkboxes[i]
|
||||||
|
value.push({
|
||||||
|
id: checkbox.id
|
||||||
|
enabled: checkedState[i]
|
||||||
|
})
|
||||||
|
end for
|
||||||
|
|
||||||
|
m.top.value = value
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnMoveUpButtonSelected() as void
|
||||||
|
MoveItem(-1)
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnMoveDownButtonSelected() as void
|
||||||
|
MoveItem(1)
|
||||||
|
end function
|
||||||
|
|
||||||
|
function MoveItem(offset as integer) as void
|
||||||
|
content = m.checkList.content
|
||||||
|
if content = invalid or content.getChildCount() = 0
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
itemCount = content.getChildCount()
|
||||||
|
index = m.checkList.itemFocused
|
||||||
|
newIndex = MathUtils.Max(0, MathUtils.Min(index + offset, itemCount - 1))
|
||||||
|
|
||||||
|
if index = newIndex
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
checkedState = m.checkList.checkedState
|
||||||
|
node = content.getChild(index)
|
||||||
|
content.insertChild(node, newIndex)
|
||||||
|
|
||||||
|
tmp = checkedState[index]
|
||||||
|
checkedState[index] = checkedState[newIndex]
|
||||||
|
checkedState[newIndex] = tmp
|
||||||
|
|
||||||
|
m.checkList.itemFocused = newIndex
|
||||||
|
m.checkList.jumpToItem = newIndex
|
||||||
|
m.checkList.checkedState = checkedState
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnSaveButtonSelected()
|
||||||
|
' Save the new layout to m.top.value
|
||||||
|
OnCheckedStateChange()
|
||||||
|
m.top.save = true
|
||||||
|
Close()
|
||||||
|
end function
|
||||||
|
|
||||||
|
function Close()
|
||||||
|
m.appController@.PopScreen()
|
||||||
|
end function
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
<component name="HomeScreenEditor" extends="Group" includes="AutoBind,Focus">
|
||||||
|
<interface>
|
||||||
|
<field id="value" type="array" onChange="OnValueChange" />
|
||||||
|
<field id="save" type="boolean" alwaysNotify="true" />
|
||||||
|
<field id="appController" type="node" bind="/AppController" />
|
||||||
|
</interface>
|
||||||
|
<children>
|
||||||
|
<Rectangle
|
||||||
|
width="1280"
|
||||||
|
height="720"
|
||||||
|
color="#000000"
|
||||||
|
opacity="0.5">
|
||||||
|
</Rectangle>
|
||||||
|
<Rectangle
|
||||||
|
width="960"
|
||||||
|
height="600"
|
||||||
|
translation="[160,60]"
|
||||||
|
color="#242424">
|
||||||
|
<CheckList
|
||||||
|
id="checkList"
|
||||||
|
vertFocusAnimationStyle="floatingFocus"
|
||||||
|
translation="[164,70]">
|
||||||
|
|
||||||
|
<ContentNode role="content" />
|
||||||
|
</CheckList>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
id="moveUpButton"
|
||||||
|
text="Move up"
|
||||||
|
showFocusFootprint="true"
|
||||||
|
minWidth="220"
|
||||||
|
translation="[640,183]" />
|
||||||
|
<Button
|
||||||
|
id="moveDownButton"
|
||||||
|
text="Move down"
|
||||||
|
showFocusFootprint="true"
|
||||||
|
minWidth="220"
|
||||||
|
translation="[640,273]" />
|
||||||
|
<Button
|
||||||
|
id="closeButton"
|
||||||
|
text="Close"
|
||||||
|
showFocusFootprint="true"
|
||||||
|
minWidth="150"
|
||||||
|
translation="[500,500]" />
|
||||||
|
<Button
|
||||||
|
id="saveButton"
|
||||||
|
text="Save"
|
||||||
|
showFocusFootprint="true"
|
||||||
|
minWidth="150"
|
||||||
|
translation="[320,500]" />
|
||||||
|
</Rectangle>
|
||||||
|
</children>
|
||||||
|
</component>
|
||||||
@@ -50,7 +50,7 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
|||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if key = "options" and press
|
if key = "options"
|
||||||
' A pass-through to the app controller, so it can toggle picture-in-picture
|
' A pass-through to the app controller, so it can toggle picture-in-picture
|
||||||
return false
|
return false
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
import "pkg:/components/Navigation/Navigation.bs"
|
import "pkg:/components/Navigation/Navigation.bs"
|
||||||
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||||
import "pkg:/components/Screens/SettingsScreen/InvidiousInstance/InvidiousInstanceTesting/InvidiousInstanceTestingTask.bs"
|
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
@@ -30,7 +31,7 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
|||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if key = "options" and press
|
if key = "options"
|
||||||
' A pass-through to the app controller, so it can toggle picture-in-picture
|
' A pass-through to the app controller, so it can toggle picture-in-picture
|
||||||
return false
|
return false
|
||||||
end if
|
end if
|
||||||
@@ -58,7 +59,7 @@ function RunTestsTask()
|
|||||||
m.testingTask.cancel = true
|
m.testingTask.cancel = true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.testingTask = StartAsyncTask(InvidiousInstanceTestingTask, {
|
m.testingTask = AsyncTask.Start(Tasks.InvidiousInstanceTestingTask, {
|
||||||
instance: m.top.instance
|
instance: m.top.instance
|
||||||
listNode: m.testList
|
listNode: m.testList
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
import "pkg:/components/Screens/SettingsScreen/InvidiousInstance/InvidiousPublicInstances/InvidiousPublicInstancesTask.bs"
|
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||||
import "pkg:/source/utils/ErrorUtils.bs"
|
import "pkg:/source/utils/ErrorUtils.bs"
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
import "pkg:/source/utils/Logging.bs"
|
import "pkg:/source/utils/Logging.bs"
|
||||||
@@ -43,7 +43,7 @@ function Refresh()
|
|||||||
m.invidiousPublicInstancesTask.cancel = true
|
m.invidiousPublicInstancesTask.cancel = true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.invidiousPublicInstancesTask = StartAsyncTask(InvidiousPublicInstancesTask, {
|
m.invidiousPublicInstancesTask = AsyncTask.Start(Tasks.InvidiousPublicInstancesTask, {
|
||||||
listNode: m.instances
|
listNode: m.instances
|
||||||
}, OnInvidiousPublicInstancesTaskResults)
|
}, OnInvidiousPublicInstancesTaskResults)
|
||||||
|
|
||||||
|
|||||||
@@ -1,22 +1,11 @@
|
|||||||
function Init()
|
|
||||||
m.nameLabel = m.top.findNode("nameLabel")
|
|
||||||
m.versionLabel = m.top.findNode("versionLabel")
|
|
||||||
m.usersLabel = m.top.findNode("usersLabel")
|
|
||||||
m.signupLabel = m.top.findNode("signupLabel")
|
|
||||||
m.locationLabel = m.top.findNode("locationLabel")
|
|
||||||
m.flagEmoji = m.top.findNode("flagEmoji")
|
|
||||||
m.healthLabel = m.top.findNode("healthLabel")
|
|
||||||
|
|
||||||
end function
|
|
||||||
|
|
||||||
function OnContentSet() as void
|
function OnContentSet() as void
|
||||||
content = m.top.itemContent
|
content = m.top.itemContent
|
||||||
|
|
||||||
m.nameLabel.text = content.name
|
m.top.name = content.name
|
||||||
m.versionLabel.text = content.version
|
m.top.version = content.version
|
||||||
m.usersLabel.text = content.users
|
m.top.users = content.users
|
||||||
m.signupLabel.text = content.signup
|
m.top.signup = content.signup
|
||||||
m.locationLabel.text = content.location
|
m.top.location = content.location
|
||||||
m.flagEmoji.uri = content.flag
|
m.top.flag = content.flag
|
||||||
m.healthLabel.text = content.health
|
m.top.health = content.health
|
||||||
end function
|
end function
|
||||||
@@ -1,6 +1,13 @@
|
|||||||
<component name="InvidiousPublicInstancesListItem" extends="Group">
|
<component name="InvidiousPublicInstancesListItem" extends="Group">
|
||||||
<interface>
|
<interface>
|
||||||
<field id="itemContent" type="node" onChange="OnContentSet" />
|
<field id="itemContent" type="node" onChange="OnContentSet" />
|
||||||
|
<field id="name" type="string" alias="nameLabel.text" />
|
||||||
|
<field id="version" type="string" alias="versionLabel.text" />
|
||||||
|
<field id="users" type="string" alias="usersLabel.text" />
|
||||||
|
<field id="signup" type="string" alias="signupLabel.text" />
|
||||||
|
<field id="location" type="string" alias="locationLabel.text" />
|
||||||
|
<field id="flag" type="string" alias="flagEmoji.uri" />
|
||||||
|
<field id="health" type="string" alias="healthLabel.text" />
|
||||||
</interface>
|
</interface>
|
||||||
<children>
|
<children>
|
||||||
<Label
|
<Label
|
||||||
|
|||||||
@@ -0,0 +1,71 @@
|
|||||||
|
import "pkg:/components/Navigation/Navigation.bs"
|
||||||
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
|
import "pkg:/source/utils/MathUtils.bs"
|
||||||
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
|
function Init()
|
||||||
|
m.top.focusable = true
|
||||||
|
m.top.itemSpacings = [10]
|
||||||
|
|
||||||
|
m.minusButton = m.top.findNode("MinusButton")
|
||||||
|
m.numberButton = m.top.findNode("NumberButton")
|
||||||
|
m.plusButton = m.top.findNode("PlusButton")
|
||||||
|
|
||||||
|
m.minusButton.observeFieldScoped("buttonSelected", FuncName(OnMinusSelected))
|
||||||
|
m.plusButton.observeFieldScoped("buttonSelected", FuncName(OnPlusSelected))
|
||||||
|
|
||||||
|
SetNavigation(m.minusButton, "right", m.numberButton)
|
||||||
|
SetNavigation(m.numberButton, "left", m.minusButton)
|
||||||
|
SetNavigation(m.numberButton, "right", m.plusButton)
|
||||||
|
SetNavigation(m.plusButton, "left", m.numberButton)
|
||||||
|
end function
|
||||||
|
|
||||||
|
function BindPreference(preferences as object, key as string)
|
||||||
|
if m.preferences <> invalid and m.key <> invalid
|
||||||
|
m.preferences.unobserveFieldScoped(m.key)
|
||||||
|
end if
|
||||||
|
|
||||||
|
m.preferences = preferences
|
||||||
|
m.key = key
|
||||||
|
|
||||||
|
if preferences <> invalid and key <> invalid
|
||||||
|
preferences.observeFieldScoped(key, FuncName(OnPreferenceChange))
|
||||||
|
OnPreferenceChange()
|
||||||
|
end if
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnPreferenceChange()
|
||||||
|
m.top.value = MathUtils.Max(MathUtils.Min(m.preferences[m.key], m.top.max), m.top.min)
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnValueChange() as void
|
||||||
|
m.numberButton.text = `${m.top.value}`
|
||||||
|
if m.preferences = invalid or m.key = invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
m.preferences[m.key] = m.top.value
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnFocusChange() as void
|
||||||
|
if not m.top.focus
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
NodeSetFocus(m.numberButton, true)
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||||
|
if NavigationKeyHandler(key, press).handled
|
||||||
|
return true
|
||||||
|
end if
|
||||||
|
return false
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnMinusSelected()
|
||||||
|
m.top.value = MathUtils.Max(m.top.value - 1, m.top.min)
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnPlusSelected()
|
||||||
|
m.top.value = MathUtils.Min(m.top.value + 1, m.top.max)
|
||||||
|
end function
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<component name="NumberControl" extends="LayoutGroup" includes="Focus">
|
||||||
|
<interface>
|
||||||
|
<field id="displayText" type="string" alias="DisplayTextLabel.text" />
|
||||||
|
<field id="description" type="string" alias="DescriptionLabel.text" />
|
||||||
|
<field id="min" type="integer" value="-999999" />
|
||||||
|
<field id="max" type="integer" value="999999" />
|
||||||
|
<field id="value" type="integer" onChange="OnValueChange" />
|
||||||
|
<function name="BindPreference" />
|
||||||
|
</interface>
|
||||||
|
<children>
|
||||||
|
<Label id="DisplayTextLabel" width="450" />
|
||||||
|
<Label id="DescriptionLabel"
|
||||||
|
width="450"
|
||||||
|
color="0xb4b4b4ff"
|
||||||
|
wrap="true">
|
||||||
|
<Font role="font" uri="font:SystemFontFile" size="18" />
|
||||||
|
</Label>
|
||||||
|
<LayoutGroup layoutDirection="horiz">
|
||||||
|
<Button
|
||||||
|
id="MinusButton"
|
||||||
|
iconUri=""
|
||||||
|
focusedIconUri=""
|
||||||
|
minWidth="64"
|
||||||
|
maxWidth="64"
|
||||||
|
showFocusFootprint="true"
|
||||||
|
text="-" />
|
||||||
|
<Button
|
||||||
|
id="NumberButton"
|
||||||
|
iconUri=""
|
||||||
|
focusedIconUri=""
|
||||||
|
minWidth="150"
|
||||||
|
showFocusFootprint="true"
|
||||||
|
text="0" />
|
||||||
|
<Button
|
||||||
|
id="PlusButton"
|
||||||
|
iconUri=""
|
||||||
|
focusedIconUri=""
|
||||||
|
minWidth="64"
|
||||||
|
maxWidth="64"
|
||||||
|
showFocusFootprint="true"
|
||||||
|
text="+" />
|
||||||
|
</LayoutGroup>
|
||||||
|
</children>
|
||||||
|
</component>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
<component name="SettingCategory" extends="Button">
|
<component name="SettingCategory" extends="Button">
|
||||||
<interface>
|
<interface>
|
||||||
<field id="padding" type="integer" value="10" onChange="Resize" />
|
<field id="padding" type="integer" value="15" onChange="Resize" />
|
||||||
<field id="minimumWidth" type="integer" value="280" onChange="Resize" />
|
<field id="minimumWidth" type="integer" value="280" onChange="Resize" />
|
||||||
<field id="displayText" type="string" alias="DisplayTextLabel.text" onChange="Resize" />
|
<field id="displayText" type="string" alias="DisplayTextLabel.text" onChange="Resize" />
|
||||||
<field id="description" type="string" alias="DescriptionLabel.text" onChange="Resize" />
|
<field id="description" type="string" alias="DescriptionLabel.text" onChange="Resize" />
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import "pkg:/components/Navigation/Navigation.bs"
|
import "pkg:/components/Navigation/Navigation.bs"
|
||||||
import "pkg:/components/Navigation/ScrollTo.bs"
|
import "pkg:/components/Navigation/ScrollTo.bs"
|
||||||
import "pkg:/source/utils/FocusManagement.bs"
|
import "pkg:/source/utils/FocusManagement.bs"
|
||||||
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
m.top.focusable = true
|
m.top.focusable = true
|
||||||
@@ -9,9 +10,9 @@ function Init()
|
|||||||
m.scrollAnimationInterpolator = m.scrollAnimation.findNode("scrollAnimationInterpolator")
|
m.scrollAnimationInterpolator = m.scrollAnimation.findNode("scrollAnimationInterpolator")
|
||||||
m.viewport = {
|
m.viewport = {
|
||||||
x: 150
|
x: 150
|
||||||
y: 96
|
y: 50
|
||||||
width: 1920
|
width: 1920
|
||||||
height: 550
|
height: 620
|
||||||
}
|
}
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -126,6 +127,8 @@ function CreateControl(item as object, container as object, startX as integer, s
|
|||||||
control = CreateRadioControl(item, container)
|
control = CreateRadioControl(item, container)
|
||||||
else if item.type = "string"
|
else if item.type = "string"
|
||||||
control = CreateStringControl(item, container)
|
control = CreateStringControl(item, container)
|
||||||
|
else if item.type = "number"
|
||||||
|
control = CreateNumberComponent(item, container)
|
||||||
else if item.rokuComponent <> invalid
|
else if item.rokuComponent <> invalid
|
||||||
control = CreateRokuComponent(item, container)
|
control = CreateRokuComponent(item, container)
|
||||||
end if
|
end if
|
||||||
@@ -169,6 +172,19 @@ function CreateStringControl(item as object, container as object) as object
|
|||||||
return node
|
return node
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function CreateNumberComponent(item as object, container as object) as object
|
||||||
|
node = container.createChild("NumberControl")
|
||||||
|
node.displayText = item.displayText
|
||||||
|
node.description = item.description
|
||||||
|
if IsInt(item.min)
|
||||||
|
node.min = item.min
|
||||||
|
end if
|
||||||
|
if IsInt(item.max)
|
||||||
|
node.max = item.max
|
||||||
|
end if
|
||||||
|
return node
|
||||||
|
end function
|
||||||
|
|
||||||
function CreateRokuComponent(item as object, container as object) as object
|
function CreateRokuComponent(item as object, container as object) as object
|
||||||
node = container.createChild(item.rokuComponent)
|
node = container.createChild(item.rokuComponent)
|
||||||
if node.hasField("displayText")
|
if node.hasField("displayText")
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import "pkg:/components/Screens/WebAppScreen/GenerateQrCodeTask.bs"
|
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
@@ -22,7 +22,7 @@ function OnUrlSet()
|
|||||||
urlLabel.text = url
|
urlLabel.text = url
|
||||||
|
|
||||||
qrCodePoster = m.top.findNode("QrCodePoster")
|
qrCodePoster = m.top.findNode("QrCodePoster")
|
||||||
StartAsyncTask(GenerateQrCodeTask, {
|
AsyncTask.Start(Tasks.GenerateQrCodeTask, {
|
||||||
poster: qrCodePoster
|
poster: qrCodePoster
|
||||||
text: url
|
text: url
|
||||||
size: qrCodePoster.loadWidth
|
size: qrCodePoster.loadWidth
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
import "LatestLibVersionTask.bs"
|
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||||
|
|
||||||
import "pkg:/source/services/ApplicationInfo.bs"
|
import "pkg:/source/services/ApplicationInfo.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
@@ -32,7 +31,7 @@ function GetLatestPlayletLibVersion(_unused as dynamic) as dynamic
|
|||||||
return invalid
|
return invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.latestLibVersionTask = StartAsyncTask(LatestLibVersionTask, {}, function(output as object) as void
|
m.latestLibVersionTask = AsyncTask.Start(Tasks.LatestLibVersionTask, {}, function(output as object) as void
|
||||||
m.latestLibVersionTask = invalid
|
m.latestLibVersionTask = invalid
|
||||||
if output.success and output.result.latest <> invalid
|
if output.success and output.result.latest <> invalid
|
||||||
m.top.lib_version_latest = output.result.latest
|
m.top.lib_version_latest = output.result.latest
|
||||||
|
|||||||
@@ -14,7 +14,7 @@ function GetLatestPlayletLibVersionFromGithubReleases() as string
|
|||||||
if response.StatusCode() = 200
|
if response.StatusCode() = 200
|
||||||
headers = response.Headers()
|
headers = response.Headers()
|
||||||
if headers.location <> invalid
|
if headers.location <> invalid
|
||||||
regex = CreateObject("roRegex", "/v?(\d+\.\d+\.\d+)", "")
|
regex = /\/v?(\d+\.\d+\.\d+)/
|
||||||
match = regex.match(headers.location)
|
match = regex.match(headers.location)
|
||||||
if match.Count() = 2
|
if match.Count() = 2
|
||||||
return match[1]
|
return match[1]
|
||||||
|
|||||||
@@ -29,12 +29,15 @@ function Load() as void
|
|||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
for each bookmarkGroup in bookmarks.groups
|
groupCount = bookmarks.groups.Count()
|
||||||
|
' GetOrCreateBookmarkGroup inserts at the beginning of the list, so we need to iterate backwards
|
||||||
|
for i = groupCount - 1 to 0 step -1
|
||||||
|
bookmarkGroup = bookmarks.groups[i]
|
||||||
bookmarkGroupNode = GetOrCreateBookmarkGroup(bookmarkGroup.title)
|
bookmarkGroupNode = GetOrCreateBookmarkGroup(bookmarkGroup.title)
|
||||||
bookmarksCount = bookmarkGroup.bookmarks.Count()
|
bookmarksCount = bookmarkGroup.bookmarks.Count()
|
||||||
' AddFeedSourceBookmark inserts at the beginning of the list, so we need to iterate backwards
|
' AddFeedSourceBookmark also inserts at the beginning of the list, so we need to iterate backwards
|
||||||
for i = bookmarksCount - 1 to 0 step -1
|
for j = bookmarksCount - 1 to 0 step -1
|
||||||
bookmark = bookmarkGroup.bookmarks[i]
|
bookmark = bookmarkGroup.bookmarks[j]
|
||||||
AddFeedSourceBookmark(bookmark.feedSource, bookmark.id, bookmarkGroupNode)
|
AddFeedSourceBookmark(bookmark.feedSource, bookmark.id, bookmarkGroupNode)
|
||||||
end for
|
end for
|
||||||
end for
|
end for
|
||||||
@@ -85,7 +88,7 @@ function GetOrCreateBookmarkGroup(groupName as string) as object
|
|||||||
node = CreateObject("roSGNode", "ContentNode")
|
node = CreateObject("roSGNode", "ContentNode")
|
||||||
node.id = id
|
node.id = id
|
||||||
node.title = groupName
|
node.title = groupName
|
||||||
m.top.content.appendChild(node)
|
m.top.content.insertChild(node, 0)
|
||||||
LogInfo("Added bookmark group:", groupName)
|
LogInfo("Added bookmark group:", groupName)
|
||||||
return node
|
return node
|
||||||
end function
|
end function
|
||||||
|
|||||||
@@ -8,8 +8,28 @@ class DashManifest
|
|||||||
public invidiousInstance as dynamic
|
public invidiousInstance as dynamic
|
||||||
|
|
||||||
function new(invidiousInstance as string)
|
function new(invidiousInstance as string)
|
||||||
m.utils = new Http.Utils()
|
|
||||||
m.invidiousInstance = invidiousInstance
|
m.invidiousInstance = invidiousInstance
|
||||||
|
|
||||||
|
m.utils = new Http.Utils()
|
||||||
|
m.urlRegex = /https?:\/\/\S+(\/\S+)/i
|
||||||
|
|
||||||
|
' https://github.com/LuanRT/YouTube.js/blob/6082b4a52ee07a622735e6e9128a0531a5ae3bfb/src/utils/StreamingInfo.ts#L332-L349
|
||||||
|
m.colorInfo = {
|
||||||
|
primaries: {
|
||||||
|
"COLOR_PRIMARIES_BT709": "1"
|
||||||
|
"COLOR_PRIMARIES_BT2020": "9"
|
||||||
|
}
|
||||||
|
transferCharacteristics: {
|
||||||
|
"COLOR_TRANSFER_CHARACTERISTICS_BT709": "1"
|
||||||
|
"COLOR_TRANSFER_CHARACTERISTICS_BT2020_10": "14"
|
||||||
|
"COLOR_TRANSFER_CHARACTERISTICS_SMPTEST2084": "16"
|
||||||
|
"COLOR_TRANSFER_CHARACTERISTICS_ARIB_STD_B67": "18"
|
||||||
|
}
|
||||||
|
matrixCoefficients: {
|
||||||
|
"COLOR_MATRIX_COEFFICIENTS_BT709": "1"
|
||||||
|
"COLOR_MATRIX_COEFFICIENTS_BT2020_NCL": "14"
|
||||||
|
}
|
||||||
|
}
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function fromVideoMetadata(metadata as object, local as boolean) as string
|
function fromVideoMetadata(metadata as object, local as boolean) as string
|
||||||
@@ -17,10 +37,8 @@ class DashManifest
|
|||||||
adaptiveFormats.Append (metadata.adaptiveFormats)
|
adaptiveFormats.Append (metadata.adaptiveFormats)
|
||||||
|
|
||||||
if local
|
if local
|
||||||
urlRegex = CreateObject("roRegex", "https?:\/\/\S+(\/\S+)", "i")
|
|
||||||
|
|
||||||
for i = 0 to adaptiveFormats.Count() - 1
|
for i = 0 to adaptiveFormats.Count() - 1
|
||||||
adaptiveFormats[i].url = urlRegex.replace(adaptiveFormats[i].url, m.invidiousInstance + "\1")
|
adaptiveFormats[i].url = m.urlRegex.replace(adaptiveFormats[i].url, m.invidiousInstance + "\1")
|
||||||
end for
|
end for
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -55,11 +73,10 @@ class DashManifest
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
if xml.Node("AdaptationSet", adaptationSetAttributes)
|
if xml.Node("AdaptationSet", adaptationSetAttributes)
|
||||||
xml.Node("Role", {
|
xml.EmptyNode("Role", {
|
||||||
"schemeIdUri": "urn:mpeg:dash:role:2011"
|
"schemeIdUri": "urn:mpeg:dash:role:2011"
|
||||||
"value": audioSet.acont = "original" ? "main" : "alternate"
|
"value": audioSet.acont = "original" ? "main" : "alternate"
|
||||||
})
|
})
|
||||||
xml.End()
|
|
||||||
|
|
||||||
for i = 0 to audioStreams.Count() - 1
|
for i = 0 to audioStreams.Count() - 1
|
||||||
stream = audioStreams[i]
|
stream = audioStreams[i]
|
||||||
@@ -82,31 +99,23 @@ class DashManifest
|
|||||||
"bandwidth": stream.bitrate
|
"bandwidth": stream.bitrate
|
||||||
})
|
})
|
||||||
|
|
||||||
xml.Node("AudioChannelConfiguration", {
|
xml.EmptyNode("AudioChannelConfiguration", {
|
||||||
"schemeIdUri": "urn:mpeg:dash:23003:3:audio_channel_configuration:2011"
|
"schemeIdUri": "urn:mpeg:dash:23003:3:audio_channel_configuration:2011"
|
||||||
"value": `${stream.audioChannels}`
|
"value": `${stream.audioChannels}`
|
||||||
})
|
})
|
||||||
xml.End()
|
|
||||||
|
|
||||||
if xml.Node("BaseURL")
|
xml.TextNode("BaseURL", stream.url)
|
||||||
xml.Text(stream.url)
|
|
||||||
xml.End()
|
if xml.Node("SegmentBase", { "indexRange": stream.index })
|
||||||
end if
|
xml.EmptyNode("Initialization", { "range": stream.init })
|
||||||
|
|
||||||
if xml.Node("SegmentBase", {
|
|
||||||
"indexRange": stream.index
|
|
||||||
})
|
|
||||||
if xml.Node("Initialization", {
|
|
||||||
"range": stream.init
|
|
||||||
})
|
|
||||||
xml.End()
|
|
||||||
end if
|
|
||||||
xml.End()
|
xml.End()
|
||||||
end if
|
end if
|
||||||
|
|
||||||
xml.End()
|
xml.End()
|
||||||
end if
|
end if
|
||||||
end for
|
end for
|
||||||
|
|
||||||
xml.End()
|
xml.End()
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -154,19 +163,15 @@ class DashManifest
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
if xml.Node("Representation", representationAttributes)
|
if xml.Node("Representation", representationAttributes)
|
||||||
|
m.AddColorInfo(stream, xml)
|
||||||
if xml.Node("BaseURL")
|
if xml.Node("BaseURL")
|
||||||
xml.Text(stream.url)
|
xml.Text(stream.url)
|
||||||
xml.End()
|
xml.End()
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if xml.Node("SegmentBase", {
|
if xml.Node("SegmentBase", { "indexRange": stream.index })
|
||||||
"indexRange": stream.index
|
xml.EmptyNode("Initialization", { "range": stream.init })
|
||||||
})
|
|
||||||
if xml.Node("Initialization", {
|
|
||||||
"range": stream.init
|
|
||||||
})
|
|
||||||
xml.End()
|
|
||||||
end if
|
|
||||||
xml.End()
|
xml.End()
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -184,7 +189,7 @@ class DashManifest
|
|||||||
for each storyboard in storyboards
|
for each storyboard in storyboards
|
||||||
interval = ValidInt(storyboard.interval)
|
interval = ValidInt(storyboard.interval)
|
||||||
if interval = 0
|
if interval = 0
|
||||||
LogWarn("Invalid storyboard interval=0")
|
LogWarn("Invalid storyboard interval:", storyboard.interval)
|
||||||
continue for
|
continue for
|
||||||
end if
|
end if
|
||||||
|
|
||||||
@@ -211,7 +216,7 @@ class DashManifest
|
|||||||
|
|
||||||
intervalInSeconds = interval \ 1000
|
intervalInSeconds = interval \ 1000
|
||||||
|
|
||||||
' Youtube template uses the var $M for tile pages
|
' YouTube template uses the var $M for tile pages
|
||||||
' DASH-IF uses $Number$ in the SegmentTemplate
|
' DASH-IF uses $Number$ in the SegmentTemplate
|
||||||
' https://dashif.org/docs/DASH-IF-IOP-v4.3.pdf
|
' https://dashif.org/docs/DASH-IF-IOP-v4.3.pdf
|
||||||
url = templateUrl.replace("$M", "$Number$")
|
url = templateUrl.replace("$M", "$Number$")
|
||||||
@@ -230,12 +235,11 @@ class DashManifest
|
|||||||
"mimeType": "image/jpeg"
|
"mimeType": "image/jpeg"
|
||||||
"contentType": "image"
|
"contentType": "image"
|
||||||
})
|
})
|
||||||
xml.Node("SegmentTemplate", {
|
xml.EmptyNode("SegmentTemplate", {
|
||||||
"media": url
|
"media": url
|
||||||
"duration": duration
|
"duration": duration
|
||||||
"startNumber": 0
|
"startNumber": 0
|
||||||
})
|
})
|
||||||
xml.End()
|
|
||||||
|
|
||||||
if xml.Node("Representation", {
|
if xml.Node("Representation", {
|
||||||
"id": `thumbnails_${id}`
|
"id": `thumbnails_${id}`
|
||||||
@@ -244,11 +248,10 @@ class DashManifest
|
|||||||
"height": storyboardHeightInPixels
|
"height": storyboardHeightInPixels
|
||||||
})
|
})
|
||||||
|
|
||||||
xml.Node("EssentialProperty", {
|
xml.EmptyNode("EssentialProperty", {
|
||||||
"schemeIdUri": "http://dashif.org/guidelines/thumbnail_tile"
|
"schemeIdUri": "http://dashif.org/guidelines/thumbnail_tile"
|
||||||
"value": `${storyboardWidth}x${storyboardHeight}`
|
"value": `${storyboardWidth}x${storyboardHeight}`
|
||||||
})
|
})
|
||||||
xml.End()
|
|
||||||
|
|
||||||
xml.End()
|
xml.End()
|
||||||
end if
|
end if
|
||||||
@@ -371,4 +374,47 @@ class DashManifest
|
|||||||
end for
|
end for
|
||||||
return result
|
return result
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function AddColorInfo(videoStream as object, xml as object) as void
|
||||||
|
if videoStream.colorInfo = invalid
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
if videoStream.colorInfo.primaries <> invalid
|
||||||
|
primaries = m.colorInfo.primaries[videoStream.colorInfo.primaries]
|
||||||
|
if primaries <> invalid
|
||||||
|
xml.EmptyNode("EssentialProperty", {
|
||||||
|
"schemeIdUri": "urn:mpeg:mpegB:cicp:ColourPrimaries"
|
||||||
|
"value": primaries
|
||||||
|
})
|
||||||
|
else
|
||||||
|
LogWarn("Unknown colorInfo.primaries:", videoStream.colorInfo.primaries)
|
||||||
|
end if
|
||||||
|
end if
|
||||||
|
|
||||||
|
if videoStream.colorInfo.transferCharacteristics <> invalid
|
||||||
|
transferCharacteristics = m.colorInfo.transferCharacteristics[videoStream.colorInfo.transferCharacteristics]
|
||||||
|
if transferCharacteristics <> invalid
|
||||||
|
xml.EmptyNode("EssentialProperty", {
|
||||||
|
"schemeIdUri": "urn:mpeg:mpegB:cicp:TransferCharacteristics"
|
||||||
|
"value": transferCharacteristics
|
||||||
|
})
|
||||||
|
else
|
||||||
|
LogWarn("Unknown colorInfo.transferCharacteristics:", videoStream.colorInfo.transferCharacteristics)
|
||||||
|
end if
|
||||||
|
end if
|
||||||
|
|
||||||
|
if videoStream.colorInfo.matrixCoefficients <> invalid
|
||||||
|
matrixCoefficients = m.colorInfo.matrixCoefficients[videoStream.colorInfo.matrixCoefficients]
|
||||||
|
if matrixCoefficients <> invalid
|
||||||
|
xml.EmptyNode("EssentialProperty", {
|
||||||
|
"schemeIdUri": "urn:mpeg:mpegB:cicp:MatrixCoefficients"
|
||||||
|
"value": matrixCoefficients
|
||||||
|
})
|
||||||
|
else
|
||||||
|
LogWarn("Unknown colorInfo.matrixCoefficients:", videoStream.colorInfo.matrixCoefficients)
|
||||||
|
end if
|
||||||
|
end if
|
||||||
|
end function
|
||||||
|
|
||||||
end class
|
end class
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
import "InvidiousService.bs"
|
import "InvidiousService.bs"
|
||||||
import "InvidiousSubscriptionsTask.bs"
|
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
m.top.apiDefinitions = ParseJson(ReadAsciiFile("libpkg:/config/invidious_video_api.yaml"))
|
m.top.apiDefinitions = ParseJson(ReadAsciiFile("libpkg:/config/invidious_video_api.yaml"))
|
||||||
@@ -32,5 +32,5 @@ function GetSubscriptions() as void
|
|||||||
m.top.subscriptions = invalid
|
m.top.subscriptions = invalid
|
||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
m.subscriptionsTask = StartAsyncTask(InvidiousSubscriptionsTask, { invidious: m.top })
|
m.subscriptionsTask = AsyncTask.Start(Tasks.InvidiousSubscriptionsTask, { invidious: m.top })
|
||||||
end function
|
end function
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
import "pkg:/components/Services/Invidious/InvidiousUnregisterTokenTask.bs"
|
|
||||||
import "pkg:/components/VideoFeed/PaginationType.bs"
|
import "pkg:/components/VideoFeed/PaginationType.bs"
|
||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||||
|
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||||
import "pkg:/source/services/HttpClient.bs"
|
import "pkg:/source/services/HttpClient.bs"
|
||||||
import "pkg:/source/utils/CryptoUtils.bs"
|
import "pkg:/source/utils/CryptoUtils.bs"
|
||||||
import "pkg:/source/utils/Logging.bs"
|
import "pkg:/source/utils/Logging.bs"
|
||||||
@@ -44,7 +44,7 @@ namespace Invidious
|
|||||||
|
|
||||||
m.endpoints = node.apiDefinitions
|
m.endpoints = node.apiDefinitions
|
||||||
|
|
||||||
m.responseHanlders = {
|
m.responseHandlers = {
|
||||||
DefaultHandler: m.DefaultHandler
|
DefaultHandler: m.DefaultHandler
|
||||||
AuthFeedHandler: m.AuthFeedHandler
|
AuthFeedHandler: m.AuthFeedHandler
|
||||||
PlaylistHandler: m.PlaylistHandler
|
PlaylistHandler: m.PlaylistHandler
|
||||||
@@ -53,7 +53,6 @@ namespace Invidious
|
|||||||
ChannelInfoHandler: m.ChannelInfoHandler
|
ChannelInfoHandler: m.ChannelInfoHandler
|
||||||
ChannelVideosHandler: m.ChannelVideosHandler
|
ChannelVideosHandler: m.ChannelVideosHandler
|
||||||
ChannelPlaylistsHandler: m.ChannelPlaylistsHandler
|
ChannelPlaylistsHandler: m.ChannelPlaylistsHandler
|
||||||
ChannelRelatedChannelsHandler: m.ChannelRelatedChannelsHandler
|
|
||||||
WatchHistoryHandler: m.WatchHistoryHandler
|
WatchHistoryHandler: m.WatchHistoryHandler
|
||||||
}
|
}
|
||||||
end function
|
end function
|
||||||
@@ -123,6 +122,21 @@ namespace Invidious
|
|||||||
request.CacheSeconds(60 * 60 * 5)
|
request.CacheSeconds(60 * 60 * 5)
|
||||||
request.Cancellation(cancellation)
|
request.Cancellation(cancellation)
|
||||||
|
|
||||||
|
request.TryCount(2)
|
||||||
|
request.RetryCallback(function(context as object) as boolean
|
||||||
|
response = context.response
|
||||||
|
' In some cases, video info requests return "HTTP/0.9 when not allowed" errors.
|
||||||
|
' Retrying should usually fix the issue.
|
||||||
|
if response.StatusCode() = HttpClient.CurlErrors.CURLE_UNSUPPORTED_PROTOCOL
|
||||||
|
errorMessage = response.ErrorMessage()
|
||||||
|
if errorMessage.InStr("HTTP/0.9") <> -1
|
||||||
|
return true
|
||||||
|
end if
|
||||||
|
end if
|
||||||
|
|
||||||
|
return false
|
||||||
|
end function)
|
||||||
|
|
||||||
return request.Await()
|
return request.Await()
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -277,7 +291,7 @@ namespace Invidious
|
|||||||
|
|
||||||
response = request.Await()
|
response = request.Await()
|
||||||
|
|
||||||
responseHandler = endpoint.responseHandler <> invalid ? m.responseHanlders[endpoint.responseHandler] : m.responseHanlders["DefaultHandler"]
|
responseHandler = endpoint.responseHandler <> invalid ? m.responseHandlers[endpoint.responseHandler] : m.responseHandlers["DefaultHandler"]
|
||||||
|
|
||||||
result = responseHandler(m, feedSource, response)
|
result = responseHandler(m, feedSource, response)
|
||||||
|
|
||||||
@@ -336,25 +350,32 @@ namespace Invidious
|
|||||||
return invalid
|
return invalid
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function ChannelRelatedChannelsHandler(m as object, feedSource as object, response as object) as object
|
function VideoInfoHandler(m as object, feedSource as object, response as object) as object
|
||||||
if response.StatusCode() = 200
|
statusCode = response.StatusCode()
|
||||||
json = response.Json()
|
if statusCode >= 500
|
||||||
|
' In some cases, such as a video became private, or a live stream ended,
|
||||||
|
' Invidious returns a 500 error. We can in this case return a valid response
|
||||||
|
' with just a video id, which will allow us to show a valid thumbnail if possible.
|
||||||
|
' This is to makes it possible to load a bookmarked video and delete it even if
|
||||||
|
' it is no longer valid.
|
||||||
|
' TODO:P2 access to private property
|
||||||
|
response._statusCode = 200
|
||||||
return {
|
return {
|
||||||
items: json.relatedChannels
|
items: [{
|
||||||
continuation: json.continuation
|
"videoId": feedSource.pathParams.id
|
||||||
|
"type": "video"
|
||||||
|
}]
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
return invalid
|
|
||||||
end function
|
|
||||||
|
|
||||||
function VideoInfoHandler(m as object, feedSource as object, response as object) as object
|
if statusCode = 200
|
||||||
if response.StatusCode() = 200
|
|
||||||
json = response.Json()
|
json = response.Json()
|
||||||
json.type = "video"
|
json.type = "video"
|
||||||
return {
|
return {
|
||||||
items: [json]
|
items: [json]
|
||||||
}
|
}
|
||||||
end if
|
end if
|
||||||
|
|
||||||
return invalid
|
return invalid
|
||||||
end function
|
end function
|
||||||
|
|
||||||
@@ -453,7 +474,7 @@ namespace Invidious
|
|||||||
if not m.VerifyTokenScope(authToken.token)
|
if not m.VerifyTokenScope(authToken.token)
|
||||||
' Right now we're probably in a UI thread, and we can't unregister the token
|
' Right now we're probably in a UI thread, and we can't unregister the token
|
||||||
' Without a Task
|
' Without a Task
|
||||||
StartAsyncTask(InvidiousUnregisterTokenTask, {
|
AsyncTask.Start(Tasks.InvidiousUnregisterTokenTask, {
|
||||||
invidious: m.node
|
invidious: m.node
|
||||||
authToken: authToken
|
authToken: authToken
|
||||||
})
|
})
|
||||||
@@ -484,14 +505,22 @@ We apologize for the inconvenience.`
|
|||||||
function VerifyTokenScope(token as string) as boolean
|
function VerifyTokenScope(token as string) as boolean
|
||||||
tokenObject = ParseJson(token)
|
tokenObject = ParseJson(token)
|
||||||
if tokenObject = invalid
|
if tokenObject = invalid
|
||||||
|
LogWarn("Failed to json parse token:", token)
|
||||||
return false
|
return false
|
||||||
end if
|
end if
|
||||||
if not IsArray(tokenObject.scopes)
|
if not IsArray(tokenObject.scopes)
|
||||||
|
LogWarn("Token scopes are not an array:", tokenObject.scopes)
|
||||||
return false
|
return false
|
||||||
end if
|
end if
|
||||||
|
|
||||||
scopes = tokenObject.scopes.join(",")
|
scopes = tokenObject.scopes.join(",")
|
||||||
return scopes = Invidious.AUTH_SCOPES
|
expectedScopes = Invidious.AUTH_SCOPES
|
||||||
|
validScopes = expectedScopes = scopes
|
||||||
|
|
||||||
|
if not validScopes
|
||||||
|
LogWarn(`Token scopes do not match expected scopes. Expected: "${expectedScopes}", got: "${scopes}"`)
|
||||||
|
end if
|
||||||
|
return validScopes
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function DeleteAuthToken()
|
function DeleteAuthToken()
|
||||||
|
|||||||
@@ -2,6 +2,14 @@ import "pkg:/source/utils/RegistryUtils.bs"
|
|||||||
import "pkg:/source/utils/Types.bs"
|
import "pkg:/source/utils/Types.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
|
m.typeMapping = {
|
||||||
|
"boolean": "boolean"
|
||||||
|
"string": "string"
|
||||||
|
"number": "integer"
|
||||||
|
"radio": "string"
|
||||||
|
"array": "array"
|
||||||
|
}
|
||||||
|
|
||||||
m.disableSavingToRegistry = false
|
m.disableSavingToRegistry = false
|
||||||
LoadPreferencesFile()
|
LoadPreferencesFile()
|
||||||
AddNodeFields()
|
AddNodeFields()
|
||||||
@@ -25,14 +33,7 @@ end function
|
|||||||
|
|
||||||
function AddNodeFieldsFromPreference(pref as object, fields as object)
|
function AddNodeFieldsFromPreference(pref as object, fields as object)
|
||||||
if pref.key <> invalid and pref.type <> invalid
|
if pref.key <> invalid and pref.type <> invalid
|
||||||
fieldType = ""
|
fieldType = m.typeMapping[pref.type]
|
||||||
if pref.type = "boolean"
|
|
||||||
fieldType = "boolean"
|
|
||||||
else if pref.type = "string"
|
|
||||||
fieldType = "string"
|
|
||||||
else if pref.type = "radio"
|
|
||||||
fieldType = "string"
|
|
||||||
end if
|
|
||||||
m.top.addField(pref.key, fieldType, false)
|
m.top.addField(pref.key, fieldType, false)
|
||||||
fields[pref.key] = true
|
fields[pref.key] = true
|
||||||
end if
|
end if
|
||||||
|
|||||||
@@ -1,5 +1,10 @@
|
|||||||
<component name="Preferences" extends="Node">
|
<component name="Preferences" extends="Node">
|
||||||
<interface>
|
<interface>
|
||||||
|
<!--
|
||||||
|
The version of the preferences model. This is used to determine if the
|
||||||
|
user prefs saved need to be migrated. If the version is less than the
|
||||||
|
current version, a migration is needed.
|
||||||
|
-->
|
||||||
<field id="__version" type="integer" value="1" />
|
<field id="__version" type="integer" value="1" />
|
||||||
<field id="prefsModel" type="array" />
|
<field id="prefsModel" type="array" />
|
||||||
<field id="preferenceFields" type="assocarray" />
|
<field id="preferenceFields" type="assocarray" />
|
||||||
|
|||||||
@@ -2,10 +2,11 @@ import "pkg:/components/ChannelView/ChannelUtils.bs"
|
|||||||
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
||||||
import "pkg:/components/Navigation/LongPress.bs"
|
import "pkg:/components/Navigation/LongPress.bs"
|
||||||
import "pkg:/components/PlaylistView/PlaylistUtils.bs"
|
import "pkg:/components/PlaylistView/PlaylistUtils.bs"
|
||||||
import "pkg:/components/VideoFeed/VideoRowListContentTask.bs"
|
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||||
import "pkg:/components/VideoFeed/VideoRowListRowContentTask.bs"
|
import "pkg:/components/VideoFeed/FeedLoadState.bs"
|
||||||
import "pkg:/components/VideoPlayer/VideoUtils.bs"
|
import "pkg:/components/VideoPlayer/VideoUtils.bs"
|
||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||||
|
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||||
import "pkg:/source/utils/DisposableObserve.bs"
|
import "pkg:/source/utils/DisposableObserve.bs"
|
||||||
import "pkg:/source/utils/ErrorUtils.bs"
|
import "pkg:/source/utils/ErrorUtils.bs"
|
||||||
import "pkg:/source/utils/Logging.bs"
|
import "pkg:/source/utils/Logging.bs"
|
||||||
@@ -213,7 +214,7 @@ function InitContent() as void
|
|||||||
return
|
return
|
||||||
end if
|
end if
|
||||||
|
|
||||||
task = StartAsyncTask(VideoRowListContentTask, {
|
task = AsyncTask.Start(Tasks.VideoRowListContentTask, {
|
||||||
node: m.top
|
node: m.top
|
||||||
feeds: m.top.feeds
|
feeds: m.top.feeds
|
||||||
}, OnVideoRowListContentTaskResult)
|
}, OnVideoRowListContentTaskResult)
|
||||||
@@ -286,7 +287,7 @@ function LoadRowContent(contentNode as object)
|
|||||||
LogInfo("Loading row content:", contentNode.title)
|
LogInfo("Loading row content:", contentNode.title)
|
||||||
|
|
||||||
contentNode.loadState = FeedLoadState.Loading
|
contentNode.loadState = FeedLoadState.Loading
|
||||||
task = StartAsyncTask(VideoRowListRowContentTask, {
|
task = AsyncTask.Start(Tasks.VideoRowListRowContentTask, {
|
||||||
rowList: m.top
|
rowList: m.top
|
||||||
feedContentNode: contentNode
|
feedContentNode: contentNode
|
||||||
invidious: m.invidious
|
invidious: m.invidious
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
import "FeedLoadState.bs"
|
import "pkg:/components/VideoFeed/FeedLoadState.bs"
|
||||||
import "pkg:/source/utils/StringUtils.bs"
|
import "pkg:/source/utils/StringUtils.bs"
|
||||||
|
|
||||||
@asynctask
|
@asynctask
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
import "pkg:/components/Services/SponsorBlock/Notifications/SponsorBlockNotificationUtils.bs"
|
import "pkg:/components/Services/SponsorBlock/Notifications/SponsorBlockNotificationUtils.bs"
|
||||||
import "pkg:/components/Services/SponsorBlock/SponsorBlockSegmentViewedTask.bs"
|
import "pkg:/components/Services/SponsorBlock/SponsorBlockService.bs"
|
||||||
import "pkg:/components/Services/SponsorBlock/SponsorBlockTask.bs"
|
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||||
|
|
||||||
namespace SponsorBlock
|
namespace SponsorBlock
|
||||||
|
|
||||||
@@ -84,7 +84,7 @@ namespace SponsorBlock
|
|||||||
m.sponsorBlockTask.cancel = true
|
m.sponsorBlockTask.cancel = true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.sponsorBlockTask = StartAsyncTask(SponsorBlockTask, { metadata: metadata }, OnSponsorBlockTaskResults)
|
m.sponsorBlockTask = AsyncTask.Start(Tasks.SponsorBlockTask, { metadata: metadata }, OnSponsorBlockTaskResults)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnSponsorBlockTaskResults(output as object) as void
|
function OnSponsorBlockTaskResults(output as object) as void
|
||||||
@@ -172,7 +172,7 @@ namespace SponsorBlock
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function SendSkippedSectionEvent(segmentId as string)
|
function SendSkippedSectionEvent(segmentId as string)
|
||||||
StartAsyncTask(SponsorBlockSegmentViewedTask, { segmentId: segmentId })
|
AsyncTask.Start(Tasks.SponsorBlockSegmentViewedTask, { segmentId: segmentId })
|
||||||
end function
|
end function
|
||||||
|
|
||||||
end namespace
|
end namespace
|
||||||
@@ -1,17 +1,20 @@
|
|||||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||||
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||||
import "pkg:/components/VideoPlayer/MarkVideoWatchedTask.bs"
|
|
||||||
import "pkg:/components/VideoPlayer/SponsorBlock.bs"
|
import "pkg:/components/VideoPlayer/SponsorBlock.bs"
|
||||||
import "pkg:/components/VideoPlayer/VideoContentTask.bs"
|
|
||||||
import "pkg:/components/VideoPlayer/VideoPlayerStyle.bs"
|
import "pkg:/components/VideoPlayer/VideoPlayerStyle.bs"
|
||||||
import "pkg:/components/VideoPlayer/VideoUtils.bs"
|
import "pkg:/components/VideoPlayer/VideoUtils.bs"
|
||||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||||
|
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||||
import "pkg:/source/utils/ErrorUtils.bs"
|
import "pkg:/source/utils/ErrorUtils.bs"
|
||||||
import "pkg:/source/utils/Logging.bs"
|
import "pkg:/source/utils/Logging.bs"
|
||||||
|
|
||||||
function Init()
|
function Init()
|
||||||
SetPlayerStyle()
|
SetPlayerStyle()
|
||||||
SetupAnimation()
|
SetupAnimation()
|
||||||
|
m.fullScreenHint = m.top.findNode("fullScreenHint")
|
||||||
|
m.fullScreenHintLabel = m.top.findNode("fullScreenHintLabel")
|
||||||
|
m.fullScreenHintTimer = m.top.findNode("fullScreenHintTimer")
|
||||||
|
m.fullScreenHintTimer.ObserveField("fire", FuncName(OnFullScreenHintTimer))
|
||||||
|
|
||||||
' videoPlayingSuccess indicates if we started playing a video successfully
|
' videoPlayingSuccess indicates if we started playing a video successfully
|
||||||
' We use it to detect if we should try another link for a video, or if another error
|
' We use it to detect if we should try another link for a video, or if another error
|
||||||
@@ -34,14 +37,20 @@ function Init()
|
|||||||
end function
|
end function
|
||||||
|
|
||||||
function OnNodeReady()
|
function OnNodeReady()
|
||||||
rect = m.container.fullscreen ? m.top.maxRect : m.top.minRect
|
minRect = m.top.minRect
|
||||||
|
rect = m.container.fullscreen ? m.top.maxRect : minRect
|
||||||
|
|
||||||
m.top.width = rect.width
|
m.top.width = rect.width
|
||||||
m.top.height = rect.height
|
m.top.height = rect.height
|
||||||
m.top.translation = [rect.x, rect.y]
|
m.top.translation = [rect.x, rect.y]
|
||||||
|
|
||||||
|
m.fullScreenHint.width = minRect.width
|
||||||
|
m.fullScreenHintLabel.width = minRect.width
|
||||||
|
m.fullScreenHint.translation = [0, minRect.height - m.fullScreenHint.height]
|
||||||
|
|
||||||
' TODO:P2 show a loading spinner if video is loading minimized
|
' TODO:P2 show a loading spinner if video is loading minimized
|
||||||
m.top.enableUI = m.container.fullscreen
|
m.top.enableUI = m.container.fullscreen
|
||||||
|
m.top.showFullScreenHint = not m.container.fullscreen
|
||||||
|
|
||||||
m.container.observeFieldScoped("fullscreen", FuncName(OnFullScreenChange))
|
m.container.observeFieldScoped("fullscreen", FuncName(OnFullScreenChange))
|
||||||
m.top.ObserveField("state", FuncName(OnVideoPlayerStateChange))
|
m.top.ObserveField("state", FuncName(OnVideoPlayerStateChange))
|
||||||
@@ -77,7 +86,7 @@ function StartVideoContentTask(videoContentNode as object)
|
|||||||
|
|
||||||
m.top.content = videoContentNode
|
m.top.content = videoContentNode
|
||||||
|
|
||||||
m.videoContentTask = StartAsyncTask(VideoContentTask, {
|
m.videoContentTask = AsyncTask.Start(Tasks.VideoContentTask, {
|
||||||
content: videoContentNode
|
content: videoContentNode
|
||||||
invidious: m.top.invidious
|
invidious: m.top.invidious
|
||||||
preferences: m.top.preferences
|
preferences: m.top.preferences
|
||||||
@@ -118,7 +127,7 @@ end function
|
|||||||
|
|
||||||
function MarkVideoWatched(videoId as string)
|
function MarkVideoWatched(videoId as string)
|
||||||
if m.top.invidious.authToken <> invalid
|
if m.top.invidious.authToken <> invalid
|
||||||
StartAsyncTask(MarkVideoWatchedTask, {
|
AsyncTask.Start(Tasks.MarkVideoWatchedTask, {
|
||||||
videoId: videoId
|
videoId: videoId
|
||||||
invidious: m.top.invidious
|
invidious: m.top.invidious
|
||||||
})
|
})
|
||||||
@@ -135,13 +144,20 @@ function Close(_unused as dynamic)
|
|||||||
m.sponsorBlockTask = invalid
|
m.sponsorBlockTask = invalid
|
||||||
end if
|
end if
|
||||||
|
|
||||||
m.top.control = "stop"
|
|
||||||
m.top.content = invalid
|
|
||||||
parent = m.top.getParent()
|
parent = m.top.getParent()
|
||||||
if parent <> invalid
|
if parent <> invalid
|
||||||
parent.RemoveChild(m.top)
|
parent.RemoveChild(m.top)
|
||||||
end if
|
end if
|
||||||
SponsorBlock.RemoveNotifcation(m.notifications)
|
SponsorBlock.RemoveNotifcation(m.notifications)
|
||||||
|
|
||||||
|
' Stopping a video is slow and synchronous, and can lead to execution timeout crashes.
|
||||||
|
try
|
||||||
|
m.top.control = "stop"
|
||||||
|
catch error
|
||||||
|
DialogUtils.ShowDialog(ErrorUtils.Format(error), "Error closing video", true)
|
||||||
|
end try
|
||||||
|
|
||||||
|
m.top.content = invalid
|
||||||
end function
|
end function
|
||||||
|
|
||||||
function OnVideoPlayerStateChange() as void
|
function OnVideoPlayerStateChange() as void
|
||||||
@@ -320,6 +336,34 @@ function OnFullScreenChange()
|
|||||||
m.minimizeAnimation.control = "start"
|
m.minimizeAnimation.control = "start"
|
||||||
|
|
||||||
m.top.enableUI = m.container.fullscreen
|
m.top.enableUI = m.container.fullscreen
|
||||||
|
m.top.showFullScreenHint = not m.container.fullscreen
|
||||||
|
|
||||||
SponsorBlock.SetVisible(m.notifications, m.container.fullscreen)
|
SponsorBlock.SetVisible(m.notifications, m.container.fullscreen)
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function OnShowFullScreenHint() as void
|
||||||
|
m.fullScreenHintTimer.control = "stop"
|
||||||
|
|
||||||
|
if m.container.fullscreen
|
||||||
|
m.fullScreenHint.visible = false
|
||||||
|
return
|
||||||
|
end if
|
||||||
|
|
||||||
|
if m.top.showFullScreenHint
|
||||||
|
' Take 1 second until the shrink animation finishes to show the hint
|
||||||
|
m.fullScreenHintTimer.duration = 1
|
||||||
|
else
|
||||||
|
' Wait 5 seconds then hide the hint
|
||||||
|
m.fullScreenHintTimer.duration = 5
|
||||||
|
end if
|
||||||
|
|
||||||
|
m.fullScreenHintTimer.control = "start"
|
||||||
|
end function
|
||||||
|
|
||||||
|
function OnFullScreenHintTimer()
|
||||||
|
showFullScreenHint = m.top.showFullScreenHint
|
||||||
|
m.fullScreenHint.visible = showFullScreenHint
|
||||||
|
if showFullScreenHint
|
||||||
|
m.top.showFullScreenHint = false
|
||||||
|
end if
|
||||||
|
end function
|
||||||
@@ -10,6 +10,7 @@
|
|||||||
<field id="minRect" type="rect2D" value="[834,460,426,240]" />
|
<field id="minRect" type="rect2D" value="[834,460,426,240]" />
|
||||||
<field id="maxRect" type="rect2D" value="[0,0,1280,720]" />
|
<field id="maxRect" type="rect2D" value="[0,0,1280,720]" />
|
||||||
<field id="chapter" type="string" alias="chapterLabel.text" />
|
<field id="chapter" type="string" alias="chapterLabel.text" />
|
||||||
|
<field id="showFullScreenHint" type="boolean" alwaysNotify="true" onChange="OnShowFullScreenHint" />
|
||||||
<function name="PlayWithContent" />
|
<function name="PlayWithContent" />
|
||||||
<function name="Close" />
|
<function name="Close" />
|
||||||
</interface>
|
</interface>
|
||||||
@@ -43,5 +44,24 @@
|
|||||||
key="[0.0, 0.5, 1.0]"
|
key="[0.0, 0.5, 1.0]"
|
||||||
fieldToInterp="VideoPlayer.translation" />
|
fieldToInterp="VideoPlayer.translation" />
|
||||||
</Animation>
|
</Animation>
|
||||||
|
<Rectangle
|
||||||
|
id="fullScreenHint"
|
||||||
|
height="26"
|
||||||
|
color="0x000000"
|
||||||
|
opacity="0.8"
|
||||||
|
visible="false">
|
||||||
|
<Label
|
||||||
|
id="fullScreenHintLabel"
|
||||||
|
text="Press Options (*) for full screen"
|
||||||
|
height="26"
|
||||||
|
color="0xFFFFFF"
|
||||||
|
horizAlign="center"
|
||||||
|
vertAlign="center"
|
||||||
|
font="font:SmallestSystemFont"
|
||||||
|
/>
|
||||||
|
<Timer
|
||||||
|
id="fullScreenHintTimer"
|
||||||
|
duration="5" />
|
||||||
|
</Rectangle>
|
||||||
</children>
|
</children>
|
||||||
</component>
|
</component>
|
||||||
@@ -4,10 +4,14 @@ namespace Http
|
|||||||
|
|
||||||
class BookmarksRouter extends HttpRouter
|
class BookmarksRouter extends HttpRouter
|
||||||
|
|
||||||
function new()
|
function new(server as object)
|
||||||
super()
|
super()
|
||||||
|
|
||||||
m.Get("/api/bookmarks", function(context as object) as boolean
|
m.bookmarksNode = server.task.bookmarks
|
||||||
|
end function
|
||||||
|
|
||||||
|
@get("/api/bookmarks")
|
||||||
|
function GetBookmarks(context as object) as boolean
|
||||||
response = context.response
|
response = context.response
|
||||||
|
|
||||||
bookmarksString = RegistryUtils.Read(RegistryUtils.BOOKMARKS)
|
bookmarksString = RegistryUtils.Read(RegistryUtils.BOOKMARKS)
|
||||||
@@ -23,19 +27,17 @@ namespace Http
|
|||||||
response.http_code = 200
|
response.http_code = 200
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end function)
|
end function
|
||||||
|
|
||||||
m.Get("/api/bookmarks/feeds", function(context as object) as boolean
|
@get("/api/bookmarks/feeds")
|
||||||
|
function GetBookmarksFeeds(context as object) as boolean
|
||||||
response = context.response
|
response = context.response
|
||||||
router = context.router
|
|
||||||
bookmarks = context.server.task.bookmarks
|
|
||||||
|
|
||||||
feeds = router.BookmarksContentToFeeds(bookmarks.content)
|
feeds = m.BookmarksContentToFeeds(m.bookmarksNode.content)
|
||||||
|
|
||||||
response.Json(feeds)
|
response.Json(feeds)
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end function)
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
' TODO:P1 refactor to share code with Bookmarks screen
|
' TODO:P1 refactor to share code with Bookmarks screen
|
||||||
|
|||||||
@@ -5,15 +5,20 @@ import "pkg:/source/utils/Types.bs"
|
|||||||
namespace Http
|
namespace Http
|
||||||
|
|
||||||
class DashRouter extends HttpRouter
|
class DashRouter extends HttpRouter
|
||||||
|
function new(server as object)
|
||||||
function new()
|
|
||||||
super()
|
super()
|
||||||
|
|
||||||
m.Get("/api/dash", function(context as object) as boolean
|
m.invidiousNode = server.task.invidious
|
||||||
|
m.invidiousService = new Invidious.InvidiousService(m.invidiousNode)
|
||||||
|
' No need to pass the invidious instance here, we will refresh it for
|
||||||
|
' each request to make sure we are using the latest one
|
||||||
|
m.dashManifest = new DashManifest("")
|
||||||
|
end function
|
||||||
|
|
||||||
|
@get("/api/dash")
|
||||||
|
function GenerateDashManifest(context as object) as boolean
|
||||||
request = context.request
|
request = context.request
|
||||||
response = context.response
|
response = context.response
|
||||||
task = context.server.task
|
|
||||||
invidiousNode = task.invidious
|
|
||||||
|
|
||||||
v = request.query.v
|
v = request.query.v
|
||||||
local = request.query.local
|
local = request.query.local
|
||||||
@@ -23,25 +28,22 @@ namespace Http
|
|||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
service = new Invidious.InvidiousService(invidiousNode)
|
metadataRequest = m.invidiousService.GetVideoMetadata(v)
|
||||||
metadataRequest = service.GetVideoMetadata(v)
|
|
||||||
if not metadataRequest.IsSuccess()
|
if not metadataRequest.IsSuccess()
|
||||||
response.Default(metadataRequest.StatusCode(), metadataRequest.ErrorMessage())
|
response.Default(metadataRequest.StatusCode(), metadataRequest.ErrorMessage())
|
||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
metadata = metadataRequest.Json()
|
metadata = metadataRequest.Json()
|
||||||
instance = service.GetInstance()
|
m.dashManifest.invidiousInstance = m.invidiousService.GetInstance()
|
||||||
|
|
||||||
dash = new DashManifest(instance)
|
xmlContent = m.dashManifest.fromVideoMetadata(metadata, ValidString(local) = "true")
|
||||||
xmlContent = dash.fromVideoMetadata(metadata, ValidString(local) = "true")
|
|
||||||
|
|
||||||
response.http_code = 200
|
response.http_code = 200
|
||||||
response.SetBodyDataString(xmlContent)
|
response.SetBodyDataString(xmlContent)
|
||||||
response.ContentType("application/dash+xml")
|
response.ContentType("application/dash+xml")
|
||||||
|
|
||||||
return true
|
return true
|
||||||
end function)
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
end class
|
end class
|
||||||
|
|||||||
@@ -0,0 +1,25 @@
|
|||||||
|
import "pkg:/components/Screens/HomeScreen/HomeScreenUtils.bs"
|
||||||
|
|
||||||
|
namespace Http
|
||||||
|
|
||||||
|
class HomeLayoutRouter extends HttpRouter
|
||||||
|
|
||||||
|
function new(server as object)
|
||||||
|
super()
|
||||||
|
|
||||||
|
m.preferencesNode = server.task.preferences
|
||||||
|
end function
|
||||||
|
|
||||||
|
@get("/api/home-layout")
|
||||||
|
function GetHomeLayout(context as object) as boolean
|
||||||
|
response = context.response
|
||||||
|
|
||||||
|
feed = HomeScreenUtils.GetFeed("libpkg:/config/default_home_layout.yaml", m.preferencesNode)
|
||||||
|
response.Json(feed)
|
||||||
|
|
||||||
|
return true
|
||||||
|
end function
|
||||||
|
|
||||||
|
end class
|
||||||
|
|
||||||
|
end namespace
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
namespace Http
|
||||||
|
|
||||||
|
class HomeRouter extends HttpRouter
|
||||||
|
|
||||||
|
function new()
|
||||||
|
super()
|
||||||
|
end function
|
||||||
|
|
||||||
|
@get("/")
|
||||||
|
function GoHome(context as object) as boolean
|
||||||
|
response = context.response
|
||||||
|
response.Redirect("/index.html")
|
||||||
|
return true
|
||||||
|
end function
|
||||||
|
|
||||||
|
end class
|
||||||
|
|
||||||
|
end namespace
|
||||||
@@ -5,33 +5,36 @@ namespace Http
|
|||||||
|
|
||||||
class InvidiousRouter extends HttpRouter
|
class InvidiousRouter extends HttpRouter
|
||||||
|
|
||||||
function new()
|
function new(server as object)
|
||||||
super()
|
super()
|
||||||
|
|
||||||
m.Get("/invidious/login", function(context as object) as boolean
|
m.invidiousNode = server.task.invidious
|
||||||
response = context.response
|
m.invidiousService = new Invidious.InvidiousService(m.invidiousNode)
|
||||||
invidiousNode = context.server.task.invidious
|
end function
|
||||||
|
|
||||||
authLink = invidiousNode@.GetAuthorizeTokenLink()
|
@get("/invidious/login")
|
||||||
|
function Login(context as object) as boolean
|
||||||
|
response = context.response
|
||||||
|
|
||||||
|
authLink = m.invidiousNode@.GetAuthorizeTokenLink()
|
||||||
response.Redirect(authLink)
|
response.Redirect(authLink)
|
||||||
return true
|
return true
|
||||||
end function)
|
end function
|
||||||
|
|
||||||
m.Get("/invidious/logout", function(context as object) as boolean
|
@get("/invidious/logout")
|
||||||
|
function Logout(context as object) as boolean
|
||||||
response = context.response
|
response = context.response
|
||||||
invidiousNode = context.server.task.invidious
|
|
||||||
|
|
||||||
service = new Invidious.InvidiousService(invidiousNode)
|
m.invidiousService.Logout()
|
||||||
service.Logout()
|
|
||||||
|
|
||||||
response.Default(204, "OK")
|
response.Default(204, "OK")
|
||||||
return true
|
return true
|
||||||
end function)
|
end function
|
||||||
|
|
||||||
m.Get(Invidious.TOKEN_CALLBACK, function(context as object) as boolean
|
@get("/invidious/token_callback")
|
||||||
|
function OnTokenReceived(context as object) as boolean
|
||||||
request = context.request
|
request = context.request
|
||||||
response = context.response
|
response = context.response
|
||||||
invidiousNode = context.server.task.invidious
|
|
||||||
|
|
||||||
if request.query["token"] <> invalid and request.query["ref"] <> invalid
|
if request.query["token"] <> invalid and request.query["ref"] <> invalid
|
||||||
' Invidious encodes token and username twice
|
' Invidious encodes token and username twice
|
||||||
@@ -39,21 +42,21 @@ namespace Http
|
|||||||
username = request.query["username"].DecodeUriComponent().DecodeUriComponent()
|
username = request.query["username"].DecodeUriComponent().DecodeUriComponent()
|
||||||
referer = request.query["ref"].DecodeUriComponent()
|
referer = request.query["ref"].DecodeUriComponent()
|
||||||
|
|
||||||
invidiousNode@.SetAuthToken(token, referer, username)
|
m.invidiousNode@.SetAuthToken(token, referer, username)
|
||||||
end if
|
end if
|
||||||
response.Redirect("/")
|
response.Redirect("/")
|
||||||
return true
|
return true
|
||||||
end function)
|
end function
|
||||||
|
|
||||||
' This is an endpoint allowing the web app to make an authenticated request
|
' This is an endpoint allowing the web app to make an authenticated request
|
||||||
' without needing the Invidious token
|
' without needing the Invidious token
|
||||||
' This is a GET not a POST for better caching
|
' This is a GET not a POST for better caching
|
||||||
m.Get("/invidious/authenticated-request", function(context as object) as boolean
|
@get("/invidious/authenticated-request")
|
||||||
|
function AuthRequestProxy(context as object) as boolean
|
||||||
request = context.request
|
request = context.request
|
||||||
response = context.response
|
response = context.response
|
||||||
invidiousNode = context.server.task.invidious
|
|
||||||
|
|
||||||
token = invidiousNode.authToken
|
token = m.invidiousNode.authToken
|
||||||
if token = invalid
|
if token = invalid
|
||||||
response.Default(403, "No token, not logged in")
|
response.Default(403, "No token, not logged in")
|
||||||
return true
|
return true
|
||||||
@@ -71,14 +74,12 @@ namespace Http
|
|||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
invService = new Invidious.InvidiousService(invidiousNode)
|
|
||||||
|
|
||||||
additionalQueryParams = invalid
|
additionalQueryParams = invalid
|
||||||
if feedSource.state <> invalid and feedSource.state.queryParams <> invalid
|
if feedSource.state <> invalid and feedSource.state.queryParams <> invalid
|
||||||
additionalQueryParams = feedSource.state.queryParams
|
additionalQueryParams = feedSource.state.queryParams
|
||||||
end if
|
end if
|
||||||
|
|
||||||
invResponse = invService.MakeRequest(feedSource, additionalQueryParams)
|
invResponse = m.invidiousService.MakeRequest(feedSource, additionalQueryParams)
|
||||||
if not invResponse.success
|
if not invResponse.success
|
||||||
response.Default(500, `Failed to make request: ${invResponse.error}`)
|
response.Default(500, `Failed to make request: ${invResponse.error}`)
|
||||||
return true
|
return true
|
||||||
@@ -86,8 +87,6 @@ namespace Http
|
|||||||
|
|
||||||
response.Json(invResponse.result)
|
response.Json(invResponse.result)
|
||||||
return true
|
return true
|
||||||
end function)
|
|
||||||
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
end class
|
end class
|
||||||
|
|||||||
@@ -5,27 +5,28 @@ namespace Http
|
|||||||
|
|
||||||
class PlayQueueRouter extends HttpRouter
|
class PlayQueueRouter extends HttpRouter
|
||||||
|
|
||||||
function new()
|
function new(server as object)
|
||||||
super()
|
super()
|
||||||
|
|
||||||
' Get queue
|
task = server.task
|
||||||
m.Get("/api/queue", function(context as object) as boolean
|
m.playQueueNode = task.playQueue
|
||||||
response = context.response
|
m.invidiousNode = task.invidious
|
||||||
task = context.server.task
|
m.invidiousService = new Invidious.InvidiousService(m.invidiousNode)
|
||||||
playQueue = task.playQueue
|
end function
|
||||||
|
|
||||||
queue = playQueue@.GetQueue()
|
@get("/api/queue")
|
||||||
|
function GetQueue(context as object) as boolean
|
||||||
|
response = context.response
|
||||||
|
|
||||||
|
queue = m.playQueueNode@.GetQueue()
|
||||||
response.Json(queue)
|
response.Json(queue)
|
||||||
return true
|
return true
|
||||||
end function)
|
end function
|
||||||
|
|
||||||
' Add to queue
|
@post("/api/queue")
|
||||||
m.Post("/api/queue", function(context as object) as boolean
|
function AddToQueue(context as object) as boolean
|
||||||
request = context.request
|
request = context.request
|
||||||
response = context.response
|
response = context.response
|
||||||
task = context.server.task
|
|
||||||
playQueue = task.playQueue
|
|
||||||
invidiousNode = task.invidious
|
|
||||||
|
|
||||||
payload = request.Json()
|
payload = request.Json()
|
||||||
if payload = invalid
|
if payload = invalid
|
||||||
@@ -40,24 +41,20 @@ namespace Http
|
|||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
service = new Invidious.InvidiousService(invidiousNode)
|
instance = m.invidiousService.GetInstance()
|
||||||
instance = service.GetInstance()
|
|
||||||
|
|
||||||
contentNode = InvidiousContent.ToRowCellContentNode(payload, instance)
|
contentNode = InvidiousContent.ToRowCellContentNode(payload, instance)
|
||||||
playQueue@.AddToQueue(contentNode)
|
m.playQueueNode@.AddToQueue(contentNode)
|
||||||
|
|
||||||
queue = playQueue@.GetQueue()
|
queue = m.playQueueNode@.GetQueue()
|
||||||
response.Json(queue)
|
response.Json(queue)
|
||||||
return true
|
return true
|
||||||
end function)
|
end function
|
||||||
|
|
||||||
' Play a video
|
@post("/api/queue/play")
|
||||||
m.Post("/api/queue/play", function(context as object) as boolean
|
function Play(context as object) as boolean
|
||||||
request = context.request
|
request = context.request
|
||||||
response = context.response
|
response = context.response
|
||||||
task = context.server.task
|
|
||||||
playQueue = task.playQueue
|
|
||||||
invidiousNode = task.invidious
|
|
||||||
|
|
||||||
payload = request.Json()
|
payload = request.Json()
|
||||||
if payload = invalid
|
if payload = invalid
|
||||||
@@ -76,8 +73,7 @@ namespace Http
|
|||||||
payload.timestamp = payload.timestamp.toInt()
|
payload.timestamp = payload.timestamp.toInt()
|
||||||
end if
|
end if
|
||||||
|
|
||||||
service = new Invidious.InvidiousService(invidiousNode)
|
instance = m.invidiousService.GetInstance()
|
||||||
instance = service.GetInstance()
|
|
||||||
|
|
||||||
contentNode = InvidiousContent.ToRowCellContentNode(payload, instance)
|
contentNode = InvidiousContent.ToRowCellContentNode(payload, instance)
|
||||||
playlistIndex = IsInt(payload.playlistIndex) ? payload.playlistIndex : -1
|
playlistIndex = IsInt(payload.playlistIndex) ? payload.playlistIndex : -1
|
||||||
@@ -86,28 +82,19 @@ namespace Http
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
'TODO:P1 play existing item by index instead of new item inserted
|
'TODO:P1 play existing item by index instead of new item inserted
|
||||||
playQueue@.Play(contentNode, playlistIndex)
|
m.playQueueNode@.Play(contentNode, playlistIndex)
|
||||||
|
|
||||||
response.Default(204, "OK")
|
response.Default(204, "OK")
|
||||||
return true
|
return true
|
||||||
end function)
|
end function
|
||||||
|
|
||||||
' clear queue
|
@delete("/api/queue")
|
||||||
m.Delete("/api/queue", function(context as object) as boolean
|
function ClearQueue(context as object) as boolean
|
||||||
response = context.response
|
response = context.response
|
||||||
task = context.server.task
|
|
||||||
playQueue = task.playQueue
|
|
||||||
|
|
||||||
if playQueue = invalid
|
m.playQueueNode@.Clear()
|
||||||
response.Default(500, `Reference to "playQueue" object was invalid`)
|
|
||||||
return true
|
|
||||||
end if
|
|
||||||
|
|
||||||
playQueue@.Clear()
|
|
||||||
response.Default(204, "OK")
|
response.Default(204, "OK")
|
||||||
return true
|
return true
|
||||||
end function)
|
|
||||||
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
end class
|
end class
|
||||||
|
|||||||
@@ -4,13 +4,16 @@ namespace Http
|
|||||||
|
|
||||||
class PlayletLibUrlsRouter extends HttpRouter
|
class PlayletLibUrlsRouter extends HttpRouter
|
||||||
|
|
||||||
function new()
|
function new(server as object)
|
||||||
super()
|
super()
|
||||||
|
|
||||||
m.Get("/api/playlet-lib-urls", function(context as object) as boolean
|
task = server.task
|
||||||
|
m.scene = task.getScene()
|
||||||
|
end function
|
||||||
|
|
||||||
|
@get("/api/playlet-lib-urls")
|
||||||
|
function GetPlayletLibUrls(context as object) as boolean
|
||||||
response = context.response
|
response = context.response
|
||||||
task = context.server.task
|
|
||||||
scene = task.getScene()
|
|
||||||
|
|
||||||
saved = RegistryUtils.Read(RegistryUtils.PLAYLET_LIB_URLS)
|
saved = RegistryUtils.Read(RegistryUtils.PLAYLET_LIB_URLS)
|
||||||
if saved <> invalid
|
if saved <> invalid
|
||||||
@@ -18,13 +21,14 @@ namespace Http
|
|||||||
end if
|
end if
|
||||||
|
|
||||||
response.Json({
|
response.Json({
|
||||||
loaded: scene.playletLibLoadedUrl
|
loaded: m.scene.playletLibLoadedUrl
|
||||||
saved: saved
|
saved: saved
|
||||||
})
|
})
|
||||||
return true
|
return true
|
||||||
end function)
|
end function
|
||||||
|
|
||||||
m.Post("/api/playlet-lib-urls", function(context as object) as boolean
|
@post("/api/playlet-lib-urls")
|
||||||
|
function SetPlayletLibUrls(context as object) as boolean
|
||||||
request = context.request
|
request = context.request
|
||||||
response = context.response
|
response = context.response
|
||||||
|
|
||||||
@@ -50,19 +54,17 @@ namespace Http
|
|||||||
|
|
||||||
response.Default(204, "OK")
|
response.Default(204, "OK")
|
||||||
return true
|
return true
|
||||||
end function)
|
end function
|
||||||
|
|
||||||
m.Delete("/api/playlet-lib-urls", function(context as object) as boolean
|
@delete("/api/playlet-lib-urls")
|
||||||
|
function DeletePlayletLibUrls(context as object) as boolean
|
||||||
response = context.response
|
response = context.response
|
||||||
|
|
||||||
RegistryUtils.Delete(RegistryUtils.PLAYLET_LIB_URLS)
|
RegistryUtils.Delete(RegistryUtils.PLAYLET_LIB_URLS)
|
||||||
|
|
||||||
response.Default(204, "OK")
|
response.Default(204, "OK")
|
||||||
return true
|
return true
|
||||||
end function)
|
|
||||||
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
end class
|
end class
|
||||||
|
|
||||||
end namespace
|
end namespace
|
||||||
@@ -2,31 +2,25 @@ namespace Http
|
|||||||
|
|
||||||
class PreferencesRouter extends HttpRouter
|
class PreferencesRouter extends HttpRouter
|
||||||
|
|
||||||
function new()
|
function new(server as object)
|
||||||
super()
|
super()
|
||||||
|
|
||||||
' Get preferences
|
m.preferencesNode = server.task.preferences
|
||||||
m.Get("/api/preferences", function(context as object) as boolean
|
end function
|
||||||
|
|
||||||
|
@get("/api/preferences")
|
||||||
|
function GetPreferences(context as object) as boolean
|
||||||
response = context.response
|
response = context.response
|
||||||
task = context.server.task
|
|
||||||
preferences = task.preferences
|
|
||||||
|
|
||||||
if preferences = invalid
|
userPrefs = m.preferencesNode@.GetUserPreferences()
|
||||||
response.Default(500, `Reference to "preferences" object was invalid`)
|
|
||||||
return true
|
|
||||||
end if
|
|
||||||
|
|
||||||
userPrefs = preferences@.GetUserPreferences()
|
|
||||||
response.Json(userPrefs)
|
response.Json(userPrefs)
|
||||||
return true
|
return true
|
||||||
end function)
|
end function
|
||||||
|
|
||||||
' Update preferences
|
@put("/api/preferences")
|
||||||
m.Put("/api/preferences", function(context as object) as boolean
|
function UpdatePreferences(context as object) as boolean
|
||||||
request = context.request
|
request = context.request
|
||||||
response = context.response
|
response = context.response
|
||||||
task = context.server.task
|
|
||||||
preferences = task.preferences
|
|
||||||
|
|
||||||
payload = request.Json()
|
payload = request.Json()
|
||||||
if payload = invalid
|
if payload = invalid
|
||||||
@@ -34,32 +28,18 @@ namespace Http
|
|||||||
return true
|
return true
|
||||||
end if
|
end if
|
||||||
|
|
||||||
if preferences = invalid
|
m.preferencesNode@.ApplyUserPreferences(payload)
|
||||||
response.Default(500, `Reference to "preferences" object was invalid`)
|
|
||||||
return true
|
|
||||||
end if
|
|
||||||
|
|
||||||
preferences@.ApplyUserPreferences(payload)
|
|
||||||
response.Default(204, "OK")
|
response.Default(204, "OK")
|
||||||
return true
|
return true
|
||||||
end function)
|
end function
|
||||||
|
|
||||||
' Reset default preferences
|
@delete("/api/preferences")
|
||||||
m.Delete("/api/preferences", function(context as object) as boolean
|
function ResetPreferences(context as object) as boolean
|
||||||
response = context.response
|
response = context.response
|
||||||
task = context.server.task
|
|
||||||
preferences = task.preferences
|
|
||||||
|
|
||||||
if preferences = invalid
|
m.preferencesNode@.ClearUserPreferences()
|
||||||
response.Default(500, `Reference to "preferences" object was invalid`)
|
|
||||||
return true
|
|
||||||
end if
|
|
||||||
|
|
||||||
preferences@.ClearUserPreferences()
|
|
||||||
response.Default(204, "OK")
|
response.Default(204, "OK")
|
||||||
return true
|
return true
|
||||||
end function)
|
|
||||||
|
|
||||||
end function
|
end function
|
||||||
|
|
||||||
end class
|
end class
|
||||||
|
|||||||
@@ -0,0 +1,49 @@
|
|||||||
|
#if DEBUG
|
||||||
|
import "pkg:/source/utils/RegistryUtils.bs"
|
||||||
|
|
||||||
|
namespace Http
|
||||||
|
|
||||||
|
class RegistryRouter extends HttpRouter
|
||||||
|
|
||||||
|
function new()
|
||||||
|
super()
|
||||||
|
end function
|
||||||
|
|
||||||
|
@get("/debug/registry")
|
||||||
|
function GetRegistry(context as object) as boolean
|
||||||
|
response = context.response
|
||||||
|
|
||||||
|
registryValues = RegistryUtils.ReadAll()
|
||||||
|
response.Json(registryValues)
|
||||||
|
return true
|
||||||
|
end function
|
||||||
|
|
||||||
|
@post("/debug/registry")
|
||||||
|
function SetRegistry(context as object) as boolean
|
||||||
|
request = context.request
|
||||||
|
response = context.response
|
||||||
|
|
||||||
|
payload = request.Json()
|
||||||
|
if payload = invalid
|
||||||
|
response.Default(400, "Invalid JSON")
|
||||||
|
return true
|
||||||
|
end if
|
||||||
|
|
||||||
|
RegistryUtils.WriteAll(payload)
|
||||||
|
response.Default(204, "OK")
|
||||||
|
return true
|
||||||
|
end function
|
||||||
|
|
||||||
|
@delete("/debug/registry")
|
||||||
|
function ClearRegistry(context as object) as boolean
|
||||||
|
response = context.response
|
||||||
|
|
||||||
|
RegistryUtils.DeleteAll()
|
||||||
|
response.Default(204, "OK")
|
||||||
|
return true
|
||||||
|
end function
|
||||||
|
|
||||||
|
end class
|
||||||
|
|
||||||
|
end namespace
|
||||||
|
#end if
|
||||||