Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
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,34 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [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
|
||||
|
||||
### Fixed
|
||||
@@ -12,7 +40,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 where a long press can cause a crash
|
||||
- [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
|
||||
|
||||
|
||||
@@ -101,6 +101,7 @@ In any case, I hope you find **Playlet** useful, and pleasant to use.
|
||||
## Disclaimer
|
||||
|
||||
**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 } } -->
|
||||
@@ -70,11 +70,13 @@
|
||||
"../tools/bs-plugins/json-yaml-plugin.ts",
|
||||
"../tools/bs-plugins/validation-plugin.ts",
|
||||
"../tools/bs-plugins/logger-plugin.ts",
|
||||
"../tools/bs-plugins/image-gen-plugin.ts"
|
||||
"../tools/bs-plugins/image-gen-plugin.ts",
|
||||
"../tools/bs-plugins/type-gen-plugin.ts"
|
||||
],
|
||||
"retainStagingDir": true,
|
||||
"require": [
|
||||
"ts-node/register"
|
||||
],
|
||||
"sourceMap": true
|
||||
"sourceMap": true,
|
||||
"pruneEmptyCodeFiles": true
|
||||
}
|
||||
@@ -26,7 +26,8 @@
|
||||
"../tools/bs-plugins/json-yaml-plugin.ts",
|
||||
"../tools/bs-plugins/validation-plugin.ts",
|
||||
"../tools/bs-plugins/logger-plugin.ts",
|
||||
"../tools/bs-plugins/image-gen-plugin.ts"
|
||||
"../tools/bs-plugins/image-gen-plugin.ts",
|
||||
"../tools/bs-plugins/type-gen-plugin.ts"
|
||||
],
|
||||
"rooibos": {
|
||||
"logLevel": 2,
|
||||
|
||||
@@ -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.
|
||||
- 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)
|
||||
|
||||
|
||||
@@ -4,8 +4,7 @@ This is an automated release. It is generated when new code is pushed to the mai
|
||||
|
||||
To test this release:
|
||||
|
||||
- Open Playlet web app in a browser (`http://ROKU_IP_ADDRESS:8888/index.html`)
|
||||
- Go to settings, and scroll down to `Developer settings`
|
||||
- Set `Playlet Library version` to `canary` and click `Apply`
|
||||
- Open Playlet web app settings in a browser (`http://ROKU_IP_ADDRESS:8888/index.html#settings`)
|
||||
- Scroll down to `Developer settings` and set `Playlet Library version` to `canary` and click `Apply`
|
||||
- Restart Playlet
|
||||
- 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:
|
||||
title: Playlet Web API
|
||||
version: 0.18.1
|
||||
version: 0.19.1
|
||||
description:
|
||||
Playlet Web API is a RESTful API for controlling the Playlet app on
|
||||
Roku devices. The API is intended to be used by the Playlet web app, but can
|
||||
@@ -153,7 +153,7 @@ paths:
|
||||
properties:
|
||||
index:
|
||||
type: integer
|
||||
playlistIndex
|
||||
playlistIndex:
|
||||
type: integer
|
||||
items:
|
||||
type: array
|
||||
@@ -178,7 +178,7 @@ paths:
|
||||
properties:
|
||||
index:
|
||||
type: integer
|
||||
playlistIndex
|
||||
playlistIndex:
|
||||
type: integer
|
||||
items:
|
||||
type: array
|
||||
@@ -227,6 +227,41 @@ paths:
|
||||
description: No Content
|
||||
"400":
|
||||
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:
|
||||
get:
|
||||
summary: Get Playlet lib URLs
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
- [Async Task Generator](#async-task-generator)
|
||||
- [Tracking transpilied files](#tracking-transpilied-files)
|
||||
- [Logger](#logger)
|
||||
- [Type Gen](#type-gen)
|
||||
|
||||
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 +470,10 @@ end function
|
||||
And use the function like so
|
||||
|
||||
```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
|
||||
print(output.result.value)
|
||||
end if
|
||||
@@ -478,7 +482,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.
|
||||
|
||||
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
|
||||
|
||||
@@ -517,7 +521,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)`
|
||||
- Based on usage, it generates `LogErrorX` functions used. Example:
|
||||
|
||||
```
|
||||
```brs
|
||||
function LogError2(arg0, arg1) as void
|
||||
logger = m.global.logger
|
||||
if logger.logLevel < 0
|
||||
@@ -537,3 +541,33 @@ 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 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
|
||||
```
|
||||
@@ -1,30 +1,37 @@
|
||||
# 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
|
||||
|
||||

|
||||
|
||||
## Link to web app
|
||||
|
||||

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

|
||||
|
||||
## Web app
|
||||
|
||||
|  |  |  |
|
||||
| Home | Search | Settings |
|
||||
| ---------------------------------- | -------------------------------------- | ------------------------------------------ |
|
||||
|  |  |  |
|
||||
|
||||
| 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,22 +1,22 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.18.1",
|
||||
"version": "0.19.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet",
|
||||
"version": "0.18.1",
|
||||
"version": "0.19.1",
|
||||
"hasInstallScript": true,
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.8.13",
|
||||
"@rokucommunity/bslint": "^0.8.14",
|
||||
"@types/crypto-js": "^4.2.1",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/node": "^20.10.6",
|
||||
"@types/node": "^20.11.0",
|
||||
"@types/xml2js": "^0.4.14",
|
||||
"argparse": "^2.0.1",
|
||||
"brighterscript": "0.65.15",
|
||||
"brighterscript-formatter": "^1.6.36",
|
||||
"brighterscript": "0.65.16",
|
||||
"brighterscript-formatter": "^1.6.37",
|
||||
"convert-svg-to-png": "^0.6.4",
|
||||
"cross-fetch": "^4.0.0",
|
||||
"crypto-js": "^4.2.0",
|
||||
@@ -27,9 +27,9 @@
|
||||
"imap": "^0.8.19",
|
||||
"ip": "^1.1.8",
|
||||
"json5": "^2.2.3",
|
||||
"mailparser": "^3.6.5",
|
||||
"mailparser": "^3.6.6",
|
||||
"roku-deploy": "^3.11.2",
|
||||
"rooibos-roku": "^5.8.0",
|
||||
"rooibos-roku": "^5.10.0",
|
||||
"semver": "^7.5.4",
|
||||
"shelljs": "^0.8.5",
|
||||
"ts-node": "^10.9.2",
|
||||
@@ -276,9 +276,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@rokucommunity/bslint": {
|
||||
"version": "0.8.13",
|
||||
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.13.tgz",
|
||||
"integrity": "sha512-EC5tQdtRFTJxOo+9lnZz6yLcsyctuchCzUNJX391ZgCN0EKJTjGigyqTsdsFprINmr0pBojUiys/ZpS/Bv3ROQ==",
|
||||
"version": "0.8.14",
|
||||
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.14.tgz",
|
||||
"integrity": "sha512-vKD2weW5I8jOXe+2xHN9FZ9GUCkbE/FOTbWcziLXrObraXJZcNRqk+fWDvi7go79ourQ/9DmYfmFH0bocjOMqg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"fs-extra": "^10.0.0",
|
||||
@@ -370,9 +370,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "20.10.6",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.10.6.tgz",
|
||||
"integrity": "sha512-Vac8H+NlRNNlAmDfGUP7b5h/KA+AtWIzuXy0E6OyP8f1tCLYAtPvKRRDJjAPqhpCb0t6U2j7/xqAuLEebW2kiw==",
|
||||
"version": "20.11.0",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.11.0.tgz",
|
||||
"integrity": "sha512-o9bjXmDNcF7GbM4CNQpmi+TutCgap/K3w1JyKgxAjqx41zp9qlIAVFi0IhCNsJcXolEqLWhbFbEeL0PvYm4pcQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"undici-types": "~5.26.4"
|
||||
@@ -728,9 +728,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/brighterscript": {
|
||||
"version": "0.65.15",
|
||||
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.65.15.tgz",
|
||||
"integrity": "sha512-WDnHaeCQclDG8wic1SCLYavnZDSjjzHcWxo+efwYkvyTjZivPoGWXbEulsYM3Nm9VawPuWWwzVqzHiN0Y4RvxQ==",
|
||||
"version": "0.65.16",
|
||||
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.65.16.tgz",
|
||||
"integrity": "sha512-2RJMF8itkrPXtZ92JkJf3emvzcCl5ETXGVyPsdO/hMKbUGinEGMRFG07FR0bzjRotbALzsozGE/Hjzw412Sjww==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@rokucommunity/bslib": "^0.1.1",
|
||||
@@ -771,12 +771,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/brighterscript-formatter": {
|
||||
"version": "1.6.36",
|
||||
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.6.36.tgz",
|
||||
"integrity": "sha512-f9Y3Re6egB1MCUftph8AT8RxWTtXmeMjwigRv1biNGmEuGeSOipoBnCbwY4U1CFz46L7W39/TL4n1JMV9URD6w==",
|
||||
"version": "1.6.37",
|
||||
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.6.37.tgz",
|
||||
"integrity": "sha512-jIlqRjPVIp2WwB9Pe0YwK4KU4G3WqhRsqRluuOFY1sTDVW0R/AKXMvCfTsu99L2W7CbpeWA4UjOPzl9JOqN5hw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"brighterscript": "^0.65.12",
|
||||
"brighterscript": "^0.65.16",
|
||||
"glob-all": "^3.3.0",
|
||||
"jsonc-parser": "^3.0.0",
|
||||
"source-map": "^0.7.3",
|
||||
@@ -2902,12 +2902,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/linkify-it": {
|
||||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-4.0.1.tgz",
|
||||
"integrity": "sha512-C7bfi1UZmoj8+PQx22XyeXCuBlokoyWQL5pWSP+EI6nzRylyThouddufc2c1NDIcP9k5agmN9fLpA7VNJfIiqw==",
|
||||
"version": "5.0.0",
|
||||
"resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-5.0.0.tgz",
|
||||
"integrity": "sha512-5aHCbzQRADcdP+ATqnDuhhJ/MRIqDkZX5pyjFHRRysS8vZ5AbqGEoFIb6pYHPZ+L/OC2Lc+xT8uHVVR5CAK/wQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"uc.micro": "^1.0.1"
|
||||
"uc.micro": "^2.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/locate-path": {
|
||||
@@ -2980,9 +2980,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/mailparser": {
|
||||
"version": "3.6.5",
|
||||
"resolved": "https://registry.npmjs.org/mailparser/-/mailparser-3.6.5.tgz",
|
||||
"integrity": "sha512-nteTpF0Khm5JLOnt4sigmzNdUH/6mO7PZ4KEnvxf4mckyXYFFhrtAWZzbq/V5aQMH+049gA7ZjfLdh+QiX2Uqg==",
|
||||
"version": "3.6.6",
|
||||
"resolved": "https://registry.npmjs.org/mailparser/-/mailparser-3.6.6.tgz",
|
||||
"integrity": "sha512-noCjBl3FToxmqTP2fp7z17hQsiCroWNntfTd8O+UejOAF59xeN5WGZK27ilexXV2e2X/cbUhG3L8sfEKaz0/sw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"encoding-japanese": "2.0.0",
|
||||
@@ -2990,10 +2990,10 @@
|
||||
"html-to-text": "9.0.5",
|
||||
"iconv-lite": "0.6.3",
|
||||
"libmime": "5.2.1",
|
||||
"linkify-it": "4.0.1",
|
||||
"linkify-it": "5.0.0",
|
||||
"mailsplit": "5.4.0",
|
||||
"nodemailer": "6.9.3",
|
||||
"tlds": "1.240.0"
|
||||
"nodemailer": "6.9.8",
|
||||
"tlds": "1.248.0"
|
||||
}
|
||||
},
|
||||
"node_modules/mailparser/node_modules/iconv-lite": {
|
||||
@@ -3200,9 +3200,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/nodemailer": {
|
||||
"version": "6.9.3",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.3.tgz",
|
||||
"integrity": "sha512-fy9v3NgTzBngrMFkDsKEj0r02U7jm6XfC3b52eoNV+GCrGj+s8pt5OqhiJdWKuw51zCTdiNR/IUD1z33LIIGpg==",
|
||||
"version": "6.9.8",
|
||||
"resolved": "https://registry.npmjs.org/nodemailer/-/nodemailer-6.9.8.tgz",
|
||||
"integrity": "sha512-cfrYUk16e67Ks051i4CntM9kshRYei1/o/Gi8K1d+R34OIs21xdFnW7Pt7EucmVKA0LKtqUGNcjMZ7ehjl49mQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=6.0.0"
|
||||
@@ -3994,9 +3994,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/rooibos-roku": {
|
||||
"version": "5.8.0",
|
||||
"resolved": "https://registry.npmjs.org/rooibos-roku/-/rooibos-roku-5.8.0.tgz",
|
||||
"integrity": "sha512-mPAszwOH1VdxMgSaoXQ/CgpAZ3RQ0A+d3BoxyY8axMsYS5kPO/8dL8fa7iFTGEZYA7803Ur52zlyN8GXqV5nLg==",
|
||||
"version": "5.10.0",
|
||||
"resolved": "https://registry.npmjs.org/rooibos-roku/-/rooibos-roku-5.10.0.tgz",
|
||||
"integrity": "sha512-Idiv3nWQOEr5V8z8oHcIovjcoBffgqRtTQ5B6K+x/cGAouKxyVJp0fsZ80xQvUul9IwHQ0XIPUYbNWCR3RQ3sA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"source-map": "^0.7.3",
|
||||
@@ -4477,9 +4477,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/tlds": {
|
||||
"version": "1.240.0",
|
||||
"resolved": "https://registry.npmjs.org/tlds/-/tlds-1.240.0.tgz",
|
||||
"integrity": "sha512-1OYJQenswGZSOdRw7Bql5Qu7uf75b+F3HFBXbqnG/ifHa0fev1XcG+3pJf3pA/KC6RtHQzfKgIf1vkMlMG7mtQ==",
|
||||
"version": "1.248.0",
|
||||
"resolved": "https://registry.npmjs.org/tlds/-/tlds-1.248.0.tgz",
|
||||
"integrity": "sha512-noj0KdpWTBhwsKxMOXk0rN9otg4kTgLm4WohERRHbJ9IY+kSDKr3RmjitaQ3JFzny+DyvBOQKlFZhp0G0qNSfg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tlds": "bin.js"
|
||||
@@ -4612,9 +4612,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/uc.micro": {
|
||||
"version": "1.0.6",
|
||||
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz",
|
||||
"integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==",
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-2.0.0.tgz",
|
||||
"integrity": "sha512-DffL94LsNOccVn4hyfRe5rdKa273swqeA5DJpMOeFmEn1wCDc7nAbbB0gXlgBCL7TNzeTv6G7XVWzan7iJtfig==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/unbzip2-stream": {
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.18.1",
|
||||
"version": "0.19.1",
|
||||
"description": "Unofficial Youtube client for Roku",
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.8.13",
|
||||
"@rokucommunity/bslint": "^0.8.14",
|
||||
"@types/crypto-js": "^4.2.1",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/node": "^20.10.6",
|
||||
"@types/node": "^20.11.0",
|
||||
"@types/xml2js": "^0.4.14",
|
||||
"argparse": "^2.0.1",
|
||||
"brighterscript": "0.65.15",
|
||||
"brighterscript-formatter": "^1.6.36",
|
||||
"brighterscript": "0.65.16",
|
||||
"brighterscript-formatter": "^1.6.37",
|
||||
"convert-svg-to-png": "^0.6.4",
|
||||
"cross-fetch": "^4.0.0",
|
||||
"crypto-js": "^4.2.0",
|
||||
@@ -21,9 +21,9 @@
|
||||
"imap": "^0.8.19",
|
||||
"ip": "^1.1.8",
|
||||
"json5": "^2.2.3",
|
||||
"mailparser": "^3.6.5",
|
||||
"mailparser": "^3.6.6",
|
||||
"roku-deploy": "^3.11.2",
|
||||
"rooibos-roku": "^5.8.0",
|
||||
"rooibos-roku": "^5.10.0",
|
||||
"semver": "^7.5.4",
|
||||
"shelljs": "^0.8.5",
|
||||
"ts-node": "^10.9.2",
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.18.1",
|
||||
"version": "0.19.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-app",
|
||||
"version": "0.18.1"
|
||||
"version": "0.19.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.18.1",
|
||||
"version": "0.19.1",
|
||||
"description": "Unofficial Youtube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf build/playlet-app",
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
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
|
||||
m.scene = m.top.getScene()
|
||||
m.top.backgroundColor = "#242424FF"
|
||||
@@ -24,17 +22,17 @@ end function
|
||||
|
||||
function GetPlayletLibUrls() as object
|
||||
#if DEBUG
|
||||
debug = { type: "debug", link: ReadManifestValue("playlet_lib_debug_url") }
|
||||
debug = { type: "debug", link: Manifest.ReadValue("playlet_lib_debug_url") }
|
||||
return [debug]
|
||||
#else
|
||||
savedUrls = GetPlayletLibUrlsFromRegistry()
|
||||
savedUrls = Registry.GetPlayletLibUrlsFromRegistry()
|
||||
if savedUrls <> invalid
|
||||
m.shouldClearRegistryOnLoadFail = true
|
||||
return savedUrls
|
||||
end if
|
||||
|
||||
github = { type: "github", link: ReadManifestValue("playlet_lib_remote_url") }
|
||||
embedded = { type: "embedded", link: ReadManifestValue("playlet_lib_embedded_url") }
|
||||
github = { type: "github", link: Manifest.ReadValue("playlet_lib_remote_url") }
|
||||
embedded = { type: "embedded", link: Manifest.ReadValue("playlet_lib_embedded_url") }
|
||||
return [github, embedded]
|
||||
#end if
|
||||
end function
|
||||
@@ -43,7 +41,7 @@ function LoadPlayletLib() as void
|
||||
if m.playletLibUrlIndex >= m.playletLibUrls.Count()
|
||||
m.loadingIndicator.visible = false
|
||||
if m.shouldClearRegistryOnLoadFail = true
|
||||
DeleteRegistryKey("playlet_lib_urls", "Playlet")
|
||||
Registry.DeleteKey("playlet_lib_urls", "Playlet")
|
||||
end if
|
||||
ShowPlayletLibLoadErrorDialog()
|
||||
return
|
||||
@@ -58,8 +56,8 @@ function OnLoadStatusChanged() as void
|
||||
libUrl = m.playletLibUrls[m.playletLibUrlIndex]
|
||||
if m.lib.loadStatus = "ready"
|
||||
RemoveComponentLibrary()
|
||||
' bs:disable-next-line LINT3012
|
||||
?"Playlet lib loaded from " libUrl.link
|
||||
Logger.Log(`Playlet lib loaded from ${libUrl.link} in ${m.timer.TotalMilliseconds()} ms`)
|
||||
m.timer = invalid
|
||||
m.scene.playletLibLoadedUrl = libUrl
|
||||
container = m.scene.findNode("MainSceneContainer")
|
||||
container.createChild("PlayletLib:MainScene")
|
||||
@@ -67,8 +65,7 @@ function OnLoadStatusChanged() as void
|
||||
end if
|
||||
|
||||
if m.lib.loadStatus = "failed"
|
||||
' bs:disable-next-line LINT3012
|
||||
?"Playlet lib failed to load from " libUrl.link
|
||||
Logger.Log(`Playlet lib failed to load from ${libUrl.link}`)
|
||||
' Try next url
|
||||
m.playletLibUrlIndex += 1
|
||||
LoadPlayletLib()
|
||||
@@ -86,11 +83,14 @@ function RemoveComponentLibrary() as void
|
||||
end function
|
||||
|
||||
function LoadComponentLibrary(uri as string)
|
||||
m.timer = CreateObject("roTimespan")
|
||||
m.timer.mark()
|
||||
|
||||
m.lib = m.scene.createChild("ComponentLibrary")
|
||||
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
||||
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
|
||||
end function
|
||||
|
||||
@@ -109,5 +109,5 @@ function ShowPlayletLibLoadErrorDialog()
|
||||
"If the problem persist, contact Playlet authors."
|
||||
]
|
||||
|
||||
ShowErrorDialog(message, bulletText, bottomText)
|
||||
Dialog.ShowError(message, bulletText, bottomText)
|
||||
end function
|
||||
@@ -2,7 +2,7 @@ title=Playlet
|
||||
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=18
|
||||
minor_version=19
|
||||
build_version=00001
|
||||
|
||||
ui_resolutions=hd
|
||||
|
||||
@@ -1,40 +1,45 @@
|
||||
function ShowErrorDialog(message as object, bulletText as object, bottomMessage as object)
|
||||
' Note: dialog can be null since StandardMessageDialog is only available on 10.0 and later
|
||||
dialog = CreateObject("roSGNode", "StandardMessageDialog")
|
||||
SetPalette(dialog)
|
||||
dialog.message = message
|
||||
dialog.bulletText = bulletText
|
||||
dialog.bottomMessage = bottomMessage
|
||||
dialog.title = "Error loading Playlet"
|
||||
dialog.buttons = ["Exit"]
|
||||
namespace Dialog
|
||||
|
||||
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
||||
dialog.observeField("buttonSelected", "OnButtonSelected")
|
||||
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
||||
dialog.observeField("wasClosed", "OnDialogClosed")
|
||||
function ShowError(message as object, bulletText as object, bottomMessage as object)
|
||||
' Note: dialog can be null since StandardMessageDialog is only available on 10.0 and later
|
||||
msgDialog = CreateObject("roSGNode", "StandardMessageDialog")
|
||||
SetPalette(msgDialog)
|
||||
msgDialog.message = message
|
||||
msgDialog.bulletText = bulletText
|
||||
msgDialog.bottomMessage = bottomMessage
|
||||
msgDialog.title = "Error loading Playlet"
|
||||
msgDialog.buttons = ["Exit"]
|
||||
|
||||
m.top.getScene().dialog = dialog
|
||||
end function
|
||||
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
||||
msgDialog.observeField("buttonSelected", "OnButtonSelected")
|
||||
' bs:disable-next-line NO_OBSERVE_STRING_CALLBACK
|
||||
msgDialog.observeField("wasClosed", "OnDialogClosed")
|
||||
|
||||
function SetPalette(dialog as object)
|
||||
palette = createObject("roSGNode", "RSGPalette")
|
||||
palette.colors = {
|
||||
DialogBackgroundColor: "#242424FF"
|
||||
DialogFocusColor: "#CECECEFF"
|
||||
DialogFocusItemColor: "#202020FF"
|
||||
DialogSecondaryTextColor: "#DBDBDBFF"
|
||||
DialogSecondaryItemColor: "#FF1C30FF"
|
||||
DialogTextColor: "#DBDBDBFF"
|
||||
}
|
||||
dialog.palette = palette
|
||||
end function
|
||||
m.top.getScene().dialog = msgDialog
|
||||
end function
|
||||
|
||||
function OnButtonSelected()
|
||||
m.top.getScene().dialog.close = true
|
||||
end function
|
||||
function SetPalette(msgDialog as object)
|
||||
palette = createObject("roSGNode", "RSGPalette")
|
||||
palette.colors = {
|
||||
DialogBackgroundColor: "#242424FF"
|
||||
DialogFocusColor: "#CECECEFF"
|
||||
DialogFocusItemColor: "#202020FF"
|
||||
DialogSecondaryTextColor: "#DBDBDBFF"
|
||||
DialogSecondaryItemColor: "#FF1C30FF"
|
||||
DialogTextColor: "#DBDBDBFF"
|
||||
}
|
||||
msgDialog.palette = palette
|
||||
end function
|
||||
|
||||
function OnButtonSelected()
|
||||
m.top.getScene().dialog.close = true
|
||||
end function
|
||||
|
||||
function OnDialogClosed()
|
||||
' 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
|
||||
end function
|
||||
|
||||
end namespace
|
||||
|
||||
function OnDialogClosed()
|
||||
' 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
|
||||
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")
|
||||
screen.setMessagePort(port)
|
||||
m.global = screen.getGlobalNode()
|
||||
Logger.Init()
|
||||
|
||||
ClearPlayletLibUrlsIfNeeded(args)
|
||||
Registry.ClearPlayletLibUrlsIfNeeded(args)
|
||||
|
||||
scene = screen.CreateScene("BootstrapScene")
|
||||
screen.show()
|
||||
@@ -77,7 +78,7 @@ function Main(args as object) as void
|
||||
field = msg.getField()
|
||||
data = msg.getData()
|
||||
if field = "exitChannel" and data = true
|
||||
END
|
||||
return
|
||||
end if
|
||||
else if msgType = "roInputEvent"
|
||||
scene.inputArgs = msg.getInfo()
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
function ReadManifestValue(key as string) as string
|
||||
appInfo = CreateObject("roAppInfo")
|
||||
return appInfo.GetValue(key)
|
||||
end function
|
||||
namespace Manifest
|
||||
|
||||
function ReadValue(key as string) as string
|
||||
appInfo = CreateObject("roAppInfo")
|
||||
return appInfo.GetValue(key)
|
||||
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_embedded_url", "pkg:/lib/playlet-lib.zip")
|
||||
function _(key as string, expectedValue as string)
|
||||
m.assertEqual(ReadManifestValue(key), expectedValue)
|
||||
m.assertEqual(Manifest.ReadValue(key), expectedValue)
|
||||
end function
|
||||
|
||||
end class
|
||||
|
||||
@@ -1,29 +1,34 @@
|
||||
function ReadRegistryKey(key as string, section as string) as dynamic
|
||||
sec = CreateObject("roRegistrySection", section)
|
||||
if not sec.Exists(key)
|
||||
return invalid
|
||||
end if
|
||||
return sec.Read(key)
|
||||
end function
|
||||
namespace Registry
|
||||
|
||||
function DeleteRegistryKey(key as string, section as string)
|
||||
sec = CreateObject("roRegistrySection", section)
|
||||
sec.Delete(key)
|
||||
sec.Flush()
|
||||
end function
|
||||
function ReadKey(key as string, section as string) as dynamic
|
||||
sec = CreateObject("roRegistrySection", section)
|
||||
if not sec.Exists(key)
|
||||
return invalid
|
||||
end if
|
||||
return sec.Read(key)
|
||||
end function
|
||||
|
||||
function GetPlayletLibUrlsFromRegistry() as object
|
||||
urlsJson = ReadRegistryKey("playlet_lib_urls", "Playlet")
|
||||
if urlsJson = invalid
|
||||
return invalid
|
||||
end if
|
||||
urls = ParseJson(urlsJson)
|
||||
return urls
|
||||
end function
|
||||
function DeleteKey(key as string, section as string)
|
||||
sec = CreateObject("roRegistrySection", section)
|
||||
sec.Delete(key)
|
||||
sec.Flush()
|
||||
end function
|
||||
|
||||
function ClearPlayletLibUrlsIfNeeded(launchArgs as object) as void
|
||||
if launchArgs = invalid or launchArgs.clearPlayletLibUrls = invalid
|
||||
return
|
||||
end if
|
||||
DeleteRegistryKey("playlet_lib_urls", "Playlet")
|
||||
end function
|
||||
function GetPlayletLibUrlsFromRegistry() as object
|
||||
urlsJson = ReadKey("playlet_lib_urls", "Playlet")
|
||||
if urlsJson = invalid
|
||||
return invalid
|
||||
end if
|
||||
urls = ParseJson(urlsJson)
|
||||
return urls
|
||||
end function
|
||||
|
||||
function ClearPlayletLibUrlsIfNeeded(launchArgs as object) as void
|
||||
if launchArgs = invalid or launchArgs.clearPlayletLibUrls = invalid
|
||||
return
|
||||
end if
|
||||
DeleteKey("playlet_lib_urls", "Playlet")
|
||||
Logger.Log("Cleared key playlet_lib_urls from registry")
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.18.1",
|
||||
"version": "0.19.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-lib",
|
||||
"version": "0.18.1"
|
||||
"version": "0.19.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.18.1",
|
||||
"version": "0.19.1",
|
||||
"description": "Unofficial Youtube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf build/playlet-lib",
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
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/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
import "SubscribeTask.bs"
|
||||
|
||||
function Init()
|
||||
m.container = m.top.findNode("container")
|
||||
@@ -134,7 +134,7 @@ function OnSubscribeButtonSelected()
|
||||
end if
|
||||
|
||||
isSubbed = IsSubscribed()
|
||||
m.subscribeTask = StartAsyncTask(SubscribeTask, {
|
||||
m.subscribeTask = AsyncTask.Start(Tasks.SubscribeTask, {
|
||||
invidious: m.invidious
|
||||
ucid: m.authorId
|
||||
subscribe: not isSubbed
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import "pkg:/components/ContentNode/ChannelContentTask.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/Logging.bs"
|
||||
|
||||
function Init()
|
||||
end function
|
||||
@@ -17,7 +19,7 @@ function LoadChannel(invidiousNode as object) as void
|
||||
end if
|
||||
|
||||
m.top.loadState = FeedLoadState.Loading
|
||||
m.contentTask = StartAsyncTask(ChannelContentTask, {
|
||||
m.contentTask = AsyncTask.Start(Tasks.ChannelContentTask, {
|
||||
content: m.top
|
||||
invidious: invidiousNode
|
||||
}, OnChannelContentTaskResult)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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/Types.bs"
|
||||
|
||||
@@ -33,7 +33,7 @@ function OnUrlSet()
|
||||
url = m.top.url
|
||||
|
||||
m.urlLabel.text = url
|
||||
StartAsyncTask(GenerateQrCodeTask, {
|
||||
AsyncTask.Start(Tasks.GenerateQrCodeTask, {
|
||||
poster: m.qrCode
|
||||
text: url
|
||||
size: m.qrCode.loadWidth
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
function Init()
|
||||
m.top.functionName = "LoggerLoop"
|
||||
@@ -32,13 +32,23 @@ function LoggerLoop()
|
||||
port = m.port
|
||||
|
||||
buffer = CreateObject("roByteArray")
|
||||
previousLogsFile = m.top.folder + "/" + m.top.filenamePrevious
|
||||
logsFile = m.top.folder + "/" + m.top.filename
|
||||
previousLogsFile = m.top.folder + "/" + m.top.filenamePrevious
|
||||
filenameStartup = m.top.filenameStartup
|
||||
|
||||
CreateDirectory(m.top.folder)
|
||||
DeleteFile(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
|
||||
msg = wait(0, port)
|
||||
msgType = type(msg)
|
||||
|
||||
@@ -5,5 +5,6 @@
|
||||
<field id="folder" type="string" value="cachefs:/logs" />
|
||||
<field id="filename" type="string" value="app_logs.txt" />
|
||||
<field id="filenamePrevious" type="string" value="app_logs_previous.txt" />
|
||||
<field id="filenameStartup" type="string" value="cachefs:/playlet_startup_logs.txt" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,10 +1,10 @@
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/components/NodeByRef/NodeByRef.bs"
|
||||
import "pkg:/components/PlaylistView/PlaylistContentTask.bs"
|
||||
import "pkg:/components/PlayQueue/Notifications/PlayQueueNotificationUtils.bs"
|
||||
import "pkg:/components/VideoFeed/FeedLoadState.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/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
@@ -188,7 +188,7 @@ function LoadPlaylist(playlist as object) as void
|
||||
|
||||
playlist.loadState = FeedLoadState.Loading
|
||||
|
||||
task = StartAsyncTask(PlaylistContentTask, {
|
||||
task = AsyncTask.Start(Tasks.PlaylistContentTask, {
|
||||
content: playlist
|
||||
invidious: m.top.invidious
|
||||
}, OnPlaylistContentTaskResult)
|
||||
|
||||
@@ -2,10 +2,11 @@ import "pkg:/components/ChannelView/ChannelUtils.bs"
|
||||
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
||||
import "pkg:/components/Dialog/DialogUtils.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/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/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
@@ -222,7 +223,7 @@ function LoadPlaylist() as void
|
||||
end if
|
||||
|
||||
m.top.content.loadState = FeedLoadState.Loading
|
||||
m.playlistLoadTask = StartAsyncTask(PlaylistContentTask, {
|
||||
m.playlistLoadTask = AsyncTask.Start(Tasks.PlaylistContentTask, {
|
||||
content: m.top.content
|
||||
invidious: m.top.invidious
|
||||
}, OnPlaylistContentTaskResult)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
|
||||
function Init()
|
||||
' 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/Navigation/Navigation.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
@@ -14,7 +15,15 @@ function OnNodeReady()
|
||||
SetNavigation(invalid, "left", m.navBar)
|
||||
|
||||
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
|
||||
|
||||
function OnFocusChange() as void
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<interface>
|
||||
<field id="navBar" type="node" bind="/NavBar" />
|
||||
<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" />
|
||||
</interface>
|
||||
<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
|
||||
@@ -1,7 +1,8 @@
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/components/Screens/SearchScreen/SearchSuggestionsTask.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/FocusManagement.bs"
|
||||
import "pkg:/source/utils/LoadingScreen.bs"
|
||||
@@ -20,6 +21,8 @@ function Init()
|
||||
|
||||
m.rowList.screen = m.top
|
||||
|
||||
m.keyboard.keyGrid.keyDefinitionUri = "libpkg:/config/search-keyboard-layout.json5"
|
||||
|
||||
textEditBox = m.keyboard.textEditBox
|
||||
textEditBox.voiceEntryType = "generic"
|
||||
textEditBox.voiceEnabled = true
|
||||
@@ -98,7 +101,7 @@ function OnTextChange() as void
|
||||
m.searchSuggestionsTask.cancel = true
|
||||
end if
|
||||
|
||||
m.searchSuggestionsTask = StartAsyncTask(SearchSuggestionsTask, {
|
||||
m.searchSuggestionsTask = AsyncTask.Start(Tasks.SearchSuggestionsTask, {
|
||||
q: m.keyboard.text
|
||||
invidious: m.invidious
|
||||
preferences: m.preferences
|
||||
@@ -300,6 +303,10 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
if m.currentNavigtionNode.isSameNode(m.suggestions)
|
||||
OnSearchButtonFocused()
|
||||
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
|
||||
end if
|
||||
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,156 @@
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.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" and press
|
||||
' 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
|
||||
node = CreateObject("roSGNode", "ContentNode")
|
||||
node.id = item.id
|
||||
node.title = m.homeLayout[item.id].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>
|
||||
@@ -1,9 +1,10 @@
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/components/Navigation/Navigation.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/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
@@ -58,7 +59,7 @@ function RunTestsTask()
|
||||
m.testingTask.cancel = true
|
||||
end if
|
||||
|
||||
m.testingTask = StartAsyncTask(InvidiousInstanceTestingTask, {
|
||||
m.testingTask = AsyncTask.Start(Tasks.InvidiousInstanceTestingTask, {
|
||||
instance: m.top.instance
|
||||
listNode: m.testList
|
||||
})
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
@@ -43,7 +43,7 @@ function Refresh()
|
||||
m.invidiousPublicInstancesTask.cancel = true
|
||||
end if
|
||||
|
||||
m.invidiousPublicInstancesTask = StartAsyncTask(InvidiousPublicInstancesTask, {
|
||||
m.invidiousPublicInstancesTask = AsyncTask.Start(Tasks.InvidiousPublicInstancesTask, {
|
||||
listNode: m.instances
|
||||
}, OnInvidiousPublicInstancesTaskResults)
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
function Init()
|
||||
@@ -22,7 +22,7 @@ function OnUrlSet()
|
||||
urlLabel.text = url
|
||||
|
||||
qrCodePoster = m.top.findNode("QrCodePoster")
|
||||
StartAsyncTask(GenerateQrCodeTask, {
|
||||
AsyncTask.Start(Tasks.GenerateQrCodeTask, {
|
||||
poster: qrCodePoster
|
||||
text: url
|
||||
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"
|
||||
|
||||
function Init()
|
||||
@@ -32,7 +31,7 @@ function GetLatestPlayletLibVersion(_unused as dynamic) as dynamic
|
||||
return invalid
|
||||
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
|
||||
if output.success and output.result.latest <> invalid
|
||||
m.top.lib_version_latest = output.result.latest
|
||||
|
||||
@@ -29,12 +29,15 @@ function Load() as void
|
||||
return
|
||||
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)
|
||||
bookmarksCount = bookmarkGroup.bookmarks.Count()
|
||||
' AddFeedSourceBookmark inserts at the beginning of the list, so we need to iterate backwards
|
||||
for i = bookmarksCount - 1 to 0 step -1
|
||||
bookmark = bookmarkGroup.bookmarks[i]
|
||||
' AddFeedSourceBookmark also inserts at the beginning of the list, so we need to iterate backwards
|
||||
for j = bookmarksCount - 1 to 0 step -1
|
||||
bookmark = bookmarkGroup.bookmarks[j]
|
||||
AddFeedSourceBookmark(bookmark.feedSource, bookmark.id, bookmarkGroupNode)
|
||||
end for
|
||||
end for
|
||||
@@ -85,7 +88,7 @@ function GetOrCreateBookmarkGroup(groupName as string) as object
|
||||
node = CreateObject("roSGNode", "ContentNode")
|
||||
node.id = id
|
||||
node.title = groupName
|
||||
m.top.content.appendChild(node)
|
||||
m.top.content.insertChild(node, 0)
|
||||
LogInfo("Added bookmark group:", groupName)
|
||||
return node
|
||||
end function
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
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()
|
||||
m.top.apiDefinitions = ParseJson(ReadAsciiFile("libpkg:/config/invidious_video_api.yaml"))
|
||||
@@ -32,5 +32,5 @@ function GetSubscriptions() as void
|
||||
m.top.subscriptions = invalid
|
||||
return
|
||||
end if
|
||||
m.subscriptionsTask = StartAsyncTask(InvidiousSubscriptionsTask, { invidious: m.top })
|
||||
m.subscriptionsTask = AsyncTask.Start(Tasks.InvidiousSubscriptionsTask, { invidious: m.top })
|
||||
end function
|
||||
@@ -1,7 +1,7 @@
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/components/Services/Invidious/InvidiousUnregisterTokenTask.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/utils/CryptoUtils.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
@@ -44,7 +44,7 @@ namespace Invidious
|
||||
|
||||
m.endpoints = node.apiDefinitions
|
||||
|
||||
m.responseHanlders = {
|
||||
m.responseHandlers = {
|
||||
DefaultHandler: m.DefaultHandler
|
||||
AuthFeedHandler: m.AuthFeedHandler
|
||||
PlaylistHandler: m.PlaylistHandler
|
||||
@@ -53,7 +53,6 @@ namespace Invidious
|
||||
ChannelInfoHandler: m.ChannelInfoHandler
|
||||
ChannelVideosHandler: m.ChannelVideosHandler
|
||||
ChannelPlaylistsHandler: m.ChannelPlaylistsHandler
|
||||
ChannelRelatedChannelsHandler: m.ChannelRelatedChannelsHandler
|
||||
WatchHistoryHandler: m.WatchHistoryHandler
|
||||
}
|
||||
end function
|
||||
@@ -123,6 +122,21 @@ namespace Invidious
|
||||
request.CacheSeconds(60 * 60 * 5)
|
||||
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()
|
||||
end function
|
||||
|
||||
@@ -277,7 +291,7 @@ namespace Invidious
|
||||
|
||||
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)
|
||||
|
||||
@@ -336,25 +350,32 @@ namespace Invidious
|
||||
return invalid
|
||||
end function
|
||||
|
||||
function ChannelRelatedChannelsHandler(m as object, feedSource as object, response as object) as object
|
||||
if response.StatusCode() = 200
|
||||
json = response.Json()
|
||||
function VideoInfoHandler(m as object, feedSource as object, response as object) as object
|
||||
statusCode = response.StatusCode()
|
||||
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 {
|
||||
items: json.relatedChannels
|
||||
continuation: json.continuation
|
||||
items: [{
|
||||
"videoId": feedSource.pathParams.id
|
||||
"type": "video"
|
||||
}]
|
||||
}
|
||||
end if
|
||||
return invalid
|
||||
end function
|
||||
|
||||
function VideoInfoHandler(m as object, feedSource as object, response as object) as object
|
||||
if response.StatusCode() = 200
|
||||
if statusCode = 200
|
||||
json = response.Json()
|
||||
json.type = "video"
|
||||
return {
|
||||
items: [json]
|
||||
}
|
||||
end if
|
||||
|
||||
return invalid
|
||||
end function
|
||||
|
||||
@@ -453,7 +474,7 @@ namespace Invidious
|
||||
if not m.VerifyTokenScope(authToken.token)
|
||||
' Right now we're probably in a UI thread, and we can't unregister the token
|
||||
' Without a Task
|
||||
StartAsyncTask(InvidiousUnregisterTokenTask, {
|
||||
AsyncTask.Start(Tasks.InvidiousUnregisterTokenTask, {
|
||||
invidious: m.node
|
||||
authToken: authToken
|
||||
})
|
||||
|
||||
@@ -2,6 +2,13 @@ import "pkg:/source/utils/RegistryUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.typeMapping = {
|
||||
"boolean": "boolean"
|
||||
"string": "string"
|
||||
"radio": "string"
|
||||
"array": "array"
|
||||
}
|
||||
|
||||
m.disableSavingToRegistry = false
|
||||
LoadPreferencesFile()
|
||||
AddNodeFields()
|
||||
@@ -25,14 +32,7 @@ end function
|
||||
|
||||
function AddNodeFieldsFromPreference(pref as object, fields as object)
|
||||
if pref.key <> invalid and pref.type <> invalid
|
||||
fieldType = ""
|
||||
if pref.type = "boolean"
|
||||
fieldType = "boolean"
|
||||
else if pref.type = "string"
|
||||
fieldType = "string"
|
||||
else if pref.type = "radio"
|
||||
fieldType = "string"
|
||||
end if
|
||||
fieldType = m.typeMapping[pref.type]
|
||||
m.top.addField(pref.key, fieldType, false)
|
||||
fields[pref.key] = true
|
||||
end if
|
||||
|
||||
@@ -2,10 +2,11 @@ import "pkg:/components/ChannelView/ChannelUtils.bs"
|
||||
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
||||
import "pkg:/components/Navigation/LongPress.bs"
|
||||
import "pkg:/components/PlaylistView/PlaylistUtils.bs"
|
||||
import "pkg:/components/VideoFeed/VideoRowListContentTask.bs"
|
||||
import "pkg:/components/VideoFeed/VideoRowListRowContentTask.bs"
|
||||
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||
import "pkg:/components/VideoFeed/FeedLoadState.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/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
@@ -213,7 +214,7 @@ function InitContent() as void
|
||||
return
|
||||
end if
|
||||
|
||||
task = StartAsyncTask(VideoRowListContentTask, {
|
||||
task = AsyncTask.Start(Tasks.VideoRowListContentTask, {
|
||||
node: m.top
|
||||
feeds: m.top.feeds
|
||||
}, OnVideoRowListContentTaskResult)
|
||||
@@ -286,7 +287,7 @@ function LoadRowContent(contentNode as object)
|
||||
LogInfo("Loading row content:", contentNode.title)
|
||||
|
||||
contentNode.loadState = FeedLoadState.Loading
|
||||
task = StartAsyncTask(VideoRowListRowContentTask, {
|
||||
task = AsyncTask.Start(Tasks.VideoRowListRowContentTask, {
|
||||
rowList: m.top
|
||||
feedContentNode: contentNode
|
||||
invidious: m.invidious
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import "FeedLoadState.bs"
|
||||
import "pkg:/components/VideoFeed/FeedLoadState.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
@asynctask
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import "pkg:/components/Services/SponsorBlock/Notifications/SponsorBlockNotificationUtils.bs"
|
||||
import "pkg:/components/Services/SponsorBlock/SponsorBlockSegmentViewedTask.bs"
|
||||
import "pkg:/components/Services/SponsorBlock/SponsorBlockTask.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/components/Services/SponsorBlock/SponsorBlockService.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
|
||||
namespace SponsorBlock
|
||||
|
||||
@@ -84,7 +84,7 @@ namespace SponsorBlock
|
||||
m.sponsorBlockTask.cancel = true
|
||||
end if
|
||||
|
||||
m.sponsorBlockTask = StartAsyncTask(SponsorBlockTask, { metadata: metadata }, OnSponsorBlockTaskResults)
|
||||
m.sponsorBlockTask = AsyncTask.Start(Tasks.SponsorBlockTask, { metadata: metadata }, OnSponsorBlockTaskResults)
|
||||
end function
|
||||
|
||||
function OnSponsorBlockTaskResults(output as object) as void
|
||||
@@ -172,7 +172,7 @@ namespace SponsorBlock
|
||||
end function
|
||||
|
||||
function SendSkippedSectionEvent(segmentId as string)
|
||||
StartAsyncTask(SponsorBlockSegmentViewedTask, { segmentId: segmentId })
|
||||
AsyncTask.Start(Tasks.SponsorBlockSegmentViewedTask, { segmentId: segmentId })
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -1,17 +1,20 @@
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||
import "pkg:/components/VideoPlayer/MarkVideoWatchedTask.bs"
|
||||
import "pkg:/components/VideoPlayer/SponsorBlock.bs"
|
||||
import "pkg:/components/VideoPlayer/VideoContentTask.bs"
|
||||
import "pkg:/components/VideoPlayer/VideoPlayerStyle.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/Logging.bs"
|
||||
|
||||
function Init()
|
||||
SetPlayerStyle()
|
||||
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
|
||||
' 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
|
||||
|
||||
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.height = rect.height
|
||||
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
|
||||
m.top.enableUI = m.container.fullscreen
|
||||
m.top.showFullScreenHint = not m.container.fullscreen
|
||||
|
||||
m.container.observeFieldScoped("fullscreen", FuncName(OnFullScreenChange))
|
||||
m.top.ObserveField("state", FuncName(OnVideoPlayerStateChange))
|
||||
@@ -77,7 +86,7 @@ function StartVideoContentTask(videoContentNode as object)
|
||||
|
||||
m.top.content = videoContentNode
|
||||
|
||||
m.videoContentTask = StartAsyncTask(VideoContentTask, {
|
||||
m.videoContentTask = AsyncTask.Start(Tasks.VideoContentTask, {
|
||||
content: videoContentNode
|
||||
invidious: m.top.invidious
|
||||
preferences: m.top.preferences
|
||||
@@ -118,7 +127,7 @@ end function
|
||||
|
||||
function MarkVideoWatched(videoId as string)
|
||||
if m.top.invidious.authToken <> invalid
|
||||
StartAsyncTask(MarkVideoWatchedTask, {
|
||||
AsyncTask.Start(Tasks.MarkVideoWatchedTask, {
|
||||
videoId: videoId
|
||||
invidious: m.top.invidious
|
||||
})
|
||||
@@ -320,6 +329,34 @@ function OnFullScreenChange()
|
||||
m.minimizeAnimation.control = "start"
|
||||
|
||||
m.top.enableUI = m.container.fullscreen
|
||||
m.top.showFullScreenHint = not m.container.fullscreen
|
||||
|
||||
SponsorBlock.SetVisible(m.notifications, m.container.fullscreen)
|
||||
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="maxRect" type="rect2D" value="[0,0,1280,720]" />
|
||||
<field id="chapter" type="string" alias="chapterLabel.text" />
|
||||
<field id="showFullScreenHint" type="boolean" alwaysNotify="true" onChange="OnShowFullScreenHint" />
|
||||
<function name="PlayWithContent" />
|
||||
<function name="Close" />
|
||||
</interface>
|
||||
@@ -43,5 +44,24 @@
|
||||
key="[0.0, 0.5, 1.0]"
|
||||
fieldToInterp="VideoPlayer.translation" />
|
||||
</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>
|
||||
</component>
|
||||
@@ -0,0 +1,25 @@
|
||||
import "pkg:/components/Screens/HomeScreen/HomeScreenUtils.bs"
|
||||
|
||||
namespace Http
|
||||
|
||||
class HomeLayoutRouter extends HttpRouter
|
||||
|
||||
function new()
|
||||
super()
|
||||
|
||||
m.Get("/api/home-layout", function(context as object) as boolean
|
||||
response = context.response
|
||||
task = context.server.task
|
||||
preferences = task.preferences
|
||||
|
||||
feed = HomeScreenUtils.GetFeed("libpkg:/config/default_home_layout.yaml", preferences)
|
||||
response.Json(feed)
|
||||
|
||||
return true
|
||||
end function)
|
||||
|
||||
end function
|
||||
|
||||
end class
|
||||
|
||||
end namespace
|
||||
@@ -1,6 +1,7 @@
|
||||
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||
import "pkg:/components/Web/PlayletWebServer/Middleware/BookmarksRouter.bs"
|
||||
import "pkg:/components/Web/PlayletWebServer/Middleware/DashRouter.bs"
|
||||
import "pkg:/components/Web/PlayletWebServer/Middleware/HomeLayoutRouter.bs"
|
||||
import "pkg:/components/Web/PlayletWebServer/Middleware/InvidiousRouter.bs"
|
||||
import "pkg:/components/Web/PlayletWebServer/Middleware/PlayletLibUrlsRouter.bs"
|
||||
import "pkg:/components/Web/PlayletWebServer/Middleware/PlayQueueRouter.bs"
|
||||
@@ -46,6 +47,7 @@ function SetupRoutes(server as object)
|
||||
server.UseRouter(new Http.InvidiousRouter())
|
||||
server.UseRouter(new Http.PlayQueueRouter())
|
||||
server.UseRouter(new Http.BookmarksRouter())
|
||||
server.UseRouter(new Http.HomeLayoutRouter())
|
||||
server.UseRouter(new Http.ViewRouter())
|
||||
server.UseRouter(new Http.SearchHistoryRouter())
|
||||
server.UseRouter(new Http.PlayletLibUrlsRouter())
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
- title: Subscriptions
|
||||
id: subscriptions
|
||||
feedSources:
|
||||
- id: inv_auth_feed
|
||||
title: Subscriptions
|
||||
@@ -6,6 +7,7 @@
|
||||
endpoint: auth_feed
|
||||
|
||||
- title: Trending
|
||||
id: trending
|
||||
feedSources:
|
||||
- id: inv_trending
|
||||
title: Trending
|
||||
@@ -13,6 +15,7 @@
|
||||
endpoint: trending
|
||||
|
||||
- title: Trending - Music
|
||||
id: trending_music
|
||||
feedSources:
|
||||
- id: inv_trending_music
|
||||
title: Trending - Music
|
||||
@@ -22,6 +25,7 @@
|
||||
type: Music
|
||||
|
||||
- title: Trending - Gaming
|
||||
id: trending_gaming
|
||||
feedSources:
|
||||
- id: inv_trending_gaming
|
||||
title: Trending - Gaming
|
||||
@@ -31,6 +35,7 @@
|
||||
type: Gaming
|
||||
|
||||
- title: Trending - Movies
|
||||
id: trending_movies
|
||||
feedSources:
|
||||
- id: inv_trending_movies
|
||||
title: Trending - Movies
|
||||
@@ -40,6 +45,7 @@
|
||||
type: Movies
|
||||
|
||||
- title: Popular
|
||||
id: popular
|
||||
feedSources:
|
||||
- id: inv_popular
|
||||
title: Popular
|
||||
@@ -47,6 +53,7 @@
|
||||
endpoint: popular
|
||||
|
||||
- title: Playlists
|
||||
id: playlists
|
||||
feedSources:
|
||||
- id: inv_auth_playlists
|
||||
title: Playlists
|
||||
@@ -54,6 +61,7 @@
|
||||
endpoint: auth_playlists
|
||||
|
||||
- title: Watch history
|
||||
id: watch_history
|
||||
feedSources:
|
||||
- id: inv_auth_history
|
||||
title: Watch history
|
||||
|
||||
@@ -130,6 +130,55 @@
|
||||
key: "misc",
|
||||
description: "Misc. preferences",
|
||||
children: [
|
||||
{
|
||||
displayText: "Edit home screen",
|
||||
key: "misc.home_screen_layout",
|
||||
description: "Enable/disable and reorder sections on the home screen",
|
||||
type: "array",
|
||||
defaultValue: [
|
||||
{
|
||||
id: "subscriptions",
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: "trending",
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: "trending_music",
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: "trending_gaming",
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: "trending_movies",
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: "popular",
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: "playlists",
|
||||
enabled: true,
|
||||
},
|
||||
{
|
||||
id: "watch_history",
|
||||
enabled: true,
|
||||
},
|
||||
],
|
||||
visibility: "tv",
|
||||
rokuComponent: "EditHomeScreenControl",
|
||||
},
|
||||
{
|
||||
displayText: "Edit home screen",
|
||||
key: "misc.home_screen_layout",
|
||||
description: "Enable/disable and reorder sections on the home screen",
|
||||
visibility: "web",
|
||||
svelteComponent: "EditHomeScreenControl",
|
||||
},
|
||||
{
|
||||
displayText: "Queue notifications",
|
||||
key: "misc.queue_notifications",
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
// This is a copy of the MiniKeyboard definition found here
|
||||
// https://developer.roku.com/en-ca/docs/references/scenegraph/dynamic-voice-keyboard-nodes/key-definition-file.md#minikeyboard
|
||||
// The last row of keys was moved to be the first row.
|
||||
{
|
||||
keyboardWidthFHD: 576,
|
||||
keyboardHeightFHD: 630,
|
||||
keyboardWidthHD: 384,
|
||||
keyboardHeightHD: 420,
|
||||
sections: [
|
||||
{
|
||||
grids: [
|
||||
{
|
||||
rows: [
|
||||
{
|
||||
keys: [
|
||||
{
|
||||
icon: "theme:DKB_ClearKeyBitmap",
|
||||
focusIcon: "theme:DKB_ClearKeyFocusBitmap",
|
||||
strOut: "clear",
|
||||
},
|
||||
{
|
||||
icon: "theme:DKB_SpaceKeyBitmap",
|
||||
focusIcon: "theme:DKB_SpaceKeyFocusBitmap",
|
||||
strOut: "space",
|
||||
},
|
||||
{
|
||||
icon: "theme:DKB_DeleteKeyBitmap",
|
||||
focusIcon: "theme:DKB_DeleteKeyFocusBitmap",
|
||||
autoRepeat: 1,
|
||||
strOut: "backspace",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
keys: [
|
||||
{
|
||||
label: "a",
|
||||
},
|
||||
{
|
||||
label: "b",
|
||||
},
|
||||
{
|
||||
label: "c",
|
||||
},
|
||||
{
|
||||
label: "d",
|
||||
},
|
||||
{
|
||||
label: "e",
|
||||
},
|
||||
{
|
||||
label: "f",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
keys: [
|
||||
{
|
||||
label: "g",
|
||||
},
|
||||
{
|
||||
label: "h",
|
||||
},
|
||||
{
|
||||
label: "i",
|
||||
},
|
||||
{
|
||||
label: "j",
|
||||
},
|
||||
{
|
||||
label: "k",
|
||||
},
|
||||
{
|
||||
label: "l",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
keys: [
|
||||
{
|
||||
label: "m",
|
||||
},
|
||||
{
|
||||
label: "n",
|
||||
},
|
||||
{
|
||||
label: "o",
|
||||
},
|
||||
{
|
||||
label: "p",
|
||||
},
|
||||
{
|
||||
label: "q",
|
||||
},
|
||||
{
|
||||
label: "r",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
keys: [
|
||||
{
|
||||
label: "s",
|
||||
},
|
||||
{
|
||||
label: "t",
|
||||
},
|
||||
{
|
||||
label: "u",
|
||||
},
|
||||
{
|
||||
label: "v",
|
||||
},
|
||||
{
|
||||
label: "w",
|
||||
},
|
||||
{
|
||||
label: "x",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
keys: [
|
||||
{
|
||||
label: "y",
|
||||
},
|
||||
{
|
||||
label: "z",
|
||||
},
|
||||
{
|
||||
label: "1",
|
||||
},
|
||||
{
|
||||
label: "2",
|
||||
},
|
||||
{
|
||||
label: "3",
|
||||
},
|
||||
{
|
||||
label: "4",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
keys: [
|
||||
{
|
||||
label: "5",
|
||||
},
|
||||
{
|
||||
label: "6",
|
||||
},
|
||||
{
|
||||
label: "7",
|
||||
},
|
||||
{
|
||||
label: "8",
|
||||
},
|
||||
{
|
||||
label: "9",
|
||||
},
|
||||
{
|
||||
label: "0",
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -79,7 +79,8 @@
|
||||
},
|
||||
preview: {
|
||||
title: 'Preview/Recap/Hook',
|
||||
short_title: 'Preview/Recap/Hook',
|
||||
// Note: short title renamed from "Preview/Recap/Hook" to "Preview/Recap" to fit in the UI
|
||||
short_title: 'Preview/Recap',
|
||||
categorySupport: [
|
||||
'skip',
|
||||
'mute',
|
||||
|
||||
@@ -2,7 +2,7 @@ title=PlayletLib
|
||||
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=18
|
||||
minor_version=19
|
||||
build_version=00001
|
||||
|
||||
ui_resolutions=hd
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
namespace AsyncTask
|
||||
|
||||
function Start(taskName as string, input as object, callback = invalid as object) as object
|
||||
task = Create(taskName, input, callback)
|
||||
task.control = "RUN"
|
||||
return task
|
||||
end function
|
||||
|
||||
function Create(taskName as string, input as object, callback = invalid as object) as object
|
||||
id = StrI(rnd(2147483647), 36)
|
||||
task = createObject("roSGNode", taskName)
|
||||
task.id = id
|
||||
task.input = input
|
||||
|
||||
m[`asynctask_${id}`] = task
|
||||
m[`asynctask_${id}_callback`] = callback
|
||||
task.ObserveFieldScoped("state", FuncName(internal_OnTaskState))
|
||||
|
||||
return task
|
||||
end function
|
||||
|
||||
function internal_OnTaskState(e as object) as void
|
||||
task = e.getRoSGNode()
|
||||
if task.state = "init" or task.state = "run"
|
||||
return
|
||||
end if
|
||||
|
||||
task.UnobserveFieldScoped("state")
|
||||
|
||||
id = task.id
|
||||
output = task.output
|
||||
' if output is invalid, it means the task was interrupted before the result is ready
|
||||
if output <> invalid
|
||||
callback = m[`asynctask_${id}_callback`]
|
||||
if callback <> invalid
|
||||
callback(output)
|
||||
end if
|
||||
end if
|
||||
|
||||
task.input = invalid
|
||||
task.output = invalid
|
||||
m.delete(`asynctask_${id}`)
|
||||
m.delete(`asynctask_${id}_callback`)
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -1,56 +0,0 @@
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function StartAsyncTask(taskFunc as object, input as object, callback = invalid as object) as object
|
||||
task = CreateAsyncTask(taskFunc, input, callback)
|
||||
task.control = "RUN"
|
||||
return task
|
||||
end function
|
||||
|
||||
function CreateAsyncTask(taskFunc as object, input as object, callback = invalid as object) as object
|
||||
id = StrI(rnd(2147483647), 36)
|
||||
task = createObject("roSGNode", GetComponentName(taskFunc))
|
||||
task.id = id
|
||||
task.input = input
|
||||
|
||||
m[`asynctask_${id}`] = task
|
||||
m[`asynctask_${id}_callback`] = callback
|
||||
task.ObserveFieldScoped("state", FuncName(OnTaskState))
|
||||
|
||||
return task
|
||||
end function
|
||||
|
||||
function GetComponentName(taskFunc as object) as string
|
||||
if IsString(taskFunc)
|
||||
return `${taskFunc}_asynctask`
|
||||
end if
|
||||
' NOTE: do NOT use FuncName in here.
|
||||
' we use:
|
||||
' return `${FuncName(taskFunc)}_asynctask`
|
||||
' The app hangs on exit, and the TV crashes and restarts. I'm not kidding.
|
||||
return (LCase(`${taskFunc}_asynctask`)).replace("function:", "").trim()
|
||||
end function
|
||||
|
||||
function OnTaskState(e as object) as void
|
||||
task = e.getRoSGNode()
|
||||
if task.state = "init" or task.state = "run"
|
||||
return
|
||||
end if
|
||||
|
||||
task.UnobserveFieldScoped("state")
|
||||
|
||||
id = task.id
|
||||
output = task.output
|
||||
' if output is invalid, it means the task was interrupted before the result is ready
|
||||
if output <> invalid
|
||||
callback = m[`asynctask_${id}_callback`]
|
||||
if callback <> invalid
|
||||
callback(output)
|
||||
end if
|
||||
end if
|
||||
|
||||
|
||||
task.input = invalid
|
||||
task.output = invalid
|
||||
m.delete(`asynctask_${id}`)
|
||||
m.delete(`asynctask_${id}_callback`)
|
||||
end function
|
||||
@@ -1,6 +1,7 @@
|
||||
#const DISABLE_CACHE = false
|
||||
|
||||
import "pkg:/source/utils/CryptoUtils.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
@@ -8,6 +9,82 @@ import "pkg:/source/utils/UrlUtils.bs"
|
||||
|
||||
namespace HttpClient
|
||||
|
||||
const COMPRESSION_ENABLED = true
|
||||
|
||||
' https://developer.roku.com/en-ca/docs/references/brightscript/events/rourlevent.md#getresponsecode-as-integer
|
||||
' Seem to mirror the curl error codes https://curl.se/libcurl/c/libcurl-errors.html
|
||||
enum CurlErrors
|
||||
CURLE_UNSUPPORTED_PROTOCOL = -1
|
||||
CURLE_FAILED_INIT = -2
|
||||
CURLE_URL_MALFORMAT = -3
|
||||
CURLE_NOT_BUILT_IN = -4
|
||||
CURLE_COULDNT_RESOLVE_PROXY = -5
|
||||
CURLE_COULDNT_RESOLVE_HOST = -6
|
||||
CURLE_COULDNT_CONNECT = -7
|
||||
CURLE_FTP_WEIRD_SERVER_REPLY = -8
|
||||
CURLE_REMOTE_ACCESS_DENIED = -9
|
||||
CURLE_FTP_WEIRD_PASS_REPLY = -11
|
||||
CURLE_FTP_WEIRD_PASV_REPLY = -13
|
||||
CURLE_FTP_WEIRD_227_FORMAT = -14
|
||||
CURLE_FTP_CANT_GET_HOST = -15
|
||||
CURLE_HTTP2 = -16
|
||||
CURLE_FTP_COULDNT_SET_TYPE = -17
|
||||
CURLE_PARTIAL_FILE = -18
|
||||
CURLE_FTP_COULDNT_RETR_FILE = -19
|
||||
CURLE_QUOTE_ERROR = -21
|
||||
CURLE_HTTP_RETURNED_ERROR = -22
|
||||
CURLE_WRITE_ERROR = -23
|
||||
CURLE_UPLOAD_FAILED = -25
|
||||
CURLE_READ_ERROR = -26
|
||||
CURLE_OUT_OF_MEMORY = -27
|
||||
CURLE_OPERATION_TIMEDOUT = -28
|
||||
CURLE_FTP_PORT_FAILED = -30
|
||||
CURLE_FTP_COULDNT_USE_REST = -31
|
||||
CURLE_RANGE_ERROR = -33
|
||||
CURLE_HTTP_POST_ERROR = -34
|
||||
CURLE_SSL_CONNECT_ERROR = -35
|
||||
CURLE_BAD_DOWNLOAD_RESUME = -36
|
||||
CURLE_FILE_COULDNT_READ_FILE = -37
|
||||
CURLE_LDAP_CANNOT_BIND = -38
|
||||
CURLE_LDAP_SEARCH_FAILED = -39
|
||||
CURLE_FUNCTION_NOT_FOUND = -41
|
||||
CURLE_ABORTED_BY_CALLBACK = -42
|
||||
CURLE_BAD_FUNCTION_ARGUMENT = -43
|
||||
CURLE_INTERFACE_FAILED = -45
|
||||
CURLE_TOO_MANY_REDIRECTS = -47
|
||||
CURLE_UNKNOWN_TELNET_OPTION = -48
|
||||
CURLE_TELNET_OPTION_SYNTAX = -49
|
||||
CURLE_PEER_FAILED_VERIFICATION = -51
|
||||
CURLE_GOT_NOTHING = -52
|
||||
CURLE_SSL_ENGINE_NOTFOUND = -53
|
||||
CURLE_SSL_ENGINE_SETFAILED = -54
|
||||
CURLE_SEND_ERROR = -55
|
||||
CURLE_RECV_ERROR = -56
|
||||
CURLE_SSL_CERTPROBLEM = -58
|
||||
CURLE_SSL_CIPHER = -59
|
||||
CURLE_SSL_CACERT = -60
|
||||
CURLE_BAD_CONTENT_ENCODING = -61
|
||||
CURLE_LDAP_INVALID_URL = -62
|
||||
CURLE_FILESIZE_EXCEEDED = -63
|
||||
CURLE_USE_SSL_FAILED = -64
|
||||
CURLE_SEND_FAIL_REWIND = -65
|
||||
CURLE_SSL_ENGINE_INITFAILED = -66
|
||||
CURLE_LOGIN_DENIED = -67
|
||||
CURLE_TFTP_NOTFOUND = -68
|
||||
CURLE_TFTP_PERM = -69
|
||||
CURLE_REMOTE_DISK_FULL = -70
|
||||
CURLE_TFTP_ILLEGAL = -71
|
||||
CURLE_TFTP_UNKNOWNID = -72
|
||||
CURLE_REMOTE_FILE_EXISTS = -73
|
||||
CURLE_TFTP_NOSUCHUSER = -74
|
||||
CURLE_CONV_FAILED = -75
|
||||
CURLE_CONV_REQD = -76
|
||||
CURLE_SSL_CACERT_BADFILE = -77
|
||||
CURLE_REMOTE_FILE_NOT_FOUND = -78
|
||||
CURLE_SSH = -79
|
||||
CURLE_SSL_SHUTDOWN_FAILED = -80
|
||||
end enum
|
||||
|
||||
function Get(url as string) as HttpRequest
|
||||
return (new HttpRequest()).Method("GET").Url(url)
|
||||
end function
|
||||
@@ -36,20 +113,6 @@ namespace HttpClient
|
||||
return (new HttpRequest()).Method("HEAD").Url(url)
|
||||
end function
|
||||
|
||||
function FromObject(obj as object) as HttpRequest
|
||||
request = new HttpRequest()
|
||||
|
||||
for each key in obj
|
||||
if IsFunction(request[key])
|
||||
request[key](obj[key])
|
||||
else
|
||||
throw `Invalid key: "${key}" in object passed to HttpClient.FromObject`
|
||||
end if
|
||||
end for
|
||||
|
||||
return request
|
||||
end function
|
||||
|
||||
class HttpRequest
|
||||
|
||||
public urlTransfer as object
|
||||
@@ -161,6 +224,11 @@ namespace HttpClient
|
||||
return m
|
||||
end function
|
||||
|
||||
function RetryCallback(callback as function) as HttpRequest
|
||||
m._retryCallback = callback
|
||||
return m
|
||||
end function
|
||||
|
||||
function NoCache() as HttpRequest
|
||||
m._noCache = true
|
||||
return m
|
||||
@@ -188,7 +256,10 @@ namespace HttpClient
|
||||
end if
|
||||
|
||||
command += ` \\\n --max-time ${m._timeoutSeconds}`
|
||||
command += ` \\\n --compressed`
|
||||
|
||||
if COMPRESSION_ENABLED
|
||||
command += ` \\\n --compressed`
|
||||
end if
|
||||
|
||||
if m._headers <> invalid
|
||||
for each key in m._headers
|
||||
@@ -289,7 +360,7 @@ namespace HttpClient
|
||||
response = invalid
|
||||
|
||||
response = m.AwaitInternal()
|
||||
if response.IsSuccess() or response.TimedOut() or response.IsCancelled() or response.StatusCode() < 500
|
||||
if response.IsSuccess() or response.IsTimedOut() or response.IsCancelled()
|
||||
return response
|
||||
end if
|
||||
triesLeft -= 1
|
||||
@@ -297,7 +368,29 @@ namespace HttpClient
|
||||
while triesLeft > 0
|
||||
backoffMs = 1000 + Rnd(2000)
|
||||
tryNumber = m._tryCount - triesLeft + 1
|
||||
LogInfo("Request failed ID:", m.urlTransfer.GetIdentity(), "ErrorMessage:", response.ErrorMessage(), `\nRetrying: (`, tryNumber, "/", m._tryCount, ") in", backoffMs, "ms")
|
||||
LogWarn("Request failed ID:", m.urlTransfer.GetIdentity(), "ErrorMessage:", response.ErrorMessage(), `\nRetrying: (`, tryNumber, "/", m._tryCount, ") in", backoffMs, "ms")
|
||||
|
||||
if IsFunction(m._retryCallback)
|
||||
try
|
||||
shouldRetry = m._retryCallback({
|
||||
tryNumber: tryNumber
|
||||
tryCount: m._tryCount
|
||||
request: m
|
||||
response: response
|
||||
})
|
||||
|
||||
if IsBool(shouldRetry) and not shouldRetry
|
||||
LogInfo("Retry callback returned false. Not retrying.")
|
||||
return response
|
||||
end if
|
||||
catch error
|
||||
#if DEBUG
|
||||
throw error
|
||||
#else
|
||||
LogError("Retry callback failed:", ErrorUtils.Format(error))
|
||||
#end if
|
||||
end try
|
||||
end if
|
||||
|
||||
m.urlTransfer = invalid
|
||||
m._cache = invalid
|
||||
@@ -306,7 +399,7 @@ namespace HttpClient
|
||||
sleep(backoffMs)
|
||||
|
||||
response = m.AwaitInternal()
|
||||
if response.IsSuccess() or response.TimedOut() or response.IsCancelled() or response.StatusCode() < 500
|
||||
if response.IsSuccess() or response.IsTimedOut() or response.IsCancelled() or response.StatusCode() < 500
|
||||
return response
|
||||
end if
|
||||
triesLeft -= 1
|
||||
@@ -385,7 +478,12 @@ namespace HttpClient
|
||||
if urlTransfer = invalid
|
||||
return invalid
|
||||
end if
|
||||
urlTransfer.EnableEncodings(true)
|
||||
|
||||
if COMPRESSION_ENABLED
|
||||
' Enables gzip encoding of transfers
|
||||
urlTransfer.EnableEncodings(true)
|
||||
end if
|
||||
|
||||
urlTransfer.RetainBodyOnError(true)
|
||||
if LCase(left(m._url, 6)).StartsWith("https:")
|
||||
urlTransfer.SetCertificatesFile("common:/certs/ca-bundle.crt")
|
||||
@@ -442,7 +540,7 @@ namespace HttpClient
|
||||
return m.request._cache <> invalid
|
||||
end function
|
||||
|
||||
function TimedOut() as boolean
|
||||
function IsTimedOut() as boolean
|
||||
return not m.IsCached() and m.event = invalid
|
||||
end function
|
||||
|
||||
@@ -508,7 +606,7 @@ namespace HttpClient
|
||||
else
|
||||
if m.request._sent <> true
|
||||
m._errorMessage = "Request not sent."
|
||||
else if m.TimedOut()
|
||||
else if m.IsTimedOut()
|
||||
m._errorMessage = "Request timed out."
|
||||
else if m.IsCancelled()
|
||||
m._errorMessage = "Request cancelled."
|
||||
|
||||
@@ -7,15 +7,6 @@ class XmlObject
|
||||
|
||||
private INDENT_SIZE = 2
|
||||
|
||||
function new()
|
||||
m.escapeChars = {}
|
||||
m.escapeChars["&"] = "&"
|
||||
m.escapeChars["<"] = "<"
|
||||
m.escapeChars[">"] = ">"
|
||||
m.escapeChars[`"`] = `"`
|
||||
m.escapeChars["'"] = "'"
|
||||
end function
|
||||
|
||||
function Node(name as string, attributes = invalid as object) as boolean
|
||||
newNode = {
|
||||
name: name
|
||||
@@ -92,9 +83,11 @@ class XmlObject
|
||||
end function
|
||||
|
||||
function XmlEscape(input as string) as string
|
||||
for each escChar in m.escapeChars
|
||||
input = input.replace(escChar, m.escapeChars[escChar])
|
||||
end for
|
||||
input = input.replace("&", "&")
|
||||
input = input.replace("<", "<")
|
||||
input = input.replace(">", ">")
|
||||
input = input.replace(`"`, """)
|
||||
input = input.replace("'", "'")
|
||||
return input
|
||||
end function
|
||||
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
namespace MathUtils
|
||||
|
||||
function Max(a as dynamic, b as dynamic) as dynamic
|
||||
if a > b
|
||||
return a
|
||||
else
|
||||
return b
|
||||
end if
|
||||
end function
|
||||
|
||||
function Min(a as dynamic, b as dynamic) as dynamic
|
||||
if a < b
|
||||
return a
|
||||
else
|
||||
return b
|
||||
end if
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -8,9 +8,11 @@ namespace RegistryUtils
|
||||
const PLAYLET_LIB_URLS = "playlet_lib_urls"
|
||||
const BOOKMARKS = "bookmarks"
|
||||
|
||||
const INVIDIOUS_INSTANCES = "invidious_instances"
|
||||
const INVIDIOUS_TOKEN = "invidious_token"
|
||||
|
||||
' "invidious_instances" is deprecated, but we keep for migration purposes
|
||||
const INVIDIOUS_INSTANCES = "invidious_instances"
|
||||
|
||||
function Read(key as string, section = DEFAULT_SECTION as string) as dynamic
|
||||
sec = CreateObject("roRegistrySection", section)
|
||||
if sec.Exists(key)
|
||||
|
||||
@@ -1,54 +1,4 @@
|
||||
function IsString(obj as dynamic) as boolean
|
||||
return obj <> invalid and GetInterface(obj, "ifString") <> invalid
|
||||
end function
|
||||
|
||||
function IsArray(obj as dynamic) as boolean
|
||||
return obj <> invalid and GetInterface(obj, "ifArray") <> invalid
|
||||
end function
|
||||
|
||||
function IsAssociativeArray(obj as dynamic) as boolean
|
||||
return obj <> invalid and GetInterface(obj, "ifAssociativeArray") <> invalid
|
||||
end function
|
||||
|
||||
function IsByteArray(obj as dynamic) as boolean
|
||||
return obj <> invalid and GetInterface(obj, "ifByteArray") <> invalid
|
||||
end function
|
||||
|
||||
function IsInt(obj as dynamic) as boolean
|
||||
return obj <> invalid and GetInterface(obj, "ifInt") <> invalid
|
||||
end function
|
||||
|
||||
function IsDouble(obj as dynamic) as boolean
|
||||
return obj <> invalid and GetInterface(obj, "ifDouble") <> invalid
|
||||
end function
|
||||
|
||||
function IsFunction(obj as dynamic) as boolean
|
||||
return obj <> invalid and GetInterface(obj, "ifFunction") <> invalid
|
||||
end function
|
||||
|
||||
function ValidString(obj as object) as string
|
||||
if obj <> invalid and GetInterface(obj, "ifString") <> invalid
|
||||
return obj
|
||||
else
|
||||
return ""
|
||||
end if
|
||||
end function
|
||||
|
||||
function ValidInt(obj as dynamic) as integer
|
||||
if obj <> invalid and GetInterface(obj, "ifInt") <> invalid
|
||||
return obj
|
||||
else
|
||||
return 0
|
||||
end if
|
||||
end function
|
||||
|
||||
function ValidBool(obj as dynamic) as boolean
|
||||
if obj <> invalid and GetInterface(obj, "ifBoolean") <> invalid
|
||||
return obj
|
||||
else
|
||||
return false
|
||||
end if
|
||||
end function
|
||||
' This file will be populated with the functions using type-gen-plugin.ts
|
||||
|
||||
function FuncName(func as function) as string
|
||||
return (LCase(`${func}`)).replace("function:", "").trim()
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
{
|
||||
"name": "playlet-web",
|
||||
"version": "0.18.1",
|
||||
"version": "0.19.1",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-web",
|
||||
"version": "0.18.1",
|
||||
"version": "0.19.1",
|
||||
"devDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^3.0.1",
|
||||
"@tailwindcss/typography": "^0.5.10",
|
||||
"@tsconfig/svelte": "^5.0.2",
|
||||
"@vitejs/plugin-legacy": "^5.2.0",
|
||||
"autoprefixer": "^10.4.16",
|
||||
"daisyui": "^4.4.24",
|
||||
"daisyui": "^4.6.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"ip": "^1.1.8",
|
||||
"postcss": "^8.4.32",
|
||||
"postcss": "^8.4.33",
|
||||
"svelte": "^4.2.8",
|
||||
"svelte-check": "^3.6.2",
|
||||
"svelte-check": "^3.6.3",
|
||||
"svelte-preprocess": "^5.1.3",
|
||||
"tailwindcss": "^3.4.0",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"terser": "^5.26.0",
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^5.0.10",
|
||||
"vite": "^5.0.11",
|
||||
"vite-tsconfig-paths": "^4.2.3"
|
||||
}
|
||||
},
|
||||
@@ -2925,9 +2925,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/daisyui": {
|
||||
"version": "4.4.24",
|
||||
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-4.4.24.tgz",
|
||||
"integrity": "sha512-u/B3484J08V7N0rIYymnC+SyxOjlYQL+2vyhHWV+/KC+VaUcbEF2Z3H06eCPgdTiZ0J+ml44aH7wBhIymPFQ+g==",
|
||||
"version": "4.6.0",
|
||||
"resolved": "https://registry.npmjs.org/daisyui/-/daisyui-4.6.0.tgz",
|
||||
"integrity": "sha512-B5ZB/sczXpp4LMdo/SZrtYY/U2hq+Vr9I15QawuWZ0VwgtSAbuZpAZUftKVryEsPuv3BM0yVlBED0nAmtis/dw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"css-selector-tokenizer": "^0.8",
|
||||
@@ -3704,9 +3704,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/postcss": {
|
||||
"version": "8.4.32",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.32.tgz",
|
||||
"integrity": "sha512-D/kj5JNu6oo2EIy+XL/26JEDTlIbB8hw85G8StOE6L74RQAVVP5rej6wxCNqyMbR4RkPfqvezVbPw81Ngd6Kcw==",
|
||||
"version": "8.4.33",
|
||||
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.33.tgz",
|
||||
"integrity": "sha512-Kkpbhhdjw2qQs2O2DGX+8m5OVqEcbB9HRBvuYM9pgrjEFUg30A9LmXNlTAUj4S9kgtGyrMbTzVjH7E+s5Re2yg==",
|
||||
"dev": true,
|
||||
"funding": [
|
||||
{
|
||||
@@ -4234,9 +4234,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/svelte-check": {
|
||||
"version": "3.6.2",
|
||||
"resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-3.6.2.tgz",
|
||||
"integrity": "sha512-E6iFh4aUCGJLRz6QZXH3gcN/VFfkzwtruWSRmlKrLWQTiO6VzLsivR6q02WYLGNAGecV3EocqZuCDrC2uttZ0g==",
|
||||
"version": "3.6.3",
|
||||
"resolved": "https://registry.npmjs.org/svelte-check/-/svelte-check-3.6.3.tgz",
|
||||
"integrity": "sha512-Q2nGnoysxUnB9KjnjpQLZwdjK62DHyW6nuH/gm2qteFnDk0lCehe/6z8TsIvYeKjC6luKaWxiNGyOcWiLLPSwA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@jridgewell/trace-mapping": "^0.3.17",
|
||||
@@ -4337,9 +4337,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/tailwindcss": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.0.tgz",
|
||||
"integrity": "sha512-VigzymniH77knD1dryXbyxR+ePHihHociZbXnLZHUyzf2MMs2ZVqlUrZ3FvpXP8pno9JzmILt1sZPD19M3IxtA==",
|
||||
"version": "3.4.1",
|
||||
"resolved": "https://registry.npmjs.org/tailwindcss/-/tailwindcss-3.4.1.tgz",
|
||||
"integrity": "sha512-qAYmXRfk3ENzuPBakNK0SRrUDipP8NQnEY6772uDhflcQz5EhRdD7JNZxyrFHVQNCwULPBn6FNPp9brpO7ctcA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@alloc/quick-lru": "^5.2.0",
|
||||
@@ -4577,9 +4577,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/vite": {
|
||||
"version": "5.0.10",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-5.0.10.tgz",
|
||||
"integrity": "sha512-2P8J7WWgmc355HUMlFrwofacvr98DAjoE52BfdbwQtyLH06XKwaL/FMnmKM2crF0iX4MpmMKoDlNCB1ok7zHCw==",
|
||||
"version": "5.0.11",
|
||||
"resolved": "https://registry.npmjs.org/vite/-/vite-5.0.11.tgz",
|
||||
"integrity": "sha512-XBMnDjZcNAw/G1gEiskiM1v6yzM4GE5aMGvhWTlHAYYhxb7S3/V1s3m2LDHa8Vh6yIWYYB0iJwsEaS523c4oYA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"esbuild": "^0.19.3",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-web",
|
||||
"version": "0.18.1",
|
||||
"version": "0.19.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -14,18 +14,18 @@
|
||||
"@tsconfig/svelte": "^5.0.2",
|
||||
"@vitejs/plugin-legacy": "^5.2.0",
|
||||
"autoprefixer": "^10.4.16",
|
||||
"daisyui": "^4.4.24",
|
||||
"daisyui": "^4.6.0",
|
||||
"dotenv": "^16.3.1",
|
||||
"ip": "^1.1.8",
|
||||
"postcss": "^8.4.32",
|
||||
"postcss": "^8.4.33",
|
||||
"svelte": "^4.2.8",
|
||||
"svelte-check": "^3.6.2",
|
||||
"svelte-check": "^3.6.3",
|
||||
"svelte-preprocess": "^5.1.3",
|
||||
"tailwindcss": "^3.4.0",
|
||||
"tailwindcss": "^3.4.1",
|
||||
"terser": "^5.26.0",
|
||||
"tslib": "^2.6.2",
|
||||
"typescript": "^5.3.3",
|
||||
"vite": "^5.0.10",
|
||||
"vite": "^5.0.11",
|
||||
"vite-tsconfig-paths": "^4.2.3"
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@
|
||||
appStateStore,
|
||||
bookmarksStore,
|
||||
homeLayoutFileStore,
|
||||
homeLayoutStore,
|
||||
invidiousVideoApiStore,
|
||||
playletStateStore,
|
||||
preferencesModelStore,
|
||||
@@ -27,6 +28,10 @@
|
||||
playletStateStore.set(value);
|
||||
});
|
||||
|
||||
PlayletApi.getHomeLayout().then((value) => {
|
||||
homeLayoutStore.set(value);
|
||||
});
|
||||
|
||||
PlayletApi.getHomeLayoutFile().then((value) => {
|
||||
homeLayoutFileStore.set(value);
|
||||
});
|
||||
|
||||
@@ -18,7 +18,6 @@ export class InvidiousApi {
|
||||
"ChannelInfoHandler": (requestData, response) => this.ChannelInfoHandler(requestData, response),
|
||||
"ChannelVideosHandler": (requestData, response) => this.ChannelVideosHandler(requestData, response),
|
||||
"ChannelPlaylistsHandler": (requestData, response) => this.ChannelPlaylistsHandler(requestData, response),
|
||||
"ChannelRelatedChannelsHandler": (requestData, response) => this.ChannelRelatedChannelsHandler(requestData, response),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -211,13 +210,6 @@ export class InvidiousApi {
|
||||
};
|
||||
}
|
||||
|
||||
private async ChannelRelatedChannelsHandler(feedSource, responseJson) {
|
||||
return {
|
||||
items: responseJson.relatedChannels,
|
||||
continuation: responseJson.continuation
|
||||
};
|
||||
}
|
||||
|
||||
private makeUrl(url: string, params: any) {
|
||||
const encodedUrl = new URL(url);
|
||||
const existingParams = new URLSearchParams(encodedUrl.search);
|
||||
|
||||
@@ -13,6 +13,12 @@ export class PlayletApi {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
// Home layout is the home layout file, but with the user's preferences applied.
|
||||
static async getHomeLayout() {
|
||||
const response = await fetch(`${PlayletApi.host()}/api/home-layout`);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
static async getHomeLayoutFile() {
|
||||
const response = await fetch(`${PlayletApi.host()}/config/default_home_layout.yaml`);
|
||||
return await response.json();
|
||||
|
||||
@@ -7,7 +7,8 @@
|
||||
import RemoteIcon from "../assets/remote-control.svg.svelte";
|
||||
|
||||
import { appStateStore } from "lib/Stores";
|
||||
import type { AppState } from "lib/Types";
|
||||
import { ScreenNames, type AppState } from "lib/Types";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
function setScreen(screen: AppState["screen"]) {
|
||||
appStateStore.update((state) => {
|
||||
@@ -20,6 +21,31 @@
|
||||
state.screen = screen;
|
||||
return state;
|
||||
});
|
||||
setScreenNameInUrl(screen);
|
||||
}
|
||||
|
||||
onMount(() => {
|
||||
const screen = getScreenNameInUrl();
|
||||
if (screen) {
|
||||
setScreen(screen);
|
||||
} else {
|
||||
setScreenNameInUrl("home");
|
||||
}
|
||||
});
|
||||
|
||||
function getScreenNameInUrl(): AppState["screen"] | undefined {
|
||||
const hash = window.location.hash;
|
||||
if (hash) {
|
||||
const screen = hash.substring(1) as AppState["screen"];
|
||||
if (!ScreenNames.includes(screen)) {
|
||||
return;
|
||||
}
|
||||
return screen;
|
||||
}
|
||||
}
|
||||
|
||||
function setScreenNameInUrl(screen: AppState["screen"]) {
|
||||
window.location.hash = screen;
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
<script lang="ts">
|
||||
import VideoListRow from "lib/VideoFeed/VideoListRow.svelte";
|
||||
import { homeLayoutFileStore } from "lib/Stores";
|
||||
import { homeLayoutStore } from "lib/Stores";
|
||||
|
||||
export let visibility: boolean;
|
||||
</script>
|
||||
|
||||
<div class={visibility ? "" : "hidden"}>
|
||||
<!-- TODO:P0 Handle authenticated feed when not logged in -->
|
||||
{#each $homeLayoutFileStore as feed}
|
||||
{#each $homeLayoutStore as feed}
|
||||
<VideoListRow {feed} />
|
||||
{/each}
|
||||
</div>
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { getHost } from "lib/Api/Host";
|
||||
import { playletStateStore } from "lib/Stores";
|
||||
|
||||
export let visibility: boolean;
|
||||
@@ -38,6 +39,26 @@
|
||||
},
|
||||
];
|
||||
|
||||
const host = `http://${getHost()}`;
|
||||
const internalStateLinks = [
|
||||
{
|
||||
displayText: "App state",
|
||||
link: `${host}/api/state`,
|
||||
},
|
||||
{
|
||||
displayText: "Logs",
|
||||
link: `${host}/logs/app_logs.txt`,
|
||||
},
|
||||
{
|
||||
displayText: "Logs (previous run)",
|
||||
link: `${host}/logs/app_logs_previous.txt`,
|
||||
},
|
||||
{
|
||||
displayText: "Preferences",
|
||||
link: `${host}/api/preferences`,
|
||||
},
|
||||
];
|
||||
|
||||
function transformValue(key, value) {
|
||||
switch (key) {
|
||||
case "app_version":
|
||||
@@ -140,6 +161,26 @@ ${JSON.stringify(preferencesInfo, null, 2)}
|
||||
<td>{@html transformValue(item.key, appInfo[item.key])}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>App internal state</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
{#each internalStateLinks as item}
|
||||
<tr>
|
||||
<td>{item.displayText}</td>
|
||||
<td
|
||||
><a
|
||||
class="link"
|
||||
href={item.link}
|
||||
target="_blank"
|
||||
rel="noopener noreferrer">link</a
|
||||
></td
|
||||
>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -0,0 +1,145 @@
|
||||
<script lang="ts">
|
||||
import {
|
||||
homeLayoutFileStore,
|
||||
homeLayoutStore,
|
||||
userPreferencesStore,
|
||||
} from "lib/Stores";
|
||||
import ArrowUpIcon from "assets/remote-control/arrow-up.svg.svelte";
|
||||
import ArrowDownIcon from "assets/remote-control/arrow-down.svg.svelte";
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
export let displayText: string = "";
|
||||
// svelte-ignore unused-export-let
|
||||
export let key: string = "";
|
||||
export let description: string = "";
|
||||
export let level: number = 0;
|
||||
|
||||
let value;
|
||||
let originalValue;
|
||||
let homeLayout;
|
||||
userPreferencesStore.subscribe((userPreferences) => {
|
||||
originalValue = userPreferences[key];
|
||||
});
|
||||
|
||||
homeLayoutFileStore.subscribe((value) => {
|
||||
homeLayout = value.reduce((acc, cur) => {
|
||||
acc[cur.id] = cur;
|
||||
return acc;
|
||||
}, {});
|
||||
});
|
||||
|
||||
let modal;
|
||||
|
||||
async function openHomeScreenEditor() {
|
||||
value = JSON.parse(JSON.stringify(originalValue));
|
||||
modal.showModal();
|
||||
}
|
||||
|
||||
async function save() {
|
||||
if (key !== "" && value) {
|
||||
await PlayletApi.saveUserPreference(key, value);
|
||||
|
||||
const refreshUserPrefrences = PlayletApi.getUserPreferences();
|
||||
refreshUserPrefrences.then((value) => {
|
||||
userPreferencesStore.set(value);
|
||||
});
|
||||
|
||||
const refreshHomeLayout = PlayletApi.getHomeLayout();
|
||||
refreshHomeLayout.then((value) => {
|
||||
homeLayoutStore.set(value);
|
||||
});
|
||||
|
||||
await Promise.all([refreshUserPrefrences, refreshHomeLayout]);
|
||||
}
|
||||
}
|
||||
|
||||
function onClose() {
|
||||
// Reset value to original value to avoid weird animation on show
|
||||
value = JSON.parse(JSON.stringify(originalValue));
|
||||
}
|
||||
|
||||
function moveUp(index) {
|
||||
if (index > 0) {
|
||||
const updatedValue = [...value];
|
||||
[updatedValue[index - 1], updatedValue[index]] = [
|
||||
updatedValue[index],
|
||||
updatedValue[index - 1],
|
||||
];
|
||||
value = updatedValue;
|
||||
}
|
||||
}
|
||||
|
||||
function moveDown(index) {
|
||||
if (index < value.length - 1) {
|
||||
const updatedValue = [...value];
|
||||
[updatedValue[index], updatedValue[index + 1]] = [
|
||||
updatedValue[index + 1],
|
||||
updatedValue[index],
|
||||
];
|
||||
value = updatedValue;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{displayText}</div>
|
||||
<div class="text-xs text-gray-500">{@html description}</div>
|
||||
<button class="btn m-1" on:click={openHomeScreenEditor}
|
||||
>Edit home screen</button
|
||||
>
|
||||
</div>
|
||||
|
||||
<dialog bind:this={modal} on:close={onClose} class="modal">
|
||||
<div class="modal-box bg-base-100">
|
||||
{#if value && homeLayout}
|
||||
<table class="w-full">
|
||||
{#each value as item, i (i)}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="tooltip" data-tip="Move up">
|
||||
<button
|
||||
class="btn btn-outline btn-sm"
|
||||
on:click={() => moveUp(i)}
|
||||
disabled={i === 0}
|
||||
>
|
||||
<ArrowUpIcon />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text">{homeLayout[item.id].title}</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
name={item.id}
|
||||
bind:checked={item.enabled}
|
||||
class="toggle toggle-primary"
|
||||
/>
|
||||
</label>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="tooltip" data-tip="Move down">
|
||||
<button
|
||||
class="btn btn-outline btn-sm m-2"
|
||||
on:click={() => moveDown(i)}
|
||||
disabled={i === value.length - 1}
|
||||
>
|
||||
<ArrowDownIcon />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</table>
|
||||
<form method="dialog" class="flex justify-center space-x-2">
|
||||
<button class="btn btn-primary" on:click={save}>Save</button>
|
||||
<button class="btn btn-primary">Close</button>
|
||||
</form>
|
||||
{/if}
|
||||
</div>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>Close</button>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import BooleanControl from "lib/Screens/Settings/SettingControls/BooleanControl.svelte";
|
||||
import ClearSearchHistoryControl from "lib/Screens/Settings/SettingControls/ClearSearchHistoryControl.svelte";
|
||||
import EditHomeScreenControl from "lib/Screens/Settings/SettingControls/EditHomeScreenControl.svelte";
|
||||
import RadioControl from "lib/Screens/Settings/SettingControls/RadioControl.svelte";
|
||||
import StringControl from "lib/Screens/Settings/SettingControls/StringControl.svelte";
|
||||
|
||||
@@ -23,6 +24,7 @@
|
||||
|
||||
const customComponents = {
|
||||
ClearSearchHistoryControl,
|
||||
EditHomeScreenControl,
|
||||
};
|
||||
</script>
|
||||
|
||||
|
||||
@@ -15,6 +15,8 @@ export const userPreferencesStore = writable({} as any);
|
||||
|
||||
export const invidiousVideoApiStore = writable({} as any);
|
||||
|
||||
export const homeLayoutStore = writable([] as any);
|
||||
|
||||
export const homeLayoutFileStore = writable([] as any);
|
||||
|
||||
export const bookmarksStore = writable([] as any);
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
export const ScreenNames = ["search", "home", "bookmarks", "settings", "info", "remote"] as const;
|
||||
|
||||
export type AppState = {
|
||||
screen: "search" | "home" | "bookmarks" | "settings" | "info" | "remote"
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
|
||||
// TODO:P1 figure out why some uncached feeds (e.g. channels/ucid/videos) get hit twice
|
||||
export let feed: any = undefined;
|
||||
export let videos = [];
|
||||
let videos = [];
|
||||
|
||||
enum FeedLoadState {
|
||||
None,
|
||||
@@ -28,6 +28,8 @@
|
||||
let scrollStart = 0;
|
||||
let scrollEnd = 0;
|
||||
|
||||
let loadDataTask = undefined;
|
||||
|
||||
// w-80|w-60 p-2: 320px|240px + 16px padding on each side
|
||||
const videoItemWidth = 320 + 16 * 2;
|
||||
const channelItemWidth = 240 + 16 * 2;
|
||||
@@ -42,6 +44,18 @@
|
||||
{ threshold: [0] }
|
||||
);
|
||||
|
||||
$: {
|
||||
if (feed) {
|
||||
feedSourcesIndex = 0;
|
||||
feedLoadState = FeedLoadState.None;
|
||||
videos = [];
|
||||
itemWidths = [];
|
||||
scrollStart = 0;
|
||||
scrollEnd = 0;
|
||||
loadDataTask = undefined;
|
||||
}
|
||||
}
|
||||
|
||||
$: {
|
||||
if (
|
||||
carouselElement &&
|
||||
@@ -112,8 +126,6 @@
|
||||
loadDataTask = undefined;
|
||||
}
|
||||
|
||||
let loadDataTask;
|
||||
|
||||
async function loadData() {
|
||||
feedLoadState = FeedLoadState.Loading;
|
||||
let totalFetchedItems = 0;
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
# Tools
|
||||
|
||||
Various scripts for various purposes. Most of them are not called directly, but from an npm shortcut `npm run COMMAND`
|
||||
@@ -3,89 +3,24 @@
|
||||
import {
|
||||
CompilerPlugin,
|
||||
BscFile,
|
||||
BeforeFileTranspileEvent,
|
||||
isBrsFile,
|
||||
WalkMode,
|
||||
createVisitor,
|
||||
DiagnosticSeverity,
|
||||
Program,
|
||||
FunctionStatement,
|
||||
BeforeFileValidateEvent,
|
||||
} from 'brighterscript';
|
||||
|
||||
declare type FunctionInFile = {
|
||||
functionStatement: FunctionStatement,
|
||||
file: BscFile
|
||||
}
|
||||
|
||||
export class AsyncTaskPlugin implements CompilerPlugin {
|
||||
public name = 'AsyncTaskPlugin';
|
||||
|
||||
private asyncTaskFunctions: FunctionInFile[] = []
|
||||
private duplicatesReporeted: FunctionInFile[] = []
|
||||
|
||||
beforeProgramValidate(program: Program) {
|
||||
this.asyncTaskFunctions = []
|
||||
this.duplicatesReporeted = []
|
||||
}
|
||||
|
||||
beforeFileValidate(event: BeforeFileValidateEvent) {
|
||||
if (!isBrsFile(event.file)) {
|
||||
return
|
||||
}
|
||||
event.file.ast.walk(createVisitor({
|
||||
FunctionExpression: (func) => {
|
||||
if (!this.isAsyncTask(func.functionStatement)) {
|
||||
return
|
||||
}
|
||||
|
||||
this.asyncTaskFunctions.push({
|
||||
file: event.file,
|
||||
functionStatement: func.functionStatement!
|
||||
})
|
||||
},
|
||||
}), {
|
||||
walkMode: WalkMode.visitExpressionsRecursive
|
||||
});
|
||||
}
|
||||
|
||||
afterFileValidate(file: BscFile) {
|
||||
afterFileParse(file: BscFile) {
|
||||
if (!isBrsFile(file)) {
|
||||
return
|
||||
}
|
||||
|
||||
const functionsWithDuplicates = this.getFunctionsWithDuplicatesForFile(file);
|
||||
const program = file.program
|
||||
|
||||
for (let index = 0; index < functionsWithDuplicates.length; index++) {
|
||||
const fn = functionsWithDuplicates[index];
|
||||
if (this.duplicatesReporeted.indexOf(fn) !== -1) {
|
||||
continue
|
||||
}
|
||||
file.addDiagnostics([{
|
||||
code: 6661,
|
||||
message: `Duplicate async task '${fn.functionStatement.name.text}', use a different function name`,
|
||||
range: fn.functionStatement.range,
|
||||
file: fn.file,
|
||||
source: "AsyncTaskPlugin",
|
||||
severity: DiagnosticSeverity.Error,
|
||||
}])
|
||||
this.duplicatesReporeted.push(fn)
|
||||
}
|
||||
}
|
||||
|
||||
beforeFileTranspile(event: BeforeFileTranspileEvent) {
|
||||
if (!isBrsFile(event.file)) {
|
||||
return
|
||||
}
|
||||
|
||||
const functions = this.asyncTaskFunctions
|
||||
.filter((fn) => fn.file === event.file)
|
||||
|
||||
if (functions.length === 0) {
|
||||
return
|
||||
}
|
||||
|
||||
event.file.ast.walk(createVisitor({
|
||||
file.ast.walk(createVisitor({
|
||||
FunctionExpression: (func) => {
|
||||
if (!this.isAsyncTask(func.functionStatement)) {
|
||||
return
|
||||
@@ -93,22 +28,51 @@ export class AsyncTaskPlugin implements CompilerPlugin {
|
||||
|
||||
const functionName = func.functionStatement!.name.text
|
||||
const hasParams = func.functionStatement!.func.parameters.length > 0
|
||||
const taskName = `${functionName}_asynctask`
|
||||
const taskName = `${functionName}_AsyncTask`
|
||||
|
||||
const bs = this.generateBsTask(functionName, hasParams, event.file)
|
||||
const bsFile = `components/asynctasks/generated/${taskName}.bs`
|
||||
const bs = this.generateBsTask(functionName, hasParams, file)
|
||||
const bsFile = `components/AsyncTask/generated/${taskName}.bs`
|
||||
|
||||
const xml = this.generateXmlTask(taskName, bsFile)
|
||||
const xmlFile = `components/asynctasks/generated/${taskName}.xml`
|
||||
const xmlFile = `components/AsyncTask/generated/${taskName}.xml`
|
||||
|
||||
event.program.setFile(xmlFile, xml)
|
||||
event.program.setFile(bsFile, bs)
|
||||
if (program.hasFile(xmlFile)) {
|
||||
const currentContent = program.getFile(xmlFile).fileContents
|
||||
if (currentContent !== xml) {
|
||||
file.addDiagnostics([{
|
||||
file: file,
|
||||
range: func.range,
|
||||
message: `AsyncTaskPlugin: file ${xmlFile} already exists`,
|
||||
severity: 1,
|
||||
code: 'ASYNC_TASK_FILE_EXISTS',
|
||||
}]);
|
||||
}
|
||||
}
|
||||
file.program.setFile(xmlFile, xml)
|
||||
|
||||
if (program.hasFile(bsFile)) {
|
||||
const currentContent = program.getFile(bsFile).fileContents
|
||||
if (currentContent !== bs) {
|
||||
file.addDiagnostics([{
|
||||
file: file,
|
||||
range: func.range,
|
||||
message: `AsyncTaskPlugin: file ${bsFile} already exists`,
|
||||
severity: 1,
|
||||
code: 'ASYNC_TASK_FILE_EXISTS',
|
||||
}]);
|
||||
}
|
||||
}
|
||||
file.program.setFile(bsFile, bs)
|
||||
},
|
||||
}), {
|
||||
walkMode: WalkMode.visitExpressionsRecursive
|
||||
});
|
||||
}
|
||||
|
||||
beforeProgramValidate(program: Program) {
|
||||
this.generateTaskListEnum(program);
|
||||
}
|
||||
|
||||
isAsyncTask(functionStatement: FunctionStatement | undefined) {
|
||||
const annotations = functionStatement?.annotations
|
||||
if (!annotations || annotations.length === 0) {
|
||||
@@ -123,39 +87,6 @@ export class AsyncTaskPlugin implements CompilerPlugin {
|
||||
return false
|
||||
}
|
||||
|
||||
getFunctionsWithDuplicatesForFile(filterFile: BscFile) {
|
||||
const fileFunctions = this.asyncTaskFunctions
|
||||
.filter((fn) => fn.file === filterFile)
|
||||
|
||||
if (fileFunctions.length === 0) {
|
||||
return []
|
||||
}
|
||||
|
||||
const uniqueNames: { [name: string]: FunctionInFile | undefined } = {}
|
||||
const duplicatesNames: { [name: string]: boolean } = {}
|
||||
const duplicates: FunctionInFile[] = []
|
||||
|
||||
for (var i = 0; i < this.asyncTaskFunctions.length; i++) {
|
||||
const fnName = this.asyncTaskFunctions[i].functionStatement.name.text.toLowerCase()
|
||||
if (duplicatesNames[fnName]) {
|
||||
duplicates.push(this.asyncTaskFunctions[i])
|
||||
continue
|
||||
}
|
||||
|
||||
if (uniqueNames[fnName]) {
|
||||
duplicates.push(uniqueNames[fnName]!)
|
||||
uniqueNames[fnName] = undefined
|
||||
duplicatesNames[fnName] = true
|
||||
duplicates.push(this.asyncTaskFunctions[i])
|
||||
continue
|
||||
}
|
||||
|
||||
uniqueNames[fnName] = this.asyncTaskFunctions[i]
|
||||
}
|
||||
|
||||
return duplicates
|
||||
}
|
||||
|
||||
generateBsTask(functionName: string, hasInput: boolean, file: BscFile): string {
|
||||
return `
|
||||
import "pkg:/${file.pkgPath}"
|
||||
@@ -164,8 +95,8 @@ import "pkg:/source/utils/ErrorUtils.bs"
|
||||
function Init()
|
||||
m.top.functionName = "TaskMain"
|
||||
m.top.cancellation = {
|
||||
node: m.top,
|
||||
field: "cancel",
|
||||
node: m.top
|
||||
field: "cancel"
|
||||
value: true
|
||||
}
|
||||
end function
|
||||
@@ -174,9 +105,9 @@ function TaskMain()
|
||||
try
|
||||
result = ${functionName}(${(hasInput ? "m.top.input" : "")})
|
||||
m.top.setField("output", {
|
||||
success: true,
|
||||
task: m.top,
|
||||
cancelled: m.top.cancel,
|
||||
success: true
|
||||
task: m.top
|
||||
cancelled: m.top.cancel
|
||||
result: result
|
||||
})
|
||||
catch e
|
||||
@@ -185,9 +116,9 @@ function TaskMain()
|
||||
print ErrorUtils.Format(e)
|
||||
#end if
|
||||
m.top.setField("output", {
|
||||
success: false,
|
||||
task: m.top,
|
||||
cancelled: m.top.cancel,
|
||||
success: false
|
||||
task: m.top
|
||||
cancelled: m.top.cancel
|
||||
error: e
|
||||
})
|
||||
end try
|
||||
@@ -206,9 +137,38 @@ end function
|
||||
<field id="cancel" type="boolean" alwaysNotify="true" />
|
||||
<field id="cancellation" type="assocarray" />
|
||||
</interface>
|
||||
<script type="text/brightscript" uri="pkg:/${bsFile}" />
|
||||
</component>`
|
||||
}
|
||||
|
||||
generateTaskListEnum(program: Program) {
|
||||
const asyncTasks = Object.values(program.files).reduce((acc, file) => {
|
||||
if (!isBrsFile(file)) {
|
||||
return acc
|
||||
}
|
||||
|
||||
file.ast.walk(createVisitor({
|
||||
FunctionExpression: (func) => {
|
||||
if (!this.isAsyncTask(func.functionStatement)) {
|
||||
return
|
||||
}
|
||||
|
||||
acc.add(func.functionStatement!.name.text)
|
||||
},
|
||||
}), {
|
||||
walkMode: WalkMode.visitExpressionsRecursive
|
||||
});
|
||||
|
||||
return acc
|
||||
}, new Set<string>());
|
||||
|
||||
const enumItems = Array.from(asyncTasks).map((task) => {
|
||||
return `${task} = "${task}_AsyncTask"`
|
||||
})
|
||||
|
||||
const content = 'enum Tasks\n ' + enumItems.join('\n ') + '\nend enum\n';
|
||||
|
||||
program.setFile('source/AsyncTask/Tasks.bs', content);
|
||||
}
|
||||
}
|
||||
|
||||
export default () => {
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
// This plugin generates a file containing functions for type checking and type casting.
|
||||
import { CompilerPlugin, Program, SourceObj } from "brighterscript";
|
||||
|
||||
const types = [
|
||||
{ name: 'Bool', interface: 'ifBoolean', type: 'boolean', defaultValue: 'false' },
|
||||
{ name: 'Int', interface: 'ifInt', type: 'integer', defaultValue: '0' },
|
||||
{ name: 'Double', interface: 'ifDouble', type: 'double', defaultValue: '0#' },
|
||||
{ name: 'String', interface: 'ifString', type: 'string', defaultValue: '""' },
|
||||
{ name: 'Array', interface: 'ifArray', type: 'object', defaultValue: '[]' },
|
||||
{ name: 'AssociativeArray', interface: 'ifAssociativeArray', type: 'object', defaultValue: '{}' },
|
||||
{ name: 'ByteArray', interface: 'ifByteArray', type: null, defaultValue: null },
|
||||
{ name: 'Function', interface: 'ifFunction', type: null, defaultValue: null },
|
||||
];
|
||||
|
||||
const generatedCodeHeader = `' The rest of this file is generated by the TypeGenPlugin`
|
||||
|
||||
const typesFilePath = 'source/utils/Types.bs';
|
||||
|
||||
const isTypeTemplate = (name: string, _interface: string) => {
|
||||
return `' Returns true if the given object is of type ${name}, false otherwise
|
||||
function Is${name}(obj as dynamic) as boolean
|
||||
return obj <> invalid and GetInterface(obj, "${_interface}") <> invalid
|
||||
end function`;
|
||||
};
|
||||
|
||||
const validTypeTemplate = (name: string, type: string, _interface: string, defaultValue: string) => {
|
||||
return `' Returns the given object if it is of type ${name}, otherwise returns the default value \`${defaultValue}\`
|
||||
function Valid${name}(obj as dynamic) as ${type}
|
||||
if obj <> invalid and GetInterface(obj, "${_interface}") <> invalid
|
||||
return obj
|
||||
else
|
||||
return ${defaultValue}
|
||||
end if
|
||||
end function`;
|
||||
}
|
||||
|
||||
export class TypeGenPlugin implements CompilerPlugin {
|
||||
public name = 'TypeGenPlugin';
|
||||
|
||||
program: Program | undefined;
|
||||
|
||||
afterProgramCreate(program: Program) {
|
||||
this.program = program;
|
||||
}
|
||||
|
||||
beforeFileParse(source: SourceObj) {
|
||||
if (!source.srcPath.endsWith(typesFilePath)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (source.source.includes(generatedCodeHeader)) {
|
||||
return;
|
||||
}
|
||||
|
||||
let generatedCode = `\n${generatedCodeHeader}\n\n`;
|
||||
|
||||
types.forEach(type => {
|
||||
generatedCode += `${isTypeTemplate(type.name, type.interface)}\n`;
|
||||
if (type.type !== null && type.defaultValue !== null) {
|
||||
generatedCode += `${validTypeTemplate(type.name, type.type, type.interface, type.defaultValue)}\n`;
|
||||
}
|
||||
});
|
||||
|
||||
const fileContents = source.source + generatedCode;
|
||||
this.program!.setFile(source.srcPath, fileContents)
|
||||
}
|
||||
}
|
||||
|
||||
export default () => {
|
||||
return new TypeGenPlugin();
|
||||
};
|
||||
@@ -1,3 +1,7 @@
|
||||
// Description: Download stats from Roku (through email) and save them to a local folder.
|
||||
// This script is meant to be run daily from Github Actions.
|
||||
// It will download the stats from the previous day and update repo wiki.
|
||||
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const Imap = require('imap');
|
||||
|
||||