Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ca1399c60c | ||
|
|
1acf1da00d | ||
|
|
55c811adb7 | ||
|
|
0bbb876a84 | ||
|
|
8b15d1113b | ||
|
|
ff35ad61ab | ||
|
|
b8fd099d5c | ||
|
|
795435ff4b | ||
|
|
7ce5105434 | ||
|
|
71f32d1305 | ||
|
|
ff1ef8c9d8 | ||
|
|
aebb79a738 | ||
|
|
7bf54c4357 | ||
|
|
0366e54a80 | ||
|
|
015e84b41e | ||
|
|
b254a1fe93 | ||
|
|
18445fdcc4 | ||
|
|
9af9033462 | ||
|
|
6ef038492c | ||
|
|
1606ea9e2c | ||
|
|
30a75dc229 | ||
|
|
6a13575681 | ||
|
|
1f67b307f1 | ||
|
|
37bce62b14 | ||
|
|
5dbc8611ed | ||
|
|
4151b39456 | ||
|
|
b59a0797c9 | ||
|
|
a5766c41ce | ||
|
|
383522372f | ||
|
|
92d8cc4f55 | ||
|
|
07b4fb7a60 | ||
|
|
e49f1e3023 | ||
|
|
83d0b707b5 | ||
|
|
ad23a85e4f | ||
|
|
da417f4fb2 | ||
|
|
797b536380 | ||
|
|
8016d66a46 | ||
|
|
b08e7c07f3 | ||
|
|
a018264f76 | ||
|
|
416a1b86d4 | ||
|
|
2e826e02cd | ||
|
|
c156865de7 | ||
|
|
faa4b928d9 | ||
|
|
254efb289d | ||
|
|
151d05831c | ||
|
|
e35fad7d9c | ||
|
|
f15202593b | ||
|
|
58b3405cdc | ||
|
|
2b1e0fa154 | ||
|
|
8a9f0e4dfa | ||
|
|
7ebccaa812 | ||
|
|
23336c36e8 | ||
|
|
117fe0ce81 | ||
|
|
005bf0146d | ||
|
|
3697eafc43 | ||
|
|
c741466a85 | ||
|
|
1cbb52fad4 | ||
|
|
b534ea68db | ||
|
|
dc7cded3f5 | ||
|
|
76a57af5a0 | ||
|
|
e73fc9ab72 | ||
|
|
cac9090f4d | ||
|
|
b8ed900769 | ||
|
|
5b452d527e | ||
|
|
900881e649 | ||
|
|
2a2cdd8652 | ||
|
|
15d06c0432 | ||
|
|
ad99fbbf03 | ||
|
|
d6005115a2 | ||
|
|
c36745c6aa | ||
|
|
595bd87970 | ||
|
|
fcf0334667 | ||
|
|
a0b6175858 | ||
|
|
99be2071d1 | ||
|
|
305ddaa737 | ||
|
|
20816d09f7 | ||
|
|
839f49888f | ||
|
|
b67587df2b | ||
|
|
e5062c34d7 | ||
|
|
29f5373492 | ||
|
|
f17e93936c | ||
|
|
c69ab716f5 | ||
|
|
bd389473e5 | ||
|
|
cfa7662f2e | ||
|
|
609c4622fd | ||
|
|
45262c6394 | ||
|
|
7ce3b2636c | ||
|
|
a75ce42373 | ||
|
|
fd8b61ad44 | ||
|
|
3391e3d787 | ||
|
|
862fea74e7 | ||
|
|
de4f64d38f | ||
|
|
aab99b2a2e | ||
|
|
51eb7bdfa2 | ||
|
|
3d52d00bde | ||
|
|
bd26e727c1 | ||
|
|
3b622f65f3 | ||
|
|
615439650e | ||
|
|
25330a6494 | ||
|
|
37e429f648 | ||
|
|
6e6ea94544 | ||
|
|
42dadec020 | ||
|
|
019fde1e67 | ||
|
|
fb0b1b8894 | ||
|
|
66df27cf0b | ||
|
|
feb968a72e | ||
|
|
9061275d6f | ||
|
|
059167ac56 | ||
|
|
7330b321a5 | ||
|
|
9a7db6aab2 | ||
|
|
48993dd9f5 | ||
|
|
7d9817994c | ||
|
|
403ed94e97 | ||
|
|
67252cd5d5 | ||
|
|
e4efc6832f | ||
|
|
13138740fb | ||
|
|
b37b89bffc | ||
|
|
888f7da214 | ||
|
|
750e24f724 | ||
|
|
bfd4f3e298 | ||
|
|
7b7801d7a5 | ||
|
|
ffb84d1c89 | ||
|
|
d29e51c7f2 | ||
|
|
b72a6d4614 | ||
|
|
289b845876 |
No files matched your search
@@ -24,10 +24,10 @@ jobs:
|
||||
git config --local user.email "githubaction@githubaction.com"
|
||||
git config --local user.name "github-action linter"
|
||||
|
||||
- name: Use Node.js 18.x
|
||||
uses: actions/setup-node@v3
|
||||
- name: Use Node.js 20.x
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18.x
|
||||
node-version: 20.x
|
||||
cache: "npm"
|
||||
|
||||
- name: Install dependencies
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
name: Release trigger
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
inputs:
|
||||
version:
|
||||
description: "Release version (X.Y.Z)"
|
||||
required: true
|
||||
|
||||
concurrency:
|
||||
group: ${{ github.workflow }}
|
||||
cancel-in-progress: true
|
||||
|
||||
jobs:
|
||||
release-pr:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use Node.js 20.x
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 20.x
|
||||
cache: "npm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Set package version
|
||||
run: npm version ${{ github.event.inputs.version }} --no-git-tag-version
|
||||
|
||||
# Replace "## [Unreleased]" with "## [X.Y.Z] - YYYY-MM-DD" in CHANGELOG.md
|
||||
- name: Set changelog version
|
||||
run: |
|
||||
sed -i "s/## \[Unreleased\]/## \[${{ github.event.inputs.version }}\] - $(date +%Y-%m-%d)/" CHANGELOG.md
|
||||
|
||||
# Building for release should sync the version in multiple files, and then fail if there are any changes.
|
||||
- name: Build for release
|
||||
run: npm run build:release || exit 0
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
with:
|
||||
commit-message: "Release v${{ github.event.inputs.version }}"
|
||||
branch: release/${{ github.event.inputs.version }}
|
||||
title: "Release v${{ github.event.inputs.version }}"
|
||||
body: "Release ${{ github.event.inputs.version }}. See CHANGELOG.md and roadmap #6 for details."
|
||||
token: ${{ secrets.GH_TOKEN }}
|
||||
@@ -17,26 +17,36 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use Node.js 18.x
|
||||
uses: actions/setup-node@v3
|
||||
- name: Use Node.js 20.x
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18.x
|
||||
node-version: 20.x
|
||||
cache: "npm"
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build tests
|
||||
run: npm run test:build
|
||||
- name: Run tests
|
||||
run: npm run test
|
||||
env:
|
||||
ROKU_DEV_TARGET: ${{ secrets.ROKU_DEV_TARGET }}
|
||||
ROKU_DEV_TARGET_PORT: ${{ secrets.ROKU_DEV_TARGET_PORT }}
|
||||
ROKU_DEVPASSWORD: ${{ secrets.ROKU_DEVPASSWORD }}
|
||||
ROKU_DEV_TARGET_TELNET_PORT: ${{ secrets.ROKU_DEV_TARGET_TELNET_PORT }}
|
||||
|
||||
- name: Build Playlet
|
||||
run: npm run build:release:ci
|
||||
- name: Build Playlet for release
|
||||
run: npm run build:release
|
||||
env:
|
||||
ROKU_DEV_TARGET: ${{ secrets.ROKU_DEV_TARGET }}
|
||||
ROKU_DEV_TARGET_PORT: ${{ secrets.ROKU_DEV_TARGET_PORT }}
|
||||
ROKU_DEVPASSWORD: ${{ secrets.ROKU_DEVPASSWORD }}
|
||||
ROKU_SIGN_PASSWORD: ${{ secrets.ROKU_SIGN_PASSWORD }}
|
||||
|
||||
- name: Use Java 17
|
||||
uses: actions/setup-java@v3
|
||||
- name: Use Java 21
|
||||
uses: actions/setup-java@v4
|
||||
with:
|
||||
distribution: "temurin"
|
||||
java-version: "17"
|
||||
java-version: "21"
|
||||
|
||||
- name: Download the Static Channel Analysis CLI
|
||||
run: |
|
||||
@@ -70,6 +80,6 @@ jobs:
|
||||
run: sleep 10
|
||||
|
||||
- name: Create Canary release
|
||||
run: gh release create canary ./release/playlet.zip ./release/playlet-lib.zip --notes-file docs/canary-changelog.md --prerelease --title Canary
|
||||
run: gh release create canary ./release/playlet.zip ./release/playlet.squashfs.pkg ./release/playlet-lib.zip ./release/playlet-lib.squashfs.pkg --notes-file docs/canary-changelog.md --prerelease --title Canary
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GH_TOKEN }}
|
||||
@@ -24,10 +24,10 @@ jobs:
|
||||
git config --local user.name "github-action wiki updater"
|
||||
working-directory: ./playlet.wiki
|
||||
|
||||
- name: Use Node.js 18.x
|
||||
uses: actions/setup-node@v3
|
||||
- name: Use Node.js 20.x
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18.x
|
||||
node-version: 20.x
|
||||
cache: "npm"
|
||||
|
||||
- name: Install dependencies
|
||||
|
||||
@@ -12,10 +12,10 @@ jobs:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Use Node.js 18.x
|
||||
uses: actions/setup-node@v3
|
||||
- name: Use Node.js 20.x
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 18.x
|
||||
node-version: 20.x
|
||||
cache: "npm"
|
||||
|
||||
- name: Install dependencies
|
||||
@@ -24,9 +24,6 @@ jobs:
|
||||
- name: Update dependencies
|
||||
run: npm run update-deps
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm i
|
||||
|
||||
- name: Create Pull Request
|
||||
uses: peter-evans/create-pull-request@v5
|
||||
with:
|
||||
@@ -34,3 +31,4 @@ jobs:
|
||||
branch: chore/update-deps
|
||||
title: "[chore] update dependencies"
|
||||
body: "Weekly pull request to update dependencies."
|
||||
token: ${{ secrets.GH_TOKEN }}
|
||||
@@ -1,4 +1,7 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"**/locale/**/*.ts": "xml"
|
||||
},
|
||||
"brightscript.output.clearConsoleOnChannelStart": false,
|
||||
"brightscript.bsdk": "node_modules/brighterscript",
|
||||
"editor.formatOnSave": true,
|
||||
|
||||
@@ -5,6 +5,110 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.23.6] - 2024-05-23
|
||||
|
||||
### Added
|
||||
|
||||
- A dev setting to clear the cache
|
||||
|
||||
### Fixed
|
||||
|
||||
- A bug where bookmarked channels can be duplicated
|
||||
- A bug where video cast from web app would not play if there's an error dialog on screen
|
||||
- failed to create media player error, by waiting for previous video to stop before starting a new one
|
||||
|
||||
### Changed
|
||||
|
||||
- Font weight to be less bold
|
||||
|
||||
## [0.23.5] - 2024-05-19
|
||||
|
||||
### Fixed
|
||||
|
||||
- a bug where trending and search wouldn't work in certain countries (web app)
|
||||
- A crash when lounge session is lost and fails to recover
|
||||
- A bug where live videos to not start at the "edge" of the stream
|
||||
|
||||
## [0.23.4] - 2024-05-04
|
||||
|
||||
### Added
|
||||
|
||||
- An invidious instance "fetch with CORS" test
|
||||
|
||||
### Fixed
|
||||
|
||||
- a bug where public Invidious instances all showed `N/A` in the health column
|
||||
- a bug where trending and search wouldn't work in certain countries
|
||||
|
||||
## [0.23.3] - 2024-04-28
|
||||
|
||||
### Changed
|
||||
|
||||
- Removed announcement - most public instances are now updated
|
||||
|
||||
## [0.23.2] - 2024-04-27
|
||||
|
||||
### Changed
|
||||
|
||||
- Updated announcement
|
||||
|
||||
## [0.23.1] - 2024-04-24
|
||||
|
||||
### Added
|
||||
|
||||
- Announcement dialog to indicate outage
|
||||
|
||||
## [0.23.0] - 2024-04-04
|
||||
|
||||
### Added
|
||||
|
||||
- Loading Playlet lib as squashfs, with fallback to the zip file. This significantly decreases load times.
|
||||
|
||||
### Changed
|
||||
|
||||
- Bumped minimum OS version to 11, this is required for squashfs-zstd
|
||||
|
||||
## [0.22.3] - 2024-03-31
|
||||
|
||||
### Changed
|
||||
|
||||
- Removed announcement
|
||||
|
||||
## [0.22.2] - 2024-03-31
|
||||
|
||||
### Changed
|
||||
|
||||
- Updated announcement
|
||||
|
||||
## [0.22.1] - 2024-03-30
|
||||
|
||||
### Added
|
||||
|
||||
- Announcement dialog to indicate outage
|
||||
|
||||
### Fixed
|
||||
|
||||
- [Attempt] A bug where the lounge would randomly lose the session id, making it unable to cast, and spam the same error over and over
|
||||
- Dialog with timer now stops as expected if any button is pressed
|
||||
|
||||
## [0.22.0] - 2024-03-24
|
||||
|
||||
### Added
|
||||
|
||||
- Context menu sort options for channel videos and playlists
|
||||
- Localization support and French translations
|
||||
- Channel releases
|
||||
|
||||
### Changed
|
||||
|
||||
- Colors to be more broadcast safe
|
||||
|
||||
### Fixed
|
||||
|
||||
- A bug where instance testing is not immediately cancelled when the testing page is closed
|
||||
- A bug in the web app where "upcoming" videos show up as "live"
|
||||
- Search sort filters
|
||||
|
||||
## [0.21.2] - 2024-03-10
|
||||
|
||||
### Fixed
|
||||
@@ -39,7 +143,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
### Added
|
||||
|
||||
- Small improvement in the context menu of the Playlist view
|
||||
- Videos can be paused and resumed using the `Ok` remote button
|
||||
- Videos can be paused and resumed using the `OK` remote button
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -141,7 +245,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- If you like to add these two feeds to your bookmarks:
|
||||
- Search for `Funny` (or `News`)
|
||||
- Set the `Sort by` filter to `Upload date`
|
||||
- Press and hold the `Ok` button while a video from the search result is selected
|
||||
- Press and hold the `OK` button while a video from the search result is selected
|
||||
- Choose the `Add to "Search - Funny"` option
|
||||
|
||||
## [0.18.0] - 2023-12-28
|
||||
@@ -386,7 +490,7 @@ This version went through a major refactor, which resulted in a different arcite
|
||||
- It reads the response data, headers, error codes and etc even if they are not needed
|
||||
- Excessive logging without a way to toggle it, or redirect it to a file
|
||||
- Some unused parts of the code (Like basic auth in the server, WebSockets, RegistryRouter, Kanji QR Code)
|
||||
- These were unsued and/or feature flagged features. Things can be restored as needed.
|
||||
- These were unused and/or feature flagged features. Things can be restored as needed.
|
||||
- The video player loading spinner when the video is minimized: this added too much hacky code with minimum value.
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -19,7 +19,7 @@ could be public instances hosted by volenteers. These instances are available
|
||||
[here](https://api.invidious.io/).
|
||||
|
||||
While invidious does no data collection by default, and it is in fact built to
|
||||
be privacy driven, but in theory, from a playlet request it is possible to
|
||||
be privacy driven, but in theory, from a Playlet request it is possible to
|
||||
know the IP address of a user, the identifiers of watched video, and search
|
||||
keywords. In case the user has privacy concerns, they can host their own
|
||||
Invidious instance and use it from Playlet.
|
||||
@@ -39,7 +39,7 @@ user privacy.
|
||||
Additionally, Playlet may send a "skipped" event to SponsorBlock, to indicate
|
||||
that a section of a video has been skipped. This event does not have any
|
||||
tracking information attached to it, and it is anonymous. It is merely to
|
||||
indicate to contributers how much their contributions are being used in the wild.
|
||||
indicate to contributors how much their contributions are being used in the wild.
|
||||
|
||||
## LeanBack
|
||||
|
||||
@@ -47,6 +47,6 @@ LeanBack, also known as Lounge API, also known as "cast from phone". Is a featur
|
||||
When this feature is used, all traffic related to the videos being watched, added to the queue, and the video player state is routed through YouTube servers.
|
||||
|
||||
Playlet tries to preserve user privacy, to the best of its ability, by implementing several techniques, such as randomizing device id, using a fresh session on each start, and only providing necessary fields for the feature to function.
|
||||
Additionally, Playlet does not join a session/lounge, until a device is attempting to connect using DIAL (**DI**scovery **A**nd **L**aunch spec), or when a `Link with TV code` is generated, by visiting the appropriate settings page.
|
||||
Additionally, Playlet does not join a session/lounge, until a device is attempting to connect using DIAL (**DI**scovery **A**nd **L**aunch spec) also know sa "Connect with Wi-Fi", or when a `Link with TV code` is generated, by visiting the appropriate settings page.
|
||||
|
||||
If you have privacy concerns and do not wish to use this functionality, simply do not connect from a local network using the YouTube app or the browser, and do not visit the `Link with TV code` tab.
|
||||
@@ -7,7 +7,10 @@
|
||||
</a>
|
||||
<a href="https://github.com/iBicha/playlet/releases">
|
||||
<img alt="Current Release" src="https://img.shields.io/github/release/iBicha/playlet.svg"/>
|
||||
<img alt="Total Downloads" src="https://img.shields.io/github/downloads/iBicha/playlet/latest/playlet-lib.zip.svg"/>
|
||||
<img alt="Total Downloads" src="https://img.shields.io/github/downloads/iBicha/playlet/latest/playlet-lib.squashfs.pkg.svg"/>
|
||||
</a>
|
||||
<a href="https://hosted.weblate.org/engage/playlet/">
|
||||
<img src="https://hosted.weblate.org/widget/playlet/svg-badge.svg" alt="Translation status" />
|
||||
</a>
|
||||
<a href="/LICENSE">
|
||||
<img alt="AGPL-3.0 license" src="https://img.shields.io/github/license/iBicha/playlet.svg"/>
|
||||
|
||||
@@ -46,6 +46,12 @@
|
||||
"regex": "\\?[\\.|\\[|\\(|@]",
|
||||
"regexFlags": "ig",
|
||||
"message": "No optional chaning (var1?.property). Do a type check instead."
|
||||
},
|
||||
{
|
||||
"code": "NO_TRANSLATE_STRING_LITERAL",
|
||||
"regex": "\\bTr\\s*\\(\\s*\"[^\\\"]*\"\\s*\\)",
|
||||
"regexFlags": "ig",
|
||||
"message": "Tr(\"String\") is not allowed. Use Tr(Locale.Key) instead."
|
||||
}
|
||||
],
|
||||
"files": [
|
||||
@@ -56,6 +62,7 @@
|
||||
"!**/*.psd",
|
||||
"!**/*.svg",
|
||||
"!**/*.svg.meta.json5",
|
||||
"locale/**",
|
||||
"config/**",
|
||||
"lib/**",
|
||||
"www/**",
|
||||
@@ -79,7 +86,8 @@
|
||||
"../tools/bs-plugins/logger-plugin.ts",
|
||||
"../tools/bs-plugins/image-gen-plugin.ts",
|
||||
"../tools/bs-plugins/type-gen-plugin.ts",
|
||||
"../tools/bs-plugins/web-server-plugin.ts"
|
||||
"../tools/bs-plugins/web-server-plugin.ts",
|
||||
"../tools/bs-plugins/locale-validation-plugin.ts"
|
||||
],
|
||||
"retainStagingDir": true,
|
||||
"require": [
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
"!**/*.psd",
|
||||
"!**/*.svg",
|
||||
"!**/*.svg.meta.json5",
|
||||
"locale/**",
|
||||
"config/**",
|
||||
"lib/**",
|
||||
"www/**",
|
||||
@@ -29,7 +30,8 @@
|
||||
"../tools/bs-plugins/logger-plugin.ts",
|
||||
"../tools/bs-plugins/image-gen-plugin.ts",
|
||||
"../tools/bs-plugins/type-gen-plugin.ts",
|
||||
"../tools/bs-plugins/web-server-plugin.ts"
|
||||
"../tools/bs-plugins/web-server-plugin.ts",
|
||||
"../tools/bs-plugins/locale-validation-plugin.ts"
|
||||
],
|
||||
"rooibos": {
|
||||
"logLevel": 2,
|
||||
|
||||
@@ -13,16 +13,11 @@ These are mostly the steps when releasing a new version:
|
||||
|
||||
## Playlet lib
|
||||
|
||||
- Create local branch `release/$VERSION` e.g. `release/0.10.0`
|
||||
- Set version in package.json
|
||||
- Update CHANGELOG.md section from `[Unreleased]` to `[$VERSION] - DATE`
|
||||
- `npm run build:release`
|
||||
- This should fail because there are uncommitted changes. This is expected.
|
||||
- Commit changes
|
||||
- Create pull request
|
||||
- Title: `Release v$VERSION`
|
||||
- Comment: `Release $VERSION \nIt should contain everything planned from #6`
|
||||
- Wait for CI and merge
|
||||
- Use the [Release trigger](https://github.com/iBicha/playlet/actions/workflows/release-trigger.yml) to trigger a release
|
||||
- Run workflow from **main** branch
|
||||
- Set the new version in the format X.Y.Z
|
||||
- Wait for the PR to be created
|
||||
- Inspect PR, wait for CI and merge
|
||||
- Wait for CI on main branch to create the `canary` release
|
||||
- Edit `canary` release
|
||||
- Tag: `v$VERSION`
|
||||
@@ -40,11 +35,4 @@ These are mostly the steps when releasing a new version:
|
||||
|
||||
## Playlet
|
||||
|
||||
For releasing to the store (when needed), this is done following a Playlet lib release:
|
||||
|
||||
- Switch to main branch and pull changes, **including tags** - **match commit corresponding to the release.**
|
||||
- `npm run build:release:ci`
|
||||
- This makes sure to have a valid app in the staging folder
|
||||
- `npm run sign-released-package`
|
||||
- This should create the signed package under `release/playlet.pkg`
|
||||
- Upload to dashboard, and schedule a release (takes a couple of days)
|
||||
For releasing to the store (when needed), signed packages are attached to Github releases, ready to publish
|
||||
@@ -2,7 +2,7 @@ openapi: 3.0.0
|
||||
|
||||
info:
|
||||
title: Playlet Web API
|
||||
version: 0.21.2
|
||||
version: 0.23.6
|
||||
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
|
||||
@@ -572,6 +572,8 @@ components:
|
||||
type: string
|
||||
friendly_name:
|
||||
type: string
|
||||
current_locale:
|
||||
type: string
|
||||
invidious:
|
||||
type: object
|
||||
properties:
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
- [Logger](#logger)
|
||||
- [Type Gen](#type-gen)
|
||||
- [Web Server](#web-server)
|
||||
- [Locale validation](#locale-validation)
|
||||
|
||||
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:
|
||||
|
||||
@@ -602,3 +603,23 @@ There one special annotation, and one special route:
|
||||
- `*` matches all paths
|
||||
|
||||
So `@all(*)` would be a middleware that will be matched with any request.
|
||||
|
||||
## Locale validation
|
||||
|
||||
**[Source](/tools/bs-plugins/locale-validation-plugin.ts)**
|
||||
|
||||
### Why
|
||||
|
||||
Roku's built-in localization system has some undesired side effects: for example, it might translate node ids, which would break the relationship between the nodes.
|
||||
This plugin enforces some rules to ensure translation files are kept up to date with code implementation.
|
||||
See the next section for the validation rules.
|
||||
|
||||
### How
|
||||
|
||||
The plugin checks for the following:
|
||||
|
||||
- Translated words and sentenses are defined in an enum annotated with `@locale`
|
||||
- All the values in the `@locale` enums must be provided in the English (`en_US`) translation. This is because `en_US` is the fallback translation when the current localte translations are not complete.
|
||||
- `en_US` must have matching source and translation values, so it can act as a fallback translation.
|
||||
- All `source` translations from all languages must be present in the `@locale` enums. This is to prevent renaming the values in the code without updating translation files.
|
||||
- Translation `source` keys can't be used except for certain fields such as `"text"` and `"title"`. This is to prevent the accidental localization of non-display fields, such as node ids.
|
||||
@@ -14,13 +14,17 @@
|
||||
| ------------------------- | --------------------------- |
|
||||
|  |  |
|
||||
|
||||
| Settings | Invidious instances | Invidious testing |
|
||||
| --------------------------- | ------------------------------------------------ | --------------------------------------------- |
|
||||
|  |  |  |
|
||||
| Profiles | Settings |
|
||||
| --------------------------- | --------------------------- |
|
||||
|  |  |
|
||||
|
||||
| Remote | App info |
|
||||
| ----------------------- | --------------------------- |
|
||||
|  |  |
|
||||
| Invidious instances | Invidious testing |
|
||||
| ------------------------------------------------ | --------------------------------------------- |
|
||||
|  |  |
|
||||
|
||||
| Remote | Info |
|
||||
| ----------------------- | ------------------- |
|
||||
|  |  |
|
||||
|
||||
## Playlet web app
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 78 KiB After Width: | Height: | Size: 98 KiB |
|
Before Width: | Height: | Size: 123 KiB After Width: | Height: | Size: 122 KiB |
|
Before Width: | Height: | Size: 124 KiB After Width: | Height: | Size: 109 KiB |
|
After Width: | Height: | Size: 37 KiB |
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 63 KiB |
|
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 52 KiB |
|
Before Width: | Height: | Size: 74 KiB After Width: | Height: | Size: 75 KiB |
|
After Width: | Height: | Size: 32 KiB |
|
Before Width: | Height: | Size: 67 KiB After Width: | Height: | Size: 67 KiB |
|
Before Width: | Height: | Size: 83 KiB After Width: | Height: | Size: 87 KiB |
|
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 43 KiB |
@@ -1,46 +1,46 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.21.2",
|
||||
"version": "0.23.6",
|
||||
"description": "Unofficial YouTube client for Roku",
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.8.19",
|
||||
"@rokucommunity/bslint": "^0.8.21",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/node": "^20.11.25",
|
||||
"@types/node": "^20.12.12",
|
||||
"@types/xml2js": "^0.4.14",
|
||||
"argparse": "^2.0.1",
|
||||
"brighterscript": "0.65.25",
|
||||
"brighterscript-formatter": "^1.7.0",
|
||||
"brighterscript": "0.67.1",
|
||||
"brighterscript-formatter": "^1.7.2",
|
||||
"convert-svg-to-png": "^0.6.4",
|
||||
"cross-fetch": "^4.0.0",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dotenv": "^16.4.5",
|
||||
"express": "^4.18.3",
|
||||
"express": "^4.19.2",
|
||||
"fs-extra": "^11.2.0",
|
||||
"glob": "^10.3.10",
|
||||
"glob": "^10.3.15",
|
||||
"imap": "^0.8.19",
|
||||
"ip": "^2.0.1",
|
||||
"json5": "^2.2.3",
|
||||
"mailparser": "^3.6.9",
|
||||
"mailparser": "^3.7.1",
|
||||
"roku-deploy": "^3.12.0",
|
||||
"rooibos-roku": "5.10.0",
|
||||
"semver": "^7.6.0",
|
||||
"rooibos-roku": "5.12.0",
|
||||
"rounded-rect-9patch": "^1.0.1",
|
||||
"semver": "^7.6.2",
|
||||
"shelljs": "^0.8.5",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "^5.4.2",
|
||||
"typescript": "^5.4.5",
|
||||
"xml2js": "^0.6.2",
|
||||
"yaml": "^2.4.1"
|
||||
"yaml": "^2.4.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": "18"
|
||||
"node": "20"
|
||||
},
|
||||
"scripts": {
|
||||
"dev:web": "cd playlet-web && npm run dev",
|
||||
"prebuild": "rm -rf dist",
|
||||
"build:dev": "npm run build:web && npm run build:lib:dev && npm run build:app:dev",
|
||||
"build:prod": "npm run build:web && npm run build:lib:prod && npm run build:app:prod",
|
||||
"build:release": "npm run build:release:ci && npm run sign-package",
|
||||
"build:release:ci": "npm run format:fix && npm run lint:fix && npm run version-sync && npm run manifest-git-hash && npm run build:prod",
|
||||
"build:release": "npm run format:fix && npm run lint:fix && npm run version-sync && npm run manifest-git-hash && npm run build:prod",
|
||||
"build:app:dev": "cd playlet-app && npm run build:dev",
|
||||
"build:app:prod": "cd playlet-app && npm run build:prod",
|
||||
"build:lib:dev": "cd playlet-lib && npm run build:dev",
|
||||
@@ -58,14 +58,13 @@
|
||||
"test:build:lib": "cd playlet-lib && npm run test:build",
|
||||
"version-sync": "node tools/version-sync.js",
|
||||
"manifest-git-hash": "node tools/update-manifest-git-hash.js",
|
||||
"sign-package": "node tools/sign-package.js",
|
||||
"sign-released-package": "node tools/sign-released-package.js",
|
||||
"screenshot": "node tools/screenshot.js",
|
||||
"profile-sync": "node tools/profile-sync.js",
|
||||
"generate-sponsorblock-config": "node tools/generate-sponsorblock-config.js",
|
||||
"update-rale-component": "cd tools/RALE && rm TrackerTask.xml && curl -o TrackerTask.zip https://devtools.web.roku.com/roku-advanced-layout-editor/app/TrackerTask.zip && unzip TrackerTask.zip && rm TrackerTask.zip",
|
||||
"postinstall": "cd playlet-lib && npm install && cd ../playlet-app && npm install && cd ../playlet-web && npm install",
|
||||
"update-deps": "npx npm-check-updates -u && cd playlet-app && npx npm-check-updates -u && cd ../playlet-lib && npx npm-check-updates -u && cd ../playlet-web && npx npm-check-updates -u",
|
||||
"update-deps": "npx npm-check-updates --deep --upgrade --install always",
|
||||
"registry:write": "node tools/registry.js --input registry.json",
|
||||
"registry:read": "node tools/registry.js --output registry.json",
|
||||
"registry:clear": "node tools/registry.js --clear"
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.21.2",
|
||||
"version": "0.23.6",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-app",
|
||||
"version": "0.21.2"
|
||||
"version": "0.23.6"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,16 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.21.2",
|
||||
"version": "0.23.6",
|
||||
"description": "Unofficial YouTube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf build/playlet-app",
|
||||
"prebuild": "rm -rf ../build/playlet-app",
|
||||
"prebuild:dev": "npm run prebuild",
|
||||
"prebuild:prod": "npm run prebuild",
|
||||
"build:dev": "bsc --create-package --debug --sourceMap=true --lintConfig ../config/bslint.jsonc",
|
||||
"build:prod": "bsc --create-package --sourceMap=false --lintConfig ../config/bslint.jsonc",
|
||||
"postbuild:prod": "mkdir -p ../release && cp ../dist/playlet-app.zip ../release/playlet.zip",
|
||||
"postbuild:prod": "mkdir -p ../release && cp ../dist/playlet-app.zip ../release/playlet.zip && npm run squash-fs && npm run sign-package",
|
||||
"squash-fs": "node ../tools/squash-fs.js --in-file ../release/playlet.zip --out-file ../release/playlet.squashfs.zip",
|
||||
"sign-package": "node ../tools/sign-package.js --out-file playlet.squashfs.zip --out-dir ../release --staging-dir ../build/playlet-app",
|
||||
"lint": "bslint --project bsconfig.lint.json --lintConfig ../config/bslint.jsonc",
|
||||
"lint:fix": "npm run lint -- --fix",
|
||||
"format:base": "bsfmt \"src/**/*.brs\" \"src/**/*.bs\" \"!**/bslib.brs\" \"!**/roku_modules/**/*\" \"!**/*.transpiled/**\" \"!**/*.transpiled.*\" --bsfmt-path ../config/bsfmt.jsonc",
|
||||
|
||||
@@ -22,8 +22,8 @@ end function
|
||||
|
||||
function GetPlayletLibUrls() as object
|
||||
#if DEBUG
|
||||
debug = { type: "debug", link: Manifest.ReadValue("playlet_lib_debug_url") }
|
||||
embedded = { type: "embedded", link: Manifest.ReadValue("playlet_lib_embedded_url") }
|
||||
debug = { type: "debug-zip", link: Manifest.ReadValue("playlet_lib_zip_debug_url") }
|
||||
embedded = { type: "embedded-zip", link: Manifest.ReadValue("playlet_lib_zip_embedded_url") }
|
||||
#if DEBUG_FALLBACK_TO_EMBEDDED
|
||||
return [debug, embedded]
|
||||
#else
|
||||
@@ -36,9 +36,10 @@ function GetPlayletLibUrls() as object
|
||||
return savedUrls
|
||||
end if
|
||||
|
||||
github = { type: "github", link: Manifest.ReadValue("playlet_lib_remote_url") }
|
||||
embedded = { type: "embedded", link: Manifest.ReadValue("playlet_lib_embedded_url") }
|
||||
return [github, embedded]
|
||||
githubSquashFs = { type: "github-squashfs", link: Manifest.ReadValue("playlet_lib_squashfs_remote_url") }
|
||||
githubZip = { type: "github-zip", link: Manifest.ReadValue("playlet_lib_zip_remote_url") }
|
||||
embedded = { type: "embedded-zip", link: Manifest.ReadValue("playlet_lib_zip_embedded_url") }
|
||||
return [githubSquashFs, githubZip, embedded]
|
||||
#end if
|
||||
end function
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ end function
|
||||
|
||||
function GetLoadingMessagesFromCache() as object
|
||||
messagesFile = ReadAsciiFile("cachefs:/loading_messages_v1.json")
|
||||
if messagesFile = invalid or messagesFile = ""
|
||||
if messagesFile = ""
|
||||
return invalid
|
||||
end if
|
||||
return ParseJson(messagesFile)
|
||||
|
||||
|
Before Width: | Height: | Size: 9.9 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 5.2 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 3.3 KiB |
@@ -3,24 +3,24 @@
|
||||
outputs: [
|
||||
{
|
||||
outputFilePath: 'images/channel-poster_fhd.png',
|
||||
outputHash: '50729b5bdd2a7c0fd4a1d502812117d4',
|
||||
outputHash: '49c39d7f33e37a8214bf05d7db016e97',
|
||||
width: 540,
|
||||
height: 405,
|
||||
background: '#EEEEEE',
|
||||
background: '#EBEBEB',
|
||||
},
|
||||
{
|
||||
outputFilePath: 'images/channel-poster_hd.png',
|
||||
outputHash: '8022dc6fa993ce3194c5aea37d6ea49a',
|
||||
outputHash: '4968cb52fca911be47fa17e61f0af4a5',
|
||||
width: 290,
|
||||
height: 218,
|
||||
background: '#EEEEEE',
|
||||
background: '#EBEBEB',
|
||||
},
|
||||
{
|
||||
outputFilePath: 'images/channel-poster_sd.png',
|
||||
outputHash: '63b8f12ac155c29b4e85db17a2886817',
|
||||
outputHash: 'e976889af6743044db344219ec44514c',
|
||||
width: 246,
|
||||
height: 140,
|
||||
background: '#EEEEEE',
|
||||
background: '#EBEBEB',
|
||||
},
|
||||
],
|
||||
}
|
||||
@@ -2,8 +2,8 @@ title=Playlet
|
||||
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=21
|
||||
build_version=00002
|
||||
minor_version=23
|
||||
build_version=00006
|
||||
|
||||
ui_resolutions=hd
|
||||
|
||||
@@ -27,9 +27,10 @@ confirm_partner_button=1
|
||||
|
||||
supports_input_launch=1
|
||||
|
||||
playlet_lib_remote_url=https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip
|
||||
playlet_lib_embedded_url=pkg:/lib/playlet-lib.zip
|
||||
playlet_lib_debug_url=http://DEBUG_HOST_IP_ADDRESS:8086/playlet-lib.zip
|
||||
playlet_lib_squashfs_remote_url=https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.squashfs.pkg
|
||||
playlet_lib_zip_remote_url=https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip
|
||||
playlet_lib_zip_embedded_url=pkg:/lib/playlet-lib.zip
|
||||
playlet_lib_zip_debug_url=http://DEBUG_HOST_IP_ADDRESS:8086/playlet-lib.zip
|
||||
|
||||
git_commit_sha=unknown
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ function DialogSetPalette(msgDialog as object)
|
||||
DialogBackgroundColor: "#242424FF"
|
||||
DialogFocusColor: "#CECECEFF"
|
||||
DialogFocusItemColor: "#202020FF"
|
||||
DialogSecondaryTextColor: "#DBDBDBFF"
|
||||
DialogSecondaryTextColor: "#EBEBEBFF"
|
||||
DialogSecondaryItemColor: "#FF1C30FF"
|
||||
DialogTextColor: "#DBDBDBFF"
|
||||
DialogTextColor: "#EBEBEBFF"
|
||||
}
|
||||
msgDialog.palette = palette
|
||||
end function
|
||||
|
||||
@@ -46,10 +46,9 @@ function Main(args as object) as void
|
||||
input = CreateObject("roInput")
|
||||
input.setMessagePort(port)
|
||||
|
||||
' TODO:P2 follow up on bug where roSystemLog does not fire for a video player in ComponentLibrary
|
||||
' https://community.roku.com/t5/Roku-Developer-Program/BUG-roSystemLog-not-firing-with-ComponentLibrary/td-p/906075
|
||||
systemLog = CreateObject("roSystemLog")
|
||||
systemLog.SetMessagePort(port)
|
||||
' Although all types are enabled, they are filtered in Playlet Lib to avoid spamming the logs
|
||||
systemLog.EnableType("http.connect")
|
||||
systemLog.EnableType("http.error")
|
||||
systemLog.EnableType("http.complete")
|
||||
|
||||
@@ -8,8 +8,9 @@ namespace Tests
|
||||
@it("Reads values from manifest")
|
||||
@params("title", "Playlet")
|
||||
@params("supports_input_launch", "1")
|
||||
@params("playlet_lib_remote_url", "https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip")
|
||||
@params("playlet_lib_embedded_url", "pkg:/lib/playlet-lib.zip")
|
||||
@params("playlet_lib_squashfs_remote_url", "https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.squashfs.pkg")
|
||||
@params("playlet_lib_zip_remote_url", "https://github.com/iBicha/playlet/releases/latest/download/playlet-lib.zip")
|
||||
@params("playlet_lib_zip_embedded_url", "pkg:/lib/playlet-lib.zip")
|
||||
function _(key as string, expectedValue as string)
|
||||
m.assertEqual(Manifest.ReadValue(key), expectedValue)
|
||||
end function
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.21.2",
|
||||
"version": "0.23.6",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-lib",
|
||||
"version": "0.21.2"
|
||||
"version": "0.23.6"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,16 +1,18 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.21.2",
|
||||
"version": "0.23.6",
|
||||
"description": "Unofficial YouTube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf build/playlet-lib",
|
||||
"prebuild": "rm -rf ../build/playlet-lib",
|
||||
"prebuild:dev": "npm run prebuild",
|
||||
"prebuild:prod": "npm run prebuild",
|
||||
"build:dev": "bsc --create-package --debug --sourceMap=true --lintConfig ../config/bslint.jsonc",
|
||||
"build:prod": "bsc --create-package --sourceMap=false --lintConfig ../config/bslint.jsonc",
|
||||
"postbuild": "mkdir -p ../release && mkdir -p ../playlet-app/src/lib && cp ../dist/playlet-lib.zip ../playlet-app/src/lib/playlet-lib.zip",
|
||||
"postbuild:dev": "npm run postbuild",
|
||||
"postbuild:prod": "npm run postbuild && cp ../dist/playlet-lib.zip ../release/playlet-lib.zip",
|
||||
"postbuild:prod": "npm run postbuild && cp ../dist/playlet-lib.zip ../release/playlet-lib.zip && npm run squash-fs && npm run sign-package",
|
||||
"squash-fs": "node ../tools/squash-fs.js --in-file ../release/playlet-lib.zip --out-file ../release/playlet-lib.squashfs.zip",
|
||||
"sign-package": "node ../tools/sign-package.js --out-file playlet-lib.squashfs.zip --out-dir ../release --staging-dir ../build/playlet-lib",
|
||||
"lint": "bslint --project bsconfig.lint.json --lintConfig ../config/bslint.jsonc",
|
||||
"lint:fix": "npm run lint -- --fix",
|
||||
"format:base": "bsfmt \"src/**/*.brs\" \"src/**/*.bs\" \"!**/bslib.brs\" \"!**/roku_modules/**/*\" \"!**/*.transpiled/**\" \"!**/*.transpiled.*\" --bsfmt-path ../config/bsfmt.jsonc",
|
||||
|
||||
@@ -3,6 +3,7 @@ import "pkg:/components/Navigation/LongPress.bs"
|
||||
import "pkg:/components/VideoQueue/VideoQueueUtils.bs"
|
||||
import "pkg:/components/VideoQueue/VideoQueueViewUtils.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
@@ -125,7 +126,7 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
dialog = DialogUtils.ShowDialogButtons("Do you want to exit Playlet?", "Exit", ["Exit", "Cancel"])
|
||||
dialog = DialogUtils.ShowDialogButtons(Tr(Locale.Dialogs.ExitPlayletQuestion), Tr(Locale.Buttons.exit), [Tr(Locale.Buttons.exit), Tr(Locale.Buttons.Cancel)])
|
||||
dialog.observeField("buttonSelected", FuncName(OnExitDialog), ["buttonSelected"])
|
||||
return true
|
||||
end if
|
||||
|
||||
@@ -0,0 +1,146 @@
|
||||
import "pkg:/source/utils/MathUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.backgroundNode = m.top.findNode("background")
|
||||
m.labelNode = m.top.findNode("label")
|
||||
m.iconNode = m.top.findNode("icon")
|
||||
m.anchorNode = m.top.findNode("anchor")
|
||||
m.focusAnimation = m.top.findNode("focusAnimation")
|
||||
m.normalFont = m.top.findNode("normalFont")
|
||||
m.boldFont = m.top.findNode("boldFont")
|
||||
|
||||
DoLayout()
|
||||
OnDisabledChange()
|
||||
m.top.observeField("focusedChild", FuncName(OnFocusedChild))
|
||||
end function
|
||||
|
||||
function DoLayout() as void
|
||||
minWidth = m.top.minWidth
|
||||
height = m.top.height
|
||||
padding = m.top.padding
|
||||
textVisible = m.top.textVisible
|
||||
iconVisible = m.top.iconVisible
|
||||
|
||||
if not textVisible and not iconVisible
|
||||
m.top.width = minWidth
|
||||
return
|
||||
end if
|
||||
|
||||
contentWidth = 0
|
||||
iconWidth = 0
|
||||
iconHeight = 0
|
||||
textWidth = 0
|
||||
iconTextSpacing = 0
|
||||
|
||||
if iconVisible
|
||||
iconWidth = m.top.iconWidth
|
||||
iconHeight = m.top.iconHeight
|
||||
contentWidth += iconWidth
|
||||
end if
|
||||
|
||||
if textVisible
|
||||
labelRect = m.labelNode.boundingRect()
|
||||
textWidth = labelRect.width
|
||||
contentWidth += textWidth
|
||||
end if
|
||||
|
||||
if iconVisible and textVisible
|
||||
iconTextSpacing = m.top.iconTextSpacing
|
||||
contentWidth += iconTextSpacing
|
||||
end if
|
||||
|
||||
contentWidth += padding[0] + padding[1]
|
||||
|
||||
width = MathUtils.Max(contentWidth, minWidth)
|
||||
m.top.width = width
|
||||
|
||||
if iconVisible
|
||||
x = (width - contentWidth) / 2 + padding[0]
|
||||
y = (height - iconHeight) / 2
|
||||
m.iconNode.translation = [x, y]
|
||||
end if
|
||||
|
||||
if textVisible
|
||||
x = (width - contentWidth) / 2 + padding[0] + iconWidth + iconTextSpacing
|
||||
m.labelNode.height = height
|
||||
m.labelNode.translation = [x, 0]
|
||||
end if
|
||||
|
||||
OnAnchorChange()
|
||||
end function
|
||||
|
||||
function OnAnchorChange()
|
||||
width = m.top.width
|
||||
height = m.top.height
|
||||
anchor = m.top.anchor
|
||||
|
||||
m.anchorNode.scaleRotateCenter = [width / 2, height / 2]
|
||||
m.anchorNode.translation = [-width * anchor[0], -height * anchor[1]]
|
||||
end function
|
||||
|
||||
function OnDisabledChange()
|
||||
disabled = m.top.disabled
|
||||
|
||||
if disabled
|
||||
if m.top.textVisible
|
||||
m.labelNode.color = m.top.disabledTextColor
|
||||
m.labelNode.font = m.normalFont
|
||||
end if
|
||||
if m.top.iconVisible
|
||||
m.iconNode.blendColor = m.top.disabledIconColor
|
||||
end if
|
||||
m.backgroundNode.blendColor = m.top.disabledBackgroundColor
|
||||
else
|
||||
OnButtonFocused()
|
||||
end if
|
||||
m.top.focusable = not disabled
|
||||
end function
|
||||
|
||||
function OnFocusedChild()
|
||||
m.top.buttonFocused = m.top.hasFocus()
|
||||
end function
|
||||
|
||||
function OnButtonFocused()
|
||||
buttonFocused = m.top.buttonFocused
|
||||
textVisible = m.top.textVisible
|
||||
iconVisible = m.top.iconVisible
|
||||
|
||||
if buttonFocused
|
||||
if textVisible
|
||||
m.labelNode.color = m.top.focusedTextColor
|
||||
m.labelNode.font = m.boldFont
|
||||
end if
|
||||
if iconVisible
|
||||
m.iconNode.blendColor = m.top.focusedIconColor
|
||||
end if
|
||||
m.backgroundNode.blendColor = m.top.focusedBackgroundColor
|
||||
|
||||
m.focusAnimation.control = "start"
|
||||
else
|
||||
if textVisible
|
||||
m.labelNode.color = m.top.textColor
|
||||
m.labelNode.font = m.normalFont
|
||||
end if
|
||||
if iconVisible
|
||||
m.iconNode.blendColor = m.top.iconColor
|
||||
end if
|
||||
m.backgroundNode.blendColor = m.top.backgroundColor
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
if not press
|
||||
return false
|
||||
end if
|
||||
|
||||
if key = "OK"
|
||||
disabled = m.top.disabled
|
||||
if not disabled
|
||||
m.top.buttonSelected = true
|
||||
end if
|
||||
return true
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
@@ -0,0 +1,60 @@
|
||||
<component name="ButtonEx" extends="Group">
|
||||
<interface>
|
||||
<field id="text" type="string" alias="label.text" onChange="DoLayout" />
|
||||
<field id="textVisible" type="boolean" alias="label.visible" onChange="DoLayout" />
|
||||
<field id="textColor" type="color" value="#DDDDDD" />
|
||||
<field id="focusedTextColor" type="color" value="#262626" />
|
||||
<field id="disabledTextColor" type="color" value="#606060" />
|
||||
<field id="normalFontSize" type="integer" alias="normalFont.size" onChange="DoLayout" />
|
||||
<field id="boldFontSize" type="integer" alias="boldFont.size" onChange="DoLayout" />
|
||||
|
||||
<field id="iconTextSpacing" type="float" value="10" onChange="DoLayout" />
|
||||
|
||||
<field id="iconUri" type="uri" alias="icon.uri" />
|
||||
<field id="iconVisible" type="boolean" alias="icon.visible" onChange="DoLayout" />
|
||||
<field id="iconWidth" type="float" alias="icon.width" value="42" onChange="DoLayout" />
|
||||
<field id="iconHeight" type="float" alias="icon.height" value="42" onChange="DoLayout" />
|
||||
<field id="iconColor" type="color" value="#DDDDDD" />
|
||||
<field id="focusedIconColor" type="color" value="#262626" />
|
||||
<field id="disabledIconColor" type="color" value="#606060" />
|
||||
|
||||
<field id="backgroundColor" type="color" value="#3C3C3C" />
|
||||
<field id="focusedBackgroundColor" type="color" value="#DDDDDD" />
|
||||
<field id="disabledBackgroundColor" type="color" value="#292929" />
|
||||
|
||||
<field id="width" type="float" alias="background.width" onChange="DoLayout" />
|
||||
<field id="minWidth" type="float" onChange="DoLayout" />
|
||||
<field id="height" type="float" alias="background.height" onChange="DoLayout" value="58" />
|
||||
<field id="padding" type="vector2d" value="[20,20]" onChange="DoLayout" />
|
||||
<field id="anchor" type="vector2d" onChange="OnAnchorChange" />
|
||||
<field id="disabled" type="boolean" onChange="OnDisabledChange" />
|
||||
|
||||
<field id="buttonSelected" type="boolean" alwaysNotify="true" />
|
||||
<field id="buttonFocused" type="boolean" onChange="OnButtonFocused" />
|
||||
</interface>
|
||||
<children>
|
||||
<Font id="normalFont" uri="font:SystemFontFile" size="24" />
|
||||
<Font id="boldFont" uri="font:MediumSystemFontFile" size="24" />
|
||||
<Group id="anchor">
|
||||
<Poster
|
||||
id="background"
|
||||
uri="pkg:/images/button-ex.9.png">
|
||||
<Poster id="icon" />
|
||||
<Label
|
||||
id="label"
|
||||
horizAlign="center"
|
||||
vertAlign="center" />
|
||||
</Poster>
|
||||
</Group>
|
||||
<Animation
|
||||
id="focusAnimation"
|
||||
optional="true"
|
||||
duration="0.15">
|
||||
<Vector2DFieldInterpolator
|
||||
id="scale"
|
||||
key="[ 0.0, 0.5, 1.0 ]"
|
||||
keyValue="[ [ 1.0, 1.0 ], [ 1.05, 1.05 ], [ 1.0, 1.0 ] ]"
|
||||
fieldToInterp="anchor.scale" />
|
||||
</Animation>
|
||||
</children>
|
||||
</component>
|
||||
@@ -1,8 +1,11 @@
|
||||
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/components/Navigation/Navigation.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/Locale.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
@@ -27,6 +30,7 @@ function Init()
|
||||
m.authorId = ""
|
||||
|
||||
InitializeTabs()
|
||||
InitializeSortOptions()
|
||||
end function
|
||||
|
||||
function OnNodeready()
|
||||
@@ -35,7 +39,7 @@ function OnNodeready()
|
||||
SetNavigation(m.rowList, "up", m.subscribeButton)
|
||||
SetNavigation(m.subscribeButton, "down", m.rowList)
|
||||
|
||||
m.subscribeButton.text = "Subscribe"
|
||||
m.subscribeButton.text = Tr(Locale.Buttons.Subscribe)
|
||||
DisposableObserveFieldScoped(m.subscribeButton, "buttonSelected", FuncName(OnSubscribeButtonSelected))
|
||||
|
||||
SetSubscribeButtonVisibility()
|
||||
@@ -172,25 +176,51 @@ end function
|
||||
|
||||
function InitializeTabs()
|
||||
m.tabs = {
|
||||
videos: function(authorId as string, author as string) as object
|
||||
return CreateChannelFeed("Latest videos", "channel_videos", authorId, author)
|
||||
"videos": function(authorId as string, author as string) as object
|
||||
return CreateChannelFeed("Videos", "channel_videos", authorId, author)
|
||||
end function
|
||||
shorts: function(authorId as string, author as string) as object
|
||||
"shorts": function(authorId as string, author as string) as object
|
||||
return CreateChannelFeed("Shorts", "channel_shorts", authorId, author)
|
||||
end function
|
||||
streams: function(authorId as string, author as string) as object
|
||||
"streams": function(authorId as string, author as string) as object
|
||||
return CreateChannelFeed("Live", "channel_streams", authorId, author)
|
||||
end function
|
||||
podcasts: function(authorId as string, author as string) as object
|
||||
"releases": function(authorId as string, author as string) as object
|
||||
return CreateChannelFeed("Releases", "channel_releases", authorId, author)
|
||||
end function
|
||||
"podcasts": function(authorId as string, author as string) as object
|
||||
return CreateChannelFeed("Podcasts", "channel_podcasts", authorId, author)
|
||||
end function
|
||||
playlists: function(authorId as string, author as string) as object
|
||||
"playlists": function(authorId as string, author as string) as object
|
||||
return CreateChannelFeed("Playlists", "channel_playlists", authorId, author)
|
||||
end function
|
||||
}
|
||||
end function
|
||||
|
||||
function InitializeSortOptions()
|
||||
m.sortOptions = {
|
||||
"channel_videos": [{
|
||||
"id": "newest"
|
||||
"title": "Latest"
|
||||
}, {
|
||||
"id": "popular"
|
||||
"title": "Popular"
|
||||
}, {
|
||||
"id": "oldest"
|
||||
"title": "Oldest"
|
||||
}]
|
||||
"channel_playlists": [{
|
||||
"id": "newest"
|
||||
"title": "Date added (newest)"
|
||||
}, {
|
||||
"id": "last"
|
||||
"title": "Last video added"
|
||||
}]
|
||||
}
|
||||
end function
|
||||
|
||||
function CreateChannelFeed(title as string, endpoint as string, ucid as string, author as string) as object
|
||||
title = Tr(title)
|
||||
return {
|
||||
title: title
|
||||
feedSources: [{
|
||||
@@ -209,7 +239,32 @@ function GetContextMenuOptionsForItem(video as object) as object
|
||||
if StringUtils.IsNullOrEmpty(m.top.authorId)
|
||||
return []
|
||||
end if
|
||||
return m.bookmarks@.GetMenuForChannel(m.top.content)
|
||||
options = m.bookmarksService@.GetMenuForChannel(m.top.content)
|
||||
options.Append(GetSortingContextMenuOptionsForItem(video))
|
||||
return options
|
||||
end function
|
||||
|
||||
function GetSortingContextMenuOptionsForItem(video as object) as object
|
||||
feedContentNode = video.getParent()
|
||||
if feedContentNode = invalid or not feedContentNode.hasField("feedSources")
|
||||
return []
|
||||
end if
|
||||
|
||||
feedSources = feedContentNode.feedSources
|
||||
if feedSources = invalid or feedSources.Count() = 0
|
||||
return []
|
||||
end if
|
||||
|
||||
feedSource = feedSources[0]
|
||||
endpoint = feedSource.endpoint
|
||||
if not m.sortOptions.DoesExist(endpoint)
|
||||
return []
|
||||
end if
|
||||
|
||||
title = Tr(Locale.Dialogs.SortFeedBy).replace("%1", `"${feedSource.title}"`)
|
||||
sortOptions = m.sortOptions[endpoint]
|
||||
|
||||
return [ContextMenuUtils.CreateOption(title + "...", m.top, "ShowSortDialog", [title, sortOptions, feedContentNode])]
|
||||
end function
|
||||
|
||||
function IsLoggedIn() as boolean
|
||||
@@ -238,10 +293,10 @@ function OnAuthorIdChange()
|
||||
end function
|
||||
|
||||
function SetSubscribeButtonVisibility()
|
||||
isLogged = IsLoggedIn()
|
||||
m.subscribeButton.visible = isLogged and not StringUtils.IsNullOrEmpty(m.top.authorId)
|
||||
m.subscribeButton.focusable = m.subscribeButton.visible
|
||||
if not m.subscribeButton.visible and m.subscribeButton.hasFocus()
|
||||
isEnabled = IsLoggedIn() and not StringUtils.IsNullOrEmpty(m.top.authorId)
|
||||
m.subscribeButton.visible = isEnabled
|
||||
m.subscribeButton.focusable = isEnabled
|
||||
if not isEnabled and m.subscribeButton.hasFocus()
|
||||
NodeSetFocus(m.rowList, true)
|
||||
end if
|
||||
end function
|
||||
@@ -249,8 +304,56 @@ end function
|
||||
function OnSubscriptionChanged()
|
||||
isSubbed = IsSubscribed()
|
||||
if isSubbed
|
||||
m.subscribeButton.text = "Unsubscribe"
|
||||
m.subscribeButton.text = Tr(Locale.Buttons.Unsubscribe)
|
||||
else
|
||||
m.subscribeButton.text = "Subscribe"
|
||||
m.subscribeButton.text = Tr(Locale.Buttons.Subscribe)
|
||||
end if
|
||||
end function
|
||||
|
||||
function ShowSortDialog(title as string, sortOptions as object, feedContentNode as object)
|
||||
buttons = []
|
||||
for i = 0 to sortOptions.Count() - 1
|
||||
buttons.Push(Tr(sortOptions[i].title))
|
||||
end for
|
||||
|
||||
dialog = DialogUtils.ShowDialogButtons("", title, buttons)
|
||||
dialog.addFields({
|
||||
"feedContentNode": feedContentNode
|
||||
"sortOptions": sortOptions
|
||||
})
|
||||
dialog.observeField("buttonSelected", FuncName(OnSortDialogResult), ["buttonSelected"])
|
||||
end function
|
||||
|
||||
function OnSortDialogResult(event as object) as void
|
||||
dialog = event.getRoSGNode()
|
||||
sortOptions = dialog.sortOptions
|
||||
buttonIndex = event.GetData()
|
||||
|
||||
if not IsInt(buttonIndex) or buttonIndex < 0 or buttonIndex >= sortOptions.Count()
|
||||
return
|
||||
end if
|
||||
|
||||
selected = sortOptions[buttonIndex]
|
||||
|
||||
feedContentNode = dialog.feedContentNode
|
||||
feedSources = feedContentNode.feedSources
|
||||
if feedSources = invalid or feedSources.Count() = 0
|
||||
return
|
||||
end if
|
||||
selectedFeedSource = feedSources[0]
|
||||
|
||||
currentFeeds = m.rowList.feeds
|
||||
for i = 0 to currentFeeds.Count() - 1
|
||||
feed = currentFeeds[i]
|
||||
feedSource = feed.feedSources[0]
|
||||
if feedSource.id = selectedFeedSource.id
|
||||
if feedSource.queryParams = invalid
|
||||
feedSource.queryParams = {}
|
||||
end if
|
||||
|
||||
feedSource.queryParams["sort_by"] = selected.id
|
||||
m.rowList.feeds = currentFeeds
|
||||
return
|
||||
end if
|
||||
end for
|
||||
end function
|
||||
@@ -4,7 +4,8 @@
|
||||
<field id="authorId" type="string" onChange="OnAuthorIdChange" />
|
||||
<field id="appController" type="node" bind="/AppController" />
|
||||
<field id="invidious" type="node" bind="/Invidious" />
|
||||
<field id="bookmarks" type="node" bind="/Bookmarks" />
|
||||
<field id="bookmarksService" type="node" bind="/BookmarksService" />
|
||||
<function name="ShowSortDialog" />
|
||||
</interface>
|
||||
<children>
|
||||
<Rectangle
|
||||
@@ -23,6 +24,7 @@
|
||||
translation="[115,20]"
|
||||
width="104"
|
||||
height="104"
|
||||
blendColor="#DDDDDDFF"
|
||||
uri="pkg:/images/white-circle.png">
|
||||
|
||||
<CirclePoster
|
||||
@@ -42,13 +44,12 @@
|
||||
font="font:SmallestSystemFont" />
|
||||
</Poster>
|
||||
|
||||
<Button
|
||||
<ButtonEx
|
||||
id="subscribeButton"
|
||||
iconUri=""
|
||||
focusedIconUri=""
|
||||
showFocusFootprint="true"
|
||||
minWidth="200"
|
||||
translation="[930,64]" />
|
||||
iconVisible="false"
|
||||
anchor="[0.5,0.5]"
|
||||
padding="[30,30]"
|
||||
translation="[1050,90]" />
|
||||
|
||||
<VideoRowList
|
||||
itemComponentName="RowCell"
|
||||
|
||||
@@ -3,6 +3,7 @@ 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/Locale.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
|
||||
function LoadChannel(invidiousNode as object) as void
|
||||
@@ -39,8 +40,8 @@ function OnChannelContentTaskResult(output as object) as void
|
||||
error = ErrorUtils.Format(error)
|
||||
LogError(error)
|
||||
authorId = output.task.input.content.authorId
|
||||
message = `Failed to load channel ${authorId}\n${error}`
|
||||
DialogUtils.ShowDialog(message, "Channel load fail", true)
|
||||
message = Tr(Locale.Dialogs.FailedToLoadChannel).Replace("%1", authorId) + `\n${error}`
|
||||
DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.ChannelLoadError), true)
|
||||
return
|
||||
end if
|
||||
end function
|
||||
@@ -29,8 +29,7 @@ function ChannelContentTask(input as object) as object
|
||||
}
|
||||
end if
|
||||
|
||||
instance = service.GetInstance()
|
||||
InvidiousContent.ToChannelContentNode(contentNode, metadata, instance)
|
||||
InvidiousContent.ToChannelContentNode(contentNode, metadata)
|
||||
|
||||
contentNode.loadState = FeedLoadState.Loaded
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ 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/Locale.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
|
||||
function LoadPlaylistPage(invidiousNode as object) as void
|
||||
@@ -48,8 +49,8 @@ function OnPlaylistContentTaskResult(output as object) as void
|
||||
error = ErrorUtils.Format(error)
|
||||
LogError(error)
|
||||
playlistId = output.task.input.content.playlistId
|
||||
message = `Failed to load playlist ${playlistId}\n${error}`
|
||||
DialogUtils.ShowDialog(message, "Playlist load fail", true)
|
||||
message = Tr(Locale.Dialogs.FailedToLoadPlaylist).Replace("%1", playlistId) + `\n${error}`
|
||||
DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.PlaylistLoadError), true)
|
||||
return
|
||||
end if
|
||||
end function
|
||||
@@ -18,7 +18,7 @@
|
||||
<field id="premiereTimestampText" type="string" />
|
||||
<field id="publishedText" type="string" />
|
||||
<field id="thumbnail" type="uri" />
|
||||
<field id="timestamp" type="integer" />
|
||||
<field id="timestamp" type="integer" value="-1" />
|
||||
<field id="title" type="string" />
|
||||
<field id="videoId" type="string" />
|
||||
<field id="viewCountText" type="string" />
|
||||
|
||||
@@ -86,7 +86,7 @@ function Init()
|
||||
m.showAnimation = m.top.findNode("showAnimation")
|
||||
end function
|
||||
|
||||
function Show(unsued as dynamic)
|
||||
function Show(_unused as dynamic)
|
||||
m.optionsList.ObserveField("itemSelected", FuncName(OnItemSelected))
|
||||
m.showAnimation.control = "start"
|
||||
end function
|
||||
|
||||
@@ -14,7 +14,7 @@ function OnItemHasFocus()
|
||||
m.top.color = "#262626ff"
|
||||
else
|
||||
m.top.font = "font:SmallestSystemFont"
|
||||
m.top.color = "#DBDBDBFF"
|
||||
m.top.color = "#EBEBEBFF"
|
||||
end if
|
||||
end function
|
||||
|
||||
@@ -24,6 +24,6 @@ function OnFocusPercent()
|
||||
m.top.color = "#262626FF"
|
||||
else
|
||||
m.top.font = "font:SmallestSystemFont"
|
||||
m.top.color = "#DBDBDBFF"
|
||||
m.top.color = "#EBEBEBFF"
|
||||
end if
|
||||
end function
|
||||
@@ -4,9 +4,9 @@ function SetPalette(dialog as object)
|
||||
DialogBackgroundColor: "#242424FF"
|
||||
DialogFocusColor: "#CECECEFF"
|
||||
DialogFocusItemColor: "#202020FF"
|
||||
DialogSecondaryTextColor: "#DBDBDBFF"
|
||||
DialogSecondaryTextColor: "#EBEBEBFF"
|
||||
DialogSecondaryItemColor: "#FF1C30FF"
|
||||
DialogTextColor: "#DBDBDBFF"
|
||||
DialogTextColor: "#EBEBEBFF"
|
||||
}
|
||||
dialog.palette = palette
|
||||
end function
|
||||
@@ -1,6 +1,8 @@
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
|
||||
namespace DialogUtils
|
||||
function ShowDialog(message as dynamic, title as string, large = false as boolean) as object
|
||||
return ShowDialogButtons(message, title, ["Ok"], large)
|
||||
return ShowDialogButtons(message, title, [Tr(Locale.Buttons.OK)], large)
|
||||
end function
|
||||
|
||||
function ShowDialogButtons(message as dynamic, title as string, buttons as object, large = false as boolean) as object
|
||||
@@ -47,6 +49,8 @@ namespace DialogUtils
|
||||
|
||||
m.top.getScene().dialog = dialog
|
||||
|
||||
dialog.focusDefaultButton = true
|
||||
|
||||
return dialog
|
||||
end function
|
||||
end namespace
|
||||
@@ -1,4 +1,5 @@
|
||||
import "DialogPalette.bs"
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
@@ -9,6 +10,9 @@ function Init()
|
||||
|
||||
m.top.width = "920"
|
||||
m.top.observeFieldScoped("buttonSelected", FuncName(Close))
|
||||
|
||||
scanLabel = m.top.findNode("scanLabel")
|
||||
scanLabel.text = Tr(Locale.Dialogs.ScanTheQrCode)
|
||||
end function
|
||||
|
||||
function OnNodeReady()
|
||||
@@ -17,7 +21,7 @@ function OnNodeReady()
|
||||
if isValidAddress
|
||||
m.top.url = `${address}/invidious/login`
|
||||
else
|
||||
m.urlLabel.text = "No IP address found"
|
||||
m.urlLabel.text = Tr(Locale.Dialogs.IpAddressNotAvailable)
|
||||
end if
|
||||
|
||||
m.invidious.observeFieldScoped("authToken", FuncName(OnAuthTokenChange))
|
||||
|
||||
@@ -7,8 +7,8 @@
|
||||
<children>
|
||||
<StdDlgTitleArea primaryTitle="Login to Invidious" />
|
||||
<StdDlgContentArea>
|
||||
<StdDlgTextItem
|
||||
text="Login to Invidious in order to view Subscriptions, Playlists, and use the Watch history.

Please note that an Invidious account is different from a YouTube account." />
|
||||
<StdDlgTextItem text="Login to Invidious in order to view Subscriptions, Playlists, and use the Watch history." />
|
||||
<StdDlgTextItem text="Please note that an Invidious account is different from a YouTube account." />
|
||||
</StdDlgContentArea>
|
||||
<StdDlgButtonArea id="buttonArea">
|
||||
<StdDlgButton text="OK" />
|
||||
@@ -20,6 +20,7 @@
|
||||
extendToDialogEdge="false"
|
||||
showDivider="false">
|
||||
<Label
|
||||
id="scanLabel"
|
||||
text="Scan the QR Code"
|
||||
horizAlign="center"
|
||||
wrap="true" width="400">
|
||||
@@ -38,7 +39,7 @@
|
||||
horizAlign="center"
|
||||
width="400"
|
||||
translation="[0, 380]">
|
||||
<Font role="font" uri="font:BoldSystemFontFile" size="18" />
|
||||
<Font role="font" uri="font:MediumSystemFontFile" size="18" />
|
||||
</Label>
|
||||
</StdDlgSideCardArea>
|
||||
</children>
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import "DialogPalette.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
@@ -29,6 +30,21 @@ function OnStartCountdown()
|
||||
m.timer.observeFieldScoped("fire", FuncName(TimerUpdateButtons))
|
||||
m.currentCountDown = defaultActionTimeoutSeconds
|
||||
m.timer.control = "start"
|
||||
|
||||
FindButtonComponent()
|
||||
end function
|
||||
|
||||
function OnFocusDefaultButton() as void
|
||||
FindButtonComponent()
|
||||
if m.buttonComponents = invalid
|
||||
return
|
||||
end if
|
||||
defaultButtonIndex = m.top.defaultButtonIndex
|
||||
if m.buttonComponents.Count() <= defaultButtonIndex
|
||||
return
|
||||
end if
|
||||
button = m.buttonComponents[defaultButtonIndex]
|
||||
NodeSetFocus(button, true)
|
||||
end function
|
||||
|
||||
function TimerUpdateButtons() as void
|
||||
@@ -39,13 +55,7 @@ function TimerUpdateButtons() as void
|
||||
return
|
||||
end if
|
||||
|
||||
FindButtonComponents()
|
||||
if m.buttonComponents = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
defaultButtonIndex = m.top.defaultButtonIndex
|
||||
m.buttonComponents[defaultButtonIndex].text = `${m.top.actualButtons[defaultButtonIndex]} (${m.currentCountDown})`
|
||||
SetDefaultButtonText(m.currentCountDown)
|
||||
end function
|
||||
|
||||
function OnButtonSelected()
|
||||
@@ -57,20 +67,15 @@ function OnDialogClosed()
|
||||
CancelTimer()
|
||||
end function
|
||||
|
||||
function onKeyEvent(key as string, press as boolean) as boolean
|
||||
function onKeyEvent(_key as string, _press as boolean) as boolean
|
||||
if m.timer = invalid
|
||||
return false
|
||||
end if
|
||||
|
||||
CancelTimer()
|
||||
|
||||
FindButtonComponents()
|
||||
if m.buttonComponents = invalid
|
||||
return false
|
||||
end if
|
||||
|
||||
defaultButtonIndex = m.top.defaultButtonIndex
|
||||
m.buttonComponents[defaultButtonIndex].text = m.top.actualButtons[defaultButtonIndex]
|
||||
FindButtonComponent()
|
||||
SetDefaultButtonText(0)
|
||||
return false
|
||||
end function
|
||||
|
||||
@@ -82,7 +87,21 @@ function CancelTimer()
|
||||
end if
|
||||
end function
|
||||
|
||||
function FindButtonComponents() as void
|
||||
function SetDefaultButtonText(timeLeft as integer) as void
|
||||
if m.buttonComponents = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
defaultButtonIndex = m.top.defaultButtonIndex
|
||||
|
||||
if timeLeft > 0
|
||||
m.buttonComponents[defaultButtonIndex].text = `${m.top.actualButtons[defaultButtonIndex]} (${timeLeft})`
|
||||
else
|
||||
m.buttonComponents[defaultButtonIndex].text = m.top.actualButtons[defaultButtonIndex]
|
||||
end if
|
||||
end function
|
||||
|
||||
function FindButtonComponent() as void
|
||||
if m.buttonComponents <> invalid
|
||||
return
|
||||
end if
|
||||
|
||||
@@ -6,5 +6,6 @@
|
||||
<!-- Use actualButtonSelected because buttonSelected is read only and defaults to 0 -->
|
||||
<field id="actualButtonSelected" type="integer" value="-1" />
|
||||
<field id="startCountdown" type="boolean" alwaysNotify="true" onChange="OnStartCountdown" />
|
||||
<field id="focusDefaultButton" type="boolean" alwaysNotify="true" onChange="OnFocusDefaultButton" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -1,5 +1,6 @@
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.top.functionName = "LoggerLoop"
|
||||
@@ -9,9 +10,7 @@ function Init()
|
||||
m.top.ObserveField("logLine", port)
|
||||
|
||||
scene = m.top.getScene()
|
||||
if scene.hasField("systemLogEvent")
|
||||
scene.ObserveFieldScoped("systemLogEvent", port)
|
||||
end if
|
||||
scene.ObserveFieldScoped("systemLogEvent", port)
|
||||
|
||||
m.port = port
|
||||
|
||||
@@ -39,6 +38,7 @@ function LoggerLoop()
|
||||
logsFile = m.top.folder + "/" + m.top.filename
|
||||
previousLogsFile = m.top.folder + "/" + m.top.filenamePrevious
|
||||
filenameStartup = m.top.filenameStartup
|
||||
dateTime = CreateObject("roDateTime")
|
||||
|
||||
CreateDirectory(m.top.folder)
|
||||
DeleteFile(previousLogsFile)
|
||||
@@ -53,22 +53,31 @@ function LoggerLoop()
|
||||
buffer.AppendFile(logsFile)
|
||||
end if
|
||||
|
||||
lastExitInfo = GetLastExitInfo()
|
||||
if not StringUtils.IsNullOrEmpty(lastExitInfo)
|
||||
line = `************ Last Exit Info ************\n${lastExitInfo}\n********** End Last Exit Info **********\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)
|
||||
if msgType = "roSGNodeEvent"
|
||||
field = msg.getField()
|
||||
if field = "logLine"
|
||||
OnLineLog(msg, logsFile, buffer)
|
||||
OnLineLog(msg, dateTime, logsFile, buffer)
|
||||
else if field = "systemLogEvent"
|
||||
OnLineSysLog(msg, logsFile, buffer)
|
||||
OnLineSysLog(msg, dateTime, logsFile, buffer)
|
||||
end if
|
||||
end if
|
||||
end while
|
||||
end function
|
||||
|
||||
function OnLineLog(event as object, logsFile as string, buffer as object)
|
||||
line = event.getData()
|
||||
function OnLineLog(event as object, dateTime as object, logsFile as string, buffer as object)
|
||||
line = FormatTime(dateTime) + event.getData()
|
||||
' bs:disable-next-line LINT3012
|
||||
print line
|
||||
|
||||
@@ -76,15 +85,62 @@ function OnLineLog(event as object, logsFile as string, buffer as object)
|
||||
buffer.AppendFile(logsFile)
|
||||
end function
|
||||
|
||||
function OnLineSysLog(event as object, logsFile as string, buffer as object) as void
|
||||
function OnLineSysLog(event as object, dateTime as object, logsFile as string, buffer as object) as void
|
||||
info = event.getData()
|
||||
if info.LogType <> "http.error"
|
||||
return
|
||||
end if
|
||||
line = "[ERROR][SysLog] " + ToString(info)
|
||||
line = FormatTime(dateTime) + "[ERROR][SysLog] " + ToString(info)
|
||||
' bs:disable-next-line LINT3012
|
||||
print line
|
||||
|
||||
buffer.FromAsciiString(line + `\n`)
|
||||
buffer.AppendFile(logsFile)
|
||||
end function
|
||||
|
||||
' Note: although the timestamp should be captured in the caller, not the logger,
|
||||
' it is done here to avoid adding overhead to the caller thread.
|
||||
function FormatTime(dateTime as object) as string
|
||||
dateTime.Mark()
|
||||
dateTime.ToLocalTime()
|
||||
|
||||
hours = dateTime.GetHours().ToStr()
|
||||
if hours.Len() = 1
|
||||
hours = "0" + hours
|
||||
end if
|
||||
|
||||
minutes = dateTime.GetMinutes().ToStr()
|
||||
if minutes.Len() = 1
|
||||
minutes = "0" + minutes
|
||||
end if
|
||||
|
||||
seconds = dateTime.GetSeconds().ToStr()
|
||||
if seconds.Len() = 1
|
||||
seconds = "0" + seconds
|
||||
end if
|
||||
|
||||
milliseconds = dateTime.GetMilliseconds().ToStr()
|
||||
if milliseconds.Len() = 1
|
||||
milliseconds = "00" + milliseconds
|
||||
else if milliseconds.Len() = 2
|
||||
milliseconds = "0" + milliseconds
|
||||
end if
|
||||
|
||||
return "[" + hours + ":" + minutes + ":" + seconds + "." + milliseconds + "]"
|
||||
end function
|
||||
|
||||
function GetLastExitInfo() as dynamic
|
||||
' roAppManager.GetLastExitInfo() is only available on Roku OS 13 and above
|
||||
appManager = CreateObject("roAppManager")
|
||||
hasMethod = FindMemberFunction(appManager, "GetLastExitInfo") <> invalid
|
||||
if not hasMethod
|
||||
return invalid
|
||||
end if
|
||||
|
||||
lastExitInfo = appManager.GetLastExitInfo()
|
||||
if lastExitInfo = invalid
|
||||
return invalid
|
||||
end if
|
||||
|
||||
return ToString(lastExitInfo)
|
||||
end function
|
||||
@@ -40,9 +40,9 @@
|
||||
<VideoQueue id="VideoQueue" />
|
||||
<ApplicationInfo id="ApplicationInfo" />
|
||||
<Preferences id="Preferences" />
|
||||
<Bookmarks id="Bookmarks" />
|
||||
<BookmarksService id="BookmarksService" />
|
||||
<SearchHistory id="SearchHistory" />
|
||||
<Profiles id="Profiles" />
|
||||
<ProfilesService id="ProfilesService" />
|
||||
<Invidious id="Invidious" />
|
||||
<PlayletWebServer id="WebServer" port="8888" />
|
||||
<DialServer id="DialServer" />
|
||||
|
||||
@@ -66,18 +66,18 @@
|
||||
|
||||
<ApplicationInfo id="ApplicationInfo" />
|
||||
<Preferences id="Preferences" />
|
||||
<Bookmarks id="Bookmarks" />
|
||||
<BookmarksService id="BookmarksService" />
|
||||
<SearchHistory id="SearchHistory"
|
||||
preferences="bind:../Preferences" />
|
||||
|
||||
<Profiles id="Profiles"
|
||||
<ProfilesService id="ProfilesService"
|
||||
invidious="bind:../Invidious" />
|
||||
|
||||
<Invidious id="Invidious"
|
||||
webServer="bind:../WebServer"
|
||||
applicationInfo="bind:../ApplicationInfo"
|
||||
preferences="bind:../Preferences"
|
||||
profiles="bind:../Profiles" />
|
||||
profilesService="bind:../ProfilesService" />
|
||||
|
||||
<!-- Tasks -->
|
||||
<PlayletWebServer id="WebServer"
|
||||
@@ -85,10 +85,10 @@
|
||||
appController="bind:/AppController"
|
||||
applicationInfo="bind:../ApplicationInfo"
|
||||
invidious="bind:../Invidious"
|
||||
profiles="bind:../Profiles"
|
||||
profilesService="bind:../ProfilesService"
|
||||
preferences="bind:../Preferences"
|
||||
videoQueue="bind:../VideoQueue"
|
||||
bookmarks="bind:../Bookmarks"
|
||||
bookmarksService="bind:../BookmarksService"
|
||||
loungeService="bind:../LoungeService" />
|
||||
<DialServer id="DialServer"
|
||||
webServer="bind:../WebServer"
|
||||
|
||||
@@ -24,23 +24,23 @@ function InitializeBindings()
|
||||
"SearchHistory": {
|
||||
"preferences": "../Preferences"
|
||||
},
|
||||
"Profiles": {
|
||||
"ProfilesService": {
|
||||
"invidious": "../Invidious"
|
||||
},
|
||||
"Invidious": {
|
||||
"webServer": "../WebServer",
|
||||
"applicationInfo": "../ApplicationInfo",
|
||||
"preferences": "../Preferences",
|
||||
"profiles": "../Profiles"
|
||||
"profilesService": "../ProfilesService"
|
||||
},
|
||||
"WebServer": {
|
||||
"appController": "/AppController",
|
||||
"applicationInfo": "../ApplicationInfo",
|
||||
"invidious": "../Invidious",
|
||||
"profiles": "../Profiles",
|
||||
"profilesService": "../ProfilesService",
|
||||
"preferences": "../Preferences",
|
||||
"videoQueue": "../VideoQueue",
|
||||
"bookmarks": "../Bookmarks",
|
||||
"bookmarksService": "../BookmarksService",
|
||||
"loungeService": "../LoungeService"
|
||||
},
|
||||
"DialServer": {
|
||||
|
||||
@@ -36,7 +36,7 @@ function PopulateButtons() as void
|
||||
button.width = 90
|
||||
|
||||
button.icon = item.icon
|
||||
button.text = item.text
|
||||
button.text = Tr(item.text)
|
||||
button.padding = item.padding
|
||||
|
||||
buttons.push(button)
|
||||
|
||||
@@ -20,10 +20,10 @@ function Init()
|
||||
m.top.observeField("width", FuncName(onWidthChanged))
|
||||
m.top.observeField("padding", FuncName(onPaddingChanged))
|
||||
|
||||
profiles = m.top.getScene().findNode("Profiles")
|
||||
if profiles <> invalid
|
||||
m.profiles = profiles
|
||||
profiles.observeField("currentProfile", FuncName(OnCurrentProfile))
|
||||
profilesService = m.top.getScene().findNode("ProfilesService")
|
||||
if profilesService <> invalid
|
||||
m.profilesService = profilesService
|
||||
profilesService.observeField("currentProfile", FuncName(OnCurrentProfile))
|
||||
OnCurrentProfile()
|
||||
end if
|
||||
end function
|
||||
@@ -91,7 +91,7 @@ function onPaddingChanged()
|
||||
end function
|
||||
|
||||
function OnCurrentProfile() as void
|
||||
currentProfile = m.profiles.currentProfile
|
||||
currentProfile = m.profilesService.currentProfile
|
||||
if currentProfile = invalid
|
||||
m.circlePoster.visible = false
|
||||
m.buttonIcon.visible = true
|
||||
|
||||
@@ -15,12 +15,13 @@
|
||||
id="circlePoster"
|
||||
width="40"
|
||||
height="40"
|
||||
blendColor="#DDDDDDFF"
|
||||
uri="pkg:/images/white-circle.png">
|
||||
<Poster
|
||||
id="circlePosterInner"
|
||||
width="36"
|
||||
height="36"
|
||||
blendColor="#9696c8"
|
||||
blendColor="#9696C8"
|
||||
uri="pkg:/images/white-circle.png"
|
||||
translation="[2,2]">
|
||||
<Label
|
||||
|
||||
@@ -163,10 +163,10 @@ function GetContextMenuOptionsForItem(video as object) as object
|
||||
end if
|
||||
|
||||
options = [
|
||||
ContextMenuUtils.CreateOption("Play", m.videoQueue, "FuncPlayPlaylist", [playlist, index]),
|
||||
ContextMenuUtils.CreateOption("Queue", m.videoQueue, "FuncAddToQueuePlaylist", [playlist])
|
||||
ContextMenuUtils.CreateOption("Play video", m.videoQueue, "FuncPlayVideo", [video]),
|
||||
ContextMenuUtils.CreateOption("Queue video", m.videoQueue, "FuncAddToQueueVideo", [video]),
|
||||
ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.PlayPlaylist), m.videoQueue, "FuncPlayPlaylist", [playlist, index]),
|
||||
ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.QueuePlaylist), m.videoQueue, "FuncAddToQueuePlaylist", [playlist])
|
||||
ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.PlayVideo), m.videoQueue, "FuncPlayVideo", [video]),
|
||||
ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.QueueVideo), m.videoQueue, "FuncAddToQueueVideo", [video]),
|
||||
]
|
||||
|
||||
playlistAuthorId = playlist.authorId
|
||||
@@ -174,19 +174,19 @@ function GetContextMenuOptionsForItem(video as object) as object
|
||||
|
||||
if not StringUtils.IsNullOrEmpty(playlistAuthorId) or not StringUtils.IsNullOrEmpty(videoAuthorId)
|
||||
if playlistAuthorId = videoAuthorId
|
||||
options.push(ContextMenuUtils.CreateOption("Open channel", m.top, "OpenPlaylistChannel", [playlist]))
|
||||
options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.OpenChannel), m.top, "OpenPlaylistChannel", [playlist]))
|
||||
else
|
||||
if not StringUtils.IsNullOrEmpty(playlistAuthorId)
|
||||
options.push(ContextMenuUtils.CreateOption("Open playlist channel", m.top, "OpenPlaylistChannel", [playlist]))
|
||||
options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.OpenPlaylistChannel), m.top, "OpenPlaylistChannel", [playlist]))
|
||||
end if
|
||||
if not StringUtils.IsNullOrEmpty(videoAuthorId)
|
||||
options.push(ContextMenuUtils.CreateOption("Open video channel", m.top, "OpenVideoChannel", [video]))
|
||||
options.push(ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.OpenVideoChannel), m.top, "OpenVideoChannel", [video]))
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
|
||||
options.append(m.bookmarks@.GetMenuForPlaylist(playlist))
|
||||
options.append(m.bookmarks@.GetMenuForVideo(video))
|
||||
options.append(m.bookmarksService@.GetMenuForPlaylist(playlist))
|
||||
options.append(m.bookmarksService@.GetMenuForVideo(video))
|
||||
|
||||
return options
|
||||
end function
|
||||
@@ -197,7 +197,7 @@ function OpenPlaylistChannel(playlist as object) as void
|
||||
LogWarn("Invalid authorId:", authorId)
|
||||
return
|
||||
end if
|
||||
channel = InvidiousContent.ToChannelContentNode(invalid, { authorId: authorId }, invalid)
|
||||
channel = InvidiousContent.ToChannelContentNode(invalid, { authorId: authorId })
|
||||
ChannelUtils.Open(channel)
|
||||
end function
|
||||
|
||||
@@ -207,7 +207,7 @@ function OpenVideoChannel(video as object) as void
|
||||
LogWarn("Invalid authorId:", authorId)
|
||||
return
|
||||
end if
|
||||
channel = InvidiousContent.ToChannelContentNode(invalid, { authorId: authorId }, invalid)
|
||||
channel = InvidiousContent.ToChannelContentNode(invalid, { authorId: authorId })
|
||||
ChannelUtils.Open(channel)
|
||||
end function
|
||||
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
<field id="appController" type="node" bind="/AppController" />
|
||||
<field id="invidious" type="node" bind="/Invidious" />
|
||||
<field id="videoQueue" type="node" bind="/VideoQueue" />
|
||||
<field id="bookmarks" type="node" bind="/Bookmarks" />
|
||||
<field id="bookmarksService" type="node" bind="/BookmarksService" />
|
||||
<function name="OpenPlaylistChannel" />
|
||||
<function name="OpenVideoChannel" />
|
||||
</interface>
|
||||
@@ -29,13 +29,15 @@
|
||||
<Label
|
||||
id="titleLabel"
|
||||
width="500"
|
||||
maxLines="2"
|
||||
maxLines="3"
|
||||
wrap="true">
|
||||
<Font role="font" uri="font:BoldSystemFontFile" size="36" />
|
||||
<Font role="font" uri="font:MediumSystemFontFile" size="36" />
|
||||
</Label>
|
||||
<Label
|
||||
id="subtitleLabel"
|
||||
width="500"
|
||||
maxLines="2"
|
||||
wrap="true"
|
||||
font="font:SmallestBoldSystemFont" />
|
||||
<Label
|
||||
id="updatedLabel"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/source/utils/DisposableObserve.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
@@ -8,7 +9,6 @@ function Init()
|
||||
m.activateButton = m.top.findNode("activateButton")
|
||||
m.logoutButton = m.top.findNode("logoutButton")
|
||||
m.closeButton = m.top.findNode("closeButton")
|
||||
m.buttonGroup = m.top.findNode("buttonGroup")
|
||||
|
||||
DisposableObserveField(m.activateButton, "buttonSelected", FuncName(Activate))
|
||||
DisposableObserveField(m.logoutButton, "buttonSelected", FuncName(Logout))
|
||||
@@ -21,8 +21,8 @@ function OnNodeReady()
|
||||
SetNavigation(m.closeButton, "up", m.logoutButton)
|
||||
SetNavigation(m.logoutButton, "up", m.activateButton)
|
||||
|
||||
DisposableObserveFieldScoped(m.profiles, "currentProfile", FuncName(OnCunrrentProfileChanged))
|
||||
DisposableObserveFieldScoped(m.profiles, "onProfileLogout", FuncName(OnProfileLogout))
|
||||
DisposableObserveFieldScoped(m.profilesService, "currentProfile", FuncName(OnCunrrentProfileChanged))
|
||||
DisposableObserveFieldScoped(m.profilesService, "onProfileLogout", FuncName(OnProfileLogout))
|
||||
end function
|
||||
|
||||
function OnContentSet() as void
|
||||
@@ -81,13 +81,13 @@ function Activate() as void
|
||||
return
|
||||
end if
|
||||
|
||||
profile = m.profiles.content.getChild(0).findNode(content.id)
|
||||
profile = m.profilesService.content.getChild(0).findNode(content.id)
|
||||
if profile = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
m.top.content = invalid
|
||||
m.profiles@.SetCurrentProfile(profile)
|
||||
m.profilesService@.SetCurrentProfile(profile)
|
||||
Close()
|
||||
end function
|
||||
|
||||
@@ -98,7 +98,7 @@ function Logout() as void
|
||||
end if
|
||||
|
||||
m.top.content = invalid
|
||||
m.profiles@.LogoutWithProfile(content)
|
||||
m.profilesService@.LogoutWithProfile(content)
|
||||
Close()
|
||||
end function
|
||||
|
||||
@@ -127,7 +127,7 @@ function OnProfileLogout() as void
|
||||
return
|
||||
end if
|
||||
|
||||
profile = m.profiles.content.getChild(0).findNode(content.id)
|
||||
profile = m.profilesService.content.getChild(0).findNode(content.id)
|
||||
if profile = invalid
|
||||
Close()
|
||||
end if
|
||||
@@ -144,17 +144,10 @@ function UpdateActivateButton() as void
|
||||
if m.activateButton.hasFocus()
|
||||
NodeSetFocus(m.logoutButton, true)
|
||||
end if
|
||||
|
||||
parent = m.activateButton.getParent()
|
||||
if parent <> invalid
|
||||
m.buttonGroup.removeChild(m.activateButton)
|
||||
end if
|
||||
m.activateButton.focusable = false
|
||||
m.activateButton.text = Tr(Locale.Buttons.InUse)
|
||||
m.activateButton.disabled = true
|
||||
else
|
||||
parent = m.activateButton.getParent()
|
||||
if parent = invalid
|
||||
m.buttonGroup.insertChild(m.activateButton, 0)
|
||||
end if
|
||||
m.activateButton.focusable = true
|
||||
m.activateButton.text = Tr(Locale.Buttons.Activate)
|
||||
m.activateButton.disabled = false
|
||||
end if
|
||||
end function
|
||||
@@ -9,7 +9,7 @@
|
||||
<field id="crownVisible" type="boolean" alias="CrownPoster.visible" />
|
||||
|
||||
<field id="appController" type="node" bind="/AppController" />
|
||||
<field id="profiles" type="node" bind="/Profiles" />
|
||||
<field id="profilesService" type="node" bind="/ProfilesService" />
|
||||
</interface>
|
||||
<children>
|
||||
<Rectangle
|
||||
@@ -30,12 +30,13 @@
|
||||
width="160"
|
||||
height="160"
|
||||
translation="[20,20]"
|
||||
blendColor="#DDDDDDFF"
|
||||
uri="pkg:/images/white-circle.png">
|
||||
<Poster
|
||||
id="circlePosterInner"
|
||||
width="152"
|
||||
height="152"
|
||||
blendColor="#9696c8"
|
||||
blendColor="#9696C8"
|
||||
uri="pkg:/images/white-circle.png"
|
||||
translation="[4,4]">
|
||||
<Label
|
||||
@@ -61,7 +62,7 @@
|
||||
width="200"
|
||||
horizAlign="center"
|
||||
translation="[0,210]">
|
||||
<Font role="font" uri="font:BoldSystemFontFile" size="26" />
|
||||
<Font role="font" uri="font:MediumSystemFontFile" size="26" />
|
||||
</Label>
|
||||
<Label
|
||||
id="ServerLabel"
|
||||
@@ -72,26 +73,28 @@
|
||||
</Label>
|
||||
</Group>
|
||||
|
||||
<LayoutGroup
|
||||
id="buttonGroup"
|
||||
translation="[420,94]"
|
||||
itemSpacings="[20,20]">
|
||||
<Button
|
||||
id="activateButton"
|
||||
text="Activate"
|
||||
minWidth="200"
|
||||
showFocusFootprint="true" />
|
||||
<Button
|
||||
id="logoutButton"
|
||||
text="Logout"
|
||||
minWidth="200"
|
||||
showFocusFootprint="true" />
|
||||
<Button
|
||||
id="closeButton"
|
||||
text="Close"
|
||||
minWidth="200"
|
||||
showFocusFootprint="true" />
|
||||
</LayoutGroup>
|
||||
<ButtonEx
|
||||
id="activateButton"
|
||||
iconVisible="false"
|
||||
anchor="[0.5,0.5]"
|
||||
text="Activate"
|
||||
minWidth="200"
|
||||
translation="[520,132]" />
|
||||
<ButtonEx
|
||||
id="logoutButton"
|
||||
iconVisible="false"
|
||||
anchor="[0.5,0.5]"
|
||||
text="Logout"
|
||||
minWidth="200"
|
||||
translation="[520,210]" />
|
||||
<ButtonEx
|
||||
id="closeButton"
|
||||
iconVisible="false"
|
||||
anchor="[0.5,0.5]"
|
||||
text="Close"
|
||||
minWidth="200"
|
||||
translation="[520,288]" />
|
||||
|
||||
</Rectangle>
|
||||
</children>
|
||||
</component>
|
||||
@@ -1,6 +1,8 @@
|
||||
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/components/Services/BookmarksService/BookmarksServiceUtils.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
@@ -20,7 +22,7 @@ function OnNodeReady()
|
||||
m.rowList@.BindNode()
|
||||
|
||||
OnBookmarksChange()
|
||||
m.bookmarks.ObserveField("contentChange", FuncName(OnBookmarksChange))
|
||||
m.bookmarksService.ObserveField("contentChange", FuncName(OnBookmarksChange))
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
@@ -53,13 +55,13 @@ function OnBookmarksChange() as void
|
||||
end if
|
||||
m.isDirty = false
|
||||
|
||||
hasBookmarks = m.bookmarks.content.getChildCount() > 0
|
||||
hasBookmarks = m.bookmarksService.content.getChildCount() > 0
|
||||
m.noBookmarks.visible = not hasBookmarks
|
||||
m.yesBookmarks.visible = hasBookmarks
|
||||
m.top.focusable = hasBookmarks
|
||||
|
||||
if hasBookmarks
|
||||
SetRowListContent(m.bookmarks.content)
|
||||
SetRowListContent(m.bookmarksService.content)
|
||||
else
|
||||
if m.rowList.hasFocus()
|
||||
NodeSetFocus(m.navBar, true)
|
||||
@@ -68,23 +70,7 @@ function OnBookmarksChange() as void
|
||||
end function
|
||||
|
||||
function SetRowListContent(bookmarksContent as object)
|
||||
bookmarkGroupNodes = bookmarksContent.getChildren(-1, 0)
|
||||
|
||||
feeds = []
|
||||
for each bookmarkGroupNode in bookmarkGroupNodes
|
||||
bookmarkNodes = bookmarkGroupNode.getChildren(-1, 0)
|
||||
feedSources = []
|
||||
for each bookmarkNode in bookmarkNodes
|
||||
feedSources.push(bookmarkNode.feedSource)
|
||||
end for
|
||||
|
||||
feeds.push({
|
||||
"title": bookmarkGroupNode.title
|
||||
"feedSources": feedSources
|
||||
})
|
||||
end for
|
||||
|
||||
m.rowList.feeds = feeds
|
||||
m.rowList.feeds = BookmarksServiceUtils.BookmarksContentToFeed(bookmarksContent)
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
@@ -94,7 +80,7 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
return false
|
||||
end function
|
||||
|
||||
function GetContextMenuOptionsForItem(rowItem as object) as object
|
||||
refreshItem = ContextMenuUtils.CreateOption("Refresh Bookmarks", m.top, "Refresh", [invalid])
|
||||
function GetContextMenuOptionsForItem(_rowItem as object) as object
|
||||
refreshItem = ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.RefreshBookmarks), m.top, "Refresh", [invalid])
|
||||
return [refreshItem]
|
||||
end function
|
||||
@@ -2,19 +2,31 @@
|
||||
<interface>
|
||||
<field id="navBar" type="node" bind="/NavBar" />
|
||||
<field id="applicationInfo" type="node" bind="/ApplicationInfo" />
|
||||
<field id="bookmarks" type="node" bind="/Bookmarks" />
|
||||
<field id="bookmarksService" type="node" bind="/BookmarksService" />
|
||||
<function name="Refresh" />
|
||||
</interface>
|
||||
<children>
|
||||
<Group id="noBookmarks" visible="false">
|
||||
<Label
|
||||
height="720"
|
||||
width="1280"
|
||||
font="font:MediumBoldSystemFont"
|
||||
horizAlign="center"
|
||||
vertAlign="center"
|
||||
text="You currently have no bookmarks.

To add bookmarks, long-press 'OK' on a video, playlist or channel.

Please note that Bookmarks is an experimental feature."
|
||||
wrap="true" />
|
||||
<LayoutGroup vertAlignment="center" itemSpacings="[25,25]" translation="[180,360]">
|
||||
<Label
|
||||
width="920"
|
||||
horizAlign="center"
|
||||
font="font:SmallSystemFont"
|
||||
text="You currently have no bookmarks."
|
||||
wrap="true" />
|
||||
<Label
|
||||
width="920"
|
||||
horizAlign="center"
|
||||
font="font:SmallSystemFont"
|
||||
text="To add bookmarks, long-press 'OK' on a video, playlist or channel."
|
||||
wrap="true" />
|
||||
<Label
|
||||
width="920"
|
||||
horizAlign="center"
|
||||
font="font:SmallSystemFont"
|
||||
text="Please note that Bookmarks is an experimental feature."
|
||||
wrap="true" />
|
||||
</LayoutGroup>
|
||||
</Group>
|
||||
<Group id="yesBookmarks" visible="false">
|
||||
<VideoRowList
|
||||
|
||||
@@ -2,6 +2,7 @@ import "HomeScreenUtils.bs"
|
||||
import "pkg:/components/ContextMenu/ContextMenuUtils.bs"
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
|
||||
function Init()
|
||||
m.top.focusable = true
|
||||
@@ -40,7 +41,7 @@ function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
return false
|
||||
end function
|
||||
|
||||
function GetContextMenuOptionsForItem(rowItem as object) as object
|
||||
refresh = ContextMenuUtils.CreateOption("Refresh Home", m.rowList, "Refresh", [invalid])
|
||||
function GetContextMenuOptionsForItem(_rowItem as object) as object
|
||||
refresh = ContextMenuUtils.CreateOption(Tr(Locale.ContextMenu.RefreshHome), m.rowList, "Refresh", [invalid])
|
||||
return [refresh]
|
||||
end function
|
||||
@@ -4,6 +4,13 @@ namespace HomeScreenUtils
|
||||
|
||||
function GetFeed(feedFileName as string, preferences as object) as object
|
||||
feed = ParseJson(ReadAsciiFile(feedFileName))
|
||||
for each item in feed
|
||||
item.title = Tr(item.title)
|
||||
|
||||
for each feedSource in item.feedSources
|
||||
feedSource.title = Tr(feedSource.title)
|
||||
end for
|
||||
end for
|
||||
|
||||
homeLayout = preferences["misc.home_screen_layout"]
|
||||
if not IsArray(homeLayout) or homeLayout.Count() = 0
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
function Init()
|
||||
@@ -16,7 +17,7 @@ function OnContentSet() as void
|
||||
' bs:disable-next-line LINT3023
|
||||
m.top.circlePosterInnerBlendColor = "#FFFFFFFF"
|
||||
m.top.letter = ""
|
||||
m.top.username = "Login"
|
||||
m.top.username = Tr(Locale.Buttons.Login)
|
||||
m.top.serverUrl = ""
|
||||
m.top.crownVisible = false
|
||||
return
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
</interface>
|
||||
<children>
|
||||
<Font id="normalFont" uri="font:SystemFontFile" size="24" />
|
||||
<Font id="boldFont" uri="font:BoldSystemFontFile" size="26" />
|
||||
<Font id="boldFont" uri="font:MediumSystemFontFile" size="24" />
|
||||
|
||||
<Group translation="[20,50]">
|
||||
<Group
|
||||
@@ -43,12 +43,13 @@
|
||||
width="160"
|
||||
height="160"
|
||||
translation="[20,20]"
|
||||
blendColor="#DDDDDDFF"
|
||||
uri="pkg:/images/white-circle.png">
|
||||
<Poster
|
||||
id="circlePosterInner"
|
||||
width="152"
|
||||
height="152"
|
||||
blendColor="#9696c8"
|
||||
blendColor="#9696C8"
|
||||
uri="pkg:/images/white-circle.png"
|
||||
translation="[4,4]">
|
||||
<Label
|
||||
|
||||
@@ -13,9 +13,9 @@ function OnNodeReady()
|
||||
SetNavigation(invalid, "back", m.navBar)
|
||||
SetNavigation(invalid, "left", m.navBar)
|
||||
|
||||
m.profileRowList.content = m.profiles.content
|
||||
m.profileRowList.content = m.profilesService.content
|
||||
m.profileRowList.observeFieldScoped("rowItemSelected", FuncName(OnRowItemSelected))
|
||||
m.profiles.observeFieldScoped("currentProfile", FuncName(OnCurrentProfileChanged))
|
||||
m.profilesService.observeFieldScoped("currentProfile", FuncName(OnCurrentProfileChanged))
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
@@ -47,7 +47,7 @@ function OnRowItemSelected() as void
|
||||
end function
|
||||
|
||||
function OnCurrentProfileChanged() as void
|
||||
currentProfile = m.profiles.currentProfile
|
||||
currentProfile = m.profilesService.currentProfile
|
||||
if currentProfile = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<component name="ProfileScreen" extends="Group" includes="AutoBind,Focus">
|
||||
<interface>
|
||||
<field id="navBar" type="node" bind="/NavBar" />
|
||||
<field id="profiles" type="node" bind="/Profiles" />
|
||||
<field id="profilesService" type="node" bind="/ProfilesService" />
|
||||
<field id="appController" type="node" bind="/AppController" />
|
||||
</interface>
|
||||
|
||||
|
||||
@@ -4,7 +4,9 @@ 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/Locale.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/MathUtils.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
function Init()
|
||||
@@ -21,6 +23,19 @@ function Init()
|
||||
m.wifiNameLabel = m.top.findNode("WifiNameLabel")
|
||||
m.wifiInstructionWithDeviceNameLabel = m.top.findNode("WifiInstructionWithDeviceNameLabel")
|
||||
m.linkCodeLabel = m.top.findNode("LinkCodeLabel")
|
||||
|
||||
m.wifiInstructionWithDeviceNameLabel.drawingStyles = {
|
||||
"Bold": {
|
||||
"fontSize": 22
|
||||
"fontUri": "font:SmallBoldSystemFont"
|
||||
"color": "#DDDDDDFF"
|
||||
}
|
||||
"default": {
|
||||
"fontSize": 22
|
||||
"fontUri": "font:SmallSystemFont"
|
||||
"color": "#DDDDDDFF"
|
||||
}
|
||||
}
|
||||
end function
|
||||
|
||||
function OnNodeReady()
|
||||
@@ -47,6 +62,11 @@ function OnNodeReady()
|
||||
m.linkWithWifiPanel.visible = false
|
||||
m.linkWithTvPanel.observeField("visible", FuncName(OnLinkWithTvPanelVisibleChanged))
|
||||
m.linkWithTvPanel.visible = false
|
||||
|
||||
m.webAppButton.observeField("contentWidth", FuncName(OnButtonSizeChange))
|
||||
m.linkWithWifiButton.observeField("contentWidth", FuncName(OnButtonSizeChange))
|
||||
m.linkWithTvButton.observeField("contentWidth", FuncName(OnButtonSizeChange))
|
||||
OnButtonSizeChange()
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
@@ -69,6 +89,18 @@ function OnUrlSet()
|
||||
m.webAppQrCodePoster.text = url
|
||||
end function
|
||||
|
||||
function OnButtonSizeChange()
|
||||
width1 = m.webAppButton.contentWidth
|
||||
width2 = m.linkWithWifiButton.contentWidth
|
||||
width3 = m.linkWithTvButton.contentWidth
|
||||
|
||||
width = MathUtils.Max(width1, MathUtils.Max(width2, width3))
|
||||
|
||||
m.webAppButton.minimumWidth = width
|
||||
m.linkWithWifiButton.minimumWidth = width
|
||||
m.linkWithTvButton.minimumWidth = width
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
navigation = NavigationKeyHandler(key, press)
|
||||
if navigation.handled
|
||||
@@ -117,12 +149,13 @@ function OnLinkWithWifiPanelVisibleChanged() as void
|
||||
if connectionInfo.type = "WiFiConnection"
|
||||
m.wifiNameLabel.text = connectionInfo.ssid
|
||||
else if connectionInfo.type = "WiredConnection"
|
||||
m.wifiNameLabel.text = "Wired connection"
|
||||
m.wifiNameLabel.text = Tr(Locale.RemoteScreen.WiredConnection)
|
||||
else
|
||||
m.wifiNameLabel.text = "N/A"
|
||||
end if
|
||||
|
||||
m.wifiInstructionWithDeviceNameLabel.text = `Tap the cast icon and select "${m.loungeService.deviceName}"`
|
||||
deviceName = `<Bold>"${m.loungeService.deviceName}"</Bold>`
|
||||
m.wifiInstructionWithDeviceNameLabel.text = Tr(Locale.RemoteScreen.WifiInstruction3).Replace("%1", deviceName)
|
||||
end function
|
||||
|
||||
function OnLinkWithTvPanelVisibleChanged()
|
||||
@@ -142,7 +175,7 @@ function GeneratePairingCode()
|
||||
m.linkCodeTask.cancel = true
|
||||
end if
|
||||
|
||||
m.linkCodeLabel.text = "Loading..."
|
||||
m.linkCodeLabel.text = Tr(Locale.RemoteScreen.Loading)
|
||||
m.linkCodeTask = AsyncTask.Start(Tasks.LoungeGenerateManualPairingCodeTask, {
|
||||
loungeService: m.loungeService
|
||||
loungeToken: m.loungeService.loungeToken
|
||||
@@ -170,8 +203,8 @@ function OnLoungeGenerateManualPairingCodeTaskResult(output as object) as void
|
||||
error = ErrorUtils.Format(error)
|
||||
LogError(error)
|
||||
|
||||
message = `Failed to generate manual pairing code\n${error}`
|
||||
DialogUtils.ShowDialog(message, "Get TV code fail", true)
|
||||
message = Tr(Locale.RemoteScreen.FailedToGeneratePairingCode) + `\n${error}`
|
||||
DialogUtils.ShowDialog(message, Tr(Locale.RemoteScreen.TvCodeError), true)
|
||||
return
|
||||
end if
|
||||
|
||||
|
||||
@@ -10,11 +10,13 @@
|
||||
<Group id="noInternet" visible="false">
|
||||
<Label
|
||||
height="720"
|
||||
width="1280"
|
||||
font="font:MediumBoldSystemFont"
|
||||
width="920"
|
||||
font="font:SmallSystemFont"
|
||||
horizAlign="center"
|
||||
vertAlign="center"
|
||||
text="Could not get IP address: are we connected to the internet?"
|
||||
wrap="true"
|
||||
translation="[180,0]"
|
||||
/>
|
||||
</Group>
|
||||
<Group id="yesInternet" visible="false">
|
||||
@@ -91,30 +93,29 @@
|
||||
<Label
|
||||
font="font:SmallSystemFont"
|
||||
text="3." />
|
||||
<Label
|
||||
<MultiStyleLabel
|
||||
id="WifiInstructionWithDeviceNameLabel"
|
||||
font="font:SmallSystemFont"
|
||||
width="380"
|
||||
wrap="true"
|
||||
text="Tap the cast icon and select this device." />
|
||||
</LayoutGroup>
|
||||
<Label
|
||||
text="Roku connected to:"
|
||||
translation="[0,220]">
|
||||
<Font role="font" uri="font:SystemFontFile" size="20" />
|
||||
</Label>
|
||||
<Label
|
||||
id="WifiNameLabel"
|
||||
color="#4287f5"
|
||||
translation="[0,250]">
|
||||
<Font role="font" uri="font:MediumSystemFontFile" size="28" />
|
||||
</Label>
|
||||
</LayoutGroup>
|
||||
<Label
|
||||
text="Roku connected to:"
|
||||
translation="[0,220]">
|
||||
<Font role="font" uri="font:SystemFontFile" size="20" />
|
||||
</Label>
|
||||
<Label
|
||||
id="WifiNameLabel"
|
||||
color="#4287f5"
|
||||
translation="[0,250]">
|
||||
<Font role="font" uri="font:BoldSystemFontFile" size="28" />
|
||||
</Label>
|
||||
</Group>
|
||||
|
||||
<Group id="LinkWithTvPanel"
|
||||
translation="[700,220]">
|
||||
<LayoutGroup itemSpacings="[12]">
|
||||
<LayoutGroup itemSpacings="[12,12,25]">
|
||||
<LayoutGroup layoutDirection="horiz" itemSpacings="[15]">
|
||||
<Label
|
||||
font="font:SmallSystemFont"
|
||||
@@ -133,7 +134,7 @@
|
||||
font="font:SmallSystemFont"
|
||||
width="380"
|
||||
wrap="true"
|
||||
text="Tap the Chromecast icon." />
|
||||
text="Tap the cast icon." />
|
||||
</LayoutGroup>
|
||||
<LayoutGroup layoutDirection="horiz" itemSpacings="[15]">
|
||||
<Label
|
||||
@@ -143,18 +144,15 @@
|
||||
font="font:SmallSystemFont"
|
||||
width="380"
|
||||
wrap="true"
|
||||
text="Tap "Link with TV code" and enter the code below." />
|
||||
text="Tap 'Link with TV code' and enter the code below." />
|
||||
</LayoutGroup>
|
||||
<Label
|
||||
id="LinkCodeLabel"
|
||||
font="font:LargeBoldSystemFont"
|
||||
color="#4287f5">
|
||||
<Font role="font" uri="font:MediumSystemFontFile" size="48" />
|
||||
</Label>
|
||||
</LayoutGroup>
|
||||
<Label
|
||||
id="LinkCodeLabel"
|
||||
font="font:LargeBoldSystemFont"
|
||||
color="#4287f5"
|
||||
translation="[-30,180]"
|
||||
width="460"
|
||||
horizAlign="center">
|
||||
<Font role="font" uri="font:BoldSystemFontFile" size="48" />
|
||||
</Label>
|
||||
</Group>
|
||||
</Group>
|
||||
</children>
|
||||
|
||||
@@ -1,105 +1,103 @@
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/source/utils/ArrayUtils.bs"
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
options = {
|
||||
date: [{
|
||||
title: "Any date"
|
||||
title: Tr(Locale.SearchFilters.AnyDate)
|
||||
value: ""
|
||||
}, {
|
||||
title: "Last hour"
|
||||
title: Tr(Locale.SearchFilters.LastHour)
|
||||
value: "hour"
|
||||
}, {
|
||||
title: "Today"
|
||||
title: Tr(Locale.SearchFilters.Today)
|
||||
value: "today"
|
||||
}, {
|
||||
title: "This week"
|
||||
title: Tr(Locale.SearchFilters.ThisWeek)
|
||||
value: "week"
|
||||
}, {
|
||||
title: "This month"
|
||||
title: Tr(Locale.SearchFilters.ThisMonth)
|
||||
value: "month"
|
||||
}, {
|
||||
title: "This year"
|
||||
title: Tr(Locale.SearchFilters.ThisYear)
|
||||
value: "year"
|
||||
}]
|
||||
type: [{
|
||||
title: "Any type"
|
||||
title: Tr(Locale.SearchFilters.AnyType)
|
||||
value: ""
|
||||
}, {
|
||||
title: "Video"
|
||||
title: Tr(Locale.SearchFilters.Video)
|
||||
value: "video"
|
||||
}, {
|
||||
title: "Playlist"
|
||||
title: Tr(Locale.SearchFilters.Playlist)
|
||||
value: "playlist"
|
||||
}, {
|
||||
title: "Channel"
|
||||
title: Tr(Locale.SearchFilters.Channel)
|
||||
value: "channel"
|
||||
}, {
|
||||
title: "Movie"
|
||||
title: Tr(Locale.SearchFilters.Movie)
|
||||
value: "movie"
|
||||
}, {
|
||||
title: "Show"
|
||||
value: "show"
|
||||
}]
|
||||
duration: [{
|
||||
title: "Any duration"
|
||||
title: Tr(Locale.SearchFilters.AnyDuration)
|
||||
value: ""
|
||||
}, {
|
||||
title: "Under 4 minutes"
|
||||
title: Tr(Locale.SearchFilters.Under4Minutes)
|
||||
value: "short"
|
||||
}, {
|
||||
title: "4 - 20 minutes"
|
||||
title: Tr(Locale.SearchFilters.FourTo20Minutes)
|
||||
value: "medium"
|
||||
}, {
|
||||
title: "Over 20 minutes"
|
||||
title: Tr(Locale.SearchFilters.Over20Minutes)
|
||||
value: "long"
|
||||
}]
|
||||
features: [{
|
||||
title: "Live"
|
||||
title: Tr(Locale.Feed.Live)
|
||||
value: "live"
|
||||
}, {
|
||||
title: "4K"
|
||||
title: Tr(Locale.SearchFilters.FourK)
|
||||
value: "4k"
|
||||
}, {
|
||||
title: "HD"
|
||||
title: Tr(Locale.SearchFilters.HD)
|
||||
value: "hd"
|
||||
}, {
|
||||
title: "Subtitles/CC"
|
||||
title: Tr(Locale.SearchFilters.SubtitlesCC)
|
||||
value: "subtitles"
|
||||
}, {
|
||||
title: "Creative Commons"
|
||||
title: Tr(Locale.SearchFilters.CreativeCommons)
|
||||
value: "creative_commons"
|
||||
}, {
|
||||
title: "360°"
|
||||
title: Tr(Locale.SearchFilters.ThreeSixty)
|
||||
value: "360"
|
||||
}, {
|
||||
title: "VR180"
|
||||
title: Tr(Locale.SearchFilters.VR180)
|
||||
value: "vr180"
|
||||
}, {
|
||||
title: "3D"
|
||||
title: Tr(Locale.SearchFilters.ThreeD)
|
||||
value: "3d"
|
||||
}, {
|
||||
title: "HDR"
|
||||
title: Tr(Locale.SearchFilters.HDR)
|
||||
value: "hdr"
|
||||
}, {
|
||||
title: "Purchased"
|
||||
title: Tr(Locale.SearchFilters.Purchased)
|
||||
value: "purchased"
|
||||
}, {
|
||||
title: "Location"
|
||||
title: Tr(Locale.SearchFilters.Location)
|
||||
value: "location"
|
||||
}]
|
||||
sort_by: [{
|
||||
title: "Relevance"
|
||||
sort: [{
|
||||
title: Tr(Locale.SearchFilters.Relevance)
|
||||
value: ""
|
||||
}, {
|
||||
title: "Upload date"
|
||||
value: "upload_date"
|
||||
title: Tr(Locale.SearchFilters.UploadDate)
|
||||
value: "date"
|
||||
}, {
|
||||
title: "View count"
|
||||
value: "view_count"
|
||||
title: Tr(Locale.SearchFilters.ViewCount)
|
||||
value: "views"
|
||||
}, {
|
||||
title: "Rating"
|
||||
title: Tr(Locale.SearchFilters.Rating)
|
||||
value: "rating"
|
||||
}]
|
||||
}
|
||||
@@ -109,7 +107,7 @@ function Init()
|
||||
type: m.top.findNode("TypeList")
|
||||
duration: m.top.findNode("DurationList")
|
||||
features: m.top.findNode("FeaturesList")
|
||||
sort_by: m.top.findNode("SortByList")
|
||||
sort: m.top.findNode("SortList")
|
||||
}
|
||||
|
||||
for each filterKey in m.controls
|
||||
@@ -122,12 +120,12 @@ function Init()
|
||||
type: m.controls.type.content
|
||||
duration: m.controls.duration.content
|
||||
features: m.controls.features.content
|
||||
sort_by: m.controls.sort_by.content
|
||||
sort: m.controls.sort.content
|
||||
}
|
||||
|
||||
PopulateLists(m.contentNodes, options)
|
||||
|
||||
navigationNodes = [m.controls.date, m.controls.type, m.controls.duration, m.controls.features, m.controls.sort_by]
|
||||
navigationNodes = [m.controls.date, m.controls.type, m.controls.duration, m.controls.features, m.controls.sort]
|
||||
for i = 0 to navigationNodes.count() - 2
|
||||
SetNavigation(navigationNodes[i], "right", navigationNodes[i + 1])
|
||||
end for
|
||||
@@ -156,7 +154,7 @@ function OnNodeReady()
|
||||
m.controls.type.ObserveField("checkedItem", FuncName(OnListChecked))
|
||||
m.controls.duration.ObserveField("checkedItem", FuncName(OnListChecked))
|
||||
m.controls.features.ObserveField("checkedState", FuncName(OnListChecked))
|
||||
m.controls.sort_by.ObserveField("checkedItem", FuncName(OnListChecked))
|
||||
m.controls.sort.ObserveField("checkedItem", FuncName(OnListChecked))
|
||||
end function
|
||||
|
||||
function RefreshUI()
|
||||
|
||||
@@ -10,18 +10,18 @@
|
||||
color="#000000"
|
||||
opacity="0.5">
|
||||
</Rectangle>
|
||||
<Font id="HeaderFont" uri="font:BoldSystemFontFile" size="18" />
|
||||
<Font id="HeaderFont" uri="font:MediumSystemFontFile" size="18" />
|
||||
<Font id="ItemFont" uri="font:SystemFontFile" size="18" />
|
||||
<Font id="ItemFocusedFont" uri="font:BoldSystemFontFile" size="18" />
|
||||
<Font id="ItemFocusedFont" uri="font:MediumSystemFontFile" size="18" />
|
||||
<Rectangle
|
||||
width="1116"
|
||||
width="1200"
|
||||
height="543"
|
||||
translation="[82,84]"
|
||||
translation="[40,84]"
|
||||
color="#242424">
|
||||
|
||||
<LayoutGroup
|
||||
layoutDirection="horiz"
|
||||
translation="[35,20]">
|
||||
translation="[20,20]">
|
||||
<LayoutGroup horizAlignment="center" itemSpacings="[10,10]">
|
||||
<Label
|
||||
text="Upload date"
|
||||
@@ -36,7 +36,7 @@
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
font="dictionary:ItemFont"
|
||||
focusedFont="dictionary:ItemFocusedFont"
|
||||
itemSize="[140,42]">
|
||||
itemSize="[170,42]">
|
||||
<ContentNode role="content" />
|
||||
</RadioButtonList>
|
||||
</LayoutGroup>
|
||||
@@ -74,7 +74,7 @@
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
font="dictionary:ItemFont"
|
||||
focusedFont="dictionary:ItemFocusedFont"
|
||||
itemSize="[190,42]">
|
||||
itemSize="[230,42]">
|
||||
<ContentNode role="content" />
|
||||
</RadioButtonList>
|
||||
</LayoutGroup>
|
||||
@@ -108,11 +108,11 @@
|
||||
width="180"
|
||||
height="1" />
|
||||
<RadioButtonList
|
||||
id="SortByList"
|
||||
id="SortList"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
font="dictionary:ItemFont"
|
||||
focusedFont="dictionary:ItemFocusedFont"
|
||||
itemSize="[150,42]">
|
||||
itemSize="[190,42]">
|
||||
<ContentNode role="content" />
|
||||
</RadioButtonList>
|
||||
</LayoutGroup>
|
||||
|
||||
@@ -7,6 +7,7 @@ import "pkg:/source/utils/CryptoUtils.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/LoadingScreen.bs"
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/UrlUtils.bs"
|
||||
|
||||
@@ -33,7 +34,7 @@ function Init()
|
||||
type: ""
|
||||
duration: ""
|
||||
features: []
|
||||
sort_by: ""
|
||||
sort: ""
|
||||
}
|
||||
|
||||
m.top.ObserveField("filters", FuncName(OnFiltersChange))
|
||||
@@ -196,9 +197,9 @@ function OnFiltersChange()
|
||||
end if
|
||||
end for
|
||||
if filterCount > 0
|
||||
m.filtersButton.text = `Filters (${filterCount})`
|
||||
m.filtersButton.text = `${Tr(Locale.Buttons.Filters)} (${filterCount})`
|
||||
else
|
||||
m.filtersButton.text = "Filters"
|
||||
m.filtersButton.text = Tr(Locale.Buttons.Filters)
|
||||
end if
|
||||
end function
|
||||
|
||||
@@ -209,7 +210,7 @@ function Search(text as string)
|
||||
|
||||
feedSource = {
|
||||
"id": `inv_search_${CryptoUtils.GetMd5(text)}`
|
||||
"title": `Search - ${text}`
|
||||
"title": `${Tr(Locale.NavBar.Search)} - ${text}`
|
||||
"apiType": "Invidious"
|
||||
"endpoint": "search"
|
||||
"queryParams": {
|
||||
@@ -231,7 +232,7 @@ function Search(text as string)
|
||||
end for
|
||||
|
||||
m.rowList.feeds = [{
|
||||
"title": `Search - ${text}`
|
||||
"title": `${Tr(Locale.NavBar.Search)} - ${text}`
|
||||
"feedSources": [feedSource]
|
||||
}]
|
||||
end function
|
||||
@@ -240,7 +241,7 @@ function OnSearchContentReady() as void
|
||||
m.rowlist.UnobserveFieldScoped("someContentReady")
|
||||
|
||||
if not m.rowlist.someContentReady
|
||||
DialogUtils.ShowDialog("We didn't find any results for your search. Please try again with a different query or different filters.", "No results found")
|
||||
DialogUtils.ShowDialog(Tr(Locale.Dialogs.NoResultsFoundMessage), Tr(Locale.Dialogs.NoResultsFound))
|
||||
m.rowlist.feeds = invalid
|
||||
m.rowlist.focusable = false
|
||||
HideLoadingScreen()
|
||||
|
||||
@@ -8,16 +8,13 @@
|
||||
</interface>
|
||||
<children>
|
||||
<Group id="container">
|
||||
<Button
|
||||
<ButtonEx
|
||||
id="filtersButton"
|
||||
translation="[160,35]"
|
||||
minWidth="0"
|
||||
height="58"
|
||||
showFocusFootprint="true"
|
||||
iconUri="pkg:/images/icons/filters-white.png"
|
||||
focusedIconUri="pkg:/images/icons/filters-black.png"
|
||||
text="Filters">
|
||||
</Button>
|
||||
translation="[190,64]"
|
||||
iconUri="pkg:/images/icons/filters.png"
|
||||
anchor="[0,0.5]"
|
||||
padding="[30,30]"
|
||||
text="Filters" />
|
||||
|
||||
<DynamicMiniKeyboard
|
||||
id="keyboard"
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import "pkg:/source/utils/MathUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
m.top.observeField("checkedState", FuncName(OnCheckedStateChange))
|
||||
m.minItemWidth = m.top.itemSize[0]
|
||||
end function
|
||||
|
||||
function OnValueChange()
|
||||
@@ -15,3 +17,19 @@ function OnCheckedStateChange() as void
|
||||
end if
|
||||
m.top.value = checkedState[0]
|
||||
end function
|
||||
|
||||
function OnTitleChange()
|
||||
title = m.top.title
|
||||
' TODO:P2 FIX THIS
|
||||
' This is a gross estimate of the width of the text, because there isn't
|
||||
' a simple way to measure using the font, and accurately estimate the width
|
||||
' of the checkbox. I hate it, but I currently don't have the patience to
|
||||
' do something else.
|
||||
' The risks are, if the checkbox is too big, it will look ugly, and if it's
|
||||
' too small, the text will be scrolling. Either way, it will be usable.
|
||||
' A better way is to create a Checkbox from scratch, instead of using the CheckList
|
||||
size = title.len() * 14 - 30
|
||||
|
||||
size = MathUtils.Max(size, m.minItemWidth)
|
||||
m.top.itemSize = [size, m.top.itemSize[1]]
|
||||
end function
|
||||
@@ -1,6 +1,6 @@
|
||||
<component name="Checkbox" extends="CheckList">
|
||||
<interface>
|
||||
<field id="title" type="string" alias="checkboxNode.title" />
|
||||
<field id="title" type="string" alias="checkboxNode.title" onChange="OnTitleChange" />
|
||||
<field id="value" type="boolean" onChange="OnValueChange" />
|
||||
</interface>
|
||||
<children>
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/source/utils/CacheUtils.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
|
||||
function Init()
|
||||
m.top.focusable = true
|
||||
m.top.itemSpacings = [8]
|
||||
m.button = m.top.findNode("Button")
|
||||
m.button.observeField("buttonSelected", FuncName(OnButtonSelected))
|
||||
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)
|
||||
' Do nothing
|
||||
end function
|
||||
|
||||
function OnButtonSelected()
|
||||
CacheUtils.Clear()
|
||||
DialogUtils.ShowDialog(Tr(Locale.Settings.CacheCleared), Tr(Locale.Generic.Success))
|
||||
end function
|
||||
@@ -0,0 +1,19 @@
|
||||
<component name="ClearCacheControl" extends="LayoutGroup" includes="Focus">
|
||||
<interface>
|
||||
<field id="displayText" type="string" alias="Button.text" />
|
||||
<field id="description" type="string" alias="DescriptionLabel.text" />
|
||||
<function name="BindPreference" />
|
||||
</interface>
|
||||
<children>
|
||||
<Button
|
||||
id="Button"
|
||||
minWidth="340"
|
||||
showFocusFootprint="true" />
|
||||
<Label id="DescriptionLabel"
|
||||
width="450"
|
||||
color="0xb4b4b4ff"
|
||||
wrap="true">
|
||||
<Font role="font" uri="font:SystemFontFile" size="18" />
|
||||
</Label>
|
||||
</children>
|
||||
</component>
|
||||
@@ -1,6 +1,7 @@
|
||||
import "pkg:/components/Dialog/DialogUtils.bs"
|
||||
import "pkg:/components/Services/SearchHistory/SearchHistoryUtils.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
|
||||
function Init()
|
||||
m.top.focusable = true
|
||||
@@ -16,11 +17,11 @@ function OnFocusChange() as void
|
||||
NodeSetFocus(m.button, true)
|
||||
end function
|
||||
|
||||
function BindPreference(preferences as object, key as string)
|
||||
function BindPreference(_preferences as object, _key as string)
|
||||
' Do nothing
|
||||
end function
|
||||
|
||||
function OnButtonSelected()
|
||||
SearchHistoryUtils.Clear()
|
||||
DialogUtils.ShowDialog("Search history cleared.", "Success")
|
||||
DialogUtils.ShowDialog(Tr(Locale.Settings.SearchHistoryCleared), Tr(Locale.Generic.Success))
|
||||
end function
|
||||
@@ -35,6 +35,16 @@ function Init()
|
||||
m.closeButton.observeField("buttonSelected", FuncName(Close))
|
||||
|
||||
m.checkList.observeField("checkedState", FuncName(OnCheckedStateChange))
|
||||
|
||||
SetButtonPositions()
|
||||
end function
|
||||
|
||||
function SetButtonPositions()
|
||||
saveButtonWidth = m.saveButton.width
|
||||
closeButtonWidth = m.closeButton.width
|
||||
buttonsWith = closeButtonWidth + saveButtonWidth + 20
|
||||
m.saveButton.translation = [960 / 2 - buttonsWith / 2, m.saveButton.translation[1]]
|
||||
m.closeButton.translation = [960 / 2 + buttonsWith / 2 - closeButtonWidth, m.closeButton.translation[1]]
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
@@ -77,7 +87,7 @@ function OnValueChange()
|
||||
end if
|
||||
node = CreateObject("roSGNode", "ContentNode")
|
||||
node.id = feed.id
|
||||
node.title = feed.title
|
||||
node.title = Tr(feed.title)
|
||||
nodes.push(node)
|
||||
checkedState.push(item.enabled)
|
||||
end for
|
||||
|
||||
@@ -24,30 +24,33 @@
|
||||
<ContentNode role="content" />
|
||||
</CheckList>
|
||||
|
||||
<Button
|
||||
<ButtonEx
|
||||
id="moveUpButton"
|
||||
iconVisible="false"
|
||||
anchor="[0.5,0.5]"
|
||||
text="Move up"
|
||||
showFocusFootprint="true"
|
||||
minWidth="220"
|
||||
translation="[640,183]" />
|
||||
<Button
|
||||
translation="[750,220]" />
|
||||
<ButtonEx
|
||||
id="moveDownButton"
|
||||
iconVisible="false"
|
||||
anchor="[0.5,0.5]"
|
||||
text="Move down"
|
||||
showFocusFootprint="true"
|
||||
minWidth="220"
|
||||
translation="[640,273]" />
|
||||
<Button
|
||||
id="closeButton"
|
||||
text="Close"
|
||||
showFocusFootprint="true"
|
||||
minWidth="150"
|
||||
translation="[500,500]" />
|
||||
<Button
|
||||
translation="[750,300]" />
|
||||
|
||||
<ButtonEx
|
||||
id="saveButton"
|
||||
iconVisible="false"
|
||||
text="Save"
|
||||
showFocusFootprint="true"
|
||||
minWidth="150"
|
||||
translation="[320,500]" />
|
||||
padding="[30,30]"
|
||||
translation="[340,500]" />
|
||||
<ButtonEx
|
||||
id="closeButton"
|
||||
iconVisible="false"
|
||||
text="Close"
|
||||
padding="[30,30]"
|
||||
translation="[496,500]" />
|
||||
</Rectangle>
|
||||
</children>
|
||||
</component>
|
||||
@@ -33,6 +33,28 @@ function Init()
|
||||
|
||||
m.currentNavigtionNode = m.editButton
|
||||
m.textEditBox.hintText = `e.g. ${Invidious.DEFAULT_INSTANCE}`
|
||||
|
||||
SetButtonPositions()
|
||||
|
||||
SetPublicInstancesPosition()
|
||||
m.publicInstances.observeField("width", FuncName(SetPublicInstancesPosition))
|
||||
end function
|
||||
|
||||
function SetButtonPositions()
|
||||
testButtonWidth = m.testButton.width
|
||||
saveButtonWidth = m.saveButton.width
|
||||
buttonsWith = testButtonWidth + saveButtonWidth + 20
|
||||
m.testButton.translation = [960 / 2 - buttonsWith / 2, m.testButton.translation[1]]
|
||||
m.saveButton.translation = [960 / 2 + buttonsWith / 2 - saveButtonWidth, m.saveButton.translation[1]]
|
||||
end function
|
||||
|
||||
function SetPublicInstancesPosition() as void
|
||||
width = m.publicInstances.width
|
||||
if width = 0
|
||||
return
|
||||
end if
|
||||
|
||||
m.publicInstances.translation = [960 / 2 - width / 2, m.publicInstances.translation[1]]
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
@@ -83,7 +105,7 @@ function OnEditButtonSelected()
|
||||
keyboardDialog.title = "Edit Instance"
|
||||
keyboardDialog.message = [`Enter the instance url (e.g. ${Invidious.DEFAULT_INSTANCE})`]
|
||||
keyboardDialog.text = m.top.text
|
||||
keyboardDialog.buttons = ["OK", "Cancel"]
|
||||
keyboardDialog.buttons = [Tr(Locale.Buttons.OK), Tr(Locale.Buttons.Cancel)]
|
||||
keyboardDialog.observeField("buttonSelected", FuncName(OnKeyboardButton))
|
||||
|
||||
m.top.getScene().dialog = keyboardDialog
|
||||
|
||||
@@ -18,58 +18,64 @@
|
||||
color="#242424">
|
||||
<Label
|
||||
text="Invidious custom instance"
|
||||
translation="[326,13]" />
|
||||
horizAlign="center"
|
||||
width="960"
|
||||
translation="[0,13]" />
|
||||
<TextEditBox
|
||||
id="textEditBox"
|
||||
width="480"
|
||||
height="50"
|
||||
translation="[200,50]" />
|
||||
<Button
|
||||
translation="[170,50]" />
|
||||
<ButtonEx
|
||||
id="editButton"
|
||||
text=""
|
||||
minWidth="64"
|
||||
maxWidth="80"
|
||||
height="48"
|
||||
iconUri="pkg:/images/icons/edit-48-white.png"
|
||||
focusedIconUri="pkg:/images/icons/edit-48-black.png"
|
||||
showFocusFootprint="true"
|
||||
translation="[692,50]" />
|
||||
<Label
|
||||
text="OR"
|
||||
translation="[460,110]">
|
||||
iconUri="pkg:/images/icons/edit.png"
|
||||
height="50"
|
||||
iconWidth="22"
|
||||
iconHeight="22"
|
||||
text="Edit"
|
||||
translation="[670,50]" />
|
||||
|
||||
<LayoutGroup
|
||||
layoutDirection="horiz"
|
||||
horizAlignment="center"
|
||||
vertAlignment="center"
|
||||
itemSpacings="[30,30]"
|
||||
translation="[480,125]">
|
||||
<Rectangle
|
||||
width="250"
|
||||
height="1"
|
||||
translation="[-282,10]" />
|
||||
height="1" />
|
||||
|
||||
<Label
|
||||
text="Or" />
|
||||
|
||||
<Rectangle
|
||||
width="250"
|
||||
height="1"
|
||||
translation="[71,10]" />
|
||||
height="1" />
|
||||
|
||||
</Label>
|
||||
</LayoutGroup>
|
||||
|
||||
<Label
|
||||
text="Invidious public instances"
|
||||
translation="[328,145]" />
|
||||
horizAlign="center"
|
||||
width="960"
|
||||
translation="[0,145]" />
|
||||
|
||||
<InvidiousPublicInstances
|
||||
id="instances"
|
||||
translation="[50,190]">
|
||||
translation="[50,190]" />
|
||||
|
||||
</InvidiousPublicInstances>
|
||||
|
||||
<Button
|
||||
<ButtonEx
|
||||
id="testButton"
|
||||
text="Test instance"
|
||||
showFocusFootprint="true"
|
||||
translation="[495,507]" />
|
||||
<Button
|
||||
iconVisible="false"
|
||||
padding="[30,30]"
|
||||
translation="[300,510]" />
|
||||
<ButtonEx
|
||||
id="saveButton"
|
||||
text="Save"
|
||||
showFocusFootprint="true"
|
||||
minWidth="150"
|
||||
translation="[768,507]" />
|
||||
iconVisible="false"
|
||||
padding="[30,30]"
|
||||
translation="[545,510]" />
|
||||
</Rectangle>
|
||||
</children>
|
||||
</component>
|
||||
@@ -53,25 +53,37 @@ function Close()
|
||||
end function
|
||||
|
||||
function RunTestsTask()
|
||||
m.titleLabel.text = `Testing ${m.top.instance}`
|
||||
instance = m.top.instance
|
||||
m.titleLabel.text = Tr(Locale.InvidiousTesting.TestingInstance).Replace("%1", instance)
|
||||
|
||||
if m.testingTask <> invalid
|
||||
m.testingTask.cancel = true
|
||||
end if
|
||||
|
||||
m.testingTask = AsyncTask.Start(Tasks.InvidiousInstanceTestingTask, {
|
||||
instance: m.top.instance
|
||||
instance: instance
|
||||
listNode: m.testList
|
||||
})
|
||||
end function
|
||||
|
||||
function ShowTestDetails(event as object) as void
|
||||
function ShowTestDetails() as void
|
||||
selected = m.testList.itemSelected
|
||||
itemContent = m.testList.content.GetChild(selected)
|
||||
if StringUtils.IsNullOrEmpty(itemContent.details)
|
||||
details = itemContent.details
|
||||
if StringUtils.IsNullOrEmpty(details)
|
||||
return
|
||||
end if
|
||||
|
||||
message = `Status: ${itemContent.state}\nTest duration: ${itemContent.duration}ms\nDetails: ${itemContent.details}`
|
||||
DialogUtils.ShowDialog(message, `Test: ${itemContent.title}`)
|
||||
state = itemContent.state
|
||||
displayStates = {
|
||||
"passed": Locale.InvidiousTesting.Passed
|
||||
"failed": Locale.InvidiousTesting.Failed
|
||||
}
|
||||
|
||||
message = Tr(Locale.InvidiousTesting.Status) + ": " + Tr(ValidString(displayStates[state])) + `\n`
|
||||
message += Tr(Locale.InvidiousTesting.TestDuration) + ": " + `${itemContent.duration}ms\n`
|
||||
message += Tr(Locale.InvidiousTesting.Details) + ": " + details
|
||||
|
||||
title = Tr(Locale.InvidiousTesting.Test) + ": " + itemContent.title
|
||||
DialogUtils.ShowDialog(message, title)
|
||||
end function
|
||||
@@ -12,32 +12,33 @@
|
||||
opacity="0.5">
|
||||
</Rectangle>
|
||||
<Rectangle
|
||||
width="960"
|
||||
width="1160"
|
||||
height="600"
|
||||
translation="[160,60]"
|
||||
translation="[60,60]"
|
||||
color="#242424">
|
||||
<Label
|
||||
id="titleLabel"
|
||||
width="960"
|
||||
width="1160"
|
||||
horizAlign="center"
|
||||
text=""
|
||||
translation="[0,20]" />
|
||||
|
||||
<MarkupGrid
|
||||
id="testList"
|
||||
itemSize="[860,40]"
|
||||
itemSize="[1060,40]"
|
||||
itemSpacing="[0,20]"
|
||||
numColumns="1"
|
||||
numRows="7"
|
||||
vertFocusAnimationStyle="floatingFocus"
|
||||
translation="[50,80]"
|
||||
itemComponentName="InvidiousInstanceTestingItem" />
|
||||
<Button
|
||||
<ButtonEx
|
||||
id="closeButton"
|
||||
text="Close"
|
||||
minWidth="160"
|
||||
showFocusFootprint="true"
|
||||
translation="[400,506]" />
|
||||
iconVisible="false"
|
||||
anchor="[0.5,0.5]"
|
||||
padding="[30,30]"
|
||||
translation="[580,545]" />
|
||||
</Rectangle>
|
||||
</children>
|
||||
</component>
|
||||
@@ -13,14 +13,16 @@
|
||||
translation="[5,0]" />
|
||||
<Label
|
||||
id="nameLabel"
|
||||
width="450"
|
||||
width="660"
|
||||
translation="[60,10]" />
|
||||
<Label
|
||||
id="detailsLabel"
|
||||
visible="false"
|
||||
horizAlign="right"
|
||||
width="300"
|
||||
width="400"
|
||||
text="Press 'OK' for details"
|
||||
translation="[560,10]" />
|
||||
translation="[660,12]">
|
||||
<Font role="font" uri="font:SystemFontFile" size="20" />
|
||||
</Label>
|
||||
</children>
|
||||
</component>
|
||||
@@ -2,6 +2,7 @@ import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
||||
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||
import "pkg:/source/services/HttpClient.bs"
|
||||
import "pkg:/source/utils/ErrorUtils.bs"
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
@asynctask
|
||||
@@ -16,7 +17,7 @@ function InvidiousInstanceTestingTask(input as object) as object
|
||||
content = PrepareTests()
|
||||
listNode.content = content
|
||||
|
||||
RunTests(instance, content)
|
||||
RunTests(instance, content, m.top.cancellation)
|
||||
|
||||
return invalid
|
||||
end function
|
||||
@@ -25,12 +26,13 @@ function PrepareTests() as object
|
||||
content = CreateObject("roSGNode", "ContentNode")
|
||||
' TODO:P2 test if video data is reachable (head?)
|
||||
' TODO:P2 test if video data is reachable in proxy mode (local=true)
|
||||
content.AppendChild(CreateTestNode("Valid url", IsValidUrl))
|
||||
content.AppendChild(CreateTestNode("Instance reachable", IsReachable))
|
||||
content.AppendChild(CreateTestNode("Fetch video details", CanFetchVideoDetails))
|
||||
content.AppendChild(CreateTestNode("Fetch video comments", CanFetchVideoComments))
|
||||
content.AppendChild(CreateTestNode("Fetch video captions", CanFetchVideoCaptions))
|
||||
content.AppendChild(CreateTestNode("Fetch video thumbnails", CanFetchVideoThumbails))
|
||||
content.AppendChild(CreateTestNode(Tr(Locale.InvidiousTesting.ValidUrl), IsValidUrl))
|
||||
content.AppendChild(CreateTestNode(Tr(Locale.InvidiousTesting.InstanceReachable), IsReachable))
|
||||
content.AppendChild(CreateTestNode(Tr(Locale.InvidiousTesting.FetchVideoDetails), CanFetchVideoDetails))
|
||||
content.AppendChild(CreateTestNode(Tr(Locale.InvidiousTesting.FetchVideoComments), CanFetchVideoComments))
|
||||
content.AppendChild(CreateTestNode(Tr(Locale.InvidiousTesting.FetchVideoCaptions), CanFetchVideoCaptions))
|
||||
content.AppendChild(CreateTestNode(Tr(Locale.InvidiousTesting.FetchVideoThumbnails), CanFetchVideoThumbails))
|
||||
content.AppendChild(CreateTestNode(Tr(Locale.InvidiousTesting.FetchWithCors), CanFetchWithCors))
|
||||
return content
|
||||
end function
|
||||
|
||||
@@ -47,14 +49,14 @@ function CreateTestNode(title as string, func as function) as object
|
||||
return testNode
|
||||
end function
|
||||
|
||||
function RunTests(instance as string, content as object) as void
|
||||
function RunTests(instance as string, content as object, cancellation as object) as void
|
||||
testNodes = content.getChildren(-1, 0)
|
||||
|
||||
timer = CreateObject("roTimespan")
|
||||
|
||||
for each testNode in testNodes
|
||||
timer.Mark()
|
||||
m[testNode.func](instance, testNode)
|
||||
m[testNode.func](instance, testNode, cancellation)
|
||||
|
||||
testNode.duration = timer.TotalMilliseconds()
|
||||
testNode.title = `${testNode.title} (${testNode.duration}ms)`
|
||||
@@ -69,31 +71,31 @@ function RunTests(instance as string, content as object) as void
|
||||
end for
|
||||
end function
|
||||
|
||||
function IsValidUrl(instance as string, testNode as object) as void
|
||||
function IsValidUrl(instance as string, testNode as object, _cancellation as object) as void
|
||||
try
|
||||
if not instance.StartsWith("http://") and not instance.StartsWith("https://")
|
||||
testNode.state = "failed"
|
||||
testNode.details = "Url must start with http:// or https://"
|
||||
testNode.details = Tr(Locale.InvidiousTesting.UrlMustStartWith)
|
||||
return
|
||||
end if
|
||||
if instance.EndsWith("/")
|
||||
testNode.state = "failed"
|
||||
testNode.details = "Url must not end with /"
|
||||
testNode.details = Tr(Locale.InvidiousTesting.UrlMustNotEndWith)
|
||||
return
|
||||
end if
|
||||
|
||||
testNode.state = "passed"
|
||||
testNode.details = "The url seems to be of a valid format"
|
||||
testNode.details = Tr(Locale.InvidiousTesting.UrlSeemsValid)
|
||||
catch e
|
||||
testNode.state = "failed"
|
||||
testNode.details = ErrorUtils.Format(e)
|
||||
end try
|
||||
end function
|
||||
|
||||
function IsReachable(instance as string, testNode as object) as void
|
||||
function IsReachable(instance as string, testNode as object, cancellation as object) as void
|
||||
try
|
||||
url = `${instance}${Invidious.STATS_ENDPOINT}`
|
||||
response = HttpClient.Get(url).NoCache().Await()
|
||||
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
|
||||
if not response.IsSuccess()
|
||||
testNode.state = "failed"
|
||||
testNode.details = response.ErrorMessage()
|
||||
@@ -103,33 +105,33 @@ function IsReachable(instance as string, testNode as object) as void
|
||||
json = response.Json()
|
||||
if json = invalid
|
||||
testNode.state = "failed"
|
||||
testNode.details = `Invalid json from ${url}`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFrom).Replace("%1", url)
|
||||
return
|
||||
end if
|
||||
|
||||
software = json.software
|
||||
if software = invalid
|
||||
testNode.state = "failed"
|
||||
testNode.details = `Invalid json from ${url} (couldn't read $.software)`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFromCouldntRead).Replace("%1", url).Replace("%2", "$.software")
|
||||
return
|
||||
end if
|
||||
|
||||
name = software.name
|
||||
if not IsString(name)
|
||||
testNode.state = "failed"
|
||||
testNode.details = `Invalid json from ${url} (couldn't read $.software.name)`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFromCouldntRead).Replace("%1", url).Replace("%2", "$.software.name")
|
||||
return
|
||||
end if
|
||||
|
||||
version = software.version
|
||||
if not IsString(version)
|
||||
testNode.state = "failed"
|
||||
testNode.details = `Invalid json from ${url} (couldn't read software.version)`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFromCouldntRead).Replace("%1", url).Replace("%2", "$.software.version")
|
||||
return
|
||||
end if
|
||||
|
||||
testNode.state = "passed"
|
||||
testNode.details = `The instance is reachable and running ${name} version ${version}`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.TheInstanceIsReachableAndRunning).Replace("%1", name).Replace("%2", version)
|
||||
catch e
|
||||
testNode.state = "failed"
|
||||
testNode.details = ErrorUtils.Format(e)
|
||||
@@ -137,11 +139,11 @@ function IsReachable(instance as string, testNode as object) as void
|
||||
|
||||
end function
|
||||
|
||||
function CanFetchVideoDetails(instance as string, testNode as object) as void
|
||||
function CanFetchVideoDetails(instance as string, testNode as object, cancellation as object) as void
|
||||
try
|
||||
videoId = "jNQXAC9IVRw"
|
||||
url = `${instance}${Invidious.VIDEOS_ENDPOINT}/${videoId}`
|
||||
response = HttpClient.Get(url).NoCache().Await()
|
||||
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
|
||||
|
||||
if not response.IsSuccess()
|
||||
testNode.state = "failed"
|
||||
@@ -152,30 +154,30 @@ function CanFetchVideoDetails(instance as string, testNode as object) as void
|
||||
json = response.Json()
|
||||
if json = invalid
|
||||
testNode.state = "failed"
|
||||
testNode.details = `Invalid json from ${url}`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFrom).Replace("%1", url)
|
||||
return
|
||||
end if
|
||||
|
||||
title = json.title
|
||||
if not IsString(title)
|
||||
testNode.state = "failed"
|
||||
testNode.details = `Invalid json from ${url} (couldn't read title)`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFromCouldntRead).Replace("%1", url).Replace("%2", "$.title")
|
||||
return
|
||||
end if
|
||||
|
||||
testNode.state = "passed"
|
||||
testNode.details = `The instance can fetch video details for id "${videoId}" (${title})`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.TheInstanceCanFetchVideoDetails).Replace("%1", videoId).Replace("%2", title)
|
||||
catch e
|
||||
testNode.state = "failed"
|
||||
testNode.details = ErrorUtils.Format(e)
|
||||
end try
|
||||
end function
|
||||
|
||||
function CanFetchVideoComments(instance as string, testNode as object) as void
|
||||
function CanFetchVideoComments(instance as string, testNode as object, cancellation as object) as void
|
||||
try
|
||||
videoId = "jNQXAC9IVRw"
|
||||
url = `${instance}/api/v1/comments/${videoId}`
|
||||
response = HttpClient.Get(url).NoCache().Await()
|
||||
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
|
||||
|
||||
if not response.IsSuccess()
|
||||
testNode.state = "failed"
|
||||
@@ -186,38 +188,38 @@ function CanFetchVideoComments(instance as string, testNode as object) as void
|
||||
json = response.Json()
|
||||
if json = invalid
|
||||
testNode.state = "failed"
|
||||
testNode.details = `Invalid json from ${url}`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFrom).Replace("%1", url)
|
||||
return
|
||||
end if
|
||||
|
||||
commentCount = json.commentCount
|
||||
if not IsInt(commentCount)
|
||||
testNode.state = "failed"
|
||||
testNode.details = `Invalid json from ${url} (couldn't read commentCount)`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFromCouldntRead).Replace("%1", url).Replace("%2", "$.commentCount")
|
||||
return
|
||||
end if
|
||||
|
||||
comments = json.comments
|
||||
if not IsArray(comments)
|
||||
testNode.state = "failed"
|
||||
testNode.details = `Invalid json from ${url} (couldn't read comments)`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFromCouldntRead).Replace("%1", url).Replace("%2", "$.comments")
|
||||
return
|
||||
end if
|
||||
|
||||
testNode.state = "passed"
|
||||
testNode.details = `The instance can fetch video comments for id "${videoId}" (${commentCount} comments)`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.TheInstanceCanFetchVideoComments).Replace("%1", videoId).Replace("%2", `${commentCount}`)
|
||||
catch e
|
||||
testNode.state = "failed"
|
||||
testNode.details = ErrorUtils.Format(e)
|
||||
end try
|
||||
end function
|
||||
|
||||
function CanFetchVideoCaptions(instance as string, testNode as object) as void
|
||||
function CanFetchVideoCaptions(instance as string, testNode as object, cancellation as object) as void
|
||||
try
|
||||
videoId = "jNQXAC9IVRw"
|
||||
label = "English"
|
||||
url = `${instance}/api/v1/captions/${videoId}?label=${label}`
|
||||
response = HttpClient.Get(url).NoCache().Await()
|
||||
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
|
||||
|
||||
if not response.IsSuccess()
|
||||
testNode.state = "failed"
|
||||
@@ -229,36 +231,36 @@ function CanFetchVideoCaptions(instance as string, testNode as object) as void
|
||||
contentType = headers["Content-Type"]
|
||||
if StringUtils.IsNullOrEmpty(contentType) or not contentType.StartsWith("text/vtt")
|
||||
testNode.state = "failed"
|
||||
testNode.details = `Invalid caption data ${url} (Content-Type is not text/vtt)`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.InvalidCaptionDataContentType).Replace("%1", url)
|
||||
return
|
||||
end if
|
||||
|
||||
text = response.Text()
|
||||
if StringUtils.IsNullOrEmpty(text) or not text.StartsWith("WEBVTT")
|
||||
testNode.state = "failed"
|
||||
testNode.details = `Invalid caption data from ${url} (response is not a valid vtt file)`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.InvalidCaptionDataNotWebVtt).Replace("%1", url)
|
||||
return
|
||||
end if
|
||||
|
||||
if text.InStr(`All right, so here we are, in front of the\nelephants`) = -1
|
||||
testNode.state = "failed"
|
||||
testNode.details = `Did not find expected text in caption data from ${url}`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.ExpectedTextNotFoundInCaptionData).Replace("%1", url)
|
||||
return
|
||||
end if
|
||||
|
||||
testNode.state = "passed"
|
||||
testNode.details = `The instance can fetch video ${label} captions for id "${videoId}"`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.TheInstanceCanFetchVideoCaptions).Replace("%1", label).Replace("%2", videoId)
|
||||
catch e
|
||||
testNode.state = "failed"
|
||||
testNode.details = ErrorUtils.Format(e)
|
||||
end try
|
||||
end function
|
||||
|
||||
function CanFetchVideoThumbails(instance as string, testNode as object) as void
|
||||
function CanFetchVideoThumbails(instance as string, testNode as object, cancellation as object) as void
|
||||
try
|
||||
videoId = "jNQXAC9IVRw"
|
||||
url = `${instance}${Invidious.VIDEOS_ENDPOINT}/${videoId}`
|
||||
response = HttpClient.Get(url).NoCache().Await()
|
||||
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
|
||||
|
||||
if not response.IsSuccess()
|
||||
testNode.state = "failed"
|
||||
@@ -269,14 +271,14 @@ function CanFetchVideoThumbails(instance as string, testNode as object) as void
|
||||
json = response.Json()
|
||||
if json = invalid
|
||||
testNode.state = "failed"
|
||||
testNode.details = `Invalid json from ${url}`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFrom).Replace("%1", url)
|
||||
return
|
||||
end if
|
||||
|
||||
videoThumbnails = json.videoThumbnails
|
||||
if not IsArray(videoThumbnails) or videoThumbnails.Count() = 0
|
||||
testNode.state = "failed"
|
||||
testNode.details = `No thumbnails found in json from ${url}`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.NoThumbnailsFoundInJson).Replace("%1", url)
|
||||
return
|
||||
end if
|
||||
|
||||
@@ -284,28 +286,62 @@ function CanFetchVideoThumbails(instance as string, testNode as object) as void
|
||||
thumbnail = contentNode.thumbnail
|
||||
if StringUtils.IsNullOrEmpty(thumbnail)
|
||||
testNode.state = "failed"
|
||||
testNode.details = `No thumbnail found in json from ${url}`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.NoThumbnailsFoundInJson).Replace("%1", url)
|
||||
return
|
||||
end if
|
||||
|
||||
' Note: we could do a HEAD request, but Invidious returns 200 even for invalid thumbnails
|
||||
' To make sure we don't get a 200 for an invalid thumbnail, we do a GET request instead
|
||||
response = HttpClient.Get(thumbnail).NoCache().Await()
|
||||
response = HttpClient.Get(thumbnail).NoCache().Cancellation(cancellation).Await()
|
||||
if not response.IsSuccess()
|
||||
testNode.state = "failed"
|
||||
testNode.details = `${thumbnail} is not reachable\n${response.ErrorMessage(false)}`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.ThumbnailNotReachable).Replace("%1", thumbnail) + `\n` + response.ErrorMessage(false)
|
||||
return
|
||||
end if
|
||||
|
||||
contentType = response.Headers()["Content-Type"]
|
||||
if StringUtils.IsNullOrEmpty(contentType) or not contentType.StartsWith("image/")
|
||||
testNode.state = "failed"
|
||||
testNode.details = `Invalid thumbnail data ${thumbnail} (Content-Type is not image/*)`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.InvalidThumbnailData).Replace("%1", thumbnail)
|
||||
return
|
||||
end if
|
||||
|
||||
testNode.state = "passed"
|
||||
testNode.details = `The instance can fetch video thumbnail for id "${videoId}" (${thumbnail})`
|
||||
testNode.details = Tr(Locale.InvidiousTesting.TheInstanceCanFetchVideoThumbnails).Replace("%1", videoId).Replace("%2", thumbnail)
|
||||
catch e
|
||||
testNode.state = "failed"
|
||||
testNode.details = ErrorUtils.Format(e)
|
||||
end try
|
||||
end function
|
||||
|
||||
function CanFetchWithCors(instance as string, testNode as object, cancellation as object) as void
|
||||
try
|
||||
url = `${instance}/api/v1/trending`
|
||||
response = HttpClient.Get(url).NoCache().Cancellation(cancellation).Await()
|
||||
|
||||
if not response.IsSuccess()
|
||||
testNode.state = "failed"
|
||||
testNode.details = response.ErrorMessage()
|
||||
return
|
||||
end if
|
||||
|
||||
json = response.Json()
|
||||
if json = invalid
|
||||
testNode.state = "failed"
|
||||
testNode.details = Tr(Locale.InvidiousTesting.InvalidJsonFrom).Replace("%1", url)
|
||||
return
|
||||
end if
|
||||
|
||||
headers = response.Headers()
|
||||
corsHeader = headers["Access-Control-Allow-Origin"]
|
||||
if not IsString(corsHeader) or corsHeader <> "*"
|
||||
testNode.state = "failed"
|
||||
testNode.details = Tr(Locale.InvidiousTesting.CorsHeaderNotSetCorrectly).Replace("%1", url)
|
||||
return
|
||||
end if
|
||||
|
||||
testNode.state = "passed"
|
||||
testNode.details = Tr(Locale.InvidiousTesting.TheInstanceCanFetchWithCors).Replace("%1", url)
|
||||
catch e
|
||||
testNode.state = "failed"
|
||||
testNode.details = ErrorUtils.Format(e)
|
||||
|
||||
@@ -3,7 +3,9 @@ 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/Locale.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/MathUtils.bs"
|
||||
|
||||
function Init()
|
||||
m.failedLabel = m.top.findNode("failedLabel")
|
||||
@@ -16,11 +18,58 @@ function Init()
|
||||
m.busyspinner.poster.height = 100
|
||||
m.busySpinner.poster.uri = "pkg:/images/spinner.png"
|
||||
|
||||
InitHeader()
|
||||
|
||||
m.instances.ObserveField("itemSelected", FuncName(OnInstanceSelected))
|
||||
m.refreshButton.ObserveField("buttonSelected", FuncName(Refresh))
|
||||
Refresh()
|
||||
end function
|
||||
|
||||
function InitHeader()
|
||||
fields = ["name", "version", "users", "signup", "location", "health"]
|
||||
fieldLabels = ["nameLabel", "versionLabel", "usersLabel", "signupLabel", "locationLabel", "healthLabel"]
|
||||
|
||||
fieldWidths = {
|
||||
"name": 240
|
||||
"version": 220
|
||||
"users": 80
|
||||
"signup": 70
|
||||
"location": 65
|
||||
"health": 65
|
||||
}
|
||||
|
||||
totalWidth = 0
|
||||
for i = 0 to fields.Count() - 1
|
||||
field = fields[i]
|
||||
label = m.instancesHeader.findNode(fieldLabels[i])
|
||||
label.text = Tr(field)
|
||||
rect = label.boundingRect()
|
||||
rectWidth = rect.width
|
||||
if i < fields.Count() - 1
|
||||
rectWidth += 10
|
||||
end if
|
||||
width = MathUtils.Max(rectWidth, fieldWidths[field])
|
||||
fieldWidths[field] = width
|
||||
label.width = width
|
||||
totalWidth += width
|
||||
end for
|
||||
|
||||
m.fieldWidths = fieldWidths
|
||||
m.top.width = totalWidth
|
||||
end function
|
||||
|
||||
function OnWidthChange() as void
|
||||
width = m.top.width
|
||||
if width = 0
|
||||
return
|
||||
end if
|
||||
|
||||
m.instances.itemSize = [width, m.instances.itemSize[1]]
|
||||
m.busySpinner.translation = [width / 2 - 50, m.busySpinner.translation[1]]
|
||||
m.failedLabel.width = width
|
||||
m.refreshButton.translation = [width / 2, m.refreshButton.translation[1]]
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
if not m.top.focus
|
||||
return
|
||||
@@ -45,6 +94,7 @@ function Refresh()
|
||||
|
||||
m.invidiousPublicInstancesTask = AsyncTask.Start(Tasks.InvidiousPublicInstancesTask, {
|
||||
listNode: m.instances
|
||||
fieldWidths: m.fieldWidths
|
||||
}, OnInvidiousPublicInstancesTaskResults)
|
||||
|
||||
m.busySpinner.visible = true
|
||||
@@ -71,8 +121,8 @@ function OnInvidiousPublicInstancesTaskResults(output as object) as void
|
||||
error = ErrorUtils.Format(error)
|
||||
LogError(output.error)
|
||||
|
||||
message = `Failed to load Invidious public instances\n${error}`
|
||||
DialogUtils.ShowDialog(message, "Invidious public instances load error", true)
|
||||
message = Tr(Locale.Dialogs.FailedToLoadInvidiousPublicInstances) + `\n${error}`
|
||||
DialogUtils.ShowDialog(message, Tr(Locale.Dialogs.InvidiousPublicInstancesLoadError), true)
|
||||
|
||||
m.failedLabel.visible = true
|
||||
m.refreshButton.visible = true
|
||||
@@ -90,7 +140,7 @@ function OnInvidiousPublicInstancesTaskResults(output as object) as void
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnInstanceSelected(event as object) as void
|
||||
function OnInstanceSelected() as void
|
||||
selected = m.instances.itemSelected
|
||||
itemContent = m.instances.content.GetChild(selected)
|
||||
m.top.instance = itemContent.uri
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<component name="InvidiousPublicInstances" extends="Group" includes="Focus">
|
||||
<interface>
|
||||
<field id="instance" type="string" />
|
||||
<field id="width" type="float" onChange="OnWidthChange" />
|
||||
</interface>
|
||||
<children>
|
||||
<BusySpinner
|
||||
@@ -10,23 +11,19 @@
|
||||
<Label
|
||||
id="failedLabel"
|
||||
text="Failed to load Invidious public instances."
|
||||
translation="[190,60]" />
|
||||
<Button
|
||||
id="refreshButton"
|
||||
minWidth="180"
|
||||
text="Refresh"
|
||||
translation="[340,130]" />
|
||||
horizAlign="center"
|
||||
translation="[0,60]"
|
||||
width="960" />
|
||||
|
||||
<InvidiousPublicInstancesListItem id="instancesHeader">
|
||||
<InvidiousPublicInstancesListItemContent
|
||||
role="itemContent"
|
||||
name="name"
|
||||
version="version"
|
||||
users="users"
|
||||
signup="signup"
|
||||
location="location"
|
||||
health="health" />
|
||||
</InvidiousPublicInstancesListItem>
|
||||
<ButtonEx
|
||||
id="refreshButton"
|
||||
iconVisible="false"
|
||||
text="Refresh"
|
||||
anchor="[0.5,0]"
|
||||
padding="[30,30]"
|
||||
translation="[430,130]" />
|
||||
|
||||
<InvidiousPublicInstancesListItem id="instancesHeader" />
|
||||
|
||||
<MarkupGrid
|
||||
id="instances"
|
||||
|
||||