Preferences / Web App (#79)
* Add basic router * Add a preferences file * small changes * Basic settings navigation menu * Lint fix * Add bunch of controls * Lint fix * StringControl * Lint fix * Add description to keyboard * Settings saving and loading * Lint fix * Settings migration stuff * GET web api * Lint fix * PUT and DELETE (I really fucking hate BrightScript) * plug in sponsorblock settings * autoplay, quality, and video proxying * Remove unused stuff * Lint fix * Invidious instance stuff * cache public instances on start * Start loading home screen after fetching instances * Move web app out of settings to its own screen * picture in picture when in settings * Web app (#80) * Update instance stuff * Update dependencies * Add basic layout * Info and settings page, missing styling * Navbar fixes * Settings page formatting * Theme stuff * Feedback link * Fix username badge * Fix svelte warnings * A wip search page * Add a couple of api functions * Wip home screen * user country code * Expose token and proxy auth calls * Use auth requests server side * Some cleanup * Add svelte vs code extension * remove old web app * More layout stuff * Tweak for string control * Filter out old search suggestions * Search history stuff * img size for lazy loading * Basic modal to play video * Lint fix * Dependencies bump * Add video duration and LIVE indicator to cell * Delete legacy stuff * Add dev menu * Lint fix * Video cell layout * Cell stuff * prefs visibility * Modal layout * Drag and drop functionality * Clear search history * Move web calls to main app * changelog * changelog * Mostly comments * Lint fix --------- Co-authored-by: github-action linter <githubaction@githubaction.com>
No files matched your search
@@ -1,5 +1,6 @@
|
||||
{
|
||||
"recommendations": [
|
||||
"RokuCommunity.brightscript"
|
||||
"RokuCommunity.brightscript",
|
||||
"svelte.svelte-vscode",
|
||||
]
|
||||
}
|
||||
@@ -1,21 +1,47 @@
|
||||
# Changelog
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## Unreleased
|
||||
|
||||
### Added
|
||||
|
||||
- New web app, mirroring Playlet app
|
||||
- Includes home page, search, settings and info
|
||||
- Dark mode
|
||||
- Also includes a dev menu
|
||||
- Hidden by default, use `dev=1` in the browser to show it
|
||||
- Improved drag and drop functionality (drag and drop a link from Youtube into the web app)
|
||||
- New settings page, available on TV and web app
|
||||
- New preferences system
|
||||
- Unified settings between TV and web app
|
||||
- Web API allowing to import/export preferences (no UI for that yet)
|
||||
|
||||
### Changed
|
||||
|
||||
- SponsorBlock segments are not skipped by default, except for sponsor segments
|
||||
- Web app QR Code is now in its own page
|
||||
|
||||
### Removed
|
||||
|
||||
- The ability to set multiple Invidious instances. This was anticipated to use as fallback in case of failure, but it was never implemented. This is now removed to avoid confusion
|
||||
- Sometimes it is necesary to check multiple instances for closed captions in case one instance is saturated. For this case, publicly hosted Invidious instances will be used.
|
||||
- Of course, if no instance if provided, and public instance will be used by default. This behaviour did not change. It is now implicit.
|
||||
|
||||
## [0.9.0] - 2023-04-21
|
||||
|
||||
### Added
|
||||
|
||||
- Add watched videos to Invidious watch history
|
||||
- App info screen
|
||||
- A dev menu selector to test newer or older versions of playlet lib
|
||||
- Makes it possible to test unstable releases before they officially release
|
||||
|
||||
### Fixed
|
||||
|
||||
- A crash where the metadata of a video is not validated [#57](https://github.com/iBicha/playlet/issues/57)
|
||||
- A crash where the video details in home screen are null [#56](https://github.com/iBicha/playlet/issues/56)
|
||||
- A crash where the video details are not returned in json [#63](https://github.com/iBicha/playlet/issues/63)
|
||||
@@ -23,25 +49,33 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- A crash where request cache fails [#62](https://github.com/iBicha/playlet/issues/62)
|
||||
|
||||
## [0.8.0] - 2023-03-02
|
||||
|
||||
### Added
|
||||
|
||||
- SponsorBlock notification
|
||||
- Invidious username to web app v1
|
||||
|
||||
### Fixed
|
||||
|
||||
- Crash in case GetLocalIpAddress() returns invalid
|
||||
- Use Format Stream (720p) instead of DASH (https://github.com/iv-org/invidious/issues/3666)
|
||||
- Use Format Stream (720p) instead of DASH (<https://github.com/iv-org/invidious/issues/3666>)
|
||||
|
||||
## [0.7.0] - 2023-02-04
|
||||
|
||||
### Added
|
||||
|
||||
- A script to sync between Youtube profile and and Invidious profile
|
||||
- Moved most of Playlet logic to Playlet Lib
|
||||
- Support for multiple caption languages
|
||||
|
||||
#### Fixed
|
||||
|
||||
- Issue where auto-play keeps playing the same videos in a loop
|
||||
|
||||
## [0.6.0] - 2023-01-10
|
||||
|
||||
### Added
|
||||
|
||||
- Ability to clear search history from web app
|
||||
- WebSocket server for realtime events
|
||||
- SponsorBlock tracking
|
||||
@@ -50,11 +84,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Caching for video details
|
||||
|
||||
### Changed
|
||||
|
||||
- The License has changed from MIT to AGPL
|
||||
- Now videos play the next related/recommended video once finished
|
||||
- This does not take into account the videos in playlists
|
||||
|
||||
### Fixed
|
||||
|
||||
- Bug where app freezes if metadata fails to fetch
|
||||
- Bug where SponsorBlock returning videoDuration of zero causes the app to hang
|
||||
- Bug where app would lose focus when casting from web app
|
||||
@@ -62,10 +98,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Showing upcoming videos correctly
|
||||
|
||||
### Removed
|
||||
|
||||
- Dependency on [roku-promise](https://github.com/rokucommunity/roku-promise)
|
||||
|
||||
## [0.5.0] - 2022-12-02
|
||||
|
||||
### Added
|
||||
|
||||
- Version check in settings page
|
||||
- Support for web request body parsing
|
||||
- Error dialog for video load fail
|
||||
@@ -77,6 +116,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Error and Exit dialogs
|
||||
|
||||
### Fixed
|
||||
|
||||
- Bug where playing and exiting a video too quickly would cause the video to play in the background.
|
||||
- Bug where logging in causes issues if a video is already playing
|
||||
- Bug where casting from web app while playing a video from the search
|
||||
@@ -85,7 +125,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Race condition where button group gains focus before suggestions are set in Search Page
|
||||
|
||||
## [0.4.0] - 2022-11-24
|
||||
|
||||
### Added
|
||||
|
||||
- Play video API
|
||||
- Play video by ID/URL in web app
|
||||
- Metadata to Video Player
|
||||
@@ -95,13 +137,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Very basic UI to customize/change invidious instance
|
||||
|
||||
### Fixed
|
||||
|
||||
- Bug where Settings page and home page are both visible, if settings page is selected, and user logs in.
|
||||
|
||||
## [0.3.0] - 2022-11-19
|
||||
|
||||
### Changed
|
||||
|
||||
- App name! new name: **Playlet**
|
||||
|
||||
### Added
|
||||
|
||||
- Nav bar / menu
|
||||
- Web server now always on
|
||||
- Settings page with QR Code
|
||||
@@ -109,7 +155,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- New UI
|
||||
|
||||
## [0.2.0] - 2022-11-06
|
||||
|
||||
### Added
|
||||
|
||||
- QrCode component to take user to invidious token page
|
||||
- Web server allowing the recption of the token through call back
|
||||
- The web server can also be used to serve a web app, facilitating the
|
||||
@@ -121,7 +169,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Added basic instructions
|
||||
|
||||
## [0.1.0] - 2022-10-30
|
||||
|
||||
### Added
|
||||
|
||||
- Initial version
|
||||
- Reads feeds from popular and trending videos using Invidious APIs
|
||||
- Skips sections using SponsorBlock
|
||||
|
||||
<!-- markdownlint-configure-file {"MD024": { "siblings_only": true } } -->
|
||||
@@ -14,21 +14,21 @@
|
||||
"roku-requests": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.8.3",
|
||||
"@types/node": "^18.15.13",
|
||||
"@rokucommunity/bslint": "^0.8.6",
|
||||
"@types/node": "^20.3.1",
|
||||
"argparse": "^2.0.1",
|
||||
"brighterscript": "^0.64.2",
|
||||
"brighterscript-formatter": "^1.6.26",
|
||||
"brighterscript": "^0.65.1",
|
||||
"brighterscript-formatter": "^1.6.29",
|
||||
"convert-svg-to-png": "^0.6.4",
|
||||
"dotenv": "^16.0.3",
|
||||
"dotenv": "^16.3.1",
|
||||
"express": "^4.18.2",
|
||||
"ip": "^1.1.8",
|
||||
"roku-log-bsc-plugin": "^0.7.0",
|
||||
"ropm": "^0.10.13",
|
||||
"semver": "^7.5.0",
|
||||
"roku-log-bsc-plugin": "^0.8.1",
|
||||
"ropm": "^0.10.15",
|
||||
"semver": "^7.5.3",
|
||||
"shelljs": "^0.8.5",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^5.0.4"
|
||||
"typescript": "^5.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "<19.0.0"
|
||||
@@ -106,6 +106,56 @@
|
||||
"node": ">= 8"
|
||||
}
|
||||
},
|
||||
"node_modules/@postman/form-data": {
|
||||
"version": "3.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@postman/form-data/-/form-data-3.1.1.tgz",
|
||||
"integrity": "sha512-vjh8Q2a8S6UCm/KKs31XFJqEEgmbjBmpPNVV2eVav6905wyFAwaUOBGA1NPBI4ERH9MMZc6w0umFgM6WbEPMdg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/@postman/tough-cookie": {
|
||||
"version": "4.1.3-postman.1",
|
||||
"resolved": "https://registry.npmjs.org/@postman/tough-cookie/-/tough-cookie-4.1.3-postman.1.tgz",
|
||||
"integrity": "sha512-txpgUqZOnWYnUHZpHjkfb0IwVH4qJmyq77pPnJLlfhMtdCLMFTEeQHlzQiK906aaNCe4NEB5fGJHo9uzGbFMeA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"psl": "^1.1.33",
|
||||
"punycode": "^2.1.1",
|
||||
"universalify": "^0.2.0",
|
||||
"url-parse": "^1.5.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6"
|
||||
}
|
||||
},
|
||||
"node_modules/@postman/tough-cookie/node_modules/universalify": {
|
||||
"version": "0.2.0",
|
||||
"resolved": "https://registry.npmjs.org/universalify/-/universalify-0.2.0.tgz",
|
||||
"integrity": "sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 4.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@postman/tunnel-agent": {
|
||||
"version": "0.6.3",
|
||||
"resolved": "https://registry.npmjs.org/@postman/tunnel-agent/-/tunnel-agent-0.6.3.tgz",
|
||||
"integrity": "sha512-k57fzmAZ2PJGxfOA4SGR05ejorHbVAa/84Hxh/2nAztjNXc4ZjOm9NUIk6/Z6LCrBvJZqjRZbN8e/nROVUPVdg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/@rokucommunity/bslib": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/@rokucommunity/bslib/-/bslib-0.1.1.tgz",
|
||||
@@ -113,9 +163,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@rokucommunity/bslint": {
|
||||
"version": "0.8.3",
|
||||
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.3.tgz",
|
||||
"integrity": "sha512-CgUemN0evVIQ1CriO2EXkcKlvtbSZn4iq5yKSzZIwjulHPeIJLfVaiX6mX1HE1tiWnJJHOQsc8OtBgBCFQCO2A==",
|
||||
"version": "0.8.6",
|
||||
"resolved": "https://registry.npmjs.org/@rokucommunity/bslint/-/bslint-0.8.6.tgz",
|
||||
"integrity": "sha512-PsxZvOI9AvXO1SisJtSKLZUIosE1qhaoN8CgoLYqh4E2j72eL43cVCBj7Bhm1X3I9ykPEd9Wws8c+joca0m2uw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"fs-extra": "^10.0.0",
|
||||
@@ -149,15 +199,15 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@tsconfig/node16": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.3.tgz",
|
||||
"integrity": "sha512-yOlFc+7UtL/89t2ZhjPvvB/DeAr3r+Dq58IgzsFkOAvVC6NMJXmCGjbptdXdR9qsX7pKcTL+s87FtYREi2dEEQ==",
|
||||
"version": "1.0.4",
|
||||
"resolved": "https://registry.npmjs.org/@tsconfig/node16/-/node16-1.0.4.tgz",
|
||||
"integrity": "sha512-vxhUy4J8lyeyinH7Azl1pdd43GJhZH/tP2weN8TntQblOY+A0XbT8DJk1/oCPuOOyg/Ja757rG0CgHcWC8OfMA==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/node": {
|
||||
"version": "18.15.13",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-18.15.13.tgz",
|
||||
"integrity": "sha512-N+0kuo9KgrUQ1Sn/ifDXsvg0TTleP7rIy4zOBGECxAljqvqfqpTfzx0Q1NUedOixRMBfe2Whhb056a42cWs26Q==",
|
||||
"version": "20.3.1",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-20.3.1.tgz",
|
||||
"integrity": "sha512-EhcH/wvidPy1WeML3TtYFGR83UzjxeWRen9V402T8aUGYsCHOmfoisV3ZSg03gAFIbLq8TnWOJ0f4cALtnSEUg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/@types/yauzl": {
|
||||
@@ -222,9 +272,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/acorn": {
|
||||
"version": "8.8.2",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.8.2.tgz",
|
||||
"integrity": "sha512-xjIYgE8HBrkpd/sJqOGNspf8uHG+NOHGOw6a/Urj8taM2EXfdNAH2oFcPeIFfsv3+kz/mJrS5VuMqbNLjCa2vw==",
|
||||
"version": "8.9.0",
|
||||
"resolved": "https://registry.npmjs.org/acorn/-/acorn-8.9.0.tgz",
|
||||
"integrity": "sha512-jaVNAFBHNLXspO543WnNNPZFRtavh3skAkITqD0/2aeMkKZTN+254PyhwxFYrk3vQ1xfY+2wbesJMs/JC8/PwQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"acorn": "bin/acorn"
|
||||
@@ -493,6 +543,12 @@
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/bluebird": {
|
||||
"version": "2.11.0",
|
||||
"resolved": "https://registry.npmjs.org/bluebird/-/bluebird-2.11.0.tgz",
|
||||
"integrity": "sha512-UfFSr22dmHPQqPP9XWHRhq+gWnHCYguQGkXQlbyPtW5qTnhFWA8/iXg765tH0cAjy7l/zPJ1aBTO0g5XgA7kvQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/body-parser": {
|
||||
"version": "1.20.1",
|
||||
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz",
|
||||
@@ -546,9 +602,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/brighterscript": {
|
||||
"version": "0.64.2",
|
||||
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.64.2.tgz",
|
||||
"integrity": "sha512-FoPsHDa3y89qPMoDH7zGuPdFXNFlfWXdXFgWIGPymdVgywLLFaphlj7mdlX+ZdTeVcXybjVWKfyjrPRbNzJZxA==",
|
||||
"version": "0.65.1",
|
||||
"resolved": "https://registry.npmjs.org/brighterscript/-/brighterscript-0.65.1.tgz",
|
||||
"integrity": "sha512-OmNQd5Sckrx2K63y6cLbK8EIPqVi4yoc6bmz4k2J47NdnGib//JcMngJWG9JxJnCQCOuz1EheyPHW3jXryI7yg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@rokucommunity/bslib": "^0.1.1",
|
||||
@@ -558,12 +614,13 @@
|
||||
"chevrotain": "^7.0.1",
|
||||
"chokidar": "^3.5.1",
|
||||
"clear": "^0.1.0",
|
||||
"coveralls-next": "^4.2.0",
|
||||
"cross-platform-clear-console": "^2.3.0",
|
||||
"debounce-promise": "^3.1.0",
|
||||
"eventemitter3": "^4.0.0",
|
||||
"fast-glob": "^3.2.11",
|
||||
"fast-glob": "^3.2.12",
|
||||
"file-url": "^3.0.0",
|
||||
"fs-extra": "^8.0.0",
|
||||
"fs-extra": "^8.1.0",
|
||||
"jsonc-parser": "^2.3.0",
|
||||
"long": "^3.2.0",
|
||||
"luxon": "^2.5.2",
|
||||
@@ -571,8 +628,9 @@
|
||||
"moment": "^2.23.0",
|
||||
"p-settle": "^2.1.0",
|
||||
"parse-ms": "^2.1.0",
|
||||
"readline": "^1.3.0",
|
||||
"require-relative": "^0.8.7",
|
||||
"roku-deploy": "^3.10.1",
|
||||
"roku-deploy": "^3.10.2",
|
||||
"serialize-error": "^7.0.1",
|
||||
"source-map": "^0.7.4",
|
||||
"vscode-languageserver": "7.0.0",
|
||||
@@ -587,12 +645,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/brighterscript-formatter": {
|
||||
"version": "1.6.26",
|
||||
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.6.26.tgz",
|
||||
"integrity": "sha512-IT5BV+9HTr6Af23gB7hxH0Xyv8v0LIsLSsrKUFfmwHtJ1ILRI6kiyZDbZOlolYVPuX7y+0ed791CZGxfAIgm6w==",
|
||||
"version": "1.6.29",
|
||||
"resolved": "https://registry.npmjs.org/brighterscript-formatter/-/brighterscript-formatter-1.6.29.tgz",
|
||||
"integrity": "sha512-NfFscJM+9lEyaWrY5J9pliLOhNxiBkfsBKD8XmbigrbWpY4Ff6sqojw0Op2SFhySWy7N2e4J4inshx9FgKTI1A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"brighterscript": "^0.64.2",
|
||||
"brighterscript": "^0.65.0",
|
||||
"glob-all": "^3.3.0",
|
||||
"jsonc-parser": "^3.0.0",
|
||||
"source-map": "^0.7.3",
|
||||
@@ -683,9 +741,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/brighterscript-formatter/node_modules/yargs": {
|
||||
"version": "17.7.1",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.1.tgz",
|
||||
"integrity": "sha512-cwiTb08Xuv5fqF4AovYacTFNxk62th7LKJ6BL9IGUpTJrWoU7/7WdQGTP2SjKf1dUNBGzDd28p/Yfs/GI6JrLw==",
|
||||
"version": "17.7.2",
|
||||
"resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz",
|
||||
"integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"cliui": "^8.0.1",
|
||||
@@ -838,6 +896,15 @@
|
||||
"node": ">=10"
|
||||
}
|
||||
},
|
||||
"node_modules/brotli": {
|
||||
"version": "1.3.3",
|
||||
"resolved": "https://registry.npmjs.org/brotli/-/brotli-1.3.3.tgz",
|
||||
"integrity": "sha512-oTKjJdShmDuGW94SyyaoQvAjf30dZaHnjJ8uAF+u2/vGJkJbJPJAT1gDiOJP5v1Zb6f9KEyW/1HpuaWIXtGHPg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"base64-js": "^1.1.2"
|
||||
}
|
||||
},
|
||||
"node_modules/bslib": {
|
||||
"name": "@rokucommunity/bslib",
|
||||
"version": "0.1.1",
|
||||
@@ -1248,6 +1315,25 @@
|
||||
"integrity": "sha512-ZQBvi1DcpJ4GDqanjucZ2Hj3wEO5pZDS89BWbkcrvdxksJorwUDDZamX9ldFkp9aw2lmBDLgkObEA4DWNJ9FYQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/coveralls-next": {
|
||||
"version": "4.2.0",
|
||||
"resolved": "https://registry.npmjs.org/coveralls-next/-/coveralls-next-4.2.0.tgz",
|
||||
"integrity": "sha512-zg41a/4QDSASPtlV6gp+6owoU43U5CguxuPZR3nPZ26M5ZYdEK3MdUe7HwE+AnCZPkucudfhqqJZehCNkz2rYg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"form-data": "4.0.0",
|
||||
"js-yaml": "4.1.0",
|
||||
"lcov-parse": "1.0.0",
|
||||
"log-driver": "1.2.7",
|
||||
"minimist": "1.2.7"
|
||||
},
|
||||
"bin": {
|
||||
"coveralls": "bin/coveralls.js"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=14"
|
||||
}
|
||||
},
|
||||
"node_modules/create-require": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/create-require/-/create-require-1.1.1.tgz",
|
||||
@@ -1319,9 +1405,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/dayjs": {
|
||||
"version": "1.11.7",
|
||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.7.tgz",
|
||||
"integrity": "sha512-+Yw9U6YO5TQohxLcIkrXBeY73WP3ejHWVvx8XCk3gxvQDCTEmS48ZrSZCKciI7Bhl/uCMyxYtE9UqRILmFphkQ==",
|
||||
"version": "1.11.8",
|
||||
"resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.8.tgz",
|
||||
"integrity": "sha512-LcgxzFoWMEPO7ggRv1Y2N31hUf2R0Vj7fuy/m+Bg1K8rr+KAs1AEy4y9jd5DXe8pbHgX+srkHNS7TH6Q6ZhYeQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/debounce-promise": {
|
||||
@@ -1467,26 +1553,29 @@
|
||||
}
|
||||
},
|
||||
"node_modules/domutils": {
|
||||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/domutils/-/domutils-3.0.1.tgz",
|
||||
"integrity": "sha512-z08c1l761iKhDFtfXO04C7kTdPBLi41zwOZl00WS8b5eiaebNpY00HKbztwBq+e3vyqWNwWF3mP9YLUeqIrF+Q==",
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/domutils/-/domutils-3.1.0.tgz",
|
||||
"integrity": "sha512-H78uMmQtI2AhgDJjWeQmHwJJ2bLPD3GMmO7Zja/ZZh84wkm+4ut+IUnUdRa8uCGX88DiVx1j6FRe1XfxEgjEZA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"dom-serializer": "^2.0.0",
|
||||
"domelementtype": "^2.3.0",
|
||||
"domhandler": "^5.0.1"
|
||||
"domhandler": "^5.0.3"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/fb55/domutils?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/dotenv": {
|
||||
"version": "16.0.3",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
|
||||
"integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==",
|
||||
"version": "16.3.1",
|
||||
"resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
|
||||
"integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=12"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/motdotla/dotenv?sponsor=1"
|
||||
}
|
||||
},
|
||||
"node_modules/ecc-jsbn": {
|
||||
@@ -1788,17 +1877,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/form-data": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-2.3.3.tgz",
|
||||
"integrity": "sha512-1lLKB2Mu3aGP1Q/2eCOx0fNbRMe7XdwktwOruhfqqd0rIJWwN4Dh+E3hrPSlDCXnSR7UtZ1N38rVXm+6+MEhJQ==",
|
||||
"version": "4.0.0",
|
||||
"resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
|
||||
"integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"asynckit": "^0.4.0",
|
||||
"combined-stream": "^1.0.6",
|
||||
"combined-stream": "^1.0.8",
|
||||
"mime-types": "^2.1.12"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.12"
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/forwarded": {
|
||||
@@ -1875,13 +1964,14 @@
|
||||
}
|
||||
},
|
||||
"node_modules/get-intrinsic": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz",
|
||||
"integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==",
|
||||
"version": "1.2.1",
|
||||
"resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz",
|
||||
"integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"function-bind": "^1.1.1",
|
||||
"has": "^1.0.3",
|
||||
"has-proto": "^1.0.1",
|
||||
"has-symbols": "^1.0.3"
|
||||
},
|
||||
"funding": {
|
||||
@@ -2085,6 +2175,18 @@
|
||||
"node": ">=4"
|
||||
}
|
||||
},
|
||||
"node_modules/has-proto": {
|
||||
"version": "1.0.1",
|
||||
"resolved": "https://registry.npmjs.org/has-proto/-/has-proto-1.0.1.tgz",
|
||||
"integrity": "sha512-7qE+iP+O+bgF9clE5+UoBFzE65mlBiVj3tKCrlNQ0Ogwm0BjpT/gK4SlLYDMybDh5I3TCTKnPPa0oMG7JDYrhg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">= 0.4"
|
||||
},
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/has-symbols": {
|
||||
"version": "1.0.3",
|
||||
"resolved": "https://registry.npmjs.org/has-symbols/-/has-symbols-1.0.3.tgz",
|
||||
@@ -2133,18 +2235,17 @@
|
||||
}
|
||||
},
|
||||
"node_modules/http-signature": {
|
||||
"version": "1.2.0",
|
||||
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.2.0.tgz",
|
||||
"integrity": "sha512-CAbnr6Rz4CYQkLYUtSNXxQPUH2gK8f3iWexVlsnMeD+GjlsQ0Xsy1cOX+mN3dtxYomRy21CiOzU8Uhw6OwncEQ==",
|
||||
"version": "1.3.6",
|
||||
"resolved": "https://registry.npmjs.org/http-signature/-/http-signature-1.3.6.tgz",
|
||||
"integrity": "sha512-3adrsD6zqo4GsTqtO7FyrejHNv+NgiIfAfv68+jVlFmSr9OGy7zrxONceFRLKvnnZA5jbxQBX1u9PpB6Wi32Gw==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"assert-plus": "^1.0.0",
|
||||
"jsprim": "^1.2.2",
|
||||
"sshpk": "^1.7.0"
|
||||
"jsprim": "^2.0.2",
|
||||
"sshpk": "^1.14.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8",
|
||||
"npm": ">=1.3.7"
|
||||
"node": ">=0.10"
|
||||
}
|
||||
},
|
||||
"node_modules/https-proxy-agent": {
|
||||
@@ -2301,9 +2402,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/is-core-module": {
|
||||
"version": "2.12.0",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz",
|
||||
"integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==",
|
||||
"version": "2.12.1",
|
||||
"resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.1.tgz",
|
||||
"integrity": "sha512-Q4ZuBAe2FUsKtyQJoQHlvP8OvBERxO3jEmy1I7hcRXcJBGGHFh/aJBswbXuS9sgrDH2QUO8ilkwNPHvHMd8clg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"has": "^1.0.3"
|
||||
@@ -2405,6 +2506,18 @@
|
||||
"integrity": "sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/js-yaml": {
|
||||
"version": "4.1.0",
|
||||
"resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz",
|
||||
"integrity": "sha512-wpxZs9NoxZaJESJGIZTyDEaYpl0FKSA+FB9aJiyemKhMwkxQg63h4T1KJgUGHpTqPDNRcmmYLugrRjJlBtWvRA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"argparse": "^2.0.1"
|
||||
},
|
||||
"bin": {
|
||||
"js-yaml": "bin/js-yaml.js"
|
||||
}
|
||||
},
|
||||
"node_modules/jsbn": {
|
||||
"version": "0.1.1",
|
||||
"resolved": "https://registry.npmjs.org/jsbn/-/jsbn-0.1.1.tgz",
|
||||
@@ -2448,18 +2561,18 @@
|
||||
}
|
||||
},
|
||||
"node_modules/jsprim": {
|
||||
"version": "1.4.2",
|
||||
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-1.4.2.tgz",
|
||||
"integrity": "sha512-P2bSOMAc/ciLz6DzgjVlGJP9+BrJWu5UDGK70C2iweC5QBIeFf0ZXRvGjEj2uYgrY2MkAAhsSWHDWlFtEroZWw==",
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/jsprim/-/jsprim-2.0.2.tgz",
|
||||
"integrity": "sha512-gqXddjPqQ6G40VdnI6T6yObEC+pDNvyP95wdQhkWkg7crHH3km5qP1FsOXEkzEQwnz6gz5qGTn1c2Y52wP3OyQ==",
|
||||
"dev": true,
|
||||
"engines": [
|
||||
"node >=0.6.0"
|
||||
],
|
||||
"dependencies": {
|
||||
"assert-plus": "1.0.0",
|
||||
"extsprintf": "1.3.0",
|
||||
"json-schema": "0.4.0",
|
||||
"verror": "1.10.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.6.0"
|
||||
}
|
||||
},
|
||||
"node_modules/jszip": {
|
||||
@@ -2480,6 +2593,15 @@
|
||||
"integrity": "sha512-SHzxgdcFP/64lUEfX3183QALY2KdSQxad3gmhCc/b03QN1mbx0AnJWvsQjqoJLbucY9pJuK+NMbnasUIocDmnQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/lcov-parse": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/lcov-parse/-/lcov-parse-1.0.0.tgz",
|
||||
"integrity": "sha512-aprLII/vPzuQvYZnDRU78Fns9I2Ag3gi4Ipga/hxnVMCZC8DnR2nI7XBqrPoywGfxqIx/DgarGvDJZAD3YBTgQ==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"lcov-parse": "bin/cli.js"
|
||||
}
|
||||
},
|
||||
"node_modules/lie": {
|
||||
"version": "3.3.0",
|
||||
"resolved": "https://registry.npmjs.org/lie/-/lie-3.3.0.tgz",
|
||||
@@ -2528,6 +2650,15 @@
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1"
|
||||
}
|
||||
},
|
||||
"node_modules/log-driver": {
|
||||
"version": "1.2.7",
|
||||
"resolved": "https://registry.npmjs.org/log-driver/-/log-driver-1.2.7.tgz",
|
||||
"integrity": "sha512-U7KCmLdqsGHBLeWqYlFA0V0Sl6P08EE1ZrmA9cxjUE0WVqT9qnyVDPz1kzpFEP0jdJuFnasWIfSd7fsaNXkpbg==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.8.6"
|
||||
}
|
||||
},
|
||||
"node_modules/long": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/long/-/long-3.2.0.tgz",
|
||||
@@ -2655,6 +2786,15 @@
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/minimist": {
|
||||
"version": "1.2.7",
|
||||
"resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.7.tgz",
|
||||
"integrity": "sha512-bzfL1YUZsP41gmu/qjrEk0Q6i2ix/cVeAhbCbqH9u3zYutS1cLg00qhrD0M2MVdCcx4Sc0UpP2eBWo9rotpq6g==",
|
||||
"dev": true,
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/mkdirp-classic": {
|
||||
"version": "0.5.3",
|
||||
"resolved": "https://registry.npmjs.org/mkdirp-classic/-/mkdirp-classic-0.5.3.tgz",
|
||||
@@ -3042,6 +3182,48 @@
|
||||
"integrity": "sha512-2Xy6LImSXm0ANKv9BKSVuCa6Z4ACbK7oUrl9gtUgqLkekL7n9C0mlWsOGYYuGbCG8xT0x3Q4F31C3ZMyVQjwsg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/postman-request": {
|
||||
"version": "2.88.1-postman.33",
|
||||
"resolved": "https://registry.npmjs.org/postman-request/-/postman-request-2.88.1-postman.33.tgz",
|
||||
"integrity": "sha512-uL9sCML4gPH6Z4hreDWbeinKU0p0Ke261nU7OvII95NU22HN6Dk7T/SaVPaj6T4TsQqGKIFw6/woLZnH7ugFNA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@postman/form-data": "~3.1.1",
|
||||
"@postman/tough-cookie": "~4.1.3-postman.1",
|
||||
"@postman/tunnel-agent": "^0.6.3",
|
||||
"aws-sign2": "~0.7.0",
|
||||
"aws4": "^1.12.0",
|
||||
"brotli": "^1.3.3",
|
||||
"caseless": "~0.12.0",
|
||||
"combined-stream": "~1.0.6",
|
||||
"extend": "~3.0.2",
|
||||
"forever-agent": "~0.6.1",
|
||||
"har-validator": "~5.1.3",
|
||||
"http-signature": "~1.3.1",
|
||||
"is-typedarray": "~1.0.0",
|
||||
"isstream": "~0.1.2",
|
||||
"json-stringify-safe": "~5.0.1",
|
||||
"mime-types": "^2.1.35",
|
||||
"oauth-sign": "~0.9.0",
|
||||
"performance-now": "^2.1.0",
|
||||
"qs": "~6.5.3",
|
||||
"safe-buffer": "^5.1.2",
|
||||
"stream-length": "^1.0.2",
|
||||
"uuid": "^8.3.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/postman-request/node_modules/qs": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz",
|
||||
"integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/process-nextick-args": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz",
|
||||
@@ -3164,6 +3346,12 @@
|
||||
"url": "https://github.com/sponsors/ljharb"
|
||||
}
|
||||
},
|
||||
"node_modules/querystringify": {
|
||||
"version": "2.2.0",
|
||||
"resolved": "https://registry.npmjs.org/querystringify/-/querystringify-2.2.0.tgz",
|
||||
"integrity": "sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/queue-microtask": {
|
||||
"version": "1.2.3",
|
||||
"resolved": "https://registry.npmjs.org/queue-microtask/-/queue-microtask-1.2.3.tgz",
|
||||
@@ -3241,6 +3429,12 @@
|
||||
"node": ">=8.10.0"
|
||||
}
|
||||
},
|
||||
"node_modules/readline": {
|
||||
"version": "1.3.0",
|
||||
"resolved": "https://registry.npmjs.org/readline/-/readline-1.3.0.tgz",
|
||||
"integrity": "sha512-k2d6ACCkiNYz222Fs/iNze30rRJ1iIicW7JuX/7/cozvih6YCkFZH+J6mAFDVgv0dRBaAyr4jDqC95R2y4IADg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/rechoir": {
|
||||
"version": "0.6.2",
|
||||
"resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz",
|
||||
@@ -3259,47 +3453,6 @@
|
||||
"integrity": "sha512-tlbJqcMHnPKI9zSrystikWKwHkBqu2a/Sgw01h3zFjvYrMxEDYHzzoMZnUrbIfpTFEsoRnnviOXNCzFiSc54Qw==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/request": {
|
||||
"version": "2.88.2",
|
||||
"resolved": "https://registry.npmjs.org/request/-/request-2.88.2.tgz",
|
||||
"integrity": "sha512-MsvtOrfG9ZcrOwAW+Qi+F6HbD0CWXEh9ou77uOb7FM2WPhwT7smM833PzanhJLsgXjN89Ir6V2PczXNnMpwKhw==",
|
||||
"deprecated": "request has been deprecated, see https://github.com/request/request/issues/3142",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"aws-sign2": "~0.7.0",
|
||||
"aws4": "^1.8.0",
|
||||
"caseless": "~0.12.0",
|
||||
"combined-stream": "~1.0.6",
|
||||
"extend": "~3.0.2",
|
||||
"forever-agent": "~0.6.1",
|
||||
"form-data": "~2.3.2",
|
||||
"har-validator": "~5.1.3",
|
||||
"http-signature": "~1.2.0",
|
||||
"is-typedarray": "~1.0.0",
|
||||
"isstream": "~0.1.2",
|
||||
"json-stringify-safe": "~5.0.1",
|
||||
"mime-types": "~2.1.19",
|
||||
"oauth-sign": "~0.9.0",
|
||||
"performance-now": "^2.1.0",
|
||||
"qs": "~6.5.2",
|
||||
"safe-buffer": "^5.1.2",
|
||||
"tough-cookie": "~2.5.0",
|
||||
"tunnel-agent": "^0.6.0",
|
||||
"uuid": "^3.3.2"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 6"
|
||||
}
|
||||
},
|
||||
"node_modules/request/node_modules/qs": {
|
||||
"version": "6.5.3",
|
||||
"resolved": "https://registry.npmjs.org/qs/-/qs-6.5.3.tgz",
|
||||
"integrity": "sha512-qxXIEh4pCGfHICj1mAJQ2/2XVZkjCDTcEgfoSQxc/fYivUZxTkk7L3bDBJSoNrEzXI17oUO5Dp07ktqE5KzczA==",
|
||||
"dev": true,
|
||||
"engines": {
|
||||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/require-directory": {
|
||||
"version": "2.1.1",
|
||||
"resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
|
||||
@@ -3321,6 +3474,12 @@
|
||||
"integrity": "sha512-AKGr4qvHiryxRb19m3PsLRGuKVAbJLUD7E6eOaHkfKhwc+vSgVOCY5xNvm9EkolBKTOf0GrQAZKLimOCz81Khg==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/requires-port": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/requires-port/-/requires-port-1.0.0.tgz",
|
||||
"integrity": "sha512-KigOCHcocU3XODJxsu8i/j8T9tzT4adHiecwORRQ0ZZFcp7ahwXuRU1m+yuO90C5ZUyGeGfocHDI14M3L3yDAQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/resolve": {
|
||||
"version": "1.22.2",
|
||||
"resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.2.tgz",
|
||||
@@ -3384,9 +3543,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/roku-deploy": {
|
||||
"version": "3.10.1",
|
||||
"resolved": "https://registry.npmjs.org/roku-deploy/-/roku-deploy-3.10.1.tgz",
|
||||
"integrity": "sha512-utPNny0a2m/N0AQT6zyVLXtrr81KR5QeJqPUbc59VBcqGM+WIi7rQ9hBLmp5dFqIo/7JVKQYFs+nFGebOA6F7w==",
|
||||
"version": "3.10.2",
|
||||
"resolved": "https://registry.npmjs.org/roku-deploy/-/roku-deploy-3.10.2.tgz",
|
||||
"integrity": "sha512-oKMw8+CpbvFrNjf3g7PmhSRInTXitaFmtFhxb0ANiE+sC2p+/8wn/1/KqnYsTWPdEKUOLh0xIz2FHK9Nd5o9UA==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"chalk": "^2.4.2",
|
||||
@@ -3400,7 +3559,7 @@
|
||||
"micromatch": "^4.0.4",
|
||||
"moment": "^2.29.1",
|
||||
"parse-ms": "^2.1.0",
|
||||
"request": "^2.88.0",
|
||||
"postman-request": "^2.88.1-postman.32",
|
||||
"temp-dir": "^2.0.0",
|
||||
"xml2js": "^0.5.0"
|
||||
},
|
||||
@@ -3441,14 +3600,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/roku-log-bsc-plugin": {
|
||||
"version": "0.7.0",
|
||||
"resolved": "https://registry.npmjs.org/roku-log-bsc-plugin/-/roku-log-bsc-plugin-0.7.0.tgz",
|
||||
"integrity": "sha512-yaQWEw9OU21PCYrApYFRTUW7cnIG6dMYnSKvlTvtOfjHiLcbfBSu0RgafzK6Pg4RNbJ3JM7cWLsFtPEmylvraA==",
|
||||
"version": "0.8.1",
|
||||
"resolved": "https://registry.npmjs.org/roku-log-bsc-plugin/-/roku-log-bsc-plugin-0.8.1.tgz",
|
||||
"integrity": "sha512-GL/fM4vx1BCLHny9yC1RR81v8LY6FDAWx4jGkivGz36/wZfRDnM9MqSSIgJ4z7p0Jns4AL2o80MNd9Ytaulo/A==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@rokucommunity/bslib": "^0.1.1",
|
||||
"@types/node": "^14.18.12",
|
||||
"bslib": "npm:@rokucommunity/bslib@^0.1.1",
|
||||
"@types/node": "^16.18.10",
|
||||
"source-map": "^0.7.3",
|
||||
"stringify-object": "^3.3.0",
|
||||
"vscode-languageserver": "~6.1.1",
|
||||
@@ -3456,9 +3613,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/roku-log-bsc-plugin/node_modules/@types/node": {
|
||||
"version": "14.18.42",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-14.18.42.tgz",
|
||||
"integrity": "sha512-xefu+RBie4xWlK8hwAzGh3npDz/4VhF6icY/shU+zv/1fNn+ZVG7T7CRwe9LId9sAYRPxI+59QBPuKL3WpyGRg==",
|
||||
"version": "16.18.36",
|
||||
"resolved": "https://registry.npmjs.org/@types/node/-/node-16.18.36.tgz",
|
||||
"integrity": "sha512-8egDX8dE50XyXWH6C6PRCNkTP106DuUrvdrednFouDSmCi7IOvrqr0frznfZaHifHH/3aq/7a7v9N4wdXMqhBQ==",
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/roku-log-bsc-plugin/node_modules/vscode-jsonrpc": {
|
||||
@@ -3504,20 +3661,20 @@
|
||||
"integrity": "sha512-X6XakmJwxT8H+YNvjZOwH+k8rmYpD5o47k37WyZJ/brrSD6cw9xbNdxO203nz6jpso4maQJGwSJvLGZpzSQ0AA=="
|
||||
},
|
||||
"node_modules/ropm": {
|
||||
"version": "0.10.13",
|
||||
"resolved": "https://registry.npmjs.org/ropm/-/ropm-0.10.13.tgz",
|
||||
"integrity": "sha512-WlYorFMbnZGaNbKEXb6RX64wLOE/RHttzDuuQBkf2J7HbgQHseLbVdHBVaAb+SiS7BLK5xzJOoTsFbV2YTXsvg==",
|
||||
"version": "0.10.15",
|
||||
"resolved": "https://registry.npmjs.org/ropm/-/ropm-0.10.15.tgz",
|
||||
"integrity": "sha512-uQlWIgDLNlUzHVqm9WHJ9Gtm1uomX8OMhdZq5My9xAyjdtF2vk9vtIIT/hKeaVCRWWXr/RAAcU0uiMVEiNi6ww==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"@xml-tools/ast": "^5.0.5",
|
||||
"@xml-tools/parser": "1.0.10",
|
||||
"brighterscript": "^0.64.2",
|
||||
"brighterscript": "^0.65.0",
|
||||
"del": "6.0.0",
|
||||
"fs-extra": "9.1.0",
|
||||
"glob-all": "3.2.1",
|
||||
"latinize": "0.5.0",
|
||||
"npm-packlist": "2.1.4",
|
||||
"roku-deploy": "^3.10.1",
|
||||
"roku-deploy": "^3.10.2",
|
||||
"semver": "7.3.4",
|
||||
"yargs": "16.2.0"
|
||||
},
|
||||
@@ -3784,9 +3941,9 @@
|
||||
"dev": true
|
||||
},
|
||||
"node_modules/semver": {
|
||||
"version": "7.5.0",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.0.tgz",
|
||||
"integrity": "sha512-+XC0AD/R7Q2mPSRuy2Id0+CGTZ98+8f+KvwirxOKIEyid+XSx6HbC63p+O4IndTHuX5Z+JxQ0TghCkO5Cg/2HA==",
|
||||
"version": "7.5.3",
|
||||
"resolved": "https://registry.npmjs.org/semver/-/semver-7.5.3.tgz",
|
||||
"integrity": "sha512-QBlUtyVk/5EeHbi7X0fw6liDZc7BBmEaSYn01fMU1OUYbf6GPsbTtd8WmnqbI20SeycoHSeiybkE/q1Q+qlThQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"lru-cache": "^6.0.0"
|
||||
@@ -3979,6 +4136,15 @@
|
||||
"node": ">= 0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/stream-length": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/stream-length/-/stream-length-1.0.2.tgz",
|
||||
"integrity": "sha512-aI+qKFiwoDV4rsXiS7WRoCt+v2RX1nUj17+KJC5r2gfh5xoSJIfP6Y3Do/HtvesFcTSWthIuJ3l1cvKQY/+nZg==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"bluebird": "^2.6.2"
|
||||
}
|
||||
},
|
||||
"node_modules/string_decoder": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.1.1.tgz",
|
||||
@@ -4148,19 +4314,6 @@
|
||||
"node": ">=0.6"
|
||||
}
|
||||
},
|
||||
"node_modules/tough-cookie": {
|
||||
"version": "2.5.0",
|
||||
"resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.5.0.tgz",
|
||||
"integrity": "sha512-nlLsUzgm1kfLXSXfRZMc1KLAugd4hqJHDTvc2hDIwS3mZAfMEuMbc03SujMF+GEcpaX/qboeycw6iO8JwVv2+g==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"psl": "^1.1.28",
|
||||
"punycode": "^2.1.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=0.8"
|
||||
}
|
||||
},
|
||||
"node_modules/tr46": {
|
||||
"version": "0.0.3",
|
||||
"resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
|
||||
@@ -4210,18 +4363,6 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/tunnel-agent": {
|
||||
"version": "0.6.0",
|
||||
"resolved": "https://registry.npmjs.org/tunnel-agent/-/tunnel-agent-0.6.0.tgz",
|
||||
"integrity": "sha512-McnNiV1l8RYeY8tBgEpuodCC1mLUdbSN+CYBL7kJsJNInOP8UjDDEwdk6Mw60vdLLrr5NHKZhMAOSrR2NZuQ+w==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"safe-buffer": "^5.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "*"
|
||||
}
|
||||
},
|
||||
"node_modules/tweetnacl": {
|
||||
"version": "0.14.5",
|
||||
"resolved": "https://registry.npmjs.org/tweetnacl/-/tweetnacl-0.14.5.tgz",
|
||||
@@ -4254,16 +4395,16 @@
|
||||
}
|
||||
},
|
||||
"node_modules/typescript": {
|
||||
"version": "5.0.4",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.4.tgz",
|
||||
"integrity": "sha512-cW9T5W9xY37cc+jfEnaUvX91foxtHkza3Nw3wkoF4sSlKn0MONdkdEndig/qPBWXNkmplh3NzayQzCiHM4/hqw==",
|
||||
"version": "5.1.3",
|
||||
"resolved": "https://registry.npmjs.org/typescript/-/typescript-5.1.3.tgz",
|
||||
"integrity": "sha512-XH627E9vkeqhlZFQuL+UsyAXEnibT0kWR2FWONlr4sTjvxyJYnyefgrkyECLzM5NenmKzRAy2rR/OlYLA1HkZw==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"tsc": "bin/tsc",
|
||||
"tsserver": "bin/tsserver"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=12.20"
|
||||
"node": ">=14.17"
|
||||
}
|
||||
},
|
||||
"node_modules/unbzip2-stream": {
|
||||
@@ -4303,6 +4444,16 @@
|
||||
"punycode": "^2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/url-parse": {
|
||||
"version": "1.5.10",
|
||||
"resolved": "https://registry.npmjs.org/url-parse/-/url-parse-1.5.10.tgz",
|
||||
"integrity": "sha512-WypcfiRhfeUP9vvF0j6rw0J3hrWrw6iZv3+22h6iRMJ/8z1Tj6XfLP4DsUix5MhMPnXpiHDoKyoZ/bdCkwBCiQ==",
|
||||
"dev": true,
|
||||
"dependencies": {
|
||||
"querystringify": "^2.1.1",
|
||||
"requires-port": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/util-deprecate": {
|
||||
"version": "1.0.2",
|
||||
"resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz",
|
||||
@@ -4319,13 +4470,12 @@
|
||||
}
|
||||
},
|
||||
"node_modules/uuid": {
|
||||
"version": "3.4.0",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
|
||||
"integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A==",
|
||||
"deprecated": "Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.",
|
||||
"version": "8.3.2",
|
||||
"resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz",
|
||||
"integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==",
|
||||
"dev": true,
|
||||
"bin": {
|
||||
"uuid": "bin/uuid"
|
||||
"uuid": "dist/bin/uuid"
|
||||
}
|
||||
},
|
||||
"node_modules/v8-compile-cache-lib": {
|
||||
|
||||
@@ -8,21 +8,21 @@
|
||||
"roku-requests": "^1.2.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.8.3",
|
||||
"@types/node": "^18.15.13",
|
||||
"@rokucommunity/bslint": "^0.8.6",
|
||||
"@types/node": "^20.3.1",
|
||||
"argparse": "^2.0.1",
|
||||
"brighterscript": "^0.64.2",
|
||||
"brighterscript-formatter": "^1.6.26",
|
||||
"brighterscript": "^0.65.1",
|
||||
"brighterscript-formatter": "^1.6.29",
|
||||
"convert-svg-to-png": "^0.6.4",
|
||||
"dotenv": "^16.0.3",
|
||||
"dotenv": "^16.3.1",
|
||||
"express": "^4.18.2",
|
||||
"ip": "^1.1.8",
|
||||
"roku-log-bsc-plugin": "^0.7.0",
|
||||
"ropm": "^0.10.13",
|
||||
"semver": "^7.5.0",
|
||||
"roku-log-bsc-plugin": "^0.8.1",
|
||||
"ropm": "^0.10.15",
|
||||
"semver": "^7.5.3",
|
||||
"shelljs": "^0.8.5",
|
||||
"ts-node": "^10.9.1",
|
||||
"typescript": "^5.0.4"
|
||||
"typescript": "^5.1.3"
|
||||
},
|
||||
"engines": {
|
||||
"node": "<19.0.0"
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
</interface>
|
||||
<children>
|
||||
<LabelList
|
||||
translation="[160,92]"
|
||||
translation="[170,92]"
|
||||
itemSize="[1020,48]"
|
||||
font='font:SmallestBoldSystemFont'>
|
||||
<ContentNode id="KeyValueListContent" role="content">
|
||||
|
||||
@@ -3,21 +3,7 @@ import "pkg:/source/roku_modules/rokurequests/Requests.brs"
|
||||
|
||||
@asynctask
|
||||
function AppVersionTask() as object
|
||||
latest = "N/A"
|
||||
args = {
|
||||
parseJson: false
|
||||
}
|
||||
response = Requests().request("HEAD", "https://github.com/iBicha/playlet/releases/latest", args)
|
||||
|
||||
if response.statusCode = 200
|
||||
if response.headers.location <> invalid
|
||||
regex = CreateObject("roRegex", "/v?(\d+\.\d+\.\d+)", "")
|
||||
match = regex.match(response.headers.location)
|
||||
if match.Count() = 2
|
||||
latest = match[1]
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
latest = GetLatestPlayletLibVersion()
|
||||
|
||||
return {
|
||||
latest: latest
|
||||
|
||||
@@ -7,8 +7,6 @@ function Init()
|
||||
m.top.ObserveField("rowItemSelected", "OnHomeGridScreenVideoSelected")
|
||||
m.top.ObserveField("focus", "OnFocusChange")
|
||||
m.top.ObserveField("refresh", "OnRefresh")
|
||||
|
||||
InitContent()
|
||||
end function
|
||||
|
||||
function OnFocusChange()
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
rowItemSpacing="[[25,0]]"
|
||||
itemSize="[1280,326]"
|
||||
itemSpacing="[0,65]"
|
||||
rowLabelOffset="[[95,20]]"
|
||||
focusXOffset="[95]"
|
||||
rowLabelOffset="[[105,20]]"
|
||||
focusXOffset="[105]"
|
||||
showRowLabel="[true]"
|
||||
rowFocusAnimationStyle="floatingfocus"
|
||||
focusBitmapUri="pkg:/images/focus_grid.9.png"
|
||||
|
||||
@@ -10,19 +10,12 @@ function GetHomeScreenContent(input as object) as object
|
||||
|
||||
response = service.MakeRequest(requestData)
|
||||
if response <> invalid
|
||||
if type(response) = "roAssociativeArray"
|
||||
for each key in response
|
||||
rowContent = GetCategoryContent(key, response[key])
|
||||
if rowContent <> invalid
|
||||
rootChildren.Push(rowContent)
|
||||
end if
|
||||
end for
|
||||
else
|
||||
rowContent = GetCategoryContent(requestData.title, response)
|
||||
for each item in response
|
||||
rowContent = GetCategoryContent(item.title, item.videos)
|
||||
if rowContent <> invalid
|
||||
rootChildren.Push(rowContent)
|
||||
end if
|
||||
end if
|
||||
end for
|
||||
end if
|
||||
|
||||
return {
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
import "pkg:/source/services/InvidiousSettings.bs"
|
||||
|
||||
@asynctask
|
||||
function InvidiousPublicInstancesTask(input as object) as object
|
||||
' TODO: Move this to a better place
|
||||
' Caching backup instances in this task to avoid having to do it in the UI thread
|
||||
' Should be moved to a better place
|
||||
backupInstances = InvidiousSettings.FetchBackupInstances()
|
||||
|
||||
return {
|
||||
backupInstances: backupInstances
|
||||
}
|
||||
end function
|
||||
@@ -1,5 +1,6 @@
|
||||
import "pkg:/source/roku_modules/log/LogMixin.brs"
|
||||
import "pkg:/components/VideoPlayer/Video.bs"
|
||||
import "pkg:/components/Invidious/InvidiousPublicInstancesTask.bs"
|
||||
|
||||
function Init()
|
||||
log.initializeLogManager(["log_PrintTransport"], 2)
|
||||
@@ -15,8 +16,12 @@ function Init()
|
||||
m.currentFocued = m.homeGridScreen
|
||||
|
||||
m.settingsScreen = m.top.findNode("SettingsScreen")
|
||||
m.settingsScreen.ObserveField("escape", "OnSettingsScreenEscape")
|
||||
|
||||
m.appInfoScreen = m.top.findNode("AppInfoScreen")
|
||||
|
||||
m.webAppScreen = m.top.findNode("WebAppScreen")
|
||||
|
||||
m.searchScreen = m.top.findNode("SearchScreen")
|
||||
m.searchScreen.ObserveField("escape", "OnSearchScreenEscape")
|
||||
|
||||
@@ -29,6 +34,9 @@ function Init()
|
||||
canEscape: true
|
||||
}, {
|
||||
node: m.settingsScreen,
|
||||
canEscape: true
|
||||
}, {
|
||||
node: m.webAppScreen,
|
||||
canEscape: false
|
||||
}, {
|
||||
node: m.appInfoScreen,
|
||||
@@ -39,6 +47,17 @@ function Init()
|
||||
|
||||
InitWebServer()
|
||||
|
||||
StartAsyncTask(InvidiousPublicInstancesTask, {}, OnInvidiousPublicInstancesTaskResults)
|
||||
end function
|
||||
|
||||
function OnInvidiousPublicInstancesTaskResults(output as object)
|
||||
backupInstances = output.result.backupInstances
|
||||
m.global.addFields({
|
||||
invidiousBackupInstances: backupInstances
|
||||
})
|
||||
|
||||
m.homeGridScreen.refresh = true
|
||||
|
||||
LaunchArgumentsReceived()
|
||||
|
||||
scene = m.top.getScene()
|
||||
@@ -60,6 +79,12 @@ function OnSearchScreenEscape()
|
||||
m.currentFocued = m.navBar
|
||||
end function
|
||||
|
||||
function OnSettingsScreenEscape()
|
||||
m.navBar.SetFocus(true)
|
||||
m.navBar.focusIndex = 2
|
||||
m.currentFocued = m.navBar
|
||||
end function
|
||||
|
||||
function OnHomeGridScreenEscape()
|
||||
m.navBar.SetFocus(true)
|
||||
m.navBar.focusIndex = 1
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<SearchScreen id="SearchScreen" visible="false" />
|
||||
<HomeGridScreen id="HomeGridScreen" />
|
||||
<SettingsScreen id="SettingsScreen" visible="false" />
|
||||
<WebAppScreen id="WebAppScreen" visible="false" />
|
||||
<AppInfoScreen id="AppInfoScreen" visible="false" />
|
||||
<NavBar id="NavBar" />
|
||||
<VideoContainer id="VideoContainer" />
|
||||
|
||||
@@ -38,8 +38,8 @@ function onTextChanged()
|
||||
end function
|
||||
|
||||
function setIconSize()
|
||||
height = m.buttonBackground.height
|
||||
width = m.buttonBackground.width
|
||||
height = m.top.height
|
||||
width = m.top.width
|
||||
if height > 0 and width > 0
|
||||
' TODO: Use smallest number between them
|
||||
m.buttonIcon.height = m.top.height
|
||||
@@ -62,7 +62,8 @@ function onHeightChanged()
|
||||
end function
|
||||
|
||||
function onWidthChanged()
|
||||
m.buttonBackground.width = m.top.width
|
||||
m.buttonBackground.width = m.top.width - 10
|
||||
m.buttonBackground.translation = [5, 0]
|
||||
setIconSize()
|
||||
end function
|
||||
|
||||
|
||||
@@ -32,7 +32,7 @@ function onKeyEvent(key as string, press as boolean) as boolean
|
||||
return true
|
||||
else if key = "right"
|
||||
' Can only escape to search screen or home screen
|
||||
allowedEscapes = { "0": true, "1": true }
|
||||
allowedEscapes = { "0": true, "1": true, "2": true }
|
||||
if allowedEscapes[StrI(m.top.focusIndex).Trim()] = true
|
||||
m.top.escapeIndex = m.top.focusIndex
|
||||
m.top.focusIndex = -1
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<children>
|
||||
<Rectangle
|
||||
height="720"
|
||||
width="80"
|
||||
width="90"
|
||||
color="#242424"
|
||||
opacity="0.9">
|
||||
<ButtonGroup
|
||||
@@ -23,7 +23,7 @@
|
||||
icon="pkg:/images/icons/search.png"
|
||||
text="Search"
|
||||
height="50"
|
||||
width="80" />
|
||||
width="90" />
|
||||
<IconButton
|
||||
id="homeButton"
|
||||
background="#242424"
|
||||
@@ -32,7 +32,7 @@
|
||||
icon="pkg:/images/icons/home.png"
|
||||
text="Home"
|
||||
height="50"
|
||||
width="80" />
|
||||
width="90" />
|
||||
<IconButton
|
||||
id="settingsButton"
|
||||
background="#242424"
|
||||
@@ -41,7 +41,16 @@
|
||||
icon="pkg:/images/icons/settings.png"
|
||||
text="Settings"
|
||||
height="50"
|
||||
width="80" />
|
||||
width="90" />
|
||||
<IconButton
|
||||
id="webAppButton"
|
||||
background="#242424"
|
||||
focusBackground="#ff1c30"
|
||||
padding="20"
|
||||
icon="pkg:/images/icons/phone.png"
|
||||
text="Web app"
|
||||
height="50"
|
||||
width="90" />
|
||||
<IconButton
|
||||
id="appInfoButton"
|
||||
background="#242424"
|
||||
@@ -50,7 +59,7 @@
|
||||
icon="pkg:/images/icons/info.png"
|
||||
text="Info"
|
||||
height="50"
|
||||
width="80" />
|
||||
width="90" />
|
||||
</ButtonGroup>
|
||||
</Rectangle>
|
||||
</children>
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
function SaveSearchHistory(q as string, maxItems = 10 as integer)
|
||||
history = RegistryUtils.Read("search_history")
|
||||
if history <> invalid
|
||||
history = ParseJson(history)
|
||||
else
|
||||
history = []
|
||||
end if
|
||||
|
||||
index = ArrayIndexOf(history, q)
|
||||
if index <> -1
|
||||
history.Delete(index)
|
||||
end if
|
||||
|
||||
history.Unshift(q)
|
||||
|
||||
if history.Count() > maxItems
|
||||
history.Pop()
|
||||
end if
|
||||
|
||||
history = FormatJson(history)
|
||||
|
||||
RegistryUtils.Write("search_history", history)
|
||||
end function
|
||||
|
||||
function GetSavedSearchHistory(q as string) as object
|
||||
history = RegistryUtils.Read("search_history")
|
||||
if history = invalid
|
||||
return []
|
||||
end if
|
||||
history = ParseJson(history)
|
||||
if q = ""
|
||||
return history
|
||||
end if
|
||||
result = []
|
||||
for each keyword in history
|
||||
if keyword.InStr(q) = 0
|
||||
result.push(keyword)
|
||||
end if
|
||||
end for
|
||||
return result
|
||||
end function
|
||||
@@ -1,6 +1,6 @@
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/components/VideoPlayer/Video.bs"
|
||||
import "pkg:/components/SearchScreen/SearchHistory.bs"
|
||||
import "pkg:/source/services/SearchHistory.bs"
|
||||
import "pkg:/components/SearchScreen/SearchSuggestionsTask.bs"
|
||||
import "pkg:/components/SearchScreen/SearchTask.bs"
|
||||
|
||||
@@ -89,7 +89,7 @@ end function
|
||||
function OnSearchButtonSelected()
|
||||
selected = m.suggestions.buttonSelected
|
||||
text = m.suggestions.buttons[selected]
|
||||
SaveSearchHistory(text)
|
||||
SearchHistory.Save(text)
|
||||
Search(text)
|
||||
end function
|
||||
|
||||
@@ -130,6 +130,8 @@ end function
|
||||
function OnVisibilityChange()
|
||||
if m.top.visible = false
|
||||
ClearSearch()
|
||||
else
|
||||
OnTextChange()
|
||||
end if
|
||||
end function
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import "pkg:/source/services/Invidious.bs"
|
||||
import "pkg:/components/SearchScreen/SearchHistory.bs"
|
||||
import "pkg:/source/services/SearchHistory.bs"
|
||||
|
||||
@asynctask
|
||||
function SearchSuggestionsTask(input as object) as object
|
||||
@@ -7,7 +7,7 @@ function SearchSuggestionsTask(input as object) as object
|
||||
|
||||
searchSuggestsions = q <> "" ? Invidious.SearchSuggestions(q) : invalid
|
||||
|
||||
history = GetSavedSearchHistory(q)
|
||||
history = SearchHistory.GetSaved(q)
|
||||
|
||||
if searchSuggestsions <> invalid
|
||||
history = MergeSearchSuggestions(history, searchSuggestsions.suggestions)
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
function Init()
|
||||
m.radioButtonList = m.top.findNode("RadioButtonList")
|
||||
|
||||
m.top.observeField("value", "OnValueChanged")
|
||||
m.radioButtonList.observeField("checkedItem", "OnCheckedItemChanged")
|
||||
m.top.observeField("focusedChild", "OnFocusChanged")
|
||||
m.top.observeField("settings", "OnSettingsScreen")
|
||||
end function
|
||||
|
||||
function OnSettingsScreen()
|
||||
m.top.value = m.top.settings@.GetPreferenceValue(m.top.key)
|
||||
end function
|
||||
|
||||
function OnValueChanged()
|
||||
value = m.top.value
|
||||
if value = true
|
||||
m.radioButtonList.checkedItem = 0
|
||||
else if value = false
|
||||
m.radioButtonList.checkedItem = 1
|
||||
end if
|
||||
|
||||
m.top.settings@.SetPreferenceValue(m.top.key, value)
|
||||
end function
|
||||
|
||||
function OnCheckedItemChanged()
|
||||
checkedItem = m.radioButtonList.checkedItem
|
||||
if checkedItem = 0
|
||||
m.top.value = true
|
||||
else if checkedItem = 1
|
||||
m.top.value = false
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnFocusChanged()
|
||||
if m.top.hasFocus()
|
||||
m.radioButtonList.setFocus(true)
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
settingsScreen = m.top.getScene().findNode("SettingsScreen")
|
||||
return settingsScreen@.OnkeyEvent(key, press)
|
||||
end function
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="BooleanControl" extends="Group">
|
||||
<interface>
|
||||
<field id="key" type="string" />
|
||||
<field id="level" type="int" />
|
||||
<field id="value" type="bool" alwaysNotify="true" />
|
||||
<field id="settings" type="node" />
|
||||
</interface>
|
||||
<children>
|
||||
<RadioButtonList id="RadioButtonList">
|
||||
<ContentNode role="content">
|
||||
<ContentNode title="Yes" />
|
||||
<ContentNode title="No" />
|
||||
</ContentNode>
|
||||
</RadioButtonList>
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,39 @@
|
||||
import "pkg:/source/services/SearchHistory.bs"
|
||||
|
||||
function Init()
|
||||
m.button = m.top.findNode("clearButton")
|
||||
m.button.observeField("buttonSelected", "OnButtonSelected")
|
||||
m.top.observeField("focusedChild", "OnFocusChanged")
|
||||
end function
|
||||
|
||||
function OnFocusChanged()
|
||||
focused = m.top.hasFocus()
|
||||
if focused
|
||||
m.button.SetFocus(true)
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnButtonSelected()
|
||||
SearchHistory.Clear()
|
||||
SearchClearedDialog()
|
||||
end function
|
||||
|
||||
function SearchClearedDialog()
|
||||
dialog = CreateObject("roSGNode", "StandardMessageDialog")
|
||||
dialog.title = "Success"
|
||||
dialog.message = ["Search history cleared."]
|
||||
dialog.buttons = ["OK"]
|
||||
|
||||
dialog.observeField("buttonSelected", "OnDialogButtonSelected")
|
||||
|
||||
m.top.getScene().dialog = dialog
|
||||
end function
|
||||
|
||||
function OnDialogButtonSelected()
|
||||
m.top.getScene().dialog.close = true
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
settingsScreen = m.top.getScene().findNode("SettingsScreen")
|
||||
return settingsScreen@.OnkeyEvent(key, press)
|
||||
end function
|
||||
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="ClearSearchHistoryControl" extends="Group">
|
||||
<interface>
|
||||
<field id="key" type="string" />
|
||||
<field id="level" type="int" />
|
||||
<field id="value" type="bool" alwaysNotify="true" />
|
||||
<field id="settings" type="node" />
|
||||
</interface>
|
||||
<children>
|
||||
<Button id="clearButton" text="Clear Search History">
|
||||
</Button>
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,64 @@
|
||||
function Init()
|
||||
m.radioButtonList = m.top.findNode("RadioButtonList")
|
||||
m.radioButtonListContent = m.top.findNode("RadioButtonListContent")
|
||||
|
||||
m.top.observeField("value", "OnValueChanged")
|
||||
m.top.observeField("options", "OnOptionsChanged")
|
||||
m.radioButtonList.observeField("checkedItem", "OnCheckedItemChanged")
|
||||
m.top.observeField("focusedChild", "OnFocusChanged")
|
||||
m.top.observeField("settings", "OnSettingsScreen")
|
||||
end function
|
||||
|
||||
function OnSettingsScreen()
|
||||
m.top.value = m.top.settings@.GetPreferenceValue(m.top.key)
|
||||
end function
|
||||
|
||||
function OnValueChanged()
|
||||
value = m.top.value
|
||||
options = m.top.options
|
||||
|
||||
checkedItem = -1
|
||||
for i = 0 to options.Count() - 1
|
||||
option = options[i].value
|
||||
if value = option
|
||||
checkedItem = i
|
||||
exit for
|
||||
end if
|
||||
end for
|
||||
|
||||
m.radioButtonList.checkedItem = checkedItem
|
||||
|
||||
m.top.settings@.SetPreferenceValue(m.top.key, value)
|
||||
end function
|
||||
|
||||
function OnCheckedItemChanged()
|
||||
checkedItem = m.radioButtonList.checkedItem
|
||||
options = m.top.options
|
||||
|
||||
if checkedItem >= 0 and checkedItem < options.Count()
|
||||
m.top.value = options[checkedItem].value
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnFocusChanged()
|
||||
if m.top.hasFocus()
|
||||
m.radioButtonList.setFocus(true)
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
settingsScreen = m.top.getScene().findNode("SettingsScreen")
|
||||
return settingsScreen@.OnkeyEvent(key, press)
|
||||
end function
|
||||
|
||||
function OnOptionsChanged()
|
||||
options = m.top.options
|
||||
|
||||
m.radioButtonListContent.removeChildrenIndex(m.radioButtonListContent.getChildCount(), 0)
|
||||
for i = 0 to options.Count() - 1
|
||||
option = options[i].displayText
|
||||
node = CreateObject("roSGNode", "ContentNode")
|
||||
node.title = option
|
||||
m.radioButtonListContent.appendChild(node)
|
||||
end for
|
||||
end function
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="RadioControl" extends="Group">
|
||||
<interface>
|
||||
<field id="key" type="string" />
|
||||
<field id="level" type="int" />
|
||||
<field id="value" type="string" alwaysNotify="true" />
|
||||
<field id="options" type="array" alwaysNotify="true" />
|
||||
<field id="settings" type="node" />
|
||||
</interface>
|
||||
<children>
|
||||
<RadioButtonList id="RadioButtonList">
|
||||
<ContentNode id="RadioButtonListContent" role="content">
|
||||
</ContentNode>
|
||||
</RadioButtonList>
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,14 @@
|
||||
' TODO: this is being called from many places, including possibly background threads
|
||||
' It should be made better than this
|
||||
function FindAndGetPreferenceValues(keys as object) as object
|
||||
values = {}
|
||||
settings = m.top.getScene().findNode("SettingsScreen")
|
||||
if settings = invalid
|
||||
return values
|
||||
end if
|
||||
|
||||
for each key in keys
|
||||
values[key] = settings@.GetPreferenceValue(key)
|
||||
end for
|
||||
return values
|
||||
end function
|
||||
@@ -1,17 +1,356 @@
|
||||
import "pkg:/source/utils/General.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/source/services/PreferencesService.bs"
|
||||
import "pkg:/components/VideoPlayer/Video.bs"
|
||||
|
||||
function Init()
|
||||
m.top.url = `http://${GetLocalIpAddress()}:8888`
|
||||
m.service = new PreferencesService()
|
||||
|
||||
m.menu = m.top.findNode("PreferencesMenu")
|
||||
m.hint = m.top.findNode("HintLabel")
|
||||
|
||||
LoadPreferencesTopLevel(m.service.prefs_model)
|
||||
RefreshUI(0)
|
||||
|
||||
m.top.ObserveField("focus", "OnFocusChange")
|
||||
m.top.ObserveField("visible", "OnVisibilityChange")
|
||||
end function
|
||||
|
||||
function OnUrlSet()
|
||||
url = m.top.url
|
||||
function LoadPreferencesTopLevel(model as object)
|
||||
m.uiElements = {}
|
||||
LoadPreferencesAtLevel(model, 0, "")
|
||||
end function
|
||||
|
||||
qrCode = m.top.findNode("SettingsQRPoster")
|
||||
qrCode.text = url
|
||||
function LoadPreferencesAtLevel(model as object, level as integer, key as string)
|
||||
if m.menu.getChildCount() - 1 < level
|
||||
container = m.menu.createChild("Group")
|
||||
container.id = `Container${level}`
|
||||
else
|
||||
container = m.menu.getChild(level)
|
||||
end if
|
||||
|
||||
urlLabel = m.top.findNode("urlLabel")
|
||||
urlLabel.text = url
|
||||
buttonGroup = CreateSubmenu(container, model, level, key)
|
||||
|
||||
buttons = []
|
||||
for each item in model
|
||||
if item.visibility = "web"
|
||||
continue for
|
||||
end if
|
||||
buttons.push(item.displayText)
|
||||
if item.children <> invalid
|
||||
LoadPreferencesAtLevel(item.children, level + 1, item.key)
|
||||
else if item.type <> invalid
|
||||
CreateControl(item, level + 1, item.key)
|
||||
else if item.rokuComponent <> invalid
|
||||
CreateRokuComponent(item, level + 1, item.key)
|
||||
end if
|
||||
end for
|
||||
|
||||
buttonGroup.buttons = buttons
|
||||
buttonGroup.observeField("buttonFocused", "OnButtonFocused")
|
||||
end function
|
||||
|
||||
function CreateSubmenu(container as object, model as object, level as integer, key as string) as object
|
||||
buttonGroup = container.createChild("ButtonGroup")
|
||||
buttonGroup.minWidth = 300
|
||||
buttonGroup.iconUri = ""
|
||||
buttonGroup.id = `Control${level}`
|
||||
buttonGroup.visible = false
|
||||
|
||||
m.uiElements[key] = buttonGroup
|
||||
buttonGroup.addFields({
|
||||
"level": level,
|
||||
"key": key
|
||||
})
|
||||
return buttonGroup
|
||||
end function
|
||||
|
||||
function CreateControl(model as object, level as integer, key as string) as object
|
||||
menu = m.top.findNode("PreferencesMenu")
|
||||
if menu.getChildCount() - 1 < level
|
||||
container = menu.createChild("Group")
|
||||
container.id = `Container${level}`
|
||||
else
|
||||
container = menu.getChild(level)
|
||||
end if
|
||||
|
||||
if model.type = "string"
|
||||
return CreateStringControl(container, model, level, key)
|
||||
else if model.type = "boolean"
|
||||
return CreateBooleanControl(container, model, level, key)
|
||||
else if model.type = "radio"
|
||||
return CreateRadioControl(container, model, level, key)
|
||||
end if
|
||||
return invalid
|
||||
end function
|
||||
|
||||
function CreateBooleanControl(container as object, model as object, level as integer, key as string) as object
|
||||
control = container.createChild("BooleanControl")
|
||||
control.id = `Control${level}`
|
||||
control.visible = false
|
||||
control.key = key
|
||||
control.level = level
|
||||
m.uiElements[key] = control
|
||||
control.settings = m.top
|
||||
return control
|
||||
end function
|
||||
|
||||
function CreateStringControl(container as object, model as object, level as integer, key as string) as object
|
||||
control = container.createChild("StringControl")
|
||||
control.id = `Control${level}`
|
||||
control.visible = false
|
||||
control.key = key
|
||||
control.level = level
|
||||
control.displayText = model.displayText
|
||||
control.description = model.description
|
||||
control.settings = m.top
|
||||
m.uiElements[key] = control
|
||||
return control
|
||||
end function
|
||||
|
||||
function CreateRadioControl(container as object, model as object, level as integer, key as string) as object
|
||||
control = container.createChild("RadioControl")
|
||||
control.id = `Control${level}`
|
||||
control.visible = false
|
||||
control.key = key
|
||||
control.level = level
|
||||
control.options = model.options
|
||||
control.settings = m.top
|
||||
m.uiElements[key] = control
|
||||
return control
|
||||
end function
|
||||
|
||||
function CreateRokuComponent(model as object, level as integer, key as string) as object
|
||||
menu = m.top.findNode("PreferencesMenu")
|
||||
if menu.getChildCount() - 1 < level
|
||||
container = menu.createChild("Group")
|
||||
container.id = `Container${level}`
|
||||
else
|
||||
container = menu.getChild(level)
|
||||
end if
|
||||
|
||||
component = container.createChild(model.rokuComponent)
|
||||
component.id = `Control${level}`
|
||||
component.settings = m.top
|
||||
component.visible = false
|
||||
component.key = key
|
||||
component.level = level
|
||||
|
||||
m.uiElements[key] = component
|
||||
return invalid
|
||||
end function
|
||||
|
||||
function OnButtonFocused(event as object)
|
||||
buttonGroup = event.getRoSGNode()
|
||||
RefreshUI(buttonGroup.level + 1)
|
||||
end function
|
||||
|
||||
function RefreshUI(maxLevel = 0 as integer)
|
||||
for each key in m.uiElements
|
||||
m.uiElements[key].visible = false
|
||||
end for
|
||||
|
||||
topLevel = m.top.findNode("Control0")
|
||||
topLevel.visible = true
|
||||
|
||||
ShowButtonGroup(m.service.prefs_model, topLevel.buttonFocused, maxLevel)
|
||||
RefreshHint()
|
||||
end function
|
||||
|
||||
function ShowButtonGroup(model as object, index as integer, maxLevel as integer) as void
|
||||
item = model[index]
|
||||
element = m.uiElements[item.key]
|
||||
if element = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
if element.level > maxLevel
|
||||
return
|
||||
end if
|
||||
|
||||
element.visible = true
|
||||
|
||||
if item.children <> invalid
|
||||
ShowButtonGroup(item.children, element.buttonFocused, maxLevel)
|
||||
end if
|
||||
end function
|
||||
|
||||
function RefreshHint() as void
|
||||
focusedButtonGroup = GetFocusedControl()
|
||||
if focusedButtonGroup = invalid
|
||||
return
|
||||
end if
|
||||
selectedIndex = focusedButtonGroup.buttonFocused
|
||||
if selectedIndex = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
children = FindModelChildrenByKey(focusedButtonGroup.key, m.service.prefs_model)
|
||||
if children = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
if children.Count() <= selectedIndex
|
||||
return
|
||||
end if
|
||||
|
||||
displayText = children[selectedIndex].displayText
|
||||
description = children[selectedIndex].description
|
||||
if description = invalid or description = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
m.hint.text = `${displayText}: ${description}`
|
||||
end function
|
||||
|
||||
function FindModelChildrenByKey(key as string, model as object) as object
|
||||
if key = ""
|
||||
return m.service.prefs_model
|
||||
end if
|
||||
|
||||
for each item in model
|
||||
if item.key = key
|
||||
return item.children
|
||||
end if
|
||||
if item.children <> invalid
|
||||
result = FindModelChildrenByKey(key, item.children)
|
||||
if result <> invalid
|
||||
return result
|
||||
end if
|
||||
end if
|
||||
end for
|
||||
return invalid
|
||||
end function
|
||||
|
||||
function OnFocusChange() as void
|
||||
if m.top.focus <> true
|
||||
return
|
||||
end if
|
||||
|
||||
topLevelButtonGroup = m.top.findNode("Control0")
|
||||
if topLevelButtonGroup <> invalid
|
||||
topLevelButtonGroup.setFocus(true)
|
||||
RefreshUI(1)
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnVisibilityChange() as void
|
||||
if m.top.visible <> true
|
||||
return
|
||||
end if
|
||||
|
||||
topLevelButtonGroup = m.top.findNode("Control0")
|
||||
if topLevelButtonGroup <> invalid
|
||||
topLevelButtonGroup.visible = true
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
if press = false
|
||||
return false
|
||||
end if
|
||||
if key = "options"
|
||||
if ToggleVideoPictureInPicture(m.top)
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
if key = "back"
|
||||
m.top.escape = key
|
||||
return true
|
||||
end if
|
||||
if key = "left"
|
||||
if not MenuGoLeft()
|
||||
RefreshUI(0)
|
||||
m.top.escape = key
|
||||
end if
|
||||
return true
|
||||
end if
|
||||
if key = "right"
|
||||
if MenuGoRight()
|
||||
return true
|
||||
end if
|
||||
end if
|
||||
|
||||
return false
|
||||
end function
|
||||
|
||||
function GetFocusedControl() as object
|
||||
focusedChild = m.top.focusedChild
|
||||
if focusedChild = invalid
|
||||
return invalid
|
||||
end if
|
||||
|
||||
while not focusedChild.id.StartsWith("Control")
|
||||
focusedChild = focusedChild.focusedChild
|
||||
if focusedChild = invalid
|
||||
return invalid
|
||||
end if
|
||||
end while
|
||||
return focusedChild
|
||||
end function
|
||||
|
||||
function MenuGoLeft() as boolean
|
||||
return MenuNavigate(-1)
|
||||
end function
|
||||
|
||||
function MenuGoRight() as boolean
|
||||
return MenuNavigate(1)
|
||||
end function
|
||||
|
||||
function MenuNavigate(direction as integer) as boolean
|
||||
focusedControl = GetFocusedControl()
|
||||
container = focusedControl.getParent()
|
||||
containerParent = container.getParent()
|
||||
containerCount = containerParent.getChildCount()
|
||||
index = GetChildIndex(containerParent, container)
|
||||
|
||||
index += direction
|
||||
|
||||
if index >= containerCount or index < 0
|
||||
return false
|
||||
end if
|
||||
|
||||
newFocusedContainer = containerParent.getChild(index)
|
||||
childCount = newFocusedContainer.getChildCount()
|
||||
for i = 0 to childCount - 1
|
||||
child = newFocusedContainer.getChild(i)
|
||||
if child.visible
|
||||
child.setFocus(true)
|
||||
RefreshUI(index + 1)
|
||||
return true
|
||||
end if
|
||||
end for
|
||||
|
||||
return false
|
||||
end function
|
||||
|
||||
function GetChildIndex(node as object, child as object) as integer
|
||||
childCount = node.getChildCount()
|
||||
for i = 0 to childCount - 1
|
||||
c = node.getChild(i)
|
||||
if child.id = c.id
|
||||
return i
|
||||
end if
|
||||
end for
|
||||
return -1
|
||||
end function
|
||||
|
||||
function GetPreferenceValue(key as string) as dynamic
|
||||
return m.service.GetValue(key)
|
||||
end function
|
||||
|
||||
function SetPreferenceValue(key as string, value as dynamic)
|
||||
m.service.SetValue(key, value)
|
||||
end function
|
||||
|
||||
function GetUserPreferences(unused as object) as object
|
||||
return m.service.GetUserPreferences()
|
||||
end function
|
||||
|
||||
function ApplyUserPreferences(preferences as object) as void
|
||||
m.service.ApplyUserPreferences(preferences)
|
||||
end function
|
||||
|
||||
function ClearUserPreferences(unused as object) as void
|
||||
m.service.ClearUserPreferences()
|
||||
end function
|
||||
@@ -2,31 +2,31 @@
|
||||
|
||||
<component name="SettingsScreen" extends="Group">
|
||||
<interface>
|
||||
<field id="url" type="string" onChange="OnUrlSet" />
|
||||
<field id="escape" type="string" alwaysNotify="true" />
|
||||
<field id="focus" type="boolean" alwaysNotify="true" />
|
||||
<function name="OnkeyEvent" />
|
||||
<function name="MenuNavigate" />
|
||||
<function name="GetPreferenceValue" />
|
||||
<function name="SetPreferenceValue" />
|
||||
<function name="GetUserPreferences" />
|
||||
<function name="ApplyUserPreferences" />
|
||||
<function name="ClearUserPreferences" />
|
||||
</interface>
|
||||
<children>
|
||||
<LayoutGroup
|
||||
id="PreferencesMenu"
|
||||
layoutDirection="horiz"
|
||||
translation="[130,100]"
|
||||
itemSpacings="[20]"
|
||||
>
|
||||
</LayoutGroup>
|
||||
<Label
|
||||
height='60'
|
||||
width='1280'
|
||||
font='font:MediumBoldSystemFont'
|
||||
horizAlign="center"
|
||||
translation="[0,92]"
|
||||
text="Open in a web browser to configure Playlet:"
|
||||
/>
|
||||
<QRPoster
|
||||
id='SettingsQRPoster'
|
||||
loadWidth='400'
|
||||
loadHeight='400'
|
||||
loadPadding='20'
|
||||
translation='[440, 160]' />
|
||||
|
||||
<Label
|
||||
id='UrlLabel'
|
||||
height='50'
|
||||
width='1280'
|
||||
font='font:MediumBoldSystemFont'
|
||||
horizAlign="center"
|
||||
translation="[0,600]"
|
||||
id="HintLabel"
|
||||
height='100'
|
||||
width='1020'
|
||||
wrap='true'
|
||||
font='font:SmallestBoldSystemFont'
|
||||
translation="[130,600]"
|
||||
/>
|
||||
</children>
|
||||
</component>
|
||||
@@ -0,0 +1,54 @@
|
||||
function Init()
|
||||
m.textEditBox = m.top.findNode("TextEditBox")
|
||||
m.top.observeField("focusedChild", "OnFocusChanged")
|
||||
m.top.observeField("value", "OnValueChanged")
|
||||
m.top.observeField("settings", "OnSettingsScreen")
|
||||
end function
|
||||
|
||||
function OnSettingsScreen()
|
||||
m.top.value = m.top.settings@.GetPreferenceValue(m.top.key)
|
||||
end function
|
||||
|
||||
function OnFocusChanged()
|
||||
focused = m.top.hasFocus()
|
||||
if focused
|
||||
ShowEditKeyboard()
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnValueChanged()
|
||||
value = m.top.value
|
||||
m.top.editText = value
|
||||
m.top.settings@.SetPreferenceValue(m.top.key, value)
|
||||
end function
|
||||
|
||||
function OnkeyEvent(key as string, press as boolean) as boolean
|
||||
settingsScreen = m.top.getScene().findNode("SettingsScreen")
|
||||
return settingsScreen@.OnkeyEvent(key, press)
|
||||
end function
|
||||
|
||||
function ShowEditKeyboard()
|
||||
keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog")
|
||||
keyboardDialog.title = m.top.displayText
|
||||
keyboardDialog.message = [m.top.description]
|
||||
keyboardDialog.text = m.top.value
|
||||
keyboardDialog.buttons = ["OK", "Cancel"]
|
||||
keyboardDialog.observeField("wasClosed", "OnKeyboardClosed")
|
||||
keyboardDialog.observeField("buttonSelected", "OnButtonSelected")
|
||||
|
||||
m.top.getScene().dialog = keyboardDialog
|
||||
end function
|
||||
|
||||
function OnButtonSelected(event as object)
|
||||
keyboard = event.getRoSGNode()
|
||||
buttonSelected = keyboard.buttonSelected
|
||||
if buttonSelected = 0
|
||||
m.top.value = keyboard.text
|
||||
end if
|
||||
keyboard.close = true
|
||||
end function
|
||||
|
||||
function OnKeyboardClosed()
|
||||
settingsScreen = m.top.getScene().findNode("SettingsScreen")
|
||||
settingsScreen@.MenuNavigate(-1)
|
||||
end function
|
||||
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="StringControl" extends="Group">
|
||||
<interface>
|
||||
<field id="key" type="string" />
|
||||
<field id="level" type="int" />
|
||||
<field id="editText" type="string" alias="TextEditBox.text" />
|
||||
<field id="value" type="string" />
|
||||
<field id="displayText" type="string" />
|
||||
<field id="description" type="string" />
|
||||
<field id="settings" type="node" />
|
||||
</interface>
|
||||
<children>
|
||||
<TextEditBox id="TextEditBox" clearOnDownKey="false">
|
||||
</TextEditBox>
|
||||
</children>
|
||||
</component>
|
||||
@@ -117,27 +117,20 @@ function OnVideoDetailsTaskResults(output as object) as void
|
||||
end if
|
||||
playletStreamUrls.push(hlsUrlLocal)
|
||||
else
|
||||
if metadata.dashUrl <> invalid
|
||||
|
||||
#if DASH_THUMBNAILS
|
||||
' Redirect to our server so we can inject thumbnails (storyboards) into the DASH manifest
|
||||
dashUrl = `http://${GetLocalIpAddress()}:8888/dash?v=${videoId}`
|
||||
#else
|
||||
dashUrl = metadata.dashUrl
|
||||
#end if
|
||||
playletStreamUrls.push(dashUrl)
|
||||
|
||||
if dashUrl.InStr("?") = -1
|
||||
dashUrlLocal = dashUrl + "?local=true"
|
||||
else
|
||||
dashUrlLocal = dashUrl + "&local=true"
|
||||
end if
|
||||
playletStreamUrls.push(dashUrlLocal)
|
||||
settings = FindAndGetPreferenceValues(["playback.preferred_quality", "invidious.proxy_videos"])
|
||||
if settings = invalid
|
||||
settings = {
|
||||
"playback.preferred_quality": "auto",
|
||||
"invidious.proxy_videos": "if_needed"
|
||||
}
|
||||
end if
|
||||
|
||||
if metadata.formatStreams.Count() > 0
|
||||
playletStreamUrls.push(Invidious.GetVideoStreamUrl(videoId, false))
|
||||
playletStreamUrls.push(Invidious.GetVideoStreamUrl(videoId, true))
|
||||
if settings["playback.preferred_quality"] = "720p"
|
||||
AddStreamUrls(playletStreamUrls, metadata, settings)
|
||||
AddDashUrls(playletStreamUrls, metadata, settings)
|
||||
else
|
||||
AddDashUrls(playletStreamUrls, metadata, settings)
|
||||
AddStreamUrls(playletStreamUrls, metadata, settings)
|
||||
end if
|
||||
end if
|
||||
|
||||
@@ -159,6 +152,57 @@ function OnVideoDetailsTaskResults(output as object) as void
|
||||
m.videoContainer@.watchedVideosAdd(videoId)
|
||||
end function
|
||||
|
||||
function AddDashUrls(playletStreamUrls as object, metadata as object, settings as object) as void
|
||||
if metadata.dashUrl = invalid
|
||||
return
|
||||
end if
|
||||
|
||||
#if DASH_THUMBNAILS
|
||||
' Redirect to our server so we can inject thumbnails (storyboards) into the DASH manifest
|
||||
dashUrl = `http://${GetLocalIpAddress()}:8888/dash?v=${videoId}`
|
||||
#else
|
||||
dashUrl = metadata.dashUrl
|
||||
#end if
|
||||
|
||||
if dashUrl.InStr("?") = -1
|
||||
dashUrlLocal = dashUrl + "?local=true"
|
||||
else
|
||||
dashUrlLocal = dashUrl + "&local=true"
|
||||
end if
|
||||
|
||||
proxyVideos = settings["invidious.proxy_videos"]
|
||||
if proxyVideos = "if_needed"
|
||||
playletStreamUrls.push(dashUrl)
|
||||
playletStreamUrls.push(dashUrlLocal)
|
||||
else if proxyVideos = "never"
|
||||
playletStreamUrls.push(dashUrl)
|
||||
else if proxyVideos = "always"
|
||||
playletStreamUrls.push(dashUrlLocal)
|
||||
else
|
||||
playletStreamUrls.push(dashUrl)
|
||||
playletStreamUrls.push(dashUrlLocal)
|
||||
end if
|
||||
end function
|
||||
|
||||
function AddStreamUrls(playletStreamUrls as object, metadata as object, settings as object) as void
|
||||
if metadata.formatStreams = invalid or metadata.formatStreams.Count() = 0
|
||||
return
|
||||
end if
|
||||
|
||||
proxyVideos = settings["invidious.proxy_videos"]
|
||||
if proxyVideos = "if_needed"
|
||||
playletStreamUrls.push(Invidious.GetVideoStreamUrl(metadata.videoId, false))
|
||||
playletStreamUrls.push(Invidious.GetVideoStreamUrl(metadata.videoId, true))
|
||||
else if proxyVideos = "never"
|
||||
playletStreamUrls.push(Invidious.GetVideoStreamUrl(metadata.videoId, false))
|
||||
else if proxyVideos = "always"
|
||||
playletStreamUrls.push(Invidious.GetVideoStreamUrl(metadata.videoId, true))
|
||||
else
|
||||
playletStreamUrls.push(Invidious.GetVideoStreamUrl(metadata.videoId, false))
|
||||
playletStreamUrls.push(Invidious.GetVideoStreamUrl(metadata.videoId, true))
|
||||
end if
|
||||
end function
|
||||
|
||||
function FindChildNodeOfType(node as object, nodeType as string) as object
|
||||
if node.subtype() = nodeType
|
||||
return node
|
||||
@@ -296,6 +340,11 @@ function OnVideoPlayerStateChange() as void
|
||||
end function
|
||||
|
||||
function PlayNextRecommendedVideo(recommendedVideos as object) as boolean
|
||||
settings = FindAndGetPreferenceValues(["playback.autoplay"])
|
||||
if settings = invalid or settings["playback.autoplay"] <> true
|
||||
return false
|
||||
end if
|
||||
|
||||
if recommendedVideos = invalid or recommendedVideos.Count() = 0
|
||||
return false
|
||||
end if
|
||||
|
||||
@@ -5,9 +5,7 @@ function SetCaptions(metadata as object, videoPlayer as object, contentNode as o
|
||||
return
|
||||
end if
|
||||
isoLanguageList = ParseJson(ReadAsciiFile("libpkg:/config/ISO-639-1-to-ISO-639-2T.json"))
|
||||
' TODO: loop through instances until valid captions are found
|
||||
' Captions are rate limited https://github.com/iv-org/invidious/issues/2567
|
||||
instance = InvidiousSettings.GetSelectedInstance()
|
||||
instance = InvidiousSettings.GetCurrentInstance()
|
||||
|
||||
subtitleTracks = []
|
||||
|
||||
@@ -21,6 +19,8 @@ function SetCaptions(metadata as object, videoPlayer as object, contentNode as o
|
||||
contentNode.ClosedCaptions = True
|
||||
contentNode.SubtitleTracks = subtitleTracks
|
||||
|
||||
' Captions are rate limited https://github.com/iv-org/invidious/issues/2567
|
||||
' We loop through a list of backup instances hoping to find working subtitles.
|
||||
' Searching for a working caption could cause a delay in the video player start.
|
||||
' This is why it is behind a feature flag.
|
||||
#if CAPTION_INSTANCE_SEARCH
|
||||
|
||||
@@ -23,7 +23,7 @@ function VideoPlayerCaptionsTask(input as object) as object
|
||||
failedInstances = {}
|
||||
failedInstances[originalInstance] = true
|
||||
|
||||
instances = InvidiousSettings.GetCurrentInstances()
|
||||
instances = InvidiousSettings.GetBackupInstances()
|
||||
for each instance in instances
|
||||
if failedInstances[instance] = true
|
||||
continue for
|
||||
|
||||
@@ -2,8 +2,14 @@ import "pkg:/source/asyncTask/asyncTask.bs"
|
||||
import "pkg:/components/VideoPlayer/SponsorBlockTask.bs"
|
||||
import "pkg:/components/VideoPlayer/SponsorBlockTrackingTask.bs"
|
||||
import "pkg:/components/SponsorBlockNotification/SponsorBlockNotificationManager.bs"
|
||||
import "pkg:/components/SettingsScreen/Settings.bs"
|
||||
|
||||
function SetupSponsorBlock() as void
|
||||
LoadSponsorBlockSettings()
|
||||
if not m.sponsorBlockEnabled = true
|
||||
return
|
||||
end if
|
||||
|
||||
function SetupSponsorBlock()
|
||||
PositionChapterLabel()
|
||||
|
||||
SponsorBlockNotifcationSetVisible(m.videoContainer.fullscreen)
|
||||
@@ -15,6 +21,18 @@ function SetupSponsorBlock()
|
||||
m.top.observeField("videoId", "StartSponsorBlockTask")
|
||||
end function
|
||||
|
||||
function LoadSponsorBlockSettings() as void
|
||||
settings = FindAndGetPreferenceValues(["sponsorblock.enabled", "sponsorblock.show_notifications"])
|
||||
if settings = invalid
|
||||
m.sponsorBlockEnabled = false
|
||||
m.sponsorBlockShowNotifications = false
|
||||
return
|
||||
end if
|
||||
|
||||
m.sponsorBlockEnabled = settings["sponsorblock.enabled"]
|
||||
m.sponsorBlockShowNotifications = settings["sponsorblock.show_notifications"]
|
||||
end function
|
||||
|
||||
function PositionChapterLabel()
|
||||
m.chapterLabel = m.top.findNode("chapterLabel")
|
||||
m.chapterLabel.reparent(m.top.trickPlayBar, false)
|
||||
@@ -121,7 +139,9 @@ function OnPositionChangeSkipSponsorBlockSections() as void
|
||||
currentPosition = m.top.position
|
||||
if (segmentStart < currentPosition) and ((segmentEnd - 1) > currentPosition)
|
||||
action = GetActionForSegment(segment)
|
||||
ShowSponsorBlockNotifcation(segment, action)
|
||||
if m.sponsorBlockShowNotifications = true
|
||||
ShowSponsorBlockNotifcation(segment, action)
|
||||
end if
|
||||
|
||||
if action = "AutoSkip"
|
||||
m.top.seek = segmentEnd
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import "pkg:/source/utils/General.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
|
||||
function Init()
|
||||
ip = GetLocalIpAddress()
|
||||
if ip = invalid
|
||||
m.top.url = "(Could not get IP address: are we connected to the internet?)"
|
||||
else
|
||||
m.top.url = `http://${ip}:8888`
|
||||
end if
|
||||
end function
|
||||
|
||||
function OnUrlSet()
|
||||
url = m.top.url
|
||||
|
||||
qrCode = m.top.findNode("SettingsQRPoster")
|
||||
qrCode.text = url
|
||||
|
||||
urlLabel = m.top.findNode("urlLabel")
|
||||
urlLabel.text = url
|
||||
end function
|
||||
@@ -0,0 +1,32 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
|
||||
<component name="WebAppScreen" extends="Group">
|
||||
<interface>
|
||||
<field id="url" type="string" onChange="OnUrlSet" />
|
||||
</interface>
|
||||
<children>
|
||||
<Label
|
||||
height='60'
|
||||
width='1280'
|
||||
font='font:MediumBoldSystemFont'
|
||||
horizAlign="center"
|
||||
translation="[0,92]"
|
||||
text="Scan the QR code with your phone camera, or open the URL in a web browser:"
|
||||
/>
|
||||
<QRPoster
|
||||
id='SettingsQRPoster'
|
||||
loadWidth='400'
|
||||
loadHeight='400'
|
||||
loadPadding='20'
|
||||
translation='[440, 160]' />
|
||||
|
||||
<Label
|
||||
id='UrlLabel'
|
||||
height='50'
|
||||
width='1280'
|
||||
font='font:MediumBoldSystemFont'
|
||||
horizAlign="center"
|
||||
translation="[0,600]"
|
||||
/>
|
||||
</children>
|
||||
</component>
|
||||
@@ -27,16 +27,12 @@ namespace Http
|
||||
server.task.top.command = `play:${videoId}`
|
||||
response.Default(204, "OK")
|
||||
return true
|
||||
else if payload.command = "clear-search-history"
|
||||
RegistryUtils.Delete("search_history")
|
||||
response.Default(204, "OK")
|
||||
return true
|
||||
else if payload.command = "set-playlet-lib-urls"
|
||||
content = payload.content
|
||||
if content = invalid
|
||||
RegistryUtils.Delete("playlet_lib_urls")
|
||||
RegistryUtils.Delete(RegistryUtils.PLAYLET_LIB_URLS)
|
||||
else
|
||||
RegistryUtils.Write("playlet_lib_urls", content)
|
||||
RegistryUtils.Write(RegistryUtils.PLAYLET_LIB_URLS, content)
|
||||
end if
|
||||
response.Default(204, "OK")
|
||||
return true
|
||||
|
||||
@@ -2,12 +2,15 @@ namespace Http
|
||||
|
||||
class CorsMiddleware extends HttpRouter
|
||||
private origin
|
||||
private headers
|
||||
private methods
|
||||
|
||||
function new(origin = "*" as string, headers = "*" as string)
|
||||
function new(origin = "*" as string, headers = "*" as string, methods = "POST, PUT, GET, DELETE, OPTIONS" as string)
|
||||
super()
|
||||
|
||||
m.origin = origin
|
||||
m.headers = headers
|
||||
m.methods = methods
|
||||
|
||||
m.All("*", function(context as object) as boolean
|
||||
router = context.router
|
||||
@@ -15,6 +18,7 @@ namespace Http
|
||||
response = context.response
|
||||
response.headers["Access-Control-Allow-Origin"] = router.origin
|
||||
response.headers["Access-Control-Allow-Headers"] = router.headers
|
||||
response.headers["Access-Control-Allow-Methods"] = router.methods
|
||||
|
||||
if request.method = "OPTIONS"
|
||||
response.header_only = true
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace Http
|
||||
v = request.query.v
|
||||
local = request.query.local
|
||||
|
||||
instance = InvidiousSettings.GetSelectedInstance()
|
||||
instance = InvidiousSettings.GetCurrentInstance()
|
||||
metadata = router.GetVideoMetadata(context, v)
|
||||
dashUrl = Invidious.GetVideoDashUrl(v, local <> invalid)
|
||||
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
import "pkg:/source/services/InvidiousSettings.bs"
|
||||
import "pkg:/source/services/InvidiousService.bs"
|
||||
import "pkg:/source/roku_modules/rokurequests/Requests.brs"
|
||||
|
||||
namespace Http
|
||||
|
||||
class InvidiousRouter extends HttpRouter
|
||||
@@ -5,28 +9,6 @@ namespace Http
|
||||
function new()
|
||||
super()
|
||||
|
||||
m.Post("/invidious/instances", function(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
|
||||
instances = request.Json()
|
||||
|
||||
if GetInterface(instances, "ifArray") = invalid
|
||||
response.Default(400, "Expected json array")
|
||||
return true
|
||||
end if
|
||||
|
||||
for i = 0 to instances.Count() - 1
|
||||
if instances[i].right(1) = "/"
|
||||
instances[i] = instances[i].left(instances[i].len() - 1)
|
||||
end if
|
||||
end for
|
||||
|
||||
InvidiousSettings.SetRegistryInstances(instances)
|
||||
response.Default(200, "OK")
|
||||
return true
|
||||
end function)
|
||||
|
||||
m.Get(Invidious.TOKEN_CALLBACK, function(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
@@ -48,6 +30,51 @@ namespace Http
|
||||
response.Redirect("/")
|
||||
return true
|
||||
end function)
|
||||
|
||||
' This is an endpoint allowing the web app to make an authenticated request
|
||||
' without needing the Invidious token
|
||||
m.Get("/invidious/authenticated-request", function(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
|
||||
requestData = request.query["request-data"]
|
||||
if requestData = invalid
|
||||
response.Default(400, "Expected request-data")
|
||||
return true
|
||||
end if
|
||||
|
||||
token = InvidiousSettings.GetAuthToken()
|
||||
if token = invalid
|
||||
response.Default(403, "No token, not logged in")
|
||||
return true
|
||||
end if
|
||||
|
||||
requestData = ParseJson(requestData)
|
||||
' Format object again because FormatJson formats in a specific way (sorts keys, etc.)
|
||||
' so we want an exact string for the md5 hash to match
|
||||
requestDataJson = FormatJson(requestData)
|
||||
cacheKey = GetMd5(requestDataJson)
|
||||
path = `tmp:/${cacheKey}.json`
|
||||
|
||||
fs = CreateObject("roFilesystem")
|
||||
if fs.exists(path)
|
||||
cacheData = ReadAsciiFile(path)
|
||||
response.SetBodyDataString(cacheData)
|
||||
response.ContentType("application/json")
|
||||
response.source = Http.HttpResponseSource.GENERATED
|
||||
return true
|
||||
end if
|
||||
|
||||
invService = new InvidiousService()
|
||||
result = invService.MakeRequest(requestData)
|
||||
if result = invalid
|
||||
response.Default(500, "Failed to make request")
|
||||
return true
|
||||
end if
|
||||
response.Json(result)
|
||||
return true
|
||||
end function)
|
||||
|
||||
end function
|
||||
|
||||
end class
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
namespace Http
|
||||
|
||||
class PreferencesRouter extends HttpRouter
|
||||
|
||||
function new()
|
||||
super()
|
||||
|
||||
' Get preferences
|
||||
m.Get("/api/preferences", function(context as object) as boolean
|
||||
response = context.response
|
||||
task = context.server.task
|
||||
scene = task.top.getScene()
|
||||
settings = scene.findNode("SettingsScreen")
|
||||
if settings = invalid
|
||||
response.Default(500, `Settings screen not found: scene.findNode("SettingsScreen") returned invalid`)
|
||||
return true
|
||||
end if
|
||||
|
||||
' Passing invalid because of call limitation
|
||||
preferences = settings@.GetUserPreferences(invalid)
|
||||
response.Json(preferences)
|
||||
return true
|
||||
end function)
|
||||
|
||||
' Update preferences
|
||||
m.Put("/api/preferences", function(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
task = context.server.task
|
||||
|
||||
payload = request.Json()
|
||||
if payload = invalid
|
||||
response.Default(400, `Invalid JSON payload`)
|
||||
return true
|
||||
end if
|
||||
|
||||
scene = task.top.getScene()
|
||||
settings = scene.findNode("SettingsScreen")
|
||||
if settings = invalid
|
||||
response.Default(500, `Settings screen not found: scene.findNode("SettingsScreen") returned invalid`)
|
||||
return true
|
||||
end if
|
||||
|
||||
settings@.ApplyUserPreferences(payload)
|
||||
response.Default(204, "OK")
|
||||
return true
|
||||
end function)
|
||||
|
||||
' Reset default preferences
|
||||
m.Delete("/api/preferences", function(context as object) as boolean
|
||||
response = context.response
|
||||
task = context.server.task
|
||||
|
||||
scene = task.top.getScene()
|
||||
settings = scene.findNode("SettingsScreen")
|
||||
if settings = invalid
|
||||
response.Default(500, `Settings screen not found: scene.findNode("SettingsScreen") returned invalid`)
|
||||
return true
|
||||
end if
|
||||
|
||||
settings@.ClearUserPreferences(invalid)
|
||||
response.Default(204, "OK")
|
||||
return true
|
||||
end function)
|
||||
|
||||
end function
|
||||
|
||||
end class
|
||||
|
||||
end namespace
|
||||
@@ -0,0 +1,49 @@
|
||||
import "pkg:/source/services/SearchHistory.bs"
|
||||
|
||||
namespace Http
|
||||
|
||||
class SearchHistoryRouter extends HttpRouter
|
||||
|
||||
function new()
|
||||
super()
|
||||
|
||||
m.Get("/api/search-history", function(context as object) as boolean
|
||||
response = context.response
|
||||
response.Json(SearchHistory.GetAllSaved())
|
||||
return true
|
||||
end function)
|
||||
|
||||
m.Put("/api/search-history", function(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
|
||||
payload = request.Json()
|
||||
if payload = invalid
|
||||
response.Default(400, `Invalid JSON payload`)
|
||||
return true
|
||||
end if
|
||||
|
||||
query = payload.query
|
||||
if query = invalid
|
||||
response.Default(400, `missing "query" property in JSON payload`)
|
||||
return true
|
||||
end if
|
||||
|
||||
SearchHistory.Save(query)
|
||||
response.Json(SearchHistory.GetAllSaved())
|
||||
return true
|
||||
end function)
|
||||
|
||||
m.Delete("/api/search-history", function(context as object) as boolean
|
||||
response = context.response
|
||||
|
||||
SearchHistory.Clear()
|
||||
response.Default(204, "OK")
|
||||
return true
|
||||
end function)
|
||||
|
||||
end function
|
||||
|
||||
end class
|
||||
|
||||
end namespace
|
||||
@@ -11,8 +11,9 @@ namespace Http
|
||||
m.Get("/api/state", function(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
task = context.server.task
|
||||
|
||||
keys = ["app", "device", "invidious"]
|
||||
keys = ["app", "device", "invidious", "preferences"]
|
||||
|
||||
if request.query.DoesExist("key")
|
||||
keys = request.query["key"]
|
||||
@@ -25,6 +26,13 @@ namespace Http
|
||||
|
||||
if ArrayIndexOf(keys, "app") <> -1
|
||||
state["app"] = GetAppInfo()
|
||||
scene = task.top.getScene()
|
||||
if scene.playletLibLoadedUrl <> invalid
|
||||
state["app"]["lib_url"] = scene.playletLibLoadedUrl.link
|
||||
state["app"]["lib_url_type"] = scene.playletLibLoadedUrl.type
|
||||
end if
|
||||
latestPlayletLibVersion = GetLatestPlayletLibVersion()
|
||||
state["app"]["lib_version_latest"] = latestPlayletLibVersion
|
||||
end if
|
||||
|
||||
if ArrayIndexOf(keys, "device") <> -1
|
||||
@@ -34,8 +42,8 @@ namespace Http
|
||||
if ArrayIndexOf(keys, "invidious") <> -1
|
||||
authToken = InvidiousSettings.GetAuthToken()
|
||||
state["invidious"] = {
|
||||
instances: InvidiousSettings.GetCurrentInstances(),
|
||||
selected_instance: InvidiousSettings.GetSelectedInstance(),
|
||||
current_instance: InvidiousSettings.GetCurrentInstance(),
|
||||
backup_instances: InvidiousSettings.GetBackupInstances(),
|
||||
auth_url: Invidious.GetAuthorizeTokenLink(),
|
||||
logged_in: authToken <> invalid,
|
||||
logged_in_instance: authToken <> invalid ? authToken.instance : invalid,
|
||||
@@ -43,6 +51,17 @@ namespace Http
|
||||
}
|
||||
end if
|
||||
|
||||
if ArrayIndexOf(keys, "preferences") <> -1
|
||||
scene = task.top.getScene()
|
||||
settings = scene.findNode("SettingsScreen")
|
||||
if settings = invalid
|
||||
response.Default(500, `Settings screen not found: scene.findNode("SettingsScreen") returned invalid`)
|
||||
return true
|
||||
end if
|
||||
|
||||
state["preferences"] = settings@.GetUserPreferences(invalid)
|
||||
end if
|
||||
|
||||
response.Json(state)
|
||||
return true
|
||||
end function)
|
||||
|
||||
@@ -5,6 +5,8 @@ import "pkg:/components/WebServer/Middleware/HttpDefaultRouter.bs"
|
||||
import "pkg:/components/WebServer/Middleware/InvidiousRouter.bs"
|
||||
import "pkg:/components/WebServer/Middleware/RegistryApiRouter.bs"
|
||||
import "pkg:/components/WebServer/Middleware/StateApiRouter.bs"
|
||||
import "pkg:/components/WebServer/Middleware/PreferencesRouter.bs"
|
||||
import "pkg:/components/WebServer/Middleware/SearchHistoryRouter.bs"
|
||||
import "pkg:/components/WebServer/Middleware/CommandsApiRouter.bs"
|
||||
import "pkg:/components/WebServer/Middleware/CorsMiddleware.bs"
|
||||
import "pkg:/components/WebServer/Middleware/BasicAuthMiddleware.bs"
|
||||
@@ -39,7 +41,7 @@ function WebServerLoop()
|
||||
homeRouter = new Http.HttpRouter()
|
||||
homeRouter.Get("/", function(context as object) as boolean
|
||||
response = context.response
|
||||
response.Redirect("/index.v1.html")
|
||||
response.Redirect("/index.html")
|
||||
return true
|
||||
end function)
|
||||
|
||||
@@ -57,8 +59,11 @@ function WebServerLoop()
|
||||
m.server.UseRouter(new Http.DashRouter())
|
||||
m.server.UseRouter(new Http.CommandsApiRouter())
|
||||
m.server.UseRouter(new Http.StateApiRouter())
|
||||
m.server.UseRouter(new Http.PreferencesRouter())
|
||||
m.server.UseRouter(new Http.InvidiousRouter())
|
||||
m.server.UseRouter(new Http.SearchHistoryRouter())
|
||||
m.server.UseRouter(new Http.HttpStaticFilesRouter("/", m.settings.WwwRoot, false, false, false))
|
||||
m.server.UseRouter(new Http.HttpStaticFilesRouter("/config", "libpkg:/config", false, false, false))
|
||||
#if DEBUG
|
||||
m.server.UseRouter(new Http.HttpStaticFilesRouter("/debug/libpkg", "libpkg:/", true, true, false))
|
||||
m.server.UseRouter(new Http.HttpStaticFilesRouter("/debug/pkg", "pkg:/", true, true))
|
||||
|
||||
@@ -113,9 +113,6 @@
|
||||
"displayName": "User Feed",
|
||||
"url": "/api/v1/auth/feed",
|
||||
"authenticated": true,
|
||||
"requestArgs": {
|
||||
"retryCount": 3
|
||||
},
|
||||
"responseHandler": "AuthFeedHandler"
|
||||
},
|
||||
{
|
||||
@@ -123,9 +120,6 @@
|
||||
"displayName": "Playlists",
|
||||
"url": "/api/v1/auth/playlists",
|
||||
"authenticated": true,
|
||||
"requestArgs": {
|
||||
"retryCount": 3
|
||||
},
|
||||
"responseHandler": "AuthPlaylistsHandler"
|
||||
},
|
||||
{
|
||||
|
||||
@@ -0,0 +1,109 @@
|
||||
[
|
||||
{
|
||||
"displayText": "Playback",
|
||||
"key": "playback",
|
||||
"description": "Playback preferences",
|
||||
"children": [
|
||||
{
|
||||
"displayText": "Autoplay",
|
||||
"key": "playback.autoplay",
|
||||
"description": "When you finish a video, another plays automatically",
|
||||
"type": "boolean",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"displayText": "Preferred quality",
|
||||
"key": "playback.preferred_quality",
|
||||
"description": "Preferred video quality",
|
||||
"type": "radio",
|
||||
"defaultValue": "auto",
|
||||
"options": [
|
||||
{
|
||||
"displayText": "Auto",
|
||||
"value": "auto"
|
||||
},
|
||||
{
|
||||
"displayText": "720p",
|
||||
"value": "720p"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"displayText": "Invidious",
|
||||
"key": "invidious",
|
||||
"description": "Invidious preferences",
|
||||
"children": [
|
||||
{
|
||||
"displayText": "Instance",
|
||||
"key": "invidious.instance",
|
||||
"description": "Invidious instance to use",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"displayText": "Proxy videos",
|
||||
"key": "invidious.proxy_videos",
|
||||
"description": "Proxy videos through the Invidious server. This is useful if videos are geoblocked.",
|
||||
"type": "radio",
|
||||
"defaultValue": "if_needed",
|
||||
"options": [
|
||||
{
|
||||
"displayText": "Always",
|
||||
"value": "always"
|
||||
},
|
||||
{
|
||||
"displayText": "Only if needed",
|
||||
"value": "if_needed"
|
||||
},
|
||||
{
|
||||
"displayText": "Never",
|
||||
"value": "never"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"displayText": "SponsorBlock",
|
||||
"key": "sponsorblock",
|
||||
"description": "SponsorBlock preferences",
|
||||
"children": [
|
||||
{
|
||||
"displayText": "Enabled",
|
||||
"key": "sponsorblock.enabled",
|
||||
"description": "Enable SponsorBlock",
|
||||
"type": "boolean",
|
||||
"defaultValue": true
|
||||
},
|
||||
{
|
||||
"displayText": "Show notifications",
|
||||
"key": "sponsorblock.show_notifications",
|
||||
"description": "Show notifications when a segment is skipped",
|
||||
"type": "boolean",
|
||||
"defaultValue": true
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"displayText": "Search History",
|
||||
"key": "search_history",
|
||||
"description": "Search history preferences",
|
||||
"children": [
|
||||
{
|
||||
"displayText": "Clear Search History",
|
||||
"key": "search_history.clear_search_history",
|
||||
"description": "Clear search history from Playlet. This affects the search suggestions. This does not affect the watch history on Invidious.",
|
||||
"visibility": "web",
|
||||
"svelteComponent": "ClearSearchHistoryControl"
|
||||
},
|
||||
{
|
||||
"displayText": "Clear Search History",
|
||||
"key": "search_history.clear_search_history",
|
||||
"description": "Clear search history from Playlet. This affects the search suggestions. This does not affect the watch history on Invidious.",
|
||||
"visibility": "tv",
|
||||
"rokuComponent": "ClearSearchHistoryControl"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
After Width: | Height: | Size: 517 B |
@@ -32,7 +32,7 @@ namespace Invidious
|
||||
end function
|
||||
|
||||
function GetServerStats() as object
|
||||
instance = InvidiousSettings.GetSelectedInstance()
|
||||
instance = InvidiousSettings.GetCurrentInstance()
|
||||
url = `${instance}${Invidious.STATS_ENDPOINT}`
|
||||
|
||||
response = Requests().get(url)
|
||||
@@ -43,7 +43,7 @@ namespace Invidious
|
||||
end function
|
||||
|
||||
function GetVideoStreamUrl(videoId as string, local as boolean) as string
|
||||
instance = InvidiousSettings.GetSelectedInstance()
|
||||
instance = InvidiousSettings.GetCurrentInstance()
|
||||
url = `${instance}/latest_version?id=${videoId}`
|
||||
if local
|
||||
url = url + "&local=true"
|
||||
@@ -52,7 +52,7 @@ namespace Invidious
|
||||
end function
|
||||
|
||||
function GetVideoDashUrl(videoId as string, local as boolean) as string
|
||||
instance = InvidiousSettings.GetSelectedInstance()
|
||||
instance = InvidiousSettings.GetCurrentInstance()
|
||||
url = `${instance}/api/manifest/dash/id/${videoId}`
|
||||
if local
|
||||
url = url + "?local=true"
|
||||
@@ -61,7 +61,7 @@ namespace Invidious
|
||||
end function
|
||||
|
||||
function GetVideoMetadata(videoId as string) as object
|
||||
instance = InvidiousSettings.GetSelectedInstance()
|
||||
instance = InvidiousSettings.GetCurrentInstance()
|
||||
url = `${instance}${Invidious.VIDEOS_ENDPOINT}/${videoId}`
|
||||
|
||||
args = Invidious.DefaultArgs()
|
||||
@@ -94,7 +94,7 @@ namespace Invidious
|
||||
end function
|
||||
|
||||
function SearchSuggestions(q as string) as object 'SearchSuggestionResult
|
||||
instance = InvidiousSettings.GetSelectedInstance()
|
||||
instance = InvidiousSettings.GetCurrentInstance()
|
||||
url = `${instance}${Invidious.SEARCH_SUGGEST_ENDPOINT}`
|
||||
|
||||
args = Invidious.DefaultArgs()
|
||||
@@ -110,7 +110,7 @@ namespace Invidious
|
||||
end function
|
||||
|
||||
function Search(q as string, args = invalid as dynamic) as object
|
||||
instance = InvidiousSettings.GetSelectedInstance()
|
||||
instance = InvidiousSettings.GetCurrentInstance()
|
||||
url = `${instance}${Invidious.SEARCH_ENDPOINT}`
|
||||
|
||||
_args = Invidious.DefaultArgs()
|
||||
@@ -145,7 +145,7 @@ namespace Invidious
|
||||
end function
|
||||
|
||||
function GetAuthorizeTokenLink() as string
|
||||
instance = InvidiousSettings.GetSelectedInstance()
|
||||
instance = InvidiousSettings.GetCurrentInstance()
|
||||
' Make sure the host is not on https, because https cannot redirect to http, which is our local server
|
||||
invidiousHost = instance.Replace("https://", "http://")
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ import "pkg:/source/roku_modules/rokurequests/Requests.brs"
|
||||
import "pkg:/source/utils/TimeUtils.bs"
|
||||
import "pkg:/source/utils/RegistryUtils.bs"
|
||||
import "pkg:/source/utils/General.bs"
|
||||
import "pkg:/source/utils/Crypto.bs"
|
||||
import "pkg:/source/services/InvidiousSettings.bs"
|
||||
|
||||
class InvidiousService
|
||||
@@ -30,7 +31,7 @@ class InvidiousService
|
||||
return invalid
|
||||
end if
|
||||
|
||||
instance = InvidiousSettings.GetSelectedInstance()
|
||||
instance = InvidiousSettings.GetCurrentInstance()
|
||||
|
||||
url = instance + endpoint.url
|
||||
|
||||
@@ -72,15 +73,18 @@ class InvidiousService
|
||||
end for
|
||||
end if
|
||||
|
||||
if endpoint.requestArgs <> invalid
|
||||
args.append(endpoint.requestArgs)
|
||||
end if
|
||||
|
||||
response = Requests().get(url, args)
|
||||
|
||||
responseHandler = endpoint.responseHandler <> invalid ? m.responseHanlders[endpoint.responseHandler] : m.responseHanlders["DefaultHandler"]
|
||||
|
||||
return responseHandler(m, requestData, response)
|
||||
result = responseHandler(m, requestData, response)
|
||||
|
||||
if result <> invalid and endpoint.authenticated = true
|
||||
' Cache response for use by web app
|
||||
m.CacheResponse(requestData, result)
|
||||
end if
|
||||
|
||||
return result
|
||||
end function
|
||||
|
||||
function GetAuthenticationHeaders(token as string) as object
|
||||
@@ -91,7 +95,7 @@ class InvidiousService
|
||||
|
||||
function DefaultHandler(m as object, requestData as object, response as object) as object
|
||||
if response.statuscode = 200
|
||||
return response.json
|
||||
return [{ title: requestData.title, videos: response.json }]
|
||||
end if
|
||||
return invalid
|
||||
end function
|
||||
@@ -103,7 +107,7 @@ class InvidiousService
|
||||
videos = []
|
||||
videos.Append(response.json.notifications)
|
||||
videos.Append(response.json.videos)
|
||||
return videos
|
||||
return [{ title: requestData.title, videos: videos }]
|
||||
end if
|
||||
return invalid
|
||||
end function
|
||||
@@ -112,9 +116,9 @@ class InvidiousService
|
||||
m.DeleteExpiredToken(response)
|
||||
if response.statuscode = 200
|
||||
playlists = response.json
|
||||
result = {}
|
||||
result = []
|
||||
for each playlist in playlists
|
||||
result.append(m.ProcessPlaylist(requestData, playlist))
|
||||
result.push(m.ProcessPlaylist(requestData, playlist))
|
||||
end for
|
||||
return result
|
||||
end if
|
||||
@@ -124,17 +128,14 @@ class InvidiousService
|
||||
function PlaylistHandler(m as object, requestData as object, response as object) as object
|
||||
if response.statuscode = 200
|
||||
playlist = response.json
|
||||
return m.ProcessPlaylist(requestData, playlist)
|
||||
return [m.ProcessPlaylist(requestData, playlist)]
|
||||
end if
|
||||
return invalid
|
||||
end function
|
||||
|
||||
function ProcessPlaylist(requestData as object, playlist as object) as object
|
||||
title = requestData.title
|
||||
title = m.ProcessTemplate(title, playlist)
|
||||
result = {}
|
||||
result[title] = playlist.videos
|
||||
return result
|
||||
title = m.ProcessTemplate(requestData.title, playlist)
|
||||
return { title: title, videos: playlist.videos }
|
||||
end function
|
||||
|
||||
function ProcessTemplate(template as string, data as object) as string
|
||||
@@ -172,4 +173,11 @@ class InvidiousService
|
||||
currentTime = TimeUtils.Now().AsSeconds()
|
||||
return expire < currentTime
|
||||
end function
|
||||
|
||||
function CacheResponse(requestData as object, result as object)
|
||||
cacheKey = FormatJson(requestData)
|
||||
cacheKey = GetMd5(cacheKey)
|
||||
value = FormatJson(result)
|
||||
WriteAsciiFile(`tmp:/${cacheKey}.json`, value)
|
||||
end function
|
||||
end class
|
||||
@@ -1,4 +1,6 @@
|
||||
import "pkg:/source/utils/RegistryUtils.bs"
|
||||
import "pkg:/components/SettingsScreen/Settings.bs"
|
||||
import "pkg:/source/roku_modules/rokurequests/Requests.brs"
|
||||
|
||||
namespace InvidiousSettings
|
||||
|
||||
@@ -6,36 +8,17 @@ namespace InvidiousSettings
|
||||
|
||||
const INSTANCES_API = "https://api.invidious.io/instances.json?sort_by=type,users"
|
||||
|
||||
function GetCurrentInstances() as object
|
||||
' TODO: cache this call to avoid json parsing every time
|
||||
instances = InvidiousSettings.GetRegistryInstances()
|
||||
if instances.Count() > 0
|
||||
return instances
|
||||
function GetCurrentInstance() as object
|
||||
settings = FindAndGetPreferenceValues(["invidious.instance"])
|
||||
if settings <> invalid and settings["invidious.instance"] <> invalid and settings["invidious.instance"] <> ""
|
||||
return settings["invidious.instance"]
|
||||
end if
|
||||
|
||||
publicInstances = InvidiousSettings.GetPublicInstances()
|
||||
if publicInstances <> invalid
|
||||
for i = 0 to publicInstances.Count() - 1
|
||||
if InvidiousSettings.IsValidPublicInstance(publicInstances[i])
|
||||
instances.push(publicInstances[i].uri)
|
||||
end if
|
||||
if instances.Count() >= 5
|
||||
exit for
|
||||
end if
|
||||
end for
|
||||
backupInstances = InvidiousSettings.GetBackupInstances()
|
||||
if backupInstances.Count() > 0
|
||||
return backupInstances[0]
|
||||
end if
|
||||
|
||||
if instances.Count() > 0
|
||||
InvidiousSettings.SetRegistryInstances(instances)
|
||||
return instances
|
||||
end if
|
||||
|
||||
return [InvidiousSettings.DEFAULT_INSTANCE]
|
||||
end function
|
||||
|
||||
function GetSelectedInstance() as string
|
||||
instances = InvidiousSettings.GetCurrentInstances()
|
||||
return instances[0]
|
||||
return InvidiousSettings.DEFAULT_INSTANCE
|
||||
end function
|
||||
|
||||
function SetAuthToken(token as string, instance as string, username as dynamic)
|
||||
@@ -49,13 +32,6 @@ namespace InvidiousSettings
|
||||
|
||||
json = FormatJson(obj)
|
||||
RegistryUtils.Write(RegistryUtils.INVIDIOUS_TOKEN, json)
|
||||
|
||||
instances = InvidiousSettings.GetCurrentInstances()
|
||||
index = ArrayIndexOf(instances, instance)
|
||||
if index = -1
|
||||
instances.push(instance)
|
||||
InvidiousSettings.SetRegistryInstances(instances)
|
||||
end if
|
||||
end function
|
||||
|
||||
function GetAuthToken() as dynamic
|
||||
@@ -66,27 +42,34 @@ namespace InvidiousSettings
|
||||
return ParseJson(tokenPayload)
|
||||
end function
|
||||
|
||||
function GetRegistryInstances() as object
|
||||
instances = RegistryUtils.Read(RegistryUtils.INVIDIOUS_INSTANCES)
|
||||
if instances = invalid
|
||||
return []
|
||||
function GetBackupInstances() as object
|
||||
if m.global.hasField("invidiousBackupInstances")
|
||||
return m.global.invidiousBackupInstances
|
||||
end if
|
||||
return ParseJson(instances)
|
||||
return []
|
||||
end function
|
||||
|
||||
function SetRegistryInstances(instances as object)
|
||||
RegistryUtils.Write(RegistryUtils.INVIDIOUS_INSTANCES, FormatJson(instances))
|
||||
function FetchBackupInstances() as object
|
||||
backupInstances = []
|
||||
publicInstances = InvidiousSettings.GetPublicInstances()
|
||||
for i = 0 to publicInstances.Count() - 1
|
||||
if InvidiousSettings.IsValidPublicInstance(publicInstances[i])
|
||||
backupInstances.push(publicInstances[i].uri)
|
||||
end if
|
||||
if backupInstances.Count() >= 5
|
||||
exit for
|
||||
end if
|
||||
end for
|
||||
|
||||
return backupInstances
|
||||
end function
|
||||
|
||||
function GetPublicInstances() as object
|
||||
if m.invidiousPublicInstances <> invalid
|
||||
return m.invidiousPublicInstances
|
||||
end if
|
||||
instances = []
|
||||
|
||||
response = Requests().get(InvidiousSettings.INSTANCES_API)
|
||||
if response.statuscode = 200
|
||||
json = response.json
|
||||
instances = []
|
||||
|
||||
for each instance in json
|
||||
data = instance[1]
|
||||
@@ -97,10 +80,9 @@ namespace InvidiousSettings
|
||||
instances.push(data)
|
||||
end for
|
||||
|
||||
m.invidiousPublicInstances = instances
|
||||
end if
|
||||
|
||||
return m.invidiousPublicInstances
|
||||
return instances
|
||||
end function
|
||||
|
||||
function IsValidPublicInstance(instance as object) as boolean
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
import "pkg:/source/utils/RegistryUtils.bs"
|
||||
|
||||
class PreferencesService
|
||||
private version = 1
|
||||
private prefs_model
|
||||
private user_prefs
|
||||
|
||||
function new()
|
||||
m.LoadConfigFile()
|
||||
m.LoadUserPreferences()
|
||||
end function
|
||||
|
||||
function LoadConfigFile()
|
||||
m.prefs_model = ParseJson(ReadAsciiFile("libpkg:/config/preferences.json"))
|
||||
end function
|
||||
|
||||
function LoadUserPreferences()
|
||||
' Step 1: Load user preferences from registry
|
||||
m.user_prefs = RegistryUtils.Read(RegistryUtils.USER_PREFERENCES)
|
||||
if m.user_prefs = invalid
|
||||
m.user_prefs = "{}"
|
||||
end if
|
||||
m.user_prefs = ParseJson(m.user_prefs)
|
||||
' Step 2: Migrate existing preferences to new format (if needed)
|
||||
isDirty = m.MigrateExistingPreferences()
|
||||
' Step 3: Apply defaults to user preferences (if needed)
|
||||
isDirty = m.ApplyDefaultsToUserPreferences() or isDirty
|
||||
if isDirty
|
||||
m.SaveUserPreferences()
|
||||
end if
|
||||
end function
|
||||
|
||||
function SaveUserPreferences()
|
||||
m.user_prefs.__version = m.version
|
||||
RegistryUtils.Write(RegistryUtils.USER_PREFERENCES, FormatJson(m.user_prefs))
|
||||
end function
|
||||
|
||||
function MigrateExistingPreferences() as boolean
|
||||
isDirty = false
|
||||
|
||||
' v0 -> v1
|
||||
instances = RegistryUtils.Read(RegistryUtils.INVIDIOUS_INSTANCES)
|
||||
if instances <> invalid
|
||||
currentInstance = m.user_prefs["invidious.instance"]
|
||||
if currentInstance = invalid or currentInstance = ""
|
||||
instances = ParseJson(instances)
|
||||
if instances.Count() > 0
|
||||
instance = instances[0]
|
||||
if instance <> invalid and instance <> ""
|
||||
m.user_prefs["invidious.instance"] = instance
|
||||
isDirty = true
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
RegistryUtils.Delete(RegistryUtils.INVIDIOUS_INSTANCES)
|
||||
end if
|
||||
|
||||
' v1 -> v2 goes here (if needed)
|
||||
' if m.user_prefs.__version = 1
|
||||
' 'do stuff
|
||||
' end if
|
||||
|
||||
' TODO: handle case where saved preferences version is higher than current version (e.g. user downgraded)
|
||||
return isDirty
|
||||
end function
|
||||
|
||||
function ApplyDefaultsToUserPreferences() as boolean
|
||||
isDirty = false
|
||||
for each child in m.prefs_model
|
||||
isDirty = m.ApplyToUserPreferences(m.user_prefs, child) or isDirty
|
||||
end for
|
||||
return isDirty
|
||||
end function
|
||||
|
||||
function ApplyToUserPreferences(userPrefs as object, model as object) as boolean
|
||||
isDirty = false
|
||||
if model.children <> invalid
|
||||
for each child in model.children
|
||||
isDirty = m.ApplyToUserPreferences(userPrefs, child) or isDirty
|
||||
end for
|
||||
end if
|
||||
|
||||
if model.defaultValue <> invalid and (not userPrefs.DoesExist(model.key) or userPrefs[model.key] = invalid)
|
||||
userPrefs[model.key] = model.defaultValue
|
||||
isDirty = true
|
||||
end if
|
||||
return isDirty
|
||||
end function
|
||||
|
||||
function GetUserPreferences() as object
|
||||
return m.user_prefs
|
||||
end function
|
||||
|
||||
function ApplyUserPreferences(preferences as object) as void
|
||||
if preferences = invalid
|
||||
return
|
||||
end if
|
||||
' TODO: user input validation
|
||||
for each key in preferences
|
||||
m.user_prefs[key] = preferences[key]
|
||||
end for
|
||||
m.SaveUserPreferences()
|
||||
end function
|
||||
|
||||
function ClearUserPreferences() as void
|
||||
m.user_prefs = {}
|
||||
m.ApplyDefaultsToUserPreferences()
|
||||
m.SaveUserPreferences()
|
||||
end function
|
||||
|
||||
function GetValue(key as string) as dynamic
|
||||
return m.user_prefs[key]
|
||||
end function
|
||||
|
||||
function SetValue(key as string, value as dynamic) as void
|
||||
if m.user_prefs[key] = value
|
||||
return
|
||||
end if
|
||||
m.user_prefs[key] = value
|
||||
m.SaveUserPreferences()
|
||||
end function
|
||||
end class
|
||||
@@ -0,0 +1,54 @@
|
||||
import "pkg:/source/utils/General.bs"
|
||||
import "pkg:/source/utils/RegistryUtils.bs"
|
||||
|
||||
namespace SearchHistory
|
||||
function Save(q as string, maxItems = 10 as integer)
|
||||
history = GetAllSaved()
|
||||
index = ArrayIndexOf(history, q)
|
||||
if index <> -1
|
||||
history.Delete(index)
|
||||
end if
|
||||
|
||||
history.Unshift(q)
|
||||
|
||||
if history.Count() > maxItems
|
||||
history.Pop()
|
||||
end if
|
||||
|
||||
history = FormatJson(history)
|
||||
|
||||
RegistryUtils.Write(RegistryUtils.SEARCH_HISTORY, history)
|
||||
end function
|
||||
|
||||
function GetSaved(q as string) as object
|
||||
history = GetAllSaved()
|
||||
if history.count() = 0
|
||||
return []
|
||||
end if
|
||||
|
||||
if q = ""
|
||||
return history
|
||||
end if
|
||||
result = []
|
||||
for each keyword in history
|
||||
if keyword.InStr(q) = 0
|
||||
result.push(keyword)
|
||||
end if
|
||||
end for
|
||||
return result
|
||||
end function
|
||||
|
||||
function GetAllSaved() as object
|
||||
history = RegistryUtils.Read(RegistryUtils.SEARCH_HISTORY)
|
||||
if history = invalid
|
||||
return []
|
||||
end if
|
||||
return ParseJson(history)
|
||||
end function
|
||||
|
||||
|
||||
function Clear()
|
||||
RegistryUtils.Delete(RegistryUtils.SEARCH_HISTORY)
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -1,4 +1,5 @@
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/roku_modules/rokurequests/Requests.brs"
|
||||
|
||||
function GetLocalIpAddress() as dynamic
|
||||
if m.ipAddress = invalid or m.ipAddress = ""
|
||||
@@ -33,6 +34,28 @@ function GetAppInfo() as object
|
||||
return m.appInfo
|
||||
end function
|
||||
|
||||
function GetLatestPlayletLibVersion() as dynamic
|
||||
if m.latestPlayletLibVersion = invalid
|
||||
args = {
|
||||
parseJson: false
|
||||
}
|
||||
response = Requests().request("HEAD", "https://github.com/iBicha/playlet/releases/latest", args)
|
||||
|
||||
if response.statusCode = 200
|
||||
if response.headers.location <> invalid
|
||||
regex = CreateObject("roRegex", "/v?(\d+\.\d+\.\d+)", "")
|
||||
match = regex.match(response.headers.location)
|
||||
if match.Count() = 2
|
||||
m.latestPlayletLibVersion = match[1]
|
||||
return m.latestPlayletLibVersion
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
m.latestPlayletLibVersion = "N/A"
|
||||
end if
|
||||
return m.latestPlayletLibVersion
|
||||
end function
|
||||
|
||||
function GetLibVersion() as string
|
||||
values = GetLibManifestValues()
|
||||
|
||||
@@ -89,7 +112,9 @@ function GetDeviceInfo() as object
|
||||
video_mode: devInfo.GetVideoMode(),
|
||||
ui_resolution: devInfo.GetUIResolution(),
|
||||
graphics_platform: devInfo.GetGraphicsPlatform(),
|
||||
internet_status: devInfo.GetInternetStatus()
|
||||
internet_status: devInfo.GetInternetStatus(),
|
||||
user_country_code: devInfo.GetUserCountryCode(),
|
||||
friendly_name: devInfo.GetFriendlyName()
|
||||
}
|
||||
end if
|
||||
return m.deviceInfo
|
||||
|
||||
@@ -2,6 +2,11 @@ namespace RegistryUtils
|
||||
|
||||
const DEFAULT_SECTION = "Playlet"
|
||||
|
||||
const USER_PREFERENCES = "user_prefs"
|
||||
|
||||
const SEARCH_HISTORY = "search_history"
|
||||
const PLAYLET_LIB_URLS = "playlet_lib_urls"
|
||||
|
||||
const INVIDIOUS_INSTANCES = "invidious_instances"
|
||||
const INVIDIOUS_TOKEN = "invidious_token"
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, viewport-fit=cover" />
|
||||
<title>Playlet</title>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -9,19 +9,20 @@
|
||||
"check": "svelte-check --tsconfig ./tsconfig.json"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "^2.1.0",
|
||||
"@sveltejs/vite-plugin-svelte": "^2.4.2",
|
||||
"@tailwindcss/typography": "^0.5.9",
|
||||
"@tsconfig/svelte": "^4.0.1",
|
||||
"autoprefixer": "^10.4.14",
|
||||
"daisyui": "^2.51.5",
|
||||
"dotenv": "^16.0.3",
|
||||
"internal-ip": "^7.0.0",
|
||||
"postcss": "^8.4.23",
|
||||
"svelte": "^3.58.0",
|
||||
"svelte-check": "^3.2.0",
|
||||
"svelte-preprocess": "^5.0.3",
|
||||
"tailwindcss": "^3.3.1",
|
||||
"tslib": "^2.5.0",
|
||||
"typescript": "^5.0.4",
|
||||
"vite": "^4.3.1"
|
||||
"daisyui": "^3.1.6",
|
||||
"dotenv": "^16.3.1",
|
||||
"ip": "^1.1.8",
|
||||
"postcss": "^8.4.24",
|
||||
"svelte": "^4.0.0",
|
||||
"svelte-check": "^3.4.4",
|
||||
"svelte-preprocess": "^5.0.4",
|
||||
"tailwindcss": "^3.3.2",
|
||||
"tslib": "^2.5.3",
|
||||
"typescript": "^5.1.3",
|
||||
"vite": "^4.3.9"
|
||||
}
|
||||
}
|
||||
@@ -1,436 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Playlet</title>
|
||||
<style>
|
||||
table,
|
||||
th,
|
||||
td {
|
||||
border: 1px solid;
|
||||
cursor: all-scroll;
|
||||
}
|
||||
|
||||
table {
|
||||
-webkit-user-select: none;
|
||||
-ms-user-select: none;
|
||||
user-select: none;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body ondrop="OnBodyDrop(event);" ondragover="OnBodyDragover(event);">
|
||||
<h2>Playlet - Youtube Player for Roku</h2>
|
||||
<h4 id="app-version">Version: </h4>
|
||||
<h4>Invidious Instance: <a id="instance" target="_blank">None</a></h4>
|
||||
<button onclick="PlayVideo()">Play Video</button>
|
||||
<label for="video-id">Video ID:</label>
|
||||
<input type="text" id="video-id" name="video-id" style="min-width:300px;">
|
||||
<div><small>Hint: drag and drop links or video thumbnails from Youtube or Invidious into this page</small></div>
|
||||
|
||||
<h4 id="logged-in">Logged In: </h4>
|
||||
<button style="display: none" id="login-button" onclick="Login()">Login</button>
|
||||
<button style="display: none" id="logout-button" onclick="Logout()">Logout</button>
|
||||
|
||||
<br />
|
||||
|
||||
<table id="instances">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Instances - find more at <a href="https://api.invidious.io/" target="_blank">api.invidious.io</a></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
</tbody>
|
||||
<tbody>
|
||||
<tr id="instance-input-row">
|
||||
<td>
|
||||
<input type="text" id="instance-input" name="new-instance" oninput="OnNewInstanceTextChanged()"
|
||||
style="min-width:300px;">
|
||||
</td>
|
||||
<td>
|
||||
<button id="instance-add" disabled="true" onclick="AddInstance()">Add</button>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<div><small>Hint: drag and drop instances to reorder them. The one at the top will be used.</small></div>
|
||||
<button style="display: none" id="update-instances" onclick="UpdateInstances()">Update Instances</button>
|
||||
</br>
|
||||
<button onclick="ClearSearchHistory()">Clear Search History</button>
|
||||
|
||||
<h5>Instructions</h5>
|
||||
<ul>
|
||||
<li>Make sure you are logged in the Invidious instance before logging in on this page</li>
|
||||
<li>If this is your first time using this invidious Instance, you might want to create an account</li>
|
||||
<li>Once you are logged in to your current instance, click "Login" on this page, and authorize the token</li>
|
||||
<li>Once logged in, this page should show "Logged In: true"</li>
|
||||
<li>After login, the home page should refresh automatically. You should then be able to see your Subscription feed
|
||||
and Playlists, if you have any.</li>
|
||||
</ul>
|
||||
<p>
|
||||
This is a barebone page for now, <a href="/index.html">click here for the redesigned page!</a>
|
||||
</p>
|
||||
<h5>Feedback is welcome over at: <a id="feedback-url" href="https://github.com/iBicha/playlet"
|
||||
target="_blank">https://github.com/iBicha/playlet</a></h5>
|
||||
|
||||
<div id="dev-menu" style="display: none;">
|
||||
<h4>Developer menu</h4>
|
||||
<p><small>These are for testing purposes only, and are not meant to be used by end users.</small></p>
|
||||
<label for="playlet-lib-tag">Playlet Lib Tag:</label>
|
||||
<select name="playlet-lib-tag" id="playlet-lib-tag">
|
||||
<option value="">latest (default)</option>
|
||||
</select>
|
||||
<button onclick="SetPlayletLibUrls()">Apply</button>
|
||||
</div>
|
||||
<script>
|
||||
function Login() {
|
||||
if (!window.appState) {
|
||||
alert("Error with login, please refresh the page.")
|
||||
}
|
||||
window.location = window.appState.invidious.auth_url
|
||||
}
|
||||
|
||||
function Logout() {
|
||||
PostJson('/api/command', { command: "logout" })
|
||||
.then(function (response) {
|
||||
window.location.reload();
|
||||
})
|
||||
.catch(function (err) {
|
||||
alert(err)
|
||||
});
|
||||
}
|
||||
|
||||
function PlayVideo() {
|
||||
let v = document.getElementById('video-id').value
|
||||
if (IsValidHttpUrl(v)) {
|
||||
v = GetVideoId(v)
|
||||
}
|
||||
if (!v || v.length < 8) {
|
||||
alert("Please set video id")
|
||||
return
|
||||
}
|
||||
PostJson('/api/command', { command: "play", videoId: v })
|
||||
.catch(function (err) {
|
||||
alert(err)
|
||||
});
|
||||
}
|
||||
|
||||
function ClearSearchHistory() {
|
||||
PostJson('/api/command', { command: "clear-search-history" })
|
||||
.then(function (response) {
|
||||
alert("Search history cleared");
|
||||
})
|
||||
.catch(function (err) {
|
||||
alert(err)
|
||||
});
|
||||
}
|
||||
|
||||
function CreateGithubIssueUrl() {
|
||||
title = "[Feedback] Playlet"
|
||||
body = `### Feedback
|
||||
_insert feedback here_
|
||||
|
||||
#### App Info
|
||||
\`\`\`
|
||||
${JSON.stringify(window.appState.app, null, 2)}
|
||||
\`\`\`
|
||||
|
||||
#### Device Info
|
||||
\`\`\`
|
||||
${JSON.stringify(window.appState.device, null, 2)}
|
||||
\`\`\`
|
||||
|
||||
#### Invidious settings
|
||||
\`\`\`
|
||||
${JSON.stringify(window.appState.invidious, null, 2)}
|
||||
\`\`\``;
|
||||
return `https://github.com/iBicha/playlet/issues/new?title=${encodeURIComponent(title)}&body=${encodeURIComponent(body)}`
|
||||
}
|
||||
|
||||
function IsValidHttpUrl(string) {
|
||||
let url;
|
||||
try {
|
||||
url = new URL(string);
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
return url.protocol === "http:" || url.protocol === "https:";
|
||||
}
|
||||
|
||||
function GetVideoId(url) {
|
||||
// Share/Short url
|
||||
const YoutubeUrls = [
|
||||
"https://youtu.be/",
|
||||
"http://youtu.be/",
|
||||
"https://www.youtu.be/",
|
||||
"http://www.youtu.be/",
|
||||
"https://youtube.com/shorts/",
|
||||
"http://youtube.com/shorts/",
|
||||
"https://www.youtube.com/shorts/",
|
||||
"http://www.youtube.com/shorts/",
|
||||
]
|
||||
for (var i in YoutubeUrls) {
|
||||
let youtubeUrl = YoutubeUrls[i];
|
||||
if (url.startsWith(youtubeUrl)) {
|
||||
url = url.replace(youtubeUrl, "")
|
||||
if (url.includes("?")) {
|
||||
url = url.substring(0, url.indexOf("?"))
|
||||
}
|
||||
return url
|
||||
}
|
||||
}
|
||||
|
||||
// regular url
|
||||
url = new URL(url)
|
||||
const urlSearchParams = new URLSearchParams(url.search);
|
||||
return urlSearchParams.get('v')
|
||||
}
|
||||
|
||||
function OnNewInstanceTextChanged() {
|
||||
document.getElementById("instance-add").disabled = !IsValidHttpUrl(document.getElementById("instance-input").value)
|
||||
}
|
||||
|
||||
function AddInstance() {
|
||||
instance = document.getElementById("instance-input").value
|
||||
AddInstanceRow(instance)
|
||||
document.getElementById("instance-input").value = ""
|
||||
document.getElementById("update-instances").style.display = "block";
|
||||
}
|
||||
|
||||
function AddInstanceRow(instance) {
|
||||
instances = document.getElementById("instances").getElementsByTagName('tbody')[0];
|
||||
var row = instances.insertRow();
|
||||
row.draggable = true
|
||||
row.addEventListener('dragstart', OnTableRowDragStart);
|
||||
row.addEventListener('dragover', OnTableRowDragover);
|
||||
row.addEventListener('drop', OnTableRowDrop);
|
||||
var cell = row.insertCell();
|
||||
style = instance === window.appState.invidious.selected_instance ? `style="font-weight:bold"` : ""
|
||||
cell.innerHTML = `<a href="${instance}" ${style} target="_blank">${instance}</a>`
|
||||
cell = row.insertCell();
|
||||
cell.innerHTML = `<button onclick="RemoveInstance('${instance}')">Remove</button>`
|
||||
}
|
||||
|
||||
function RemoveInstance(instance) {
|
||||
instanceRows = Array.from(document.getElementById("instances")
|
||||
.getElementsByTagName('tbody')[0]
|
||||
.getElementsByTagName('tr'));
|
||||
|
||||
for (const i in instanceRows) {
|
||||
currentInstance = instanceRows[i].getElementsByTagName('a')[0].innerText
|
||||
if (currentInstance === instance) {
|
||||
instanceRows[i].remove()
|
||||
document.getElementById("update-instances").style.display = "block";
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function UpdateInstances() {
|
||||
instances = Array.from(document.getElementById("instances")
|
||||
.getElementsByTagName('tbody')[0]
|
||||
.getElementsByTagName('td'))
|
||||
.map(el => el.getElementsByTagName('a')[0])
|
||||
.filter(a => !!a)
|
||||
.map(a => a.innerText);
|
||||
|
||||
PostJson('/invidious/instances', instances)
|
||||
.then(function (response) {
|
||||
alert("Instances updated. Restart Playlet to reflect changes.")
|
||||
window.location.reload();
|
||||
})
|
||||
.catch(function (err) {
|
||||
alert(err)
|
||||
});
|
||||
}
|
||||
|
||||
function PostJson(url, payload) {
|
||||
return fetch(url,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
method: "POST",
|
||||
body: JSON.stringify(payload)
|
||||
})
|
||||
}
|
||||
|
||||
function FetchReleaseTags() {
|
||||
fetch("https://api.github.com/repos/iBicha/playlet/releases")
|
||||
.then(function (response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function (releases) {
|
||||
releases.filter(release => release.assets.filter(asset => asset.name === "playlet-lib.zip").length > 0)
|
||||
.forEach(r => {
|
||||
var option = document.createElement("option");
|
||||
option.text = r.tag_name;
|
||||
option.value = r.tag_name;
|
||||
document.getElementById("playlet-lib-tag").add(option);
|
||||
})
|
||||
})
|
||||
}
|
||||
|
||||
function SetPlayletLibUrls() {
|
||||
var tags = document.getElementById("playlet-lib-tag");
|
||||
var value = tags.value;
|
||||
let content = null
|
||||
|
||||
if(value !== ""){
|
||||
content = JSON.stringify([{
|
||||
link: `https://github.com/iBicha/playlet/releases/download/${value}/playlet-lib.zip`,
|
||||
type: 'custom'
|
||||
}]);
|
||||
}
|
||||
|
||||
PostJson('/api/command', { command: "set-playlet-lib-urls", content: content })
|
||||
.then(function (response) {
|
||||
alert("Playlet lib tag updated. Restart Playlet to reflect changes.");
|
||||
window.location.reload();
|
||||
})
|
||||
.catch(function (err) {
|
||||
alert(err)
|
||||
});
|
||||
}
|
||||
|
||||
function ShouldShowDevMenu() {
|
||||
const urlSearchParams = new URLSearchParams(window.location.search);
|
||||
return !!urlSearchParams.get('dev')
|
||||
}
|
||||
|
||||
function Initialize() {
|
||||
fetch("/api/state")
|
||||
.then(function (response) {
|
||||
return response.json();
|
||||
})
|
||||
.then(function (appState) {
|
||||
window.appState = appState
|
||||
console.log(appState)
|
||||
|
||||
document.getElementById("app-version").innerText = `Version: ${appState.app.version}`
|
||||
|
||||
if (appState.invidious.logged_in) {
|
||||
let loggedIn = 'Logged In '
|
||||
if (appState.invidious.logged_in_username) {
|
||||
loggedIn += `as "${appState.invidious.logged_in_username}"`
|
||||
} else {
|
||||
loggedIn += ": true"
|
||||
}
|
||||
loggedIn += ` (<a href="${appState.invidious.logged_in_instance}" target="_blank">${appState.invidious.logged_in_instance}</a>)`
|
||||
document.getElementById("logged-in").innerHTML = loggedIn
|
||||
} else {
|
||||
document.getElementById("logged-in").innerHTML = "Logged In: false"
|
||||
}
|
||||
|
||||
instanceEl = document.getElementById("instance")
|
||||
instanceEl.innerText = instanceEl.href = appState.invidious.selected_instance
|
||||
|
||||
for (var i in appState.invidious.instances) {
|
||||
AddInstanceRow(appState.invidious.instances[i])
|
||||
}
|
||||
|
||||
loginButton = document.getElementById("login-button")
|
||||
loginButton.innerText = `Login (${appState.invidious.selected_instance})`
|
||||
loginButton.style.display = appState.invidious.logged_in ? "none" : "block";
|
||||
|
||||
document.getElementById("logout-button").style.display = !appState.invidious.logged_in ? "none" : "block";
|
||||
|
||||
document.getElementById("feedback-url").href = CreateGithubIssueUrl()
|
||||
})
|
||||
.catch(function (err) {
|
||||
alert(err)
|
||||
});
|
||||
|
||||
SetupWebSocket();
|
||||
if(ShouldShowDevMenu()){
|
||||
document.getElementById("dev-menu").style.display = "block";
|
||||
FetchReleaseTags();
|
||||
}
|
||||
}
|
||||
|
||||
var tableRow;
|
||||
function OnTableRowDragStart(event) {
|
||||
target = event.target;
|
||||
while (target && target.tagName !== 'TR') {
|
||||
target = target.parentNode
|
||||
}
|
||||
if (target.id === "instance-input-row") {
|
||||
return
|
||||
}
|
||||
tableRow = target
|
||||
}
|
||||
|
||||
function OnTableRowDragover(event) {
|
||||
event.preventDefault();
|
||||
|
||||
if (!tableRow) {
|
||||
return
|
||||
}
|
||||
|
||||
target = event.target;
|
||||
while (target && target.tagName !== 'TR') {
|
||||
target = target.parentNode
|
||||
}
|
||||
if (!target || target.id === "instance-input-row") {
|
||||
return
|
||||
}
|
||||
|
||||
let children = Array.from(target.parentNode.children);
|
||||
|
||||
if (children.indexOf(target) > children.indexOf(tableRow))
|
||||
target.after(tableRow);
|
||||
else
|
||||
target.before(tableRow);
|
||||
}
|
||||
|
||||
function OnTableRowDrop(event) {
|
||||
event.preventDefault();
|
||||
tableRow = undefined
|
||||
document.getElementById("update-instances").style.display = "block";
|
||||
}
|
||||
|
||||
function OnBodyDrop(event) {
|
||||
for (var i in event.dataTransfer.items) {
|
||||
let item = event.dataTransfer.items[i]
|
||||
if (item.kind = 'string' && item.getAsString) {
|
||||
item.getAsString((dataString) => {
|
||||
if (IsValidHttpUrl(dataString) && GetVideoId(dataString)) {
|
||||
document.getElementById('video-id').value = dataString
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
function OnBodyDragover(event) {
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
function SetupWebSocket() {
|
||||
var socket = new WebSocket(`ws://${window.location.host}`);
|
||||
socket.onopen = function (event) {
|
||||
console.log("WebSocket connected!")
|
||||
const message = "Hello?"
|
||||
console.log(`Sending: "${message}"`)
|
||||
socket.send(message);
|
||||
};
|
||||
socket.onclose = function (event) {
|
||||
console.log("WebSocket closed!")
|
||||
};
|
||||
socket.onerror = function (event) {
|
||||
console.log('WebSocket error: ', event);
|
||||
};
|
||||
socket.onmessage = function (event) {
|
||||
console.log(`Received: "${event.data}"`);
|
||||
}
|
||||
}
|
||||
|
||||
Initialize();
|
||||
</script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,25 +1,66 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import InstanceInfo from "./lib/InstanceInfo.svelte";
|
||||
import NavBar from "./lib/NavBar.svelte";
|
||||
import PlayVideo from "./lib/PlayVideo.svelte";
|
||||
import ClearSearchHistory from "./lib/ClearSearchHistory.svelte";
|
||||
import { PlayletApi } from "./lib/PlayletApi";
|
||||
import { playletStateStore } from "./lib/Stores";
|
||||
import LegacyUI from "./lib/LegacyUI.svelte";
|
||||
import { appStateStore, homeLayoutFileStore, invidiousVideoApiStore, playletStateStore, preferencesModelStore, searchHistoryStore, userPreferencesStore } from "./lib/Stores";
|
||||
import BottomNavigation from "./lib/BottomNavigation.svelte";
|
||||
import ScreenHome from "./lib/ScreenHome.svelte";
|
||||
import type { AppState } from "./lib/Types";
|
||||
import ScreenSearch from "./lib/ScreenSearch.svelte";
|
||||
import ScreenSettings from "./lib/ScreenSettings.svelte";
|
||||
import ScreenInfo from "./lib/ScreenInfo.svelte";
|
||||
import LinkDragDrop from "./lib/LinkDragDrop.svelte";
|
||||
|
||||
onMount(async () => {
|
||||
const playletState = await PlayletApi.getState();
|
||||
playletStateStore.set(playletState);
|
||||
PlayletApi.getState().then((value) => {
|
||||
playletStateStore.set(value);
|
||||
});
|
||||
|
||||
PlayletApi.getHomeLayoutFile().then((value) => {
|
||||
homeLayoutFileStore.set(value);
|
||||
});
|
||||
|
||||
PlayletApi.getInvidiousVideoApiFile().then((invidiousVideoApiFile) => {
|
||||
const invidiousVideoApiDefinitions =
|
||||
invidiousVideoApiFile.endpoints.reduce((acc, endpoint) => {
|
||||
acc[endpoint.name] = endpoint;
|
||||
return acc;
|
||||
}, {});
|
||||
invidiousVideoApiStore.set(invidiousVideoApiDefinitions);
|
||||
});
|
||||
|
||||
PlayletApi.getPreferencesFile().then((value) => {
|
||||
preferencesModelStore.set(value);
|
||||
});
|
||||
|
||||
PlayletApi.getUserPreferences().then((value) => {
|
||||
userPreferencesStore.set(value);
|
||||
});
|
||||
|
||||
PlayletApi.getSearchHistory().then((value) => {
|
||||
searchHistoryStore.set(value);
|
||||
});
|
||||
});
|
||||
|
||||
let currentScreen: AppState["screen"];
|
||||
appStateStore.subscribe((value) => {
|
||||
currentScreen = value.screen;
|
||||
});
|
||||
</script>
|
||||
|
||||
<main>
|
||||
<LinkDragDrop />
|
||||
|
||||
<NavBar />
|
||||
<div class="p-6 space-y-2 form-control">
|
||||
<InstanceInfo />
|
||||
<PlayVideo />
|
||||
<ClearSearchHistory />
|
||||
<LegacyUI />
|
||||
<!-- TODO: a better way to make the BottomNavigation not hide screens -->
|
||||
<div style="margin-bottom: 4rem">
|
||||
<ScreenSearch visibility={currentScreen == "search"} />
|
||||
|
||||
<ScreenHome visibility={currentScreen == "home"} />
|
||||
|
||||
<ScreenSettings visibility={currentScreen == "settings"} />
|
||||
|
||||
<ScreenInfo visibility={currentScreen == "info"} />
|
||||
</div>
|
||||
<BottomNavigation />
|
||||
</main>
|
||||
@@ -0,0 +1,6 @@
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet" focusable="false" style="pointer-events: none; display: block; width: 100%; height: 100%;">
|
||||
<g class="fill-current">
|
||||
<path d="M4,10V21h6V15h4v6h6V10L12,3Z"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 364 B |
@@ -0,0 +1,6 @@
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 122.88 122.88" preserveAspectRatio="xMidYMid meet" focusable="false" style="pointer-events: none; display: block; width: 100%; height: 100%;">
|
||||
<g class="fill-current">
|
||||
<path d="M61.44,9.23c-1.85,0-3.64,0.08-5.35,0.25c-1.71,0.17-3.44,0.42-5.17,0.77c-1.72,0.34-3.39,0.77-5,1.26 c-1.59,0.49-3.16,1.07-4.7,1.72l-0.1,0.05l0,0c-1.63,0.7-3.18,1.45-4.67,2.25c-1.5,0.81-2.94,1.68-4.31,2.6 c-1.38,0.93-2.72,1.92-3.99,2.97c-1.27,1.05-2.5,2.16-3.68,3.35l-0.04,0.04c-1.18,1.18-2.29,2.4-3.33,3.66 c-1.05,1.28-2.04,2.61-2.97,3.99c-0.92,1.36-1.78,2.8-2.59,4.3c-0.8,1.49-1.56,3.05-2.26,4.67l-0.05,0.11l0,0l-0.07,0.14 c-0.63,1.5-1.19,3.04-1.67,4.61c-0.49,1.59-0.9,3.23-1.24,4.93c-0.35,1.73-0.6,3.45-0.77,5.17c-0.17,1.72-0.25,3.5-0.25,5.35 c0,1.85,0.08,3.64,0.25,5.35c0.17,1.71,0.42,3.44,0.77,5.17c0.35,1.72,0.77,3.39,1.27,5c0.49,1.57,1.05,3.13,1.7,4.66 c0.04,0.07,0.07,0.14,0.1,0.21c0.69,1.6,1.43,3.13,2.23,4.6c0.81,1.5,1.68,2.94,2.59,4.3c0.93,1.39,1.92,2.72,2.98,4 c1.02,1.24,2.11,2.44,3.26,3.59c0.07,0.06,0.13,0.12,0.19,0.19c1.16,1.16,2.36,2.24,3.59,3.26c1.28,1.05,2.61,2.04,3.99,2.97 c1.36,0.92,2.8,1.78,4.3,2.59c1.49,0.8,3.05,1.56,4.67,2.26l0.21,0.1c1.52,0.64,3.07,1.2,4.67,1.69c1.58,0.49,3.23,0.9,4.92,1.24 c1.73,0.35,3.45,0.6,5.17,0.77c1.72,0.17,3.5,0.25,5.35,0.25c1.85,0,3.64-0.08,5.35-0.25c1.71-0.17,3.44-0.42,5.17-0.77 c1.72-0.35,3.39-0.77,5-1.27c1.59-0.49,3.16-1.07,4.71-1.73l0.09-0.04l0-0.01c1.63-0.7,3.18-1.45,4.67-2.25 c1.5-0.81,2.94-1.68,4.31-2.6c1.38-0.93,2.72-1.92,3.99-2.97c1.25-1.03,2.45-2.12,3.62-3.29c0.06-0.06,0.11-0.12,0.18-0.18 c1.15-1.15,2.23-2.35,3.25-3.58c1.05-1.28,2.05-2.61,2.98-4c0.92-1.36,1.78-2.8,2.59-4.3c0.8-1.49,1.56-3.04,2.26-4.67l0.1-0.22 c0.64-1.51,1.2-3.06,1.69-4.65c0.49-1.59,0.9-3.23,1.24-4.93c0.35-1.73,0.6-3.45,0.77-5.17c0.17-1.72,0.25-3.5,0.25-5.35 c0-1.85-0.08-3.64-0.25-5.35c-0.17-1.71-0.42-3.44-0.77-5.17c-0.35-1.72-0.77-3.39-1.27-5c-0.49-1.59-1.07-3.16-1.73-4.71 l-0.04-0.09l0,0c-0.7-1.63-1.45-3.18-2.25-4.67c-0.81-1.5-1.68-2.94-2.59-4.3c-0.93-1.38-1.92-2.72-2.97-3.99 c-1.02-1.24-2.12-2.45-3.28-3.61c-0.07-0.06-0.13-0.12-0.18-0.18c-1.16-1.16-2.35-2.24-3.59-3.26c-1.28-1.05-2.61-2.04-3.99-2.97 c-1.37-0.92-2.8-1.78-4.3-2.59c-1.49-0.8-3.04-1.56-4.67-2.25l-0.19-0.09c-1.52-0.64-3.08-1.21-4.68-1.7 c-1.58-0.49-3.23-0.9-4.93-1.24c-1.73-0.35-3.45-0.6-5.17-0.77C65.08,9.31,63.29,9.23,61.44,9.23L61.44,9.23z M63.34,31.17 c2.19,0,3.91,0.63,5.16,1.88c1.24,1.25,1.87,2.96,1.87,5.17c0,2.24-1.07,4.22-3.21,5.97c-2.16,1.74-4.66,2.62-7.52,2.62 c-2.14,0-3.85-0.6-5.16-1.8c-1.31-1.22-1.96-2.79-1.96-4.75c0-2.47,1.07-4.59,3.19-6.4C57.82,32.06,60.37,31.17,63.34,31.17 L63.34,31.17L63.34,31.17z M75.55,91.71H47.33v-4.75h5.3V57.95h-5.3v-3.78h13.19c3.33,0,6.61-0.4,9.85-1.22v34.01h5.18L75.55,91.71 L75.55,91.71L75.55,91.71z M49.12,1.2c1.96-0.39,3.99-0.69,6.08-0.89C57.29,0.1,59.37,0,61.44,0c2.07,0,4.15,0.1,6.24,0.31 c2.09,0.2,4.12,0.5,6.08,0.89c1.94,0.39,3.88,0.88,5.82,1.48c1.88,0.58,3.74,1.26,5.58,2.04l0.19,0.07l0,0l0.06,0.02 c1.85,0.8,3.65,1.67,5.38,2.61c1.71,0.93,3.4,1.95,5.07,3.07c1.63,1.1,3.21,2.27,4.73,3.52c1.52,1.25,2.97,2.56,4.34,3.95 c1.38,1.38,2.7,2.83,3.95,4.34c1.25,1.52,2.42,3.09,3.52,4.73c1.09,1.63,2.11,3.32,3.06,5.06l0,0l0.01,0 c0.94,1.74,1.82,3.54,2.61,5.39c0.02,0.05,0.04,0.1,0.06,0.15c0.78,1.83,1.46,3.7,2.05,5.6c0.61,1.96,1.11,3.92,1.5,5.89 c0.39,1.96,0.69,3.99,0.89,6.08c0.2,2.09,0.3,4.17,0.3,6.24c0,2.07-0.1,4.15-0.31,6.24c-0.2,2.09-0.5,4.12-0.89,6.08 c-0.39,1.94-0.88,3.88-1.48,5.82c-0.58,1.89-1.27,3.76-2.05,5.62l-0.04,0.09l0,0l-0.05,0.11c-0.8,1.85-1.67,3.65-2.61,5.38 c-0.93,1.71-1.95,3.4-3.07,5.07c-1.1,1.63-2.27,3.21-3.52,4.73c-1.25,1.52-2.56,2.96-3.95,4.34c-1.38,1.38-2.83,2.7-4.35,3.95 c-1.52,1.25-3.09,2.42-4.72,3.51c-1.63,1.09-3.32,2.11-5.06,3.06c-1.78,0.96-3.57,1.84-5.39,2.62c-0.05,0.02-0.1,0.04-0.16,0.06 c-1.83,0.78-3.7,1.46-5.6,2.05c-1.96,0.61-3.92,1.11-5.88,1.5c-1.96,0.39-3.99,0.69-6.08,0.89c-2.09,0.2-4.17,0.3-6.24,0.3 s-4.15-0.1-6.24-0.3c-2.09-0.2-4.12-0.5-6.08-0.89c-1.94-0.39-3.88-0.88-5.82-1.48c-1.89-0.58-3.76-1.27-5.61-2.05l-0.2-0.08l0,0 c-1.85-0.8-3.65-1.67-5.38-2.61c-1.71-0.93-3.4-1.95-5.07-3.07c-1.63-1.09-3.21-2.27-4.72-3.51c-1.52-1.25-2.97-2.57-4.35-3.95 c-1.38-1.38-2.7-2.83-3.95-4.34c-1.25-1.52-2.42-3.1-3.52-4.73c-1.09-1.63-2.11-3.32-3.06-5.06c-0.97-1.78-1.84-3.58-2.62-5.4 c-0.02-0.05-0.04-0.1-0.06-0.15c-0.78-1.83-1.46-3.7-2.05-5.6c-0.61-1.96-1.11-3.93-1.5-5.89c-0.39-1.96-0.69-3.99-0.89-6.08 C0.1,65.59,0,63.51,0,61.44c0-2.07,0.1-4.15,0.31-6.24c0.2-2.09,0.5-4.12,0.89-6.08c0.39-1.94,0.88-3.88,1.48-5.82 c0.58-1.88,1.26-3.74,2.04-5.59l0.09-0.23l0,0c0.8-1.85,1.67-3.65,2.61-5.38c0.93-1.71,1.95-3.4,3.07-5.07 c1.1-1.63,2.27-3.21,3.52-4.73c1.25-1.52,2.56-2.96,3.95-4.34c1.38-1.38,2.83-2.7,4.34-3.95c1.52-1.25,3.09-2.42,4.73-3.52 c1.67-1.12,3.36-2.14,5.07-3.07l0.13-0.06c1.73-0.94,3.48-1.78,5.26-2.55c0.05-0.02,0.1-0.04,0.15-0.06 c1.83-0.78,3.7-1.46,5.6-2.05C45.19,2.09,47.15,1.59,49.12,1.2L49.12,1.2z"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 4.9 KiB |
@@ -0,0 +1,120 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<!-- Created with Inkscape (http://www.inkscape.org/) -->
|
||||
|
||||
<svg
|
||||
width="371"
|
||||
height="142"
|
||||
viewBox="0 0 98.160945 37.570857"
|
||||
version="1.1"
|
||||
id="svg9602"
|
||||
sodipodi:docname="logo-light.svg"
|
||||
inkscape:version="1.2.1 (9c6d41e4, 2022-07-14)"
|
||||
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
|
||||
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:svg="http://www.w3.org/2000/svg">
|
||||
<sodipodi:namedview
|
||||
id="namedview20"
|
||||
pagecolor="#ffffff"
|
||||
bordercolor="#000000"
|
||||
borderopacity="0.25"
|
||||
inkscape:showpageshadow="2"
|
||||
inkscape:pageopacity="0.0"
|
||||
inkscape:pagecheckerboard="0"
|
||||
inkscape:deskcolor="#d1d1d1"
|
||||
showgrid="false"
|
||||
inkscape:zoom="2.6316652"
|
||||
inkscape:cx="125.96587"
|
||||
inkscape:cy="61.177994"
|
||||
inkscape:window-width="1440"
|
||||
inkscape:window-height="744"
|
||||
inkscape:window-x="0"
|
||||
inkscape:window-y="25"
|
||||
inkscape:window-maximized="1"
|
||||
inkscape:current-layer="svg9602" />
|
||||
<defs
|
||||
id="defs9599" />
|
||||
<g
|
||||
id="layer1"
|
||||
transform="translate(-22.260864,-34.716253)">
|
||||
<rect
|
||||
style="fill:#242424;fill-opacity:0.99;stroke:none;stroke-width:1.24539;stroke-linejoin:round;stroke-dasharray:none"
|
||||
id="rect8445"
|
||||
width="65.39537"
|
||||
height="36.795055"
|
||||
x="22.703459"
|
||||
y="35.180595"
|
||||
rx="6.8266635"
|
||||
ry="6.5550508" />
|
||||
<g
|
||||
aria-label="P"
|
||||
transform="matrix(0.44612332,0,0,0.44612332,-53.310985,-114.20369)"
|
||||
id="text416-2"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2);display:inline;fill:#ff1c30;stroke-width:1.06591;stroke-linejoin:round">
|
||||
<path
|
||||
d="m 182.08151,397.45387 v -50.02669 h 15.38134 q 4.032,0 7.54134,1.49333 3.50933,1.49334 6.12267,4.18134 2.61333,2.61333 4.10667,6.12267 1.49333,3.50933 1.49333,7.54133 0,3.95734 -1.49333,7.46667 -1.49334,3.50934 -4.10667,6.12267 -2.61334,2.53867 -6.12267,4.03201 -3.50934,1.49333 -7.54134,1.49333 h -8.81067 v 11.57334 z m 6.57067,-18.14401 h 8.81067 q 2.61334,0 4.928,-0.97067 2.31467,-1.04533 4.03201,-2.688 1.71733,-1.71733 2.688,-3.95733 1.04533,-2.31467 1.04533,-4.92801 0,-2.688 -1.04533,-5.00267 -0.97067,-2.31466 -2.688,-4.032 -1.71734,-1.71733 -4.03201,-2.688 -2.31466,-0.97067 -4.928,-0.97067 h -8.81067 z"
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="path9573" />
|
||||
</g>
|
||||
<g
|
||||
aria-label="l"
|
||||
transform="matrix(0.44612332,0,0,0.44612332,-36.59502,-114.22526)"
|
||||
id="text416-2-1"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-8);display:inline;fill:#ff1c30;stroke-width:1.06591;stroke-linejoin:round">
|
||||
<path
|
||||
d="m 189.92152,349.36851 v 48.08536 h -6.27201 v -48.08536 z"
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="path9570" />
|
||||
</g>
|
||||
<g
|
||||
aria-label="e"
|
||||
transform="matrix(0.44612332,0,0,0.44612332,15.071073,-114.17511)"
|
||||
id="text416-2-5"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-53);display:inline;fill:#ff1c30;stroke-width:1.06591;stroke-linejoin:round">
|
||||
<path
|
||||
d="m 216.35353,388.8672 q -3.06134,4.55467 -7.24267,6.64533 -4.10667,2.09067 -8.96001,2.09067 -3.808,0 -7.168,-1.41867 -3.36,-1.49333 -5.824,-3.95733 -2.464,-2.464 -3.95734,-5.824 -1.41867,-3.36001 -1.41867,-7.16801 0,-3.88267 1.41867,-7.24267 1.49334,-3.36 3.95734,-5.824 2.464,-2.53867 5.824,-3.95734 3.36,-1.49333 7.168,-1.49333 4.85334,0 9.10934,2.24 4.33067,2.24 7.46667,6.944 l -21.65334,20.16001 q 1.19466,0.82134 2.98667,1.19467 1.792,0.29867 3.584,0.0747 3.136,-0.37334 5.824,-2.09067 2.76267,-1.792 4.62934,-4.48 z m -28.59735,-10.60267 q -0.224,2.83733 0.74667,5.22666 0.97066,2.38934 2.76267,3.73334 l 17.09867,-16.65067 q -1.41867,-1.71734 -3.808,-2.76267 -2.38934,-1.12 -5.22667,-0.97067 -2.31467,0.14933 -4.33067,1.04533 -2.016,0.896 -3.584,2.46401 -1.49333,1.49333 -2.464,3.50933 -0.97067,2.016 -1.19467,4.40534 z"
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="path9558" />
|
||||
</g>
|
||||
<g
|
||||
aria-label="t"
|
||||
transform="matrix(0.44612332,0,0,0.44612332,32.445174,-114.17841)"
|
||||
id="text416-2-59"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-6);display:inline;fill:#ff1c30;stroke-width:1.06591;stroke-linejoin:round">
|
||||
<path
|
||||
d="m 180.21484,360.71785 h 3.43467 v -11.34934 h 6.34667 v 11.34934 h 6.64534 v 5.22667 h -6.64534 v 20.23468 q 0,2.61333 1.64267,4.256 1.64267,1.568 4.256,1.568 v 5.6 q -6.048,0 -9.184,-2.912 -3.06134,-2.912 -3.06134,-8.512 v -20.23468 h -3.43467 z"
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="path9555" />
|
||||
</g>
|
||||
<g
|
||||
aria-label="l"
|
||||
transform="matrix(0.44612332,0,0,0.44612332,9.157916,-114.17642)"
|
||||
id="text416-2-8"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-5);display:inline;fill:#ff1c30;stroke-width:1.06591;stroke-linejoin:round">
|
||||
<path
|
||||
d="m 189.92152,349.36851 v 48.08536 h -6.27201 v -48.08536 z"
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="path9561" />
|
||||
</g>
|
||||
<g
|
||||
aria-label="a"
|
||||
transform="matrix(0.44612332,0,0,0.44612332,-30.719029,-114.24707)"
|
||||
id="text416-2-4"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-1);display:inline;fill:#ff1c30;stroke-width:1.06591;stroke-linejoin:round">
|
||||
<path
|
||||
d="m 181.85751,379.23519 q 0,-3.88267 1.344,-7.24267 1.344,-3.36 3.584,-5.824 2.31467,-2.53867 5.37601,-3.95734 3.136,-1.49333 6.72,-1.49333 4.256,0 7.76534,2.09067 3.50933,2.016 5.74933,5.45067 v -7.39201 h 6.34667 v 36.58669 h -6.34667 v -7.31734 q -2.24,3.43467 -5.74933,5.45067 -3.50934,2.016 -7.76534,2.016 -3.584,0 -6.72,-1.41867 -3.06134,-1.49333 -5.37601,-3.95733 -2.24,-2.464 -3.584,-5.824 -1.344,-3.36001 -1.344,-7.16801 z m 6.34667,0 q 0,2.464 0.896,4.704 0.97067,2.16534 2.53867,3.80801 1.64267,1.64266 3.808,2.61333 2.24,0.896 4.77867,0.896 2.464,0 4.62934,-0.896 2.24,-0.97067 3.88266,-2.61333 1.64267,-1.64267 2.61334,-3.80801 0.97067,-2.24 0.97067,-4.704 0,-2.464 -0.97067,-4.704 -0.97067,-2.24 -2.61334,-3.88267 -1.64266,-1.64267 -3.88266,-2.61333 -2.16534,-0.97067 -4.62934,-0.97067 -2.53867,0 -4.77867,0.97067 -2.16533,0.97066 -3.808,2.61333 -1.568,1.64267 -2.53867,3.88267 -0.896,2.24 -0.896,4.704 z"
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="path9567" />
|
||||
</g>
|
||||
<g
|
||||
aria-label="y"
|
||||
transform="matrix(0.44612332,0,0,0.44612332,-11.285794,-114.11033)"
|
||||
id="text416-2-84"
|
||||
style="font-size:74.6667px;font-family:'The Amaranth';-inkscape-font-specification:'The Amaranth, Normal';white-space:pre;shape-inside:url(#rect418-2-3);display:inline;fill:#ff1c30;stroke-width:1.06591;stroke-linejoin:round">
|
||||
<path
|
||||
d="m 186.56151,360.86718 10.97601,28.07468 10.752,-28.07468 h 6.72001 l -18.74135,47.56269 h -6.272 l 4.256,-10.82667 -14.48534,-36.73602 z"
|
||||
style="font-family:'Bunya PERSONAL';-inkscape-font-specification:'Bunya PERSONAL, Normal'"
|
||||
id="path9564" />
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 7.8 KiB |
@@ -0,0 +1,6 @@
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512" preserveAspectRatio="xMidYMid meet" focusable="false" style="pointer-events: none; display: block; width: 100%; height: 100%;">
|
||||
<g class="fill-current">
|
||||
<path d="M416 208c0 45.9-14.9 88.3-40 122.7L502.6 457.4c12.5 12.5 12.5 32.8 0 45.3s-32.8 12.5-45.3 0L330.7 376c-34.4 25.2-76.8 40-122.7 40C93.1 416 0 322.9 0 208S93.1 0 208 0S416 93.1 416 208zM208 352c79.5 0 144-64.5 144-144s-64.5-144-144-144S64 128.5 64 208s64.5 144 144 144z"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 605 B |
@@ -0,0 +1,6 @@
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg"
|
||||
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 24 24" preserveAspectRatio="xMidYMid meet" focusable="false" style="pointer-events: none; display: block; width: 100%; height: 100%;">
|
||||
<g class="fill-current">
|
||||
<path d="M12,9c1.65,0,3,1.35,3,3s-1.35,3-3,3s-3-1.35-3-3S10.35,9,12,9 M12,8c-2.21,0-4,1.79-4,4s1.79,4,4,4s4-1.79,4-4 S14.21,8,12,8L12,8z M13.22,3l0.55,2.2l0.13,0.51l0.5,0.18c0.61,0.23,1.19,0.56,1.72,0.98l0.4,0.32l0.5-0.14l2.17-0.62l1.22,2.11 l-1.63,1.59l-0.37,0.36l0.08,0.51c0.05,0.32,0.08,0.64,0.08,0.98s-0.03,0.66-0.08,0.98l-0.08,0.51l0.37,0.36l1.63,1.59l-1.22,2.11 l-2.17-0.62l-0.5-0.14l-0.4,0.32c-0.53,0.43-1.11,0.76-1.72,0.98l-0.5,0.18l-0.13,0.51L13.22,21h-2.44l-0.55-2.2l-0.13-0.51 l-0.5-0.18C9,17.88,8.42,17.55,7.88,17.12l-0.4-0.32l-0.5,0.14l-2.17,0.62L3.6,15.44l1.63-1.59l0.37-0.36l-0.08-0.51 C5.47,12.66,5.44,12.33,5.44,12s0.03-0.66,0.08-0.98l0.08-0.51l-0.37-0.36L3.6,8.56l1.22-2.11l2.17,0.62l0.5,0.14l0.4-0.32 C8.42,6.45,9,6.12,9.61,5.9l0.5-0.18l0.13-0.51L10.78,3H13.22 M14,2h-4L9.26,4.96c-0.73,0.27-1.4,0.66-2,1.14L4.34,5.27l-2,3.46 l2.19,2.13C4.47,11.23,4.44,11.61,4.44,12s0.03,0.77,0.09,1.14l-2.19,2.13l2,3.46l2.92-0.83c0.6,0.48,1.27,0.87,2,1.14L10,22h4 l0.74-2.96c0.73-0.27,1.4-0.66,2-1.14l2.92,0.83l2-3.46l-2.19-2.13c0.06-0.37,0.09-0.75,0.09-1.14s-0.03-0.77-0.09-1.14l2.19-2.13 l-2-3.46L16.74,6.1c-0.6-0.48-1.27-0.87-2-1.14L14,2L14,2z"></path>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.4 KiB |
|
After Width: | Height: | Size: 39 KiB |
@@ -0,0 +1,50 @@
|
||||
<script lang="ts">
|
||||
import HomeIcon from "../assets/home-icon.svg.svelte";
|
||||
import InfoIcon from "../assets/info-icon.svg.svelte";
|
||||
import SearchIcon from "../assets/search-icon.svg.svelte";
|
||||
import SettingsIcon from "../assets/settings-icon.svg.svelte";
|
||||
import { appStateStore } from "./Stores";
|
||||
import type { AppState } from "./Types";
|
||||
|
||||
function setScreen(screen: AppState["screen"]) {
|
||||
appStateStore.update((state) => {
|
||||
state.screen = screen;
|
||||
return state;
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="btm-nav">
|
||||
<button
|
||||
on:click={() => setScreen("search")}
|
||||
class={$appStateStore.screen === "search" ? "active" : ""}
|
||||
>
|
||||
<div class="h-6">
|
||||
<SearchIcon />
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("home")}
|
||||
class={$appStateStore.screen === "home" ? "active" : ""}
|
||||
>
|
||||
<div class="h-6">
|
||||
<HomeIcon />
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("settings")}
|
||||
class={$appStateStore.screen === "settings" ? "active" : ""}
|
||||
>
|
||||
<div class="h-6">
|
||||
<SettingsIcon />
|
||||
</div>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("info")}
|
||||
class={$appStateStore.screen === "info" ? "active" : ""}
|
||||
>
|
||||
<div class="h-6">
|
||||
<InfoIcon />
|
||||
</div>
|
||||
</button>
|
||||
</div>
|
||||
@@ -1,11 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "./PlayletApi";
|
||||
|
||||
const clearSearchHistory = async () => {
|
||||
await PlayletApi.clearSearchHistory();
|
||||
};
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<button class="btn" on:click={clearSearchHistory}>Clear search history</button>
|
||||
</div>
|
||||
@@ -0,0 +1,58 @@
|
||||
<script>
|
||||
import { onMount } from "svelte";
|
||||
import { PlayletApi } from "./PlayletApi";
|
||||
|
||||
let selectedRelease = ''
|
||||
let releases = [];
|
||||
onMount(async () => {
|
||||
releases = await fetchReleaseTags();
|
||||
});
|
||||
|
||||
async function fetchReleaseTags() {
|
||||
const response = await fetch(
|
||||
"https://api.github.com/repos/iBicha/playlet/releases"
|
||||
);
|
||||
const releases = await response.json();
|
||||
return releases.map((release) => {
|
||||
return {
|
||||
name: release.tag_name,
|
||||
enabled:
|
||||
release.assets.filter((asset) => asset.name === "playlet-lib.zip")
|
||||
.length > 0,
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
async function apply() {
|
||||
await PlayletApi.setPlayletLibVersion(selectedRelease);
|
||||
alert("Playlet Library version set. Restart playlet to apply changes.");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class="text-2xl">Developer settings</div>
|
||||
<div class="text-xs text-gray-500">
|
||||
Options for Playlet developers. Do not change unless you "know what you're
|
||||
doing"™
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m-5">
|
||||
<div class="text-lg">Playlet Library version</div>
|
||||
<div class="text-xs text-gray-500">
|
||||
The version of Playlet Lib to use. These correspond to tagged releases on
|
||||
Github. Releases that do not have a playlet-lib.zip file are disabled.
|
||||
</div>
|
||||
|
||||
<div class="join w-full m-1">
|
||||
<select bind:value={selectedRelease} class="select select-bordered join-item w-full mr-1">
|
||||
<option selected value="">latest (default)</option>
|
||||
{#each releases as release}
|
||||
<option disabled={!release.enabled} value={release.name}
|
||||
>{release.name}</option
|
||||
>
|
||||
{/each}
|
||||
</select>
|
||||
<button class="join-item btn" on:click={apply}>Apply</button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,33 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "./PlayletApi";
|
||||
import { playletStateStore } from "./Stores";
|
||||
|
||||
let selectedInstance;
|
||||
let inputInstance;
|
||||
|
||||
playletStateStore.subscribe((value) => {
|
||||
selectedInstance = value?.invidious?.selected_instance ?? "N/A";
|
||||
inputInstance = selectedInstance;
|
||||
});
|
||||
|
||||
const updateInstance = async () => {
|
||||
await PlayletApi.updateInstances([inputInstance]);
|
||||
// TODO: reload state
|
||||
window.location.reload();
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="form-control">
|
||||
<label class="input-group">
|
||||
<span>Invidious Instance</span>
|
||||
<input
|
||||
type="text"
|
||||
placeholder="http://my-instance.com"
|
||||
class="input input-bordered"
|
||||
bind:value={inputInstance}
|
||||
/>
|
||||
{#if inputInstance !== selectedInstance}
|
||||
<button class="btn" on:click={updateInstance}>Update</button>
|
||||
{/if}
|
||||
</label>
|
||||
</div>
|
||||
@@ -0,0 +1,128 @@
|
||||
import { PlayletApi } from "./PlayletApi";
|
||||
|
||||
export class InvidiousApi {
|
||||
public instance: string;
|
||||
public endpoints: any;
|
||||
public isLoggedIn: boolean = false;
|
||||
public userCountryCode: string = 'US';
|
||||
|
||||
responseHandlers: any;
|
||||
|
||||
constructor() {
|
||||
// Note: AuthFeedHandler and AuthPlaylistsHandler are not needed, since it is handled server side
|
||||
this.responseHandlers = {
|
||||
"DefaultHandler": (requestData, response) => this.DefaultHandler(requestData, response),
|
||||
"PlaylistHandler": (requestData, response) => this.PlaylistHandler(requestData, response),
|
||||
}
|
||||
}
|
||||
|
||||
public async searchSuggestions(query: string) {
|
||||
const response = await fetch(`${this.instance}/api/v1/search/suggestions?q=${encodeURIComponent(query)}®ion=${this.userCountryCode}`);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
public async search(query: string) {
|
||||
const response = await fetch(`${this.instance}/api/v1/search?q=${encodeURIComponent(query)}®ion=${this.userCountryCode}`);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
public async getVideoMetadata(videoId: string) {
|
||||
const response = await fetch(`${this.instance}/api/v1/videos/${videoId}`);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
public async makeRequest(requestData: any) {
|
||||
if (!requestData || !this.instance || !this.endpoints) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let endpoint = this.endpoints[requestData.endpoint];
|
||||
if (!endpoint) {
|
||||
return null;
|
||||
}
|
||||
|
||||
let url = this.instance + endpoint.url
|
||||
let queryParams = {}
|
||||
let headers = {}
|
||||
|
||||
if (endpoint.authenticated) {
|
||||
// Authenticated requests on the web app would be blocked by CORS, so we use the Playlet API as a proxy
|
||||
if (!this.isLoggedIn) {
|
||||
return null;
|
||||
}
|
||||
return await PlayletApi.invidiousAuthenticatedRequest(requestData);
|
||||
}
|
||||
|
||||
if (endpoint.queryParams !== undefined) {
|
||||
for (let queryParamKey in endpoint.queryParams) {
|
||||
let queryParam = endpoint.queryParams[queryParamKey];
|
||||
if (queryParam.default !== undefined) {
|
||||
if (queryParam.type === "string") {
|
||||
queryParams[queryParamKey] = queryParam.default;
|
||||
} else if (queryParam.type === "#ISO3166") {
|
||||
if (queryParam.default === "GetUserCountryCode") {
|
||||
queryParams[queryParamKey] = this.userCountryCode;
|
||||
} else {
|
||||
queryParams[queryParamKey] = queryParam.default;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (requestData.queryParams !== undefined) {
|
||||
queryParams = { ...queryParams, ...requestData.queryParams };
|
||||
}
|
||||
|
||||
if (requestData.pathParams !== undefined) {
|
||||
for (let param in requestData.pathParams) {
|
||||
url = url.replace(`:${param}`, requestData.pathParams[param]);
|
||||
}
|
||||
}
|
||||
|
||||
url = this.makeUrl(url, queryParams);
|
||||
const response = await fetch(url, { headers: headers });
|
||||
|
||||
let responseHandler = endpoint.responseHandler !== undefined ? this.responseHandlers[endpoint.responseHandler] : this.responseHandlers["DefaultHandler"];
|
||||
if (!responseHandler) {
|
||||
return null;
|
||||
}
|
||||
return await responseHandler(requestData, response);
|
||||
}
|
||||
|
||||
private async DefaultHandler(requestData, response) {
|
||||
const json = await response.json();
|
||||
return [{ title: requestData.title, videos: json }]
|
||||
}
|
||||
|
||||
private async PlaylistHandler(requestData, response) {
|
||||
const playlist = await response.json();
|
||||
return [this.ProcessPlaylist(requestData, playlist)]
|
||||
}
|
||||
|
||||
private ProcessPlaylist(requestData, playlist) {
|
||||
const title = this.ProcessTemplate(requestData.title, playlist)
|
||||
return { title: title, videos: playlist.videos }
|
||||
}
|
||||
|
||||
private ProcessTemplate(template: string, data) {
|
||||
let result = template;
|
||||
for (let key in data) {
|
||||
result = result.replace(`%${key}%`, `${data[key]}`);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private makeUrl(url: string, params: any) {
|
||||
const encodedUrl = new URL(url);
|
||||
const existingParams = new URLSearchParams(encodedUrl.search);
|
||||
|
||||
let mergedParams = new URLSearchParams({
|
||||
...Object.fromEntries(existingParams),
|
||||
...params
|
||||
});
|
||||
|
||||
encodedUrl.search = mergedParams.toString();
|
||||
return encodedUrl.toString();
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { getHost } from "./Host";
|
||||
|
||||
const goToLegacyUI = async () => {
|
||||
window.location.href = `http://${getHost()}`
|
||||
};
|
||||
</script>
|
||||
|
||||
<div>
|
||||
<button class="btn" on:click={goToLegacyUI}>Legacy UI</button>
|
||||
</div>
|
||||
@@ -0,0 +1,152 @@
|
||||
<script lang="ts">
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
import { PlayletApi } from "./PlayletApi";
|
||||
import { playletStateStore } from "./Stores";
|
||||
import { InvidiousApi } from "./InvidiousApi";
|
||||
|
||||
let modal;
|
||||
let isDragging;
|
||||
let isLoading;
|
||||
let dragEndTimeout;
|
||||
|
||||
let videoMetadata;
|
||||
|
||||
let tvName = "Roku TV";
|
||||
let invidiousInstance;
|
||||
|
||||
let invidiousApi = new InvidiousApi();
|
||||
|
||||
playletStateStore.subscribe((value) => {
|
||||
tvName = value?.device?.friendly_name ?? "Roku TV";
|
||||
invidiousApi.instance = invidiousInstance =
|
||||
value?.invidious?.current_instance;
|
||||
});
|
||||
|
||||
onMount(async () => {
|
||||
document.body.addEventListener("drop", onDrop);
|
||||
document.body.addEventListener("dragover", onDragOver);
|
||||
});
|
||||
|
||||
onDestroy(() => {
|
||||
document.body.removeEventListener("drop", onDrop);
|
||||
document.body.removeEventListener("dragover", onDragOver);
|
||||
});
|
||||
|
||||
async function onDrop(event) {
|
||||
event.preventDefault();
|
||||
modal.close();
|
||||
|
||||
isDragging = false;
|
||||
for (var i in event.dataTransfer.items) {
|
||||
let item = event.dataTransfer.items[i];
|
||||
if (item.kind === "string" && item.getAsString) {
|
||||
let dataString = await new Promise((resolve) =>
|
||||
item.getAsString(resolve)
|
||||
);
|
||||
if (IsValidHttpUrl(dataString)) {
|
||||
const videoId = GetVideoId(dataString);
|
||||
if (videoId) {
|
||||
searchForVideoById(videoId);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function searchForVideoById(videoId) {
|
||||
try {
|
||||
isLoading = true;
|
||||
videoMetadata = await invidiousApi.getVideoMetadata(videoId);
|
||||
modal.showModal();
|
||||
} finally {
|
||||
isLoading = false;
|
||||
}
|
||||
}
|
||||
|
||||
function onDragOver(event) {
|
||||
modal.close();
|
||||
clearTimeout(dragEndTimeout);
|
||||
dragEndTimeout = setTimeout(() => {
|
||||
isDragging = false;
|
||||
}, 200);
|
||||
isDragging = true;
|
||||
event.preventDefault();
|
||||
}
|
||||
|
||||
function IsValidHttpUrl(string) {
|
||||
let url;
|
||||
try {
|
||||
url = new URL(string);
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
return url.protocol === "http:" || url.protocol === "https:";
|
||||
}
|
||||
|
||||
function GetVideoId(url) {
|
||||
// Share/Short url
|
||||
// TODO: use regex, and support timestamped videos
|
||||
const YoutubeUrls = [
|
||||
"https://youtu.be/",
|
||||
"http://youtu.be/",
|
||||
"https://www.youtu.be/",
|
||||
"http://www.youtu.be/",
|
||||
"https://youtube.com/shorts/",
|
||||
"http://youtube.com/shorts/",
|
||||
"https://www.youtube.com/shorts/",
|
||||
"http://www.youtube.com/shorts/",
|
||||
];
|
||||
for (var i in YoutubeUrls) {
|
||||
let youtubeUrl = YoutubeUrls[i];
|
||||
if (url.startsWith(youtubeUrl)) {
|
||||
url = url.replace(youtubeUrl, "");
|
||||
if (url.includes("?")) {
|
||||
url = url.substring(0, url.indexOf("?"));
|
||||
}
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
// regular url
|
||||
url = new URL(url);
|
||||
const urlSearchParams = new URLSearchParams(url.search);
|
||||
return urlSearchParams.get("v");
|
||||
}
|
||||
|
||||
async function playVideoOnTv() {
|
||||
await PlayletApi.playVideo(videoMetadata?.videoId);
|
||||
}
|
||||
|
||||
function openInvidiousInNewTab() {
|
||||
window.open(`${invidiousInstance}/watch?v=${videoMetadata?.videoId}`);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div
|
||||
class="{isDragging || isLoading
|
||||
? ''
|
||||
: 'hidden'} absolute w-full h-full bg-base-100/80 z-50 flex justify-center items-center"
|
||||
>
|
||||
{#if isDragging}
|
||||
<div class="text-2xl font-bold">Drop a Youtube link here</div>
|
||||
{:else if isLoading}
|
||||
<span class="loading loading-spinner loading-md" />
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
<dialog bind:this={modal} id="modal_video_drag_drop" class="modal">
|
||||
<form method="dialog" class="modal-box bg-base-100">
|
||||
<h3 class="text-lg m-5">{videoMetadata?.title}</h3>
|
||||
<div class="flex flex-col">
|
||||
<button class="btn m-2" on:click={playVideoOnTv}>Play on {tvName}</button>
|
||||
<button class="btn m-2" on:click={openInvidiousInNewTab}
|
||||
>Open in Invidious</button
|
||||
>
|
||||
<button class="btn m-2">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>close</button>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -1,50 +1,83 @@
|
||||
<script lang="ts">
|
||||
import playletLogo from "../assets/logo-dark.svg";
|
||||
import { PlayletApi } from "./PlayletApi";
|
||||
import { playletStateStore } from "./Stores";
|
||||
import playletLogoDark from "../assets/logo-dark.svg";
|
||||
import playletLogoLight from "../assets/logo-light.svg";
|
||||
import userIcon from "../assets/user.png";
|
||||
import { PlayletApi } from "./PlayletApi";
|
||||
import { appThemeStore, playletStateStore } from "./Stores";
|
||||
import ThemeSelect from "./ThemeToggle.svelte";
|
||||
|
||||
let version;
|
||||
let loggedIn = false;
|
||||
let auth_url;
|
||||
let selectedInstance;
|
||||
let loggedInInstance;
|
||||
|
||||
playletStateStore.subscribe((value) => {
|
||||
version = value?.app?.version ?? "";
|
||||
loggedIn = value?.invidious?.logged_in;
|
||||
auth_url = value?.invidious?.auth_url;
|
||||
selectedInstance = value?.invidious?.selected_instance;
|
||||
loggedInInstance = value?.invidious?.logged_in_instance;
|
||||
});
|
||||
let version;
|
||||
let loggedIn = false;
|
||||
let auth_url;
|
||||
let currentInstance;
|
||||
let loggedInInstance;
|
||||
let username;
|
||||
|
||||
const login = () => {
|
||||
if (!auth_url) {
|
||||
alert("Error with login, please refresh the page.");
|
||||
return;
|
||||
}
|
||||
window.location = auth_url;
|
||||
};
|
||||
const logout = async () => {
|
||||
await PlayletApi.logout();
|
||||
// TODO: reload state
|
||||
window.location.reload();
|
||||
};
|
||||
playletStateStore.subscribe((value) => {
|
||||
version = value?.app?.lib_version ?? "";
|
||||
loggedIn = value?.invidious?.logged_in;
|
||||
auth_url = value?.invidious?.auth_url;
|
||||
currentInstance = value?.invidious?.current_instance;
|
||||
loggedInInstance = value?.invidious?.logged_in_instance;
|
||||
username = value?.invidious?.logged_in_username;
|
||||
});
|
||||
|
||||
const login = () => {
|
||||
if (!auth_url) {
|
||||
alert("Error with login, please refresh the page.");
|
||||
return;
|
||||
}
|
||||
window.location = auth_url;
|
||||
};
|
||||
const logout = async () => {
|
||||
await PlayletApi.logout();
|
||||
// TODO: reload state
|
||||
window.location.reload();
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="navbar bg-base-100">
|
||||
<div class="flex-1">
|
||||
<img src={playletLogo} class="h-12" alt="Playlet Logo" />
|
||||
<h4 class="label brightness-75">{version}</h4>
|
||||
</div>
|
||||
<div class="flex-none">
|
||||
<div class="navbar bg-base-100 sticky top-0 z-40">
|
||||
<div class="flex-1">
|
||||
<img src={$appThemeStore === 'dark' ? playletLogoDark : playletLogoLight} class="h-8" alt="Playlet Logo" />
|
||||
<h4 class="label brightness-75">{version}</h4>
|
||||
</div>
|
||||
<div class="flex-none">
|
||||
<ThemeSelect />
|
||||
{#if loggedIn && username}
|
||||
<div class="badge badge-outline">
|
||||
<span>{username}</span>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="dropdown dropdown-end">
|
||||
<div tabindex="-1" class="btn btn-ghost btn-circle avatar">
|
||||
<div class="w-8 rounded-full">
|
||||
<img src={userIcon} alt="User" />
|
||||
</div>
|
||||
</div>
|
||||
<ul
|
||||
tabindex="-1"
|
||||
class="menu menu-sm dropdown-content mt-3 p-2 shadow bg-base-100 rounded-box"
|
||||
>
|
||||
{#if loggedIn}
|
||||
<div class="tooltip tooltip-left" data-tip={loggedInInstance}>
|
||||
<button class="btn" on:click={logout}>Logout</button>
|
||||
<li>
|
||||
<div
|
||||
class="tooltip tooltip-left"
|
||||
data-tip={`Logout from ${loggedInInstance}`}
|
||||
>
|
||||
<button on:click={logout}>Logout</button>
|
||||
</div>
|
||||
</li>
|
||||
{:else}
|
||||
<div class="tooltip tooltip-left" data-tip={selectedInstance}>
|
||||
<button class="btn" on:click={login}>Login</button>
|
||||
<li>
|
||||
<div
|
||||
class="tooltip tooltip-left"
|
||||
data-tip={`Login using ${currentInstance}`}
|
||||
>
|
||||
<button on:click={login}>Login</button>
|
||||
</div>
|
||||
</li>
|
||||
{/if}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,69 +0,0 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "./PlayletApi";
|
||||
|
||||
let videoId;
|
||||
|
||||
function IsValidHttpUrl(string) {
|
||||
let url;
|
||||
try {
|
||||
url = new URL(string);
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
return url.protocol === "http:" || url.protocol === "https:";
|
||||
}
|
||||
|
||||
function GetVideoId(url) {
|
||||
// Share/Short url
|
||||
const YoutubeUrls = [
|
||||
"https://youtu.be/",
|
||||
"http://youtu.be/",
|
||||
"https://www.youtu.be/",
|
||||
"http://www.youtu.be/",
|
||||
"https://youtube.com/shorts/",
|
||||
"http://youtube.com/shorts/",
|
||||
"https://www.youtube.com/shorts/",
|
||||
"http://www.youtube.com/shorts/",
|
||||
];
|
||||
for (var i in YoutubeUrls) {
|
||||
let youtubeUrl = YoutubeUrls[i];
|
||||
if (url.startsWith(youtubeUrl)) {
|
||||
url = url.replace(youtubeUrl, "");
|
||||
if (url.includes("?")) {
|
||||
url = url.substring(0, url.indexOf("?"));
|
||||
}
|
||||
return url;
|
||||
}
|
||||
}
|
||||
|
||||
// regular url
|
||||
url = new URL(url);
|
||||
const urlSearchParams = new URLSearchParams(url.search);
|
||||
return urlSearchParams.get("v");
|
||||
}
|
||||
|
||||
const playVideo = async () => {
|
||||
let v = videoId;
|
||||
if (IsValidHttpUrl(v)) {
|
||||
v = GetVideoId(v);
|
||||
}
|
||||
if (!v || v.length < 8) {
|
||||
alert("Please set video id");
|
||||
return;
|
||||
}
|
||||
|
||||
await PlayletApi.playVideo(v);
|
||||
};
|
||||
</script>
|
||||
|
||||
<div class="form-control">
|
||||
<div class="input-group">
|
||||
<input
|
||||
type="text"
|
||||
placeholder="Video ID"
|
||||
class="input input-bordered"
|
||||
bind:value={videoId}
|
||||
/>
|
||||
<button class="btn" on:click={playVideo}> Play </button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -8,20 +8,77 @@ export class PlayletApi {
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
static async getPreferencesFile() {
|
||||
const response = await fetch(`${PlayletApi.host()}/config/preferences.json`);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
static async getHomeLayoutFile() {
|
||||
const response = await fetch(`${PlayletApi.host()}/config/default_home_layout.json`);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
static async getInvidiousVideoApiFile() {
|
||||
const response = await fetch(`${PlayletApi.host()}/config/invidious_video_api.json`);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
static async invidiousAuthenticatedRequest(requestData) {
|
||||
const url = PlayletApi.host() + "/invidious/authenticated-request?request-data=" + encodeURIComponent(JSON.stringify(requestData));
|
||||
const response = await fetch(url);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
static async getUserPreferences() {
|
||||
const response = await fetch(`${PlayletApi.host()}/api/preferences`);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
static async saveUserPreference(key, value) {
|
||||
const response = await this.putJson(`${PlayletApi.host()}/api/preferences`, { [key]: value });
|
||||
return await response;
|
||||
}
|
||||
|
||||
static async logout() {
|
||||
return await PlayletApi.postJson(`${PlayletApi.host()}/api/command`, { command: "logout" });
|
||||
}
|
||||
|
||||
static async playVideo(videoId) {
|
||||
if (!videoId) {
|
||||
return;
|
||||
}
|
||||
return await PlayletApi.postJson(`${PlayletApi.host()}/api/command`, { command: "play", videoId: videoId });
|
||||
}
|
||||
|
||||
static async clearSearchHistory() {
|
||||
return await PlayletApi.postJson(`${PlayletApi.host()}/api/command`, { command: "clear-search-history" });
|
||||
static async getSearchHistory() {
|
||||
const response = await fetch(`${PlayletApi.host()}/api/search-history`);
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
static async updateInstances(instances) {
|
||||
return await PlayletApi.postJson(`${PlayletApi.host()}/invidious/instances`, instances);
|
||||
static async putSearchHistory(query: string) {
|
||||
const response = await PlayletApi.putJson(`${PlayletApi.host()}/api/search-history`, { query });
|
||||
return await response.json();
|
||||
}
|
||||
|
||||
static async clearSearchHistory() {
|
||||
return await fetch(`${PlayletApi.host()}/api/search-history`, { method: "DELETE" });
|
||||
}
|
||||
|
||||
static async updateInstance(instance) {
|
||||
return await PlayletApi.putJson(`${PlayletApi.host()}/api/preferences`, { "invidious.instance": instance });
|
||||
}
|
||||
|
||||
static async setPlayletLibVersion(tag) {
|
||||
let content = null
|
||||
|
||||
if (tag !== "") {
|
||||
content = JSON.stringify([{
|
||||
link: `https://github.com/iBicha/playlet/releases/download/${tag}/playlet-lib.zip`,
|
||||
type: 'custom'
|
||||
}]);
|
||||
}
|
||||
|
||||
await this.postJson(`${PlayletApi.host()}/api/command`, { command: "set-playlet-lib-urls", content: content });
|
||||
}
|
||||
|
||||
private static postJson(url, payload) {
|
||||
@@ -33,4 +90,14 @@ export class PlayletApi {
|
||||
body: JSON.stringify(payload)
|
||||
})
|
||||
}
|
||||
|
||||
private static putJson(url, payload) {
|
||||
return fetch(url, {
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
method: "PUT",
|
||||
body: JSON.stringify(payload)
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<script lang="ts">
|
||||
import ScreenHomeRow from "./ScreenHomeRow.svelte";
|
||||
import { homeLayoutFileStore } from "./Stores";
|
||||
|
||||
export let visibility: boolean;
|
||||
</script>
|
||||
|
||||
<div class={visibility ? "" : "hidden"}>
|
||||
{#each $homeLayoutFileStore as homeLayoutItem}
|
||||
<ScreenHomeRow requestData={homeLayoutItem} />
|
||||
{/each}
|
||||
</div>
|
||||
@@ -0,0 +1,51 @@
|
||||
<script lang="ts">
|
||||
import { InvidiousApi } from "./InvidiousApi";
|
||||
import {
|
||||
invidiousVideoApiStore,
|
||||
playletStateStore,
|
||||
} from "./Stores";
|
||||
import VideoCell from "./VideoCell.svelte";
|
||||
|
||||
export let requestData: any = undefined;
|
||||
export let videoRowData = undefined;
|
||||
|
||||
let invidiousApi = new InvidiousApi();
|
||||
|
||||
playletStateStore.subscribe((value) => {
|
||||
invidiousApi.instance = value?.invidious?.current_instance;
|
||||
invidiousApi.userCountryCode = value?.device?.user_country_code ?? "US";
|
||||
invidiousApi.isLoggedIn = value.invidious?.logged_in ?? false;
|
||||
updateRow();
|
||||
});
|
||||
|
||||
invidiousVideoApiStore.subscribe((value) => {
|
||||
invidiousApi.endpoints = value;
|
||||
updateRow();
|
||||
});
|
||||
|
||||
async function updateRow() {
|
||||
const result = await invidiousApi.makeRequest(requestData);
|
||||
if (result) {
|
||||
videoRowData = result;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if videoRowData}
|
||||
{#if Array.isArray(videoRowData)}
|
||||
{#each videoRowData as child}
|
||||
<svelte:self videoRowData={child} />
|
||||
{/each}
|
||||
{:else if videoRowData.title && videoRowData.videos}
|
||||
<div class="text-lg font-semibold m-4">{videoRowData.title}</div>
|
||||
<div
|
||||
class="carousel carousel-center rounded-box w-full space-x-4"
|
||||
>
|
||||
{#each videoRowData.videos as video}
|
||||
<div class="carousel-item">
|
||||
<VideoCell {...video} />
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
@@ -0,0 +1,81 @@
|
||||
<script lang="ts">
|
||||
import { playletStateStore } from "./Stores";
|
||||
|
||||
export let visibility: boolean;
|
||||
|
||||
const displayNames = {
|
||||
version: "Playlet Version",
|
||||
lib_version: "Playlet Library Version",
|
||||
lib_version_latest: "Playlet Library Latest Version",
|
||||
lib_url: "Playlet Library URL",
|
||||
lib_url_type: "Playlet Library URL Type",
|
||||
git_commit_hash: "Playlet Git Commit Hash",
|
||||
lib_git_commit_hash: "Playlet Library Git Commit Hash",
|
||||
id: "App ID",
|
||||
};
|
||||
|
||||
let appInfo = {};
|
||||
let deviceInfo = {};
|
||||
let invidiousInfo = {};
|
||||
let preferencesInfo = {};
|
||||
let githubUrlIssue = "https://github.com/iBicha/playlet/issues/new";
|
||||
|
||||
playletStateStore.subscribe((value) => {
|
||||
appInfo = value.app || {};
|
||||
deviceInfo = value.device || {};
|
||||
invidiousInfo = value.invidious || {};
|
||||
preferencesInfo = value.preferences || {};
|
||||
githubUrlIssue = CreateGithubIssueUrl();
|
||||
});
|
||||
|
||||
function CreateGithubIssueUrl() {
|
||||
let title = "[Feedback] Playlet";
|
||||
let body = `### Feedback
|
||||
_insert feedback here_
|
||||
|
||||
#### App Info
|
||||
\`\`\`
|
||||
${JSON.stringify(appInfo, null, 2)}
|
||||
\`\`\`
|
||||
|
||||
#### Device Info
|
||||
\`\`\`
|
||||
${JSON.stringify(deviceInfo, null, 2)}
|
||||
\`\`\`
|
||||
|
||||
#### Invidious settings
|
||||
\`\`\`
|
||||
${JSON.stringify(invidiousInfo, null, 2)}
|
||||
\`\`\`
|
||||
|
||||
#### User preferences
|
||||
\`\`\`
|
||||
${JSON.stringify(preferencesInfo, null, 2)}
|
||||
\`\`\``;
|
||||
return `https://github.com/iBicha/playlet/issues/new?title=${encodeURIComponent(title)}&body=${encodeURIComponent(body)}`;
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class={visibility ? "" : "hidden"}>
|
||||
<div class="text-base text-center m-8">
|
||||
Thank you for using Playlet.<br/> You have feedback? Let us know by <a class="link" href={githubUrlIssue} target="_blank" rel="noopener noreferrer">creating an issue on Github</a>.
|
||||
</div>
|
||||
<div class="overflow-x-auto">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Key</th>
|
||||
<th>Value</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{#each Object.entries(displayNames) as [key, value]}
|
||||
<tr>
|
||||
<td>{value}</td>
|
||||
<td>{appInfo[key]}</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,140 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { InvidiousApi } from "./InvidiousApi";
|
||||
import { PlayletApi } from "./PlayletApi";
|
||||
import { playletStateStore, searchHistoryStore } from "./Stores";
|
||||
import VideoCell from "./VideoCell.svelte";
|
||||
|
||||
export let visibility: boolean;
|
||||
|
||||
let invidiousApi = new InvidiousApi();
|
||||
|
||||
let searchBox;
|
||||
let searchBoxText = "";
|
||||
let suggestions: { suggestions: any[] } = { suggestions: [] };
|
||||
let videos = [];
|
||||
let searchHistory = [];
|
||||
|
||||
playletStateStore.subscribe((value) => {
|
||||
invidiousApi.instance = value?.invidious?.current_instance;
|
||||
invidiousApi.userCountryCode = value?.device?.user_country_code ?? "US";
|
||||
});
|
||||
|
||||
searchHistoryStore.subscribe((value) => {
|
||||
searchHistory = value;
|
||||
});
|
||||
|
||||
async function searchSuggestions(event) {
|
||||
const query = event.currentTarget.value;
|
||||
let newSuggestions;
|
||||
if (query.length === 0) {
|
||||
newSuggestions = { suggestions: [], query: "" };
|
||||
} else {
|
||||
newSuggestions = await invidiousApi.searchSuggestions(query);
|
||||
}
|
||||
|
||||
// If we're late and the user walked away, no need for suggestions
|
||||
if (document.activeElement === searchBox) {
|
||||
// Check if this query is old or new
|
||||
if (searchBoxText === newSuggestions.query) {
|
||||
suggestions = makeSuggestionList(newSuggestions);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function makeSuggestionList(newSuggestions, maxItems = 10) {
|
||||
const matchingHistory = getSavedHistoryMatchingQuery(searchBoxText);
|
||||
const matchingHistoryAndSuggestions = [
|
||||
...matchingHistory,
|
||||
...newSuggestions.suggestions,
|
||||
];
|
||||
const uniqueMatchingHistoryAndSuggestions = [
|
||||
...new Set(matchingHistoryAndSuggestions),
|
||||
];
|
||||
return {
|
||||
suggestions: uniqueMatchingHistoryAndSuggestions.slice(0, maxItems),
|
||||
query: newSuggestions.query,
|
||||
};
|
||||
}
|
||||
|
||||
function getSavedHistoryMatchingQuery(query) {
|
||||
if (query.length === 0) {
|
||||
return searchHistory;
|
||||
}
|
||||
return searchHistory.filter((item) => item.startsWith(query));
|
||||
}
|
||||
|
||||
async function suggestionClicked(query) {
|
||||
searchBoxText = query;
|
||||
await searchVideos();
|
||||
}
|
||||
|
||||
async function searchVideos() {
|
||||
suggestions = { suggestions: [] };
|
||||
videos = [];
|
||||
if (searchBoxText.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
videos = await invidiousApi.search(searchBoxText);
|
||||
const newSearchHistory = await PlayletApi.putSearchHistory(searchBoxText);
|
||||
searchHistoryStore.set(newSearchHistory);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class={visibility ? "" : "hidden"}>
|
||||
<div class="m-4">
|
||||
<form
|
||||
on:submit={async (e) => {
|
||||
e.preventDefault();
|
||||
await searchVideos();
|
||||
}}
|
||||
>
|
||||
<input
|
||||
type="search"
|
||||
dir="auto"
|
||||
placeholder="Search..."
|
||||
class="input w-full border border-neutral rounded-full"
|
||||
bind:this={searchBox}
|
||||
bind:value={searchBoxText}
|
||||
on:input={searchSuggestions}
|
||||
on:focus={searchSuggestions}
|
||||
on:blur={() => {
|
||||
// A delay before clearing the suggestions allows the user to click on a suggestion
|
||||
// Clicking the suggestion will trigger the blur event immediately, and the search won't happen
|
||||
setTimeout(() => {
|
||||
suggestions = { suggestions: [] };
|
||||
}, 200);
|
||||
}}
|
||||
/>
|
||||
{#if suggestions.suggestions.length > 0}
|
||||
<ul
|
||||
class="dropdown-content menu z-10 p-2 shadow-xl bg-base-200 rounded-box"
|
||||
>
|
||||
{#each suggestions.suggestions as suggestion}
|
||||
<li class="p-1">
|
||||
<button
|
||||
type="button"
|
||||
on:click={async (e) => {
|
||||
await suggestionClicked(e.currentTarget.innerText);
|
||||
}}>{@html suggestion}</button
|
||||
>
|
||||
</li>
|
||||
{/each}
|
||||
</ul>
|
||||
{/if}
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<div
|
||||
class="grid grid-flow-row-dense gap-4 items-center justify-center sm:grid-cols-2 md:grid-cols-2 lg:grid-cols-2 xl:grid-cols-3 m-4"
|
||||
>
|
||||
{#each videos as video}
|
||||
{#if video.type === "video"}
|
||||
<VideoCell {...video} />
|
||||
{/if}
|
||||
{/each}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,30 @@
|
||||
<script lang="ts">
|
||||
import DevSettings from "./DevSettings.svelte";
|
||||
import SettingsNode from "./SettingsNode.svelte";
|
||||
import { preferencesModelStore } from "./Stores";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
export let visibility: boolean;
|
||||
|
||||
let developerOptionsEnabled = false;
|
||||
|
||||
onMount(async () => {
|
||||
const urlParams = new URLSearchParams(window.location.search);
|
||||
developerOptionsEnabled = !!urlParams.get("dev");
|
||||
});
|
||||
</script>
|
||||
|
||||
<div class={visibility ? "" : "hidden"}>
|
||||
{#each $preferencesModelStore as pref, i}
|
||||
{#if pref.visibility !== "tv"}
|
||||
<SettingsNode {...pref} />
|
||||
{#if i !== $preferencesModelStore.length - 1}
|
||||
<div class="divider" />
|
||||
{/if}
|
||||
{/if}
|
||||
{/each}
|
||||
{#if developerOptionsEnabled}
|
||||
<div class="divider" />
|
||||
<DevSettings />
|
||||
{/if}
|
||||
</div>
|
||||
@@ -0,0 +1,36 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "../PlayletApi";
|
||||
import { userPreferencesStore } from "../Stores";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
export let displayText: string = "";
|
||||
export let key: string = "";
|
||||
export let description: string = "";
|
||||
export let level: number = 0;
|
||||
|
||||
let value;
|
||||
userPreferencesStore.subscribe((userPreferences) => {
|
||||
value = userPreferences[key];
|
||||
});
|
||||
|
||||
async function handleChange() {
|
||||
if (key !== "") {
|
||||
await PlayletApi.saveUserPreference(key, value);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="form-control m-5">
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text {textSizes[level]}">{displayText}</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
name={key}
|
||||
bind:checked={value}
|
||||
on:change={handleChange}
|
||||
class="checkbox"
|
||||
/>
|
||||
</label>
|
||||
<div class="text-xs text-gray-500">{description}</div>
|
||||
</div>
|
||||
@@ -0,0 +1,26 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "../PlayletApi";
|
||||
import { searchHistoryStore } from "../Stores";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
export let displayText: string = "";
|
||||
// svelte-ignore unused-export-let
|
||||
export let key: string = "";
|
||||
export let description: string = "";
|
||||
export let level: number = 0;
|
||||
|
||||
async function clearSeachHistory() {
|
||||
await PlayletApi.clearSearchHistory();
|
||||
searchHistoryStore.set([]);
|
||||
alert("Search history cleared.");
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{displayText}</div>
|
||||
<div class="text-xs text-gray-500">{description}</div>
|
||||
<button class="btn m-1" on:click={clearSeachHistory}
|
||||
>Clear search history</button
|
||||
>
|
||||
</div>
|
||||
@@ -0,0 +1,45 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "../PlayletApi";
|
||||
import { userPreferencesStore } from "../Stores";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
export let displayText: string = "";
|
||||
export let key: string = "";
|
||||
export let description: string = "";
|
||||
export let level: number = 0;
|
||||
export let options: any[] = [];
|
||||
|
||||
let value;
|
||||
userPreferencesStore.subscribe((userPreferences) => {
|
||||
value = userPreferences[key];
|
||||
});
|
||||
|
||||
async function handleChange(event) {
|
||||
if (key !== "") {
|
||||
value = event.currentTarget.value;
|
||||
await PlayletApi.saveUserPreference(key, value);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{displayText}</div>
|
||||
<div class="text-xs text-gray-500">{description}</div>
|
||||
|
||||
{#each options as option}
|
||||
<div class="form-control">
|
||||
<label class="label cursor-pointer">
|
||||
<span class="label-text">{option.displayText}</span>
|
||||
<input
|
||||
type="radio"
|
||||
name={key}
|
||||
value={option.value}
|
||||
class="radio"
|
||||
checked={value === option.value}
|
||||
on:change={handleChange}
|
||||
/>
|
||||
</label>
|
||||
</div>
|
||||
{/each}
|
||||
</div>
|
||||
@@ -0,0 +1,44 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "../PlayletApi";
|
||||
import { userPreferencesStore } from "../Stores";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
export let displayText: string = "";
|
||||
export let key: string = "";
|
||||
export let description: string = "";
|
||||
export let level: number = 0;
|
||||
|
||||
let inputValue;
|
||||
let currentValue;
|
||||
userPreferencesStore.subscribe((userPreferences) => {
|
||||
currentValue = userPreferences[key];
|
||||
inputValue = currentValue;
|
||||
});
|
||||
|
||||
async function save() {
|
||||
if (key !== "") {
|
||||
const value = inputValue;
|
||||
await PlayletApi.saveUserPreference(key, value);
|
||||
currentValue = inputValue = value;
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{displayText}</div>
|
||||
<div class="text-xs text-gray-500">{description}</div>
|
||||
|
||||
<div class="join w-full m-1">
|
||||
<input
|
||||
type="text"
|
||||
name={key}
|
||||
bind:value={inputValue}
|
||||
placeholder={displayText}
|
||||
class="join-item input w-full mr-1"
|
||||
/>
|
||||
{#if inputValue !== currentValue}
|
||||
<button class="join-item btn" on:click={save}>Save</button>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,48 @@
|
||||
<script lang="ts">
|
||||
import BooleanControl from "./SettingControls/BooleanControl.svelte";
|
||||
import ClearSearchHistoryControl from "./SettingControls/ClearSearchHistoryControl.svelte";
|
||||
import RadioControl from "./SettingControls/RadioControl.svelte";
|
||||
import StringControl from "./SettingControls/StringControl.svelte";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
export let displayText: string = "";
|
||||
export let key: string = "";
|
||||
export let description: string = "";
|
||||
export let type: "boolean" | "radio" | "string" | undefined = undefined;
|
||||
export let svelteComponent: string | undefined = undefined;
|
||||
export let options: any[] | undefined = undefined;
|
||||
export let visibility: string | undefined = undefined;
|
||||
export let children: any[] | undefined = [];
|
||||
export let level: number = 0;
|
||||
|
||||
// svelte-ignore unused-export-let
|
||||
export let defaultValue: any = undefined;
|
||||
|
||||
const customComponents = {
|
||||
ClearSearchHistoryControl
|
||||
}
|
||||
</script>
|
||||
|
||||
{#if visibility !== "tv"}
|
||||
{#if type === "boolean"}
|
||||
<BooleanControl {displayText} {key} {description} {level} />
|
||||
{:else if type === "radio"}
|
||||
<RadioControl {displayText} {key} {description} {level} {options} />
|
||||
{:else if type === "string"}
|
||||
<StringControl {displayText} {key} {description} {level} />
|
||||
{:else if svelteComponent}
|
||||
<svelte:component this={customComponents[svelteComponent]} {displayText} {key} {description} {level} />
|
||||
{:else}
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{displayText}</div>
|
||||
<div class="text-xs text-gray-500">{description}</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if children}
|
||||
{#each children as child}
|
||||
<svelte:self {...child} level={level + 1} />
|
||||
{/each}
|
||||
{/if}
|
||||
{/if}
|
||||
@@ -1,3 +1,20 @@
|
||||
import { writable } from 'svelte/store';
|
||||
import type { AppState, PlayletState } from './Types';
|
||||
|
||||
export const playletStateStore = writable({} as any);
|
||||
export const playletStateStore = writable({} as PlayletState);
|
||||
|
||||
export const appStateStore = writable({
|
||||
screen: 'home',
|
||||
} as AppState);
|
||||
|
||||
export const appThemeStore = writable("dark" as "dark" | "light");
|
||||
|
||||
export const preferencesModelStore = writable([] as any);
|
||||
|
||||
export const userPreferencesStore = writable({} as any);
|
||||
|
||||
export const invidiousVideoApiStore = writable({} as any);
|
||||
|
||||
export const homeLayoutFileStore = writable([] as any);
|
||||
|
||||
export const searchHistoryStore = writable([] as any);
|
||||
@@ -0,0 +1,31 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { appThemeStore } from "./Stores";
|
||||
|
||||
let checked;
|
||||
appThemeStore.subscribe((value) => {
|
||||
checked = value === "dark";
|
||||
document.documentElement.setAttribute("data-theme", value);
|
||||
});
|
||||
|
||||
onMount(() => {
|
||||
const savedTheme = localStorage.getItem('theme') as 'dark' | 'light' | undefined;
|
||||
if(savedTheme) {
|
||||
appThemeStore.set(savedTheme);
|
||||
}
|
||||
});
|
||||
|
||||
function handleChange() {
|
||||
const theme = checked ? "dark" : "light";
|
||||
localStorage.setItem("theme", theme);
|
||||
appThemeStore.set(theme);
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="flex flex-row m-3">
|
||||
<div class="p-2">☀️</div>
|
||||
<label class="flex items-center">
|
||||
<input type="checkbox" class="toggle toggle-sm p2" bind:checked={checked} on:change={handleChange} />
|
||||
</label>
|
||||
<div class="p-2">🌙</div>
|
||||
</div>
|
||||
@@ -0,0 +1,10 @@
|
||||
export type AppState = {
|
||||
screen: "search" | "home" | "settings" | "info"
|
||||
}
|
||||
|
||||
export type PlayletState = {
|
||||
app?: any,
|
||||
device?: any,
|
||||
invidious?: any,
|
||||
preferences?: any,
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "./PlayletApi";
|
||||
import { playletStateStore } from "./Stores";
|
||||
|
||||
export let title: string | undefined = undefined;
|
||||
export let videoId: string | undefined = undefined;
|
||||
export let author: string | undefined = undefined;
|
||||
export let videoThumbnails: any[] | undefined = undefined;
|
||||
export let viewCount: number | undefined = undefined;
|
||||
export let publishedText: string | undefined = undefined;
|
||||
export let isUpcoming: boolean = undefined;
|
||||
export let premiereTimestamp: number | undefined = undefined;
|
||||
export let lengthSeconds: number = undefined;
|
||||
export let liveNow: boolean = undefined;
|
||||
|
||||
// svelte-ignore unused-export-let
|
||||
export let type: string = undefined;
|
||||
// svelte-ignore unused-export-let
|
||||
export let authorId: string = undefined;
|
||||
// svelte-ignore unused-export-let
|
||||
export let authorUrl: string = undefined;
|
||||
// svelte-ignore unused-export-let
|
||||
export let authorVerified: boolean = undefined;
|
||||
// svelte-ignore unused-export-let
|
||||
export let description: string = undefined;
|
||||
// svelte-ignore unused-export-let
|
||||
export let descriptionHtml: string = undefined;
|
||||
// svelte-ignore unused-export-let
|
||||
export let viewCountText: string = undefined;
|
||||
// svelte-ignore unused-export-let
|
||||
export let published: number = undefined;
|
||||
// svelte-ignore unused-export-let
|
||||
export let premium: boolean = undefined;
|
||||
// svelte-ignore unused-export-let
|
||||
export let index: number = undefined;
|
||||
// svelte-ignore unused-export-let
|
||||
export let indexId: string = undefined;
|
||||
|
||||
let modal;
|
||||
let tvName = "Roku TV";
|
||||
let invidiousInstance;
|
||||
|
||||
playletStateStore.subscribe((value) => {
|
||||
tvName = value?.device?.friendly_name ?? "Roku TV";
|
||||
invidiousInstance = value?.invidious?.current_instance;
|
||||
});
|
||||
|
||||
function getViewCountDateText() {
|
||||
if (isUpcoming) {
|
||||
return `Premeres in ${getFormattedTimeLeft(premiereTimestamp)}`;
|
||||
}
|
||||
const pubText = publishedText || '';
|
||||
const viewCountText = formatViewCount(viewCount);
|
||||
|
||||
if (pubText === '' && viewCountText === '') {
|
||||
return '';
|
||||
}
|
||||
|
||||
return `${pubText} • ${viewCountText}`;
|
||||
}
|
||||
|
||||
function getFormattedTimeLeft(unixTimestamp) {
|
||||
if (unixTimestamp === "invalid") {
|
||||
return "N/A";
|
||||
}
|
||||
|
||||
const currentTime = Math.floor(Date.now() / 1000);
|
||||
let timeLeft = unixTimestamp - currentTime;
|
||||
if (timeLeft <= 0) {
|
||||
return "now";
|
||||
}
|
||||
|
||||
if (timeLeft < 60) {
|
||||
let result = `${timeLeft} second`;
|
||||
if (timeLeft > 1) {
|
||||
result += "s";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
timeLeft = timeLeft / 60.0;
|
||||
if (timeLeft < 60) {
|
||||
timeLeft = Math.floor(timeLeft);
|
||||
let result = `${timeLeft} minute`;
|
||||
if (timeLeft > 1) {
|
||||
result += "s";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
timeLeft = timeLeft / 60.0;
|
||||
if (timeLeft < 24) {
|
||||
timeLeft = Math.floor(timeLeft);
|
||||
let result = `${timeLeft} hour`;
|
||||
if (timeLeft > 1) {
|
||||
result += "s";
|
||||
}
|
||||
return result;
|
||||
} else {
|
||||
timeLeft = timeLeft / 24.0;
|
||||
timeLeft = Math.floor(timeLeft);
|
||||
let result = `${timeLeft} day`;
|
||||
if (timeLeft > 1) {
|
||||
result += "s";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
function getThumbnailUrl(quality: string = "medium") {
|
||||
if (!videoThumbnails || videoThumbnails.length === 0) {
|
||||
return "";
|
||||
}
|
||||
const videoThumbnail =
|
||||
videoThumbnails.find((thumbnail) => thumbnail.quality === quality) ||
|
||||
videoThumbnails[0];
|
||||
return videoThumbnail.url;
|
||||
}
|
||||
|
||||
function formatViewCount(viewCount) {
|
||||
if (isNaN(viewCount)) {
|
||||
return "";
|
||||
}
|
||||
if (viewCount < 1000) {
|
||||
return `${formatFloat(viewCount)} views`;
|
||||
}
|
||||
|
||||
viewCount = viewCount / 1000;
|
||||
if (viewCount < 1000) {
|
||||
return `${formatFloat(viewCount)}K views`;
|
||||
}
|
||||
|
||||
viewCount = viewCount / 1000;
|
||||
if (viewCount < 1000) {
|
||||
return `${formatFloat(viewCount)}M views`;
|
||||
}
|
||||
|
||||
viewCount = viewCount / 1000;
|
||||
return `${formatFloat(viewCount)}B views`;
|
||||
}
|
||||
|
||||
function formatFloat(X) {
|
||||
X = X * 10;
|
||||
X = X + 0.5;
|
||||
X = Math.floor(X);
|
||||
X = X / 10;
|
||||
return X;
|
||||
}
|
||||
|
||||
function getFormattedTime(length) {
|
||||
const minutes = Math.floor(length / 60).toString();
|
||||
const seconds = (length % 60);
|
||||
const secondsString = seconds < 10 ? `0${seconds}` : seconds.toString();
|
||||
return minutes + ":" + secondsString;
|
||||
}
|
||||
|
||||
function isVideoLive() {
|
||||
if (liveNow) {
|
||||
return true;
|
||||
}
|
||||
return lengthSeconds === 0 && viewCount === 0;
|
||||
}
|
||||
|
||||
async function playVideoOnTv() {
|
||||
await PlayletApi.playVideo(videoId);
|
||||
}
|
||||
|
||||
function openInvidiousInNewTab() {
|
||||
window.open(`${invidiousInstance}/watch?v=${videoId}`)
|
||||
}
|
||||
</script>
|
||||
|
||||
<button class="w-80 p-2" on:click="{modal.showModal()}">
|
||||
<div class="card card-compact bg-base-100 shadow-xl border border-neutral">
|
||||
<figure class="relative">
|
||||
<img class="w-full rounded-box" loading="lazy" width="320" height="180" src={getThumbnailUrl()} alt={title} />
|
||||
{#if isVideoLive()}
|
||||
<div class="absolute bottom-2 right-0 bg-red-500 text-white text-sm rounded-sm font-bold pt-1 pb-1 pr-2 pl-2">LIVE</div>
|
||||
{:else}
|
||||
{#if lengthSeconds}
|
||||
<div class="absolute bottom-2 right-0 bg-black/70 text-white text-sm rounded-sm pt-1 pb-1 pr-2 pl-2">{getFormattedTime(lengthSeconds)}</div>
|
||||
{/if}
|
||||
{/if}
|
||||
</figure>
|
||||
<div class="card-body">
|
||||
<h3 class="card-title text-base line-clamp-2 min-h-12">{title}</h3>
|
||||
<div class="font-semibold">{author}</div>
|
||||
<div>{getViewCountDateText()}</div>
|
||||
</div>
|
||||
</div>
|
||||
</button>
|
||||
<!-- TODO: a dialog for every video is very slow. Need to reuse the same one -->
|
||||
<dialog bind:this={modal} id="modal_{videoId}" class="modal">
|
||||
<form method="dialog" class="modal-box bg-base-100">
|
||||
<h3 class="text-lg m-5">{title}</h3>
|
||||
<div class="flex flex-col">
|
||||
<button class="btn m-2" on:click={playVideoOnTv}>Play on {tvName}</button>
|
||||
<button class="btn m-2" on:click={openInvidiousInNewTab}>Open in Invidious</button>
|
||||
<button class="btn m-2">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>close</button>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -4,5 +4,15 @@ module.exports = {
|
||||
theme: {
|
||||
extend: {}
|
||||
},
|
||||
plugins: [require('daisyui')]
|
||||
plugins: [require("@tailwindcss/typography"), require("daisyui")],
|
||||
daisyui: {
|
||||
themes: false, // true: all themes | false: only light + dark | array: specific themes like this ["light", "dark", "cupcake"]
|
||||
darkTheme: "dark", // name of one of the included themes for dark mode
|
||||
base: true, // applies background color and foreground color for root element by default
|
||||
styled: true, // include daisyUI colors and design decisions for all components
|
||||
utils: true, // adds responsive and modifier utility classes
|
||||
rtl: false, // rotate style direction from left-to-right to right-to-left. You also need to add dir="rtl" to your html tag and install `tailwindcss-flip` plugin for Tailwind CSS.
|
||||
prefix: "", // prefix for daisyUI classnames (components, modifiers and responsive class names. Not colors)
|
||||
logs: true, // Shows info about daisyUI version and used config in the console when building your CSS
|
||||
}
|
||||
};
|
||||
@@ -2,7 +2,7 @@ import { defineConfig, UserConfig } from 'vite'
|
||||
import { svelte } from '@sveltejs/vite-plugin-svelte'
|
||||
import { readFileSync, existsSync } from 'fs'
|
||||
import { parse as dotEnvParse } from 'dotenv'
|
||||
import { internalIpV4Sync } from 'internal-ip';
|
||||
import ip from 'ip';
|
||||
|
||||
const PORT = 5173
|
||||
|
||||
@@ -19,7 +19,7 @@ if (existsSync('../.vscode/.env')) {
|
||||
config.server = {
|
||||
host: true,
|
||||
port: PORT,
|
||||
open: `http://${internalIpV4Sync()}:${PORT}/?host=${envVars.ROKU_DEV_TARGET}:8888`
|
||||
open: `http://${ip.address()}:${PORT}/?host=${envVars.ROKU_DEV_TARGET}:8888`
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="iso-8859-1"?>
|
||||
<!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
|
||||
<svg fill="#FFFFFF" height="800px" width="800px" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||
viewBox="0 0 27.442 27.442" xml:space="preserve">
|
||||
<g>
|
||||
<path d="M19.494,0H7.948C6.843,0,5.951,0.896,5.951,1.999v23.446c0,1.102,0.892,1.997,1.997,1.997h11.546
|
||||
c1.103,0,1.997-0.895,1.997-1.997V1.999C21.491,0.896,20.597,0,19.494,0z M10.872,1.214h5.7c0.144,0,0.261,0.215,0.261,0.481
|
||||
s-0.117,0.482-0.261,0.482h-5.7c-0.145,0-0.26-0.216-0.26-0.482C10.612,1.429,10.727,1.214,10.872,1.214z M13.722,25.469
|
||||
c-0.703,0-1.275-0.572-1.275-1.276s0.572-1.274,1.275-1.274c0.701,0,1.273,0.57,1.273,1.274S14.423,25.469,13.722,25.469z
|
||||
M19.995,21.1H7.448V3.373h12.547V21.1z"/>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
<g>
|
||||
</g>
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1021 B |