Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cef4679770 | ||
|
|
fc3a9ce41f | ||
|
|
dfaf3fa87e | ||
|
|
f8988e9d13 | ||
|
|
6f74ee61f6 | ||
|
|
a598d362ba | ||
|
|
66ce75d62e | ||
|
|
975980a3b5 | ||
|
|
951a13be1f | ||
|
|
14eba620ac | ||
|
|
57885a4e8f | ||
|
|
ed5ab70ceb | ||
|
|
2f8679bc1c | ||
|
|
28c10022bd | ||
|
|
57cdb59790 | ||
|
|
f6d8afc2d9 | ||
|
|
31c4d7e2a0 | ||
|
|
4dabd00b2a | ||
|
|
7fab7f7f39 | ||
|
|
d5508587d2 | ||
|
|
af4c28a411 | ||
|
|
26774d5655 | ||
|
|
3daa94dee1 | ||
|
|
c95bb85c6e | ||
|
|
4b3d1340df | ||
|
|
68c8f12f9d | ||
|
|
66990cfd67 | ||
|
|
aab20f2364 | ||
|
|
f987558884 | ||
|
|
fcca018fe8 | ||
|
|
96bbbd0d77 | ||
|
|
a04e853328 | ||
|
|
c534c27ae3 | ||
|
|
9eeb9fcffe | ||
|
|
75769b72e0 | ||
|
|
c14195041e | ||
|
|
ec941d64dc |
No files matched your search
@@ -1,3 +1,4 @@
|
||||
.DS_Store
|
||||
build/
|
||||
dist/
|
||||
out/
|
||||
|
||||
@@ -5,6 +5,45 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [0.36.1] - 2025-01-19
|
||||
|
||||
### Fixed
|
||||
|
||||
- Added `Visitor Data` to payload in Playlet backend
|
||||
- Session data persists for 24 hours
|
||||
- It reduces the privacy of the app, but can help with `Sign in to confirm you're not a bot` errors
|
||||
|
||||
## Changed
|
||||
|
||||
- Video queue view might be missing video titles and durations
|
||||
- This is done to reduce the risk of rate limiting. No video titles in the queue is better than no videos playing at all.
|
||||
- Only affects casting playlists from the YouTube mobile app.
|
||||
|
||||
## [0.36.0] - 2025-01-16
|
||||
|
||||
### Added
|
||||
|
||||
- Support for channel "Courses" in Playlet backend
|
||||
|
||||
### Fixed
|
||||
|
||||
- Web app tech refresh
|
||||
- Web app "Open in Invidious" when built-in backend is selected
|
||||
- Playlist continuation showing invalid items at the end of playlists
|
||||
|
||||
### Changed
|
||||
|
||||
- Skip "Creator on the Rise" that show up in trending
|
||||
- They end up hijacking the feed
|
||||
- Might become a setting in the future
|
||||
|
||||
## [0.35.5] - 2025-01-09
|
||||
|
||||
### Added
|
||||
|
||||
- Ability to hide announcement messages
|
||||
- [UX] Clarify that you can't login using Playlet built-in backend (Yet)
|
||||
|
||||
## [0.35.4] - 2025-01-07
|
||||
|
||||
### Added
|
||||
|
||||
@@ -40,7 +40,7 @@ More under [Screenshots](./docs/screenshots/README.md)
|
||||
|
||||
## Installation
|
||||
|
||||
[Playlet on Roku channel store](https://channelstore.roku.com/details/840aec36f51bfe6d96cf6db9055a372a/playlet)
|
||||
[Playlet on Roku channel store](https://channelstore.roku.com/details/840aec36f51bfe6d96cf6db9055a372a/playlet) or search "Playlet" in the Roku channel store on your device.
|
||||
|
||||
Can't install from the store? See [How to install Playlet as a sideloaded/dev app](https://github.com/iBicha/playlet/discussions/371)
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ openapi: 3.0.0
|
||||
|
||||
info:
|
||||
title: Playlet Web API
|
||||
version: 0.35.4
|
||||
version: 0.36.1
|
||||
description:
|
||||
Playlet Web API is a RESTful API for controlling the Playlet app on
|
||||
Roku devices. The API is intended to be used by the Playlet web app, but can
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
const dotenv = require('dotenv');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
import { utils } from 'roku-test-automation';
|
||||
|
||||
const envFile = path.join(__dirname, '../.env');
|
||||
const config = getEnvVars(['ROKU_DEV_TARGET', 'ROKU_DEVPASSWORD']);
|
||||
|
||||
export function setupEnvironment() {
|
||||
utils.setupEnvironmentFromConfig({
|
||||
RokuDevice: {
|
||||
devices: [{
|
||||
host: config.ROKU_DEV_TARGET,
|
||||
password: config.ROKU_DEVPASSWORD
|
||||
}]
|
||||
},
|
||||
ECP: {
|
||||
default: {
|
||||
launchChannelId: 'dev'
|
||||
}
|
||||
},
|
||||
OnDeviceComponent: {
|
||||
logLevel: 'info'
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
function getEnvVars(requiredVars = undefined) {
|
||||
let envVars = process.env;
|
||||
if (fs.existsSync(envFile)) {
|
||||
const envConfig = dotenv.parse(fs.readFileSync(envFile));
|
||||
envVars = { ...envVars, ...envConfig };
|
||||
}
|
||||
if (requiredVars) {
|
||||
const missingVars = requiredVars.filter((key) => !envVars[key]);
|
||||
if (missingVars.length) {
|
||||
throw new Error(`Missing environment variables: ${missingVars.join(', ')}`);
|
||||
}
|
||||
}
|
||||
|
||||
return envVars;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
// integration test to play a video on the Roku device
|
||||
// 1. Run dev channel on the Roku device (Playlet (dev))
|
||||
// 2. npm run restart-app && npm run test:integration
|
||||
import { ecp, odc } from 'roku-test-automation';
|
||||
import { setupEnvironment } from './common';
|
||||
import { Key } from 'roku-test-automation/client/dist/ECP';
|
||||
|
||||
setupEnvironment();
|
||||
|
||||
(async () => {
|
||||
await ecp.sendInput({ params: { contentId: "jNQXAC9IVRw" } });
|
||||
|
||||
await odc.onFieldChangeOnce({
|
||||
base: "scene",
|
||||
keyPath: "#VideoQueue.player.state",
|
||||
match: "playing",
|
||||
});
|
||||
|
||||
console.log("Video started playing");
|
||||
|
||||
await ecp.sendKeypress(Key.Back);
|
||||
|
||||
await odc.shutdown();
|
||||
})();
|
||||
Generated
+2198
-1039
File diff suppressed because it is too large.
Load diff
+16
-10
@@ -1,33 +1,34 @@
|
||||
{
|
||||
"name": "playlet",
|
||||
"version": "0.35.4",
|
||||
"version": "0.36.1",
|
||||
"description": "Unofficial YouTube client for Roku",
|
||||
"devDependencies": {
|
||||
"@rokucommunity/bslint": "^0.8.27",
|
||||
"@rokucommunity/bslint": "^0.8.28",
|
||||
"@types/crypto-js": "^4.2.2",
|
||||
"@types/fs-extra": "^11.0.4",
|
||||
"@types/node": "^22.10.5",
|
||||
"@types/node": "^22.10.7",
|
||||
"@types/xml2js": "^0.4.14",
|
||||
"argparse": "^2.0.1",
|
||||
"brighterscript": "0.68.2",
|
||||
"brighterscript-formatter": "^1.7.7",
|
||||
"brighterscript": "0.68.3",
|
||||
"brighterscript-formatter": "^1.7.8",
|
||||
"convert-svg-to-png": "^0.6.4",
|
||||
"crypto-js": "^4.2.0",
|
||||
"dotenv": "^16.4.7",
|
||||
"fs-extra": "^11.2.0",
|
||||
"glob": "^11.0.0",
|
||||
"fs-extra": "^11.3.0",
|
||||
"glob": "^11.0.1",
|
||||
"imap": "^0.8.19",
|
||||
"ip": "^2.0.1",
|
||||
"json5": "^2.2.3",
|
||||
"mailparser": "^3.7.2",
|
||||
"protocol-buffers-schema": "^3.6.0",
|
||||
"roku-deploy": "^3.12.3",
|
||||
"roku-test-automation": "^2.0.10",
|
||||
"rooibos-roku": "5.14.0",
|
||||
"rounded-rect-9patch": "^1.1.2",
|
||||
"semver": "^7.6.3",
|
||||
"shelljs": "^0.8.5",
|
||||
"ts-node": "^10.9.2",
|
||||
"typescript": "5.7.2",
|
||||
"typescript": "5.7.3",
|
||||
"xml2js": "^0.6.2",
|
||||
"yaml": "^2.7.0"
|
||||
},
|
||||
@@ -55,6 +56,7 @@
|
||||
"test:build:app": "cd playlet-app && npm run test:build",
|
||||
"test:lib": "cd playlet-lib && npm run test",
|
||||
"test:build:lib": "cd playlet-lib && npm run test:build",
|
||||
"test:integration": "npx tsx ./integration-tests/play-video.ts",
|
||||
"version-sync": "node tools/version-sync.js",
|
||||
"manifest-git-hash": "node tools/update-manifest-git-hash.js",
|
||||
"sign-released-package": "node tools/sign-released-package.js",
|
||||
@@ -62,9 +64,13 @@
|
||||
"generate-sponsorblock-config": "node tools/generate-sponsorblock-config.js",
|
||||
"update-rale-component": "cd tools/RALE && rm TrackerTask.xml && curl -o TrackerTask.zip https://devtools.web.roku.com/roku-advanced-layout-editor/app/TrackerTask.zip && unzip TrackerTask.zip && rm TrackerTask.zip",
|
||||
"postinstall": "cd playlet-lib && npm install && cd ../playlet-app && npm install && cd ../playlet-web && npm install",
|
||||
"update-deps": "npx npm-check-updates --deep --upgrade --install always --reject @sveltejs/vite-plugin-svelte,svelte,vite,@vitejs/plugin-legacy",
|
||||
"update-deps": "npx npm-check-updates --deep --upgrade --install always",
|
||||
"registry:write": "node tools/registry.js --input registry.json",
|
||||
"registry:read": "node tools/registry.js --output registry.json",
|
||||
"registry:clear": "node tools/registry.js --clear"
|
||||
"registry:clear": "node tools/registry.js --clear",
|
||||
"restart-app": "node tools/restart-app.js"
|
||||
},
|
||||
"optionalDependencies": {
|
||||
"@rollup/rollup-linux-x64-gnu": "^4.30.1"
|
||||
}
|
||||
}
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.35.4",
|
||||
"version": "0.36.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-app",
|
||||
"version": "0.35.4"
|
||||
"version": "0.36.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-app",
|
||||
"version": "0.35.4",
|
||||
"version": "0.36.1",
|
||||
"description": "Unofficial YouTube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf ../build/playlet-app",
|
||||
|
||||
@@ -2,8 +2,8 @@ title=Playlet
|
||||
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=35
|
||||
build_version=00004
|
||||
minor_version=36
|
||||
build_version=00001
|
||||
|
||||
ui_resolutions=hd
|
||||
uri_resolution_autosub=$$RES$$,480p,720p,1080p
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
function DialogShowError(message as object, bulletText as object, bottomMessage as object)
|
||||
' Note: dialog can be null since StandardMessageDialog is only available on 10.0 and later
|
||||
msgDialog = CreateObject("roSGNode", "StandardMessageDialog")
|
||||
DialogSetPalette(msgDialog)
|
||||
msgDialog.message = message
|
||||
msgDialog.bulletText = bulletText
|
||||
msgDialog.bottomMessage = bottomMessage
|
||||
@@ -16,19 +15,6 @@ function DialogShowError(message as object, bulletText as object, bottomMessage
|
||||
m.top.getScene().dialog = msgDialog
|
||||
end function
|
||||
|
||||
function DialogSetPalette(msgDialog as object)
|
||||
palette = createObject("roSGNode", "RSGPalette")
|
||||
palette.colors = {
|
||||
DialogBackgroundColor: "#242424FF"
|
||||
DialogFocusColor: "#CECECEFF"
|
||||
DialogFocusItemColor: "#202020FF"
|
||||
DialogSecondaryTextColor: "#EBEBEBFF"
|
||||
DialogSecondaryItemColor: "#FF1C30FF"
|
||||
DialogTextColor: "#EBEBEBFF"
|
||||
}
|
||||
msgDialog.palette = palette
|
||||
end function
|
||||
|
||||
function DialogOnButtonSelected()
|
||||
m.top.getScene().dialog.close = true
|
||||
end function
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
' Playlet (App to play videos from an Invidious server on Roku TVs)
|
||||
' Copyright (C) 2024 Brahim Hadriche
|
||||
' Copyright (C) 2025 Brahim Hadriche
|
||||
|
||||
' This program is free software: you can redistribute it and/or modify
|
||||
' it under the terms of the GNU Affero General Public License as published by
|
||||
@@ -29,6 +29,7 @@ function Main(args as object) as void
|
||||
scene = screen.CreateScene("BootstrapScene")
|
||||
screen.show()
|
||||
|
||||
SetScenePalette(scene)
|
||||
scene.ObserveField("exitChannel", port)
|
||||
scene.launchArgs = args
|
||||
|
||||
|
||||
+3
-3
@@ -1,5 +1,5 @@
|
||||
function SetPalette(dialog as object)
|
||||
palette = createObject("roSGNode", "RSGPalette")
|
||||
function SetScenePalette(scene as object)
|
||||
palette = CreateObject("roSGNode", "RSGPalette")
|
||||
palette.colors = {
|
||||
DialogBackgroundColor: "#242424FF"
|
||||
DialogFocusColor: "#CECECEFF"
|
||||
@@ -8,5 +8,5 @@ function SetPalette(dialog as object)
|
||||
DialogSecondaryItemColor: "#FF1C30FF"
|
||||
DialogTextColor: "#EBEBEBFF"
|
||||
}
|
||||
dialog.palette = palette
|
||||
scene.palette = palette
|
||||
end function
|
||||
Generated
+2
-2
@@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.35.4",
|
||||
"version": "0.36.1",
|
||||
"lockfileVersion": 2,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "playlet-lib",
|
||||
"version": "0.35.4"
|
||||
"version": "0.36.1"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-lib",
|
||||
"version": "0.35.4",
|
||||
"version": "0.36.1",
|
||||
"description": "Unofficial YouTube client for Roku",
|
||||
"scripts": {
|
||||
"prebuild": "rm -rf ../build/playlet-lib",
|
||||
|
||||
@@ -92,11 +92,11 @@ function OnContentSet() as void
|
||||
if (authorId <> m.authorId or author <> m.author) and IsArray(content.tabs)
|
||||
m.authorId = authorId
|
||||
m.author = author
|
||||
m.rowList.feeds = CreateChannelFeeds(m.authorId, author, content.tabs, content.tabsParams)
|
||||
m.rowList.feeds = CreateChannelFeeds(m.authorId, author, content.tabs, content.tabsParams, content.tabsTitles)
|
||||
end if
|
||||
end function
|
||||
|
||||
function CreateChannelFeeds(authorId as string, author as string, tabs as object, tabsParams as object) as object
|
||||
function CreateChannelFeeds(authorId as string, author as string, tabs as object, tabsParams as object, tabsTitles as object) as object
|
||||
if authorId = ""
|
||||
return invalid
|
||||
end if
|
||||
@@ -111,7 +111,13 @@ function CreateChannelFeeds(authorId as string, author as string, tabs as object
|
||||
params = ""
|
||||
end if
|
||||
|
||||
feeds.Push(m.tabs[tabName](authorId, author, params))
|
||||
if tabsTitles <> invalid and tabsTitles.DoesExist(tabName)
|
||||
title = tabsTitles[tabName]
|
||||
else
|
||||
title = ""
|
||||
end if
|
||||
|
||||
feeds.Push(m.tabs[tabName](authorId, author, title, params))
|
||||
end if
|
||||
end for
|
||||
|
||||
@@ -197,23 +203,47 @@ end function
|
||||
|
||||
function InitializeTabs()
|
||||
m.tabs = {
|
||||
"videos": function(authorId as string, author as string, params as string) as object
|
||||
return CreateChannelFeed("Videos", "channel_videos", authorId, author, params)
|
||||
"videos": function(authorId as string, author as string, title as string, params as string) as object
|
||||
if StringUtils.IsNullOrEmpty(title)
|
||||
title = "Videos"
|
||||
end if
|
||||
return CreateChannelFeed(title, "channel_videos", authorId, author, params)
|
||||
end function
|
||||
"shorts": function(authorId as string, author as string, params as string) as object
|
||||
return CreateChannelFeed("Shorts", "channel_shorts", authorId, author, params)
|
||||
"shorts": function(authorId as string, author as string, title as string, params as string) as object
|
||||
if StringUtils.IsNullOrEmpty(title)
|
||||
title = "Shorts"
|
||||
end if
|
||||
return CreateChannelFeed(title, "channel_shorts", authorId, author, params)
|
||||
end function
|
||||
"streams": function(authorId as string, author as string, params as string) as object
|
||||
return CreateChannelFeed("Live", "channel_streams", authorId, author, params)
|
||||
"streams": function(authorId as string, author as string, title as string, params as string) as object
|
||||
if StringUtils.IsNullOrEmpty(title)
|
||||
title = "Live"
|
||||
end if
|
||||
return CreateChannelFeed(title, "channel_streams", authorId, author, params)
|
||||
end function
|
||||
"releases": function(authorId as string, author as string, params as string) as object
|
||||
return CreateChannelFeed("Releases", "channel_releases", authorId, author, params)
|
||||
"releases": function(authorId as string, author as string, title as string, params as string) as object
|
||||
if StringUtils.IsNullOrEmpty(title)
|
||||
title = "Releases"
|
||||
end if
|
||||
return CreateChannelFeed(title, "channel_releases", authorId, author, params)
|
||||
end function
|
||||
"podcasts": function(authorId as string, author as string, params as string) as object
|
||||
return CreateChannelFeed("Podcasts", "channel_podcasts", authorId, author, params)
|
||||
"podcasts": function(authorId as string, author as string, title as string, params as string) as object
|
||||
if StringUtils.IsNullOrEmpty(title)
|
||||
title = "Podcasts"
|
||||
end if
|
||||
return CreateChannelFeed(title, "channel_podcasts", authorId, author, params)
|
||||
end function
|
||||
"playlists": function(authorId as string, author as string, params as string) as object
|
||||
return CreateChannelFeed("Playlists", "channel_playlists", authorId, author, params)
|
||||
"playlists": function(authorId as string, author as string, title as string, params as string) as object
|
||||
if StringUtils.IsNullOrEmpty(title)
|
||||
title = "Playlists"
|
||||
end if
|
||||
return CreateChannelFeed(title, "channel_playlists", authorId, author, params)
|
||||
end function
|
||||
"courses": function(authorId as string, author as string, title as string, params as string) as object
|
||||
if StringUtils.IsNullOrEmpty(title)
|
||||
title = "Courses"
|
||||
end if
|
||||
return CreateChannelFeed(title, "channel_courses", authorId, author, params)
|
||||
end function
|
||||
}
|
||||
end function
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<field id="subCountText" type="string" />
|
||||
<field id="tabs" type="array" />
|
||||
<field id="tabsParams" type="assocarray" />
|
||||
<field id="tabsTitles" type="assocarray" />
|
||||
<field id="thumbnail" type="string" />
|
||||
<field id="videoCount" type="integer" />
|
||||
<field id="videoCountText" type="string" />
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
import "pkg:/source/utils/RegistryUtils.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
namespace DialogUtils
|
||||
@@ -91,4 +93,58 @@ namespace DialogUtils
|
||||
return dialog
|
||||
end function
|
||||
|
||||
function ShowDialogOnce(options as object) as object
|
||||
messageId = ValidString(options.messageId)
|
||||
hasMessageId = messageId <> ""
|
||||
|
||||
if hasMessageId
|
||||
messages = RegistryUtils.Read(RegistryUtils.MESSAGES)
|
||||
if not StringUtils.IsNullOrEmpty(messages)
|
||||
messages = ParseJson(messages)
|
||||
if IsAssociativeArray(messages)
|
||||
savedMessageId = ValidString(messages["messageId"])
|
||||
if savedMessageId = messageId
|
||||
return invalid
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
end if
|
||||
|
||||
options.buttons = [
|
||||
Tr(Locale.Buttons.OK)
|
||||
`${Tr(Locale.Buttons.OK)} - ${Tr(Locale.Buttons.DotNotShowAgain)}`
|
||||
]
|
||||
|
||||
dialog = ShowDialogEx(options)
|
||||
if dialog = invalid
|
||||
return invalid
|
||||
end if
|
||||
|
||||
dialog.AddFields({
|
||||
"messageId": messageId
|
||||
})
|
||||
|
||||
dialog.ObserveField("buttonSelected", FuncName(OnShowDialogOnceButtonSelected))
|
||||
return dialog
|
||||
end function
|
||||
|
||||
function OnShowDialogOnceButtonSelected(event as object) as void
|
||||
buttonSelected = event.getData()
|
||||
if buttonSelected <> 1
|
||||
return
|
||||
end if
|
||||
|
||||
dialog = event.GetRoSGNode()
|
||||
messageId = dialog.messageId
|
||||
if messageId = ""
|
||||
return
|
||||
end if
|
||||
|
||||
messages = {
|
||||
"messageId": messageId
|
||||
}
|
||||
|
||||
RegistryUtils.Write(RegistryUtils.MESSAGES, FormatJson(messages))
|
||||
end function
|
||||
|
||||
end namespace
|
||||
@@ -1,10 +1,8 @@
|
||||
import "DialogPalette.bs"
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
SetPalette(m.top)
|
||||
m.urlLabel = m.top.findNode("urlLabel")
|
||||
m.qrCode = m.top.findNode("QrCodePoster")
|
||||
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import "DialogPalette.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
SetPalette(m.top)
|
||||
m.top.observeField("buttonSelected", FuncName(CloseDialog))
|
||||
end function
|
||||
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
import "DialogPalette.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
|
||||
function Init()
|
||||
SetPalette(m.top)
|
||||
m.top.observeField("buttonSelected", FuncName(OnButtonSelected))
|
||||
m.top.observeField("wasClosed", FuncName(OnDialogClosed))
|
||||
end function
|
||||
|
||||
@@ -7,12 +7,32 @@ import "pkg:/source/utils/Locale.bs"
|
||||
|
||||
function Init()
|
||||
m.scene = m.top.getScene()
|
||||
SetScenePalette(m.scene)
|
||||
|
||||
' At this point, the "MainScene" node is not yet added to the scene, and does not have a parent yet.
|
||||
' Let's wait until it has one.
|
||||
m.MainSceneContainer = m.scene.findNode("MainSceneContainer")
|
||||
m.MainSceneContainer.ObserveField("change", FuncName(MainSceneContainerChanged))
|
||||
end function
|
||||
|
||||
function SetScenePalette(scene as object) as void
|
||||
palette = scene.palette
|
||||
if palette <> invalid
|
||||
return
|
||||
end if
|
||||
|
||||
palette = CreateObject("roSGNode", "RSGPalette")
|
||||
palette.colors = {
|
||||
DialogBackgroundColor: "#242424FF"
|
||||
DialogFocusColor: "#CECECEFF"
|
||||
DialogFocusItemColor: "#202020FF"
|
||||
DialogSecondaryTextColor: "#EBEBEBFF"
|
||||
DialogSecondaryItemColor: "#FF1C30FF"
|
||||
DialogTextColor: "#EBEBEBFF"
|
||||
}
|
||||
scene.palette = palette
|
||||
end function
|
||||
|
||||
function MainSceneContainerChanged()
|
||||
AutoBindSceneGraph()
|
||||
StartWebServer()
|
||||
@@ -35,7 +55,8 @@ function StartWebServer()
|
||||
end function
|
||||
|
||||
function ShowAnnouncement()
|
||||
DialogUtils.ShowDialogEx({
|
||||
DialogUtils.ShowDialogOnce({
|
||||
messageId: "1736288537"
|
||||
title: "Announcement - Playlet backend"
|
||||
message: [
|
||||
"An experimental built-in backend has been added to Playlet."
|
||||
|
||||
@@ -8,12 +8,30 @@
|
||||
function Init()
|
||||
InitializeBindings() ' auto-generated!
|
||||
m.scene = m.top.getScene()
|
||||
SetScenePalette(m.scene)
|
||||
' At this point, the "MainScene" node is not yet added to the scene, and does not have a parent yet.
|
||||
' Let's wait until it has one.
|
||||
m.MainSceneContainer = m.scene.findNode("MainSceneContainer")
|
||||
m.MainSceneContainer.ObserveField("change", FuncName(MainSceneContainerChanged))
|
||||
end function
|
||||
|
||||
function SetScenePalette(scene as object) as void
|
||||
palette = scene.palette
|
||||
if palette <> invalid
|
||||
return
|
||||
end if
|
||||
palette = CreateObject("roSGNode", "RSGPalette")
|
||||
palette.colors = {
|
||||
DialogBackgroundColor: "#242424FF"
|
||||
DialogFocusColor: "#CECECEFF"
|
||||
DialogFocusItemColor: "#202020FF"
|
||||
DialogSecondaryTextColor: "#EBEBEBFF"
|
||||
DialogSecondaryItemColor: "#FF1C30FF"
|
||||
DialogTextColor: "#EBEBEBFF"
|
||||
}
|
||||
scene.palette = palette
|
||||
end function
|
||||
|
||||
function MainSceneContainerChanged()
|
||||
AutoBindSceneGraph()
|
||||
StartWebServer()
|
||||
@@ -34,7 +52,8 @@ function StartWebServer()
|
||||
end function
|
||||
|
||||
function ShowAnnouncement()
|
||||
DialogUtils_ShowDialogEx({
|
||||
DialogUtils_ShowDialogOnce({
|
||||
messageId: "1736288537"
|
||||
title: "Announcement - Playlet backend"
|
||||
message: [
|
||||
"An experimental built-in backend has been added to Playlet."
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/StringUtils.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/Logging.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/components/Dialog/DialogUtils.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/utils/RegistryUtils.brs" />
|
||||
<script type="text/brightscript" uri="pkg:/source/bslib.brs" />
|
||||
<children>
|
||||
<Logger id="Logger" />
|
||||
@@ -46,6 +47,7 @@
|
||||
<BookmarksService id="BookmarksService" />
|
||||
<SearchHistory id="SearchHistory" />
|
||||
<ProfilesService id="ProfilesService" />
|
||||
<Innertube id="Innertube" />
|
||||
<Invidious id="Invidious" />
|
||||
<PlayletWebServer id="WebServer" port="8888" />
|
||||
<DialServer id="DialServer" />
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
<VideoQueue id="VideoQueue"
|
||||
appController="bind:/AppController"
|
||||
videoContainer="bind:../VideoContainer"
|
||||
innertube="bind:../Innertube"
|
||||
invidious="bind:../Invidious"
|
||||
notifications="bind:../Notifications"
|
||||
preferences="bind:../Preferences"
|
||||
@@ -70,6 +71,7 @@
|
||||
<ProfilesService id="ProfilesService"
|
||||
invidious="bind:../Invidious" />
|
||||
|
||||
<Innertube id="Innertube" />
|
||||
<Invidious id="Invidious"
|
||||
webServer="bind:../WebServer"
|
||||
applicationInfo="bind:../ApplicationInfo"
|
||||
@@ -81,6 +83,7 @@
|
||||
port="8888"
|
||||
appController="bind:/AppController"
|
||||
applicationInfo="bind:../ApplicationInfo"
|
||||
innertube="bind:../Innertube"
|
||||
invidious="bind:../Invidious"
|
||||
profilesService="bind:../ProfilesService"
|
||||
preferences="bind:../Preferences"
|
||||
|
||||
@@ -18,6 +18,7 @@ function InitializeBindings()
|
||||
"VideoQueue": {
|
||||
"appController": "/AppController",
|
||||
"videoContainer": "../VideoContainer",
|
||||
"innertube": "../Innertube",
|
||||
"invidious": "../Invidious",
|
||||
"notifications": "../Notifications",
|
||||
"preferences": "../Preferences",
|
||||
@@ -38,6 +39,7 @@ function InitializeBindings()
|
||||
"WebServer": {
|
||||
"appController": "/AppController",
|
||||
"applicationInfo": "../ApplicationInfo",
|
||||
"innertube": "../Innertube",
|
||||
"invidious": "../Invidious",
|
||||
"profilesService": "../ProfilesService",
|
||||
"preferences": "../Preferences",
|
||||
|
||||
@@ -38,6 +38,17 @@ function OnRowItemSelected() as void
|
||||
row = m.profileRowList.content.GetChild(0)
|
||||
selectedProfile = row.GetChild(index)
|
||||
if selectedProfile.type = "login"
|
||||
invidiousInstance = m.preferences["invidious.instance"]
|
||||
if StringUtils.IsNullOrEmpty(invidiousInstance)
|
||||
DialogUtils.ShowDialogEx({
|
||||
title: "No Invidious Instance"
|
||||
message: [
|
||||
"Playlet built-in backend does not support login yet.",
|
||||
"Can only login if an Invidious instance is set in the settings."
|
||||
]
|
||||
})
|
||||
return
|
||||
end if
|
||||
dialog = CreateObject("roSGNode", "LoginDialog")
|
||||
dialog@.BindNode()
|
||||
m.top.getScene().dialog = dialog
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
<field id="navBar" type="node" bind="/NavBar" />
|
||||
<field id="profilesService" type="node" bind="/ProfilesService" />
|
||||
<field id="appController" type="node" bind="/AppController" />
|
||||
<field id="preferences" type="node" bind="/Preferences" />
|
||||
</interface>
|
||||
|
||||
<children>
|
||||
|
||||
-2
@@ -1,4 +1,3 @@
|
||||
import "pkg:/components/Dialog/DialogPalette.bs"
|
||||
import "pkg:/components/Navigation/Navigation.bs"
|
||||
import "pkg:/components/parts/AutoBind/OnNodeReadyNoOp.bs"
|
||||
import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
||||
@@ -102,7 +101,6 @@ end function
|
||||
|
||||
function OnEditButtonSelected()
|
||||
keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog")
|
||||
SetPalette(keyboardDialog)
|
||||
' TODO:P2 localize
|
||||
keyboardDialog.title = "Edit Instance"
|
||||
' TODO:P2 localize
|
||||
|
||||
+3
-1
@@ -102,7 +102,6 @@ function Refresh()
|
||||
end function
|
||||
|
||||
function OnInvidiousPublicInstancesTaskResults(output as object) as void
|
||||
m.top.focusable = true
|
||||
m.busySpinner.visible = false
|
||||
m.busySpinner.control = "stop"
|
||||
|
||||
@@ -130,6 +129,8 @@ function OnInvidiousPublicInstancesTaskResults(output as object) as void
|
||||
|
||||
m.failedLabel.visible = true
|
||||
m.refreshButton.visible = true
|
||||
m.top.focusable = true
|
||||
|
||||
if m.top.IsInFocusChain()
|
||||
NodeSetFocus(m.top, true)
|
||||
end if
|
||||
@@ -138,6 +139,7 @@ function OnInvidiousPublicInstancesTaskResults(output as object) as void
|
||||
|
||||
m.instances.visible = true
|
||||
m.instancesHeader.visible = true
|
||||
m.top.focusable = m.instances.content.getChildCount() > 0
|
||||
|
||||
if m.top.IsInFocusChain()
|
||||
NodeSetFocus(m.top, true)
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import "pkg:/components/Dialog/DialogPalette.bs"
|
||||
import "pkg:/source/utils/FocusManagement.bs"
|
||||
import "pkg:/source/utils/Locale.bs"
|
||||
import "pkg:/source/utils/Types.bs"
|
||||
@@ -67,7 +66,6 @@ end function
|
||||
|
||||
function ShowEditKeyboard()
|
||||
keyboardDialog = createObject("roSGNode", "StandardKeyboardDialog")
|
||||
SetPalette(keyboardDialog)
|
||||
keyboardDialog.title = m.top.displayText
|
||||
keyboardDialog.message = [m.top.description]
|
||||
keyboardDialog.text = m.top.value
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace Innertube
|
||||
deviceInfo = CreateObject("roDeviceInfo")
|
||||
|
||||
payload = {
|
||||
"context": Innertube.CreateContext(clienType, deviceInfo, "")
|
||||
"context": Innertube.CreateContext(clienType, deviceInfo, "", "")
|
||||
}
|
||||
|
||||
if not StringUtils.IsNullOrEmpty(continuation)
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace Innertube
|
||||
end if
|
||||
end function
|
||||
|
||||
function CreateContext(clienType as Innertube.ClientType, deviceInfo as object, ctt as string) as object
|
||||
function CreateContext(clienType as Innertube.ClientType, deviceInfo as object, ctt as string, visitorData as string) as object
|
||||
client = invalid
|
||||
if clienType = ClientType.Web
|
||||
client = CreateContextClientWeb(deviceInfo)
|
||||
@@ -64,19 +64,22 @@ namespace Innertube
|
||||
}]
|
||||
end if
|
||||
|
||||
if not StringUtils.IsNullOrEmpty(visitorData)
|
||||
context["client"]["visitorData"] = visitorData
|
||||
end if
|
||||
|
||||
return context
|
||||
end function
|
||||
|
||||
function CreateContextClientWeb(deviceInfo as object) as object
|
||||
return {
|
||||
"hl": deviceInfo.GetCurrentLocale()
|
||||
"hl": GetCurrentLocale(deviceInfo)
|
||||
"gl": GetContentRegion(deviceInfo)
|
||||
"remoteHost": ""
|
||||
"screenDensityFloat": 1
|
||||
"screenHeightPoints": 1440
|
||||
"screenPixelDensity": 1
|
||||
"screenWidthPoints": 2560
|
||||
"visitorData": ""
|
||||
"clientName": "WEB"
|
||||
"clientVersion": INNERTUBE_WEB_CLIENT_VERSION
|
||||
"osName": "Windows"
|
||||
@@ -103,14 +106,13 @@ namespace Innertube
|
||||
|
||||
function CreateContextClientIOS(deviceInfo as object) as object
|
||||
return {
|
||||
"hl": deviceInfo.GetCurrentLocale()
|
||||
"hl": GetCurrentLocale(deviceInfo)
|
||||
"gl": GetContentRegion(deviceInfo)
|
||||
"remoteHost": ""
|
||||
"screenDensityFloat": 1
|
||||
"screenHeightPoints": 1440
|
||||
"screenPixelDensity": 1
|
||||
"screenWidthPoints": 2560
|
||||
"visitorData": ""
|
||||
"clientName": "iOS"
|
||||
"clientVersion": INNERTUBE_IOS_CLIENT_VERSION
|
||||
"osName": "iOS"
|
||||
@@ -129,7 +131,7 @@ namespace Innertube
|
||||
|
||||
function CreateContextClientTv(deviceInfo as object) as object
|
||||
return {
|
||||
"hl": deviceInfo.GetCurrentLocale()
|
||||
"hl": GetCurrentLocale(deviceInfo)
|
||||
"gl": GetContentRegion(deviceInfo)
|
||||
"remoteHost": ""
|
||||
"deviceMake": INNERTUBE_TV_DEVICE_MAKE
|
||||
@@ -159,6 +161,10 @@ namespace Innertube
|
||||
}
|
||||
end function
|
||||
|
||||
function GetCurrentLocale(deviceInfo as object) as string
|
||||
return deviceInfo.GetCurrentLocale()
|
||||
end function
|
||||
|
||||
function GetContentRegion(deviceInfo as object) as string
|
||||
region = deviceInfo.GetUserCountryCode()
|
||||
if region.len() <> 2 or region = "OT"
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import "pkg:/components/Services/Innertube/Constants.bs"
|
||||
import "pkg:/source/AsyncTask/AsyncTask.bs"
|
||||
import "pkg:/source/AsyncTask/Tasks.bs"
|
||||
|
||||
function Init()
|
||||
AsyncTask.Start(Tasks.InnertubeInitTask, {
|
||||
innertube: m.top
|
||||
})
|
||||
end function
|
||||
@@ -0,0 +1,5 @@
|
||||
<component name="Innertube" extends="Node">
|
||||
<interface>
|
||||
<field id="visitorData" type="string" />
|
||||
</interface>
|
||||
</component>
|
||||
@@ -0,0 +1,15 @@
|
||||
import "pkg:/components/Services/Innertube/SessionData.bs"
|
||||
|
||||
@asynctask
|
||||
function InnertubeInitTask(input as object) as object
|
||||
innertubeNode = input.innertube
|
||||
|
||||
sessionData = Innertube.GetSessionData()
|
||||
if sessionData = invalid
|
||||
return invalid
|
||||
end if
|
||||
|
||||
innertubeNode.visitorData = sessionData.visitorData
|
||||
|
||||
return invalid
|
||||
end function
|
||||
@@ -18,6 +18,8 @@ namespace InnertubeService
|
||||
cancellation = invalid
|
||||
fetchNext = true
|
||||
ctt = ""
|
||||
visitorData = ""
|
||||
raw = false
|
||||
|
||||
if options <> invalid
|
||||
if options.DoesExist("cancellation")
|
||||
@@ -29,9 +31,15 @@ namespace InnertubeService
|
||||
if options.DoesExist("ctt")
|
||||
ctt = options.ctt
|
||||
end if
|
||||
if options.DoesExist("raw")
|
||||
raw = options.raw
|
||||
end if
|
||||
if options.DoesExist("visitorData")
|
||||
visitorData = options.visitorData
|
||||
end if
|
||||
end if
|
||||
|
||||
playerRequest = Innertube.CreatePlayerRequest(videoId, ctt)
|
||||
playerRequest = Innertube.CreatePlayerRequest(videoId, ctt, visitorData)
|
||||
playerRequest.Cancellation(cancellation)
|
||||
playerRequest.Send()
|
||||
|
||||
@@ -60,6 +68,16 @@ namespace InnertubeService
|
||||
nextResponse = nextRequest.Await()
|
||||
end if
|
||||
|
||||
if raw
|
||||
rawResponse = {
|
||||
"playerResponse": playerResponse.Json()
|
||||
}
|
||||
if fetchNext
|
||||
rawResponse["nextResponse"] = nextResponse.Json()
|
||||
end if
|
||||
return rawResponse
|
||||
end if
|
||||
|
||||
parsedResponse = Innertube.ParseInnertubePlayerResponse(playerResponse.Json())
|
||||
if parsedResponse.error <> invalid
|
||||
return parsedResponse
|
||||
@@ -158,6 +176,7 @@ namespace InnertubeService
|
||||
searchFilters = invalid
|
||||
continuation = ""
|
||||
cancellation = invalid
|
||||
raw = false
|
||||
|
||||
if options <> invalid
|
||||
if options.DoesExist("searchFilters")
|
||||
@@ -169,14 +188,18 @@ namespace InnertubeService
|
||||
if options.DoesExist("cancellation")
|
||||
cancellation = options.cancellation
|
||||
end if
|
||||
if options.DoesExist("raw")
|
||||
raw = options.raw
|
||||
end if
|
||||
end if
|
||||
|
||||
return Innertube.Search(query, searchFilters, continuation, cancellation)
|
||||
return Innertube.Search(query, searchFilters, continuation, cancellation, raw)
|
||||
end function
|
||||
|
||||
function GetTrending(options = invalid as object) as object
|
||||
cancellation = invalid
|
||||
params = ""
|
||||
raw = false
|
||||
|
||||
if options <> invalid
|
||||
if options.DoesExist("cancellation")
|
||||
@@ -193,6 +216,9 @@ namespace InnertubeService
|
||||
params = "4gIKGgh0cmFpbGVycw%3D%3D"
|
||||
end if
|
||||
end if
|
||||
if options.DoesExist("raw")
|
||||
raw = options.raw
|
||||
end if
|
||||
end if
|
||||
|
||||
request = Innertube.CreateBrowseRequest("FEtrending", Innertube.ClientType.WEB, params)
|
||||
@@ -203,8 +229,11 @@ namespace InnertubeService
|
||||
return invalid
|
||||
end if
|
||||
|
||||
json = response.Json()
|
||||
feeds = Innertube.ParseResponseDataForFeeds(json)
|
||||
if raw
|
||||
return response.Json()
|
||||
end if
|
||||
|
||||
feeds = Innertube.ParseResponseDataForFeeds(response.Json(), { skipCreatorOnTheRise: true })
|
||||
|
||||
result = {
|
||||
feeds: feeds
|
||||
@@ -270,6 +299,7 @@ namespace InnertubeService
|
||||
continuation = ""
|
||||
params = ""
|
||||
cancellation = invalid
|
||||
raw = false
|
||||
|
||||
if options <> invalid
|
||||
if options.DoesExist("continuation")
|
||||
@@ -281,6 +311,9 @@ namespace InnertubeService
|
||||
if options.DoesExist("cancellation")
|
||||
cancellation = options.cancellation
|
||||
end if
|
||||
if options.DoesExist("raw")
|
||||
raw = options.raw
|
||||
end if
|
||||
end if
|
||||
|
||||
request = Innertube.CreateBrowseRequest(channelId, Innertube.ClientType.Web, params, continuation)
|
||||
@@ -293,8 +326,14 @@ namespace InnertubeService
|
||||
}
|
||||
end if
|
||||
|
||||
json = response.Json()
|
||||
result = Innertube.ParseChannelPageResponseData(json)
|
||||
if raw
|
||||
return response.Json()
|
||||
end if
|
||||
|
||||
result = Innertube.ParseChannelPageResponseData(response.Json())
|
||||
if result.authorId = invalid and result.error = invalid
|
||||
result["authorId"] = channelId
|
||||
end if
|
||||
|
||||
cacheControl = Innertube.ParseResponseForCacheControl(response)
|
||||
if cacheControl <> invalid
|
||||
@@ -307,6 +346,7 @@ namespace InnertubeService
|
||||
function GetPlaylist(playlistId as string, options = invalid as object) as object
|
||||
continuation = ""
|
||||
cancellation = invalid
|
||||
raw = false
|
||||
|
||||
if options <> invalid
|
||||
if options.DoesExist("continuation")
|
||||
@@ -315,6 +355,9 @@ namespace InnertubeService
|
||||
if options.DoesExist("cancellation")
|
||||
cancellation = options.cancellation
|
||||
end if
|
||||
if options.DoesExist("raw")
|
||||
raw = options.raw
|
||||
end if
|
||||
end if
|
||||
|
||||
if not playlistId.StartsWith("VL")
|
||||
@@ -331,8 +374,11 @@ namespace InnertubeService
|
||||
}
|
||||
end if
|
||||
|
||||
json = response.Json()
|
||||
result = Innertube.ParsePlaylistPageResponseData(json)
|
||||
if raw
|
||||
return response.Json()
|
||||
end if
|
||||
|
||||
result = Innertube.ParsePlaylistPageResponseData(response.Json())
|
||||
|
||||
cacheControl = Innertube.ParseResponseForCacheControl(response)
|
||||
if cacheControl <> invalid
|
||||
@@ -345,6 +391,7 @@ namespace InnertubeService
|
||||
function GetMix(mixId as string, options = invalid as object) as object
|
||||
videoId = ""
|
||||
cancellation = invalid
|
||||
raw = false
|
||||
|
||||
if options <> invalid
|
||||
if options.DoesExist("videoId")
|
||||
@@ -353,6 +400,9 @@ namespace InnertubeService
|
||||
if options.DoesExist("cancellation")
|
||||
cancellation = options.cancellation
|
||||
end if
|
||||
if options.DoesExist("raw")
|
||||
raw = options.raw
|
||||
end if
|
||||
end if
|
||||
|
||||
args = { "playlistId": mixId }
|
||||
@@ -369,8 +419,11 @@ namespace InnertubeService
|
||||
}
|
||||
end if
|
||||
|
||||
json = response.Json()
|
||||
return Innertube.ParseMixPageResponseData(json)
|
||||
if raw
|
||||
return response.Json()
|
||||
end if
|
||||
|
||||
return Innertube.ParseMixPageResponseData(response.Json())
|
||||
end function
|
||||
|
||||
function ResolveUrl(url as string, options = invalid as object) as object
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Innertube
|
||||
deviceInfo = CreateObject("roDeviceInfo")
|
||||
|
||||
payload = {
|
||||
"context": Innertube.CreateContext(Innertube.ClientType.Web, deviceInfo, ctt)
|
||||
"context": Innertube.CreateContext(Innertube.ClientType.Web, deviceInfo, ctt, "")
|
||||
}
|
||||
payload.Append(payloadArgs)
|
||||
|
||||
|
||||
@@ -37,8 +37,10 @@ namespace Innertube
|
||||
"watchNextEndScreenRenderer": ParseWatchNextEndScreenRenderer
|
||||
"tabRenderer": ParseTabRenderer
|
||||
"sectionListRenderer": ParseSectionListRenderer
|
||||
"richSectionRenderer": ParseRichSectionRenderer
|
||||
"itemSectionRenderer": ParseItemSectionRenderer
|
||||
"shelfRenderer": ParseShelfRenderer
|
||||
"richShelfRenderer": ParseRichShelfRenderer
|
||||
"reelShelfRenderer": ParseReelShelfRenderer
|
||||
"verticalListRenderer": ParseVerticalListRenderer
|
||||
"horizontalListRenderer": ParseHorizontalListRenderer
|
||||
@@ -111,16 +113,38 @@ namespace Innertube
|
||||
return nodeData["contents"]
|
||||
end function
|
||||
|
||||
function ParseRichSectionRenderer(nodeData as object, _context as object) as object
|
||||
return nodeData["content"]
|
||||
end function
|
||||
|
||||
function ParseItemSectionRenderer(nodeData as object, _context as object) as object
|
||||
return nodeData["contents"]
|
||||
end function
|
||||
|
||||
function ParseShelfRenderer(nodeData as object, _context as object) as object
|
||||
function ParseShelfRenderer(nodeData as object, context as object) as object
|
||||
if context.skipCreatorOnTheRise = true
|
||||
badges = nodeData["badges"]
|
||||
if IsArray(badges)
|
||||
for each badge in badges
|
||||
if ValidString(ObjectUtils.Dig(badge, ["metadataBadgeRenderer", "style"])) = "BADGE_STYLE_TYPE_FEATURED"
|
||||
label = ParseText(ObjectUtils.Dig(badge, ["metadataBadgeRenderer", "label"]))
|
||||
LogInfo(`Skipping 'Create on the Rise' shelf (${label})`)
|
||||
return invalid
|
||||
end if
|
||||
end for
|
||||
end if
|
||||
end if
|
||||
|
||||
' TODO: handle shelfRenderer.title
|
||||
' TODO: handle shelfRenderer.headerRenderer.shelfHeaderRenderer.avatarLockup.avatarLockupRenderer.title
|
||||
return nodeData["content"]
|
||||
end function
|
||||
|
||||
function ParseRichShelfRenderer(nodeData as object, context as object) as object
|
||||
' TODO: handle richShelfRenderer.title
|
||||
return nodeData["contents"]
|
||||
end function
|
||||
|
||||
function ParseReelShelfRenderer(nodeData as object, _context as object) as object
|
||||
' TODO: handle reelShelfRenderer.title
|
||||
return nodeData["items"]
|
||||
|
||||
@@ -58,6 +58,9 @@ namespace Innertube
|
||||
end if
|
||||
|
||||
author = ObjectUtils.Dig(responseData, ["metadata", "channelMetadataRenderer", "title"])
|
||||
if author = invalid
|
||||
author = ObjectUtils.Dig(responseData, ["header", "pageHeaderRenderer", "pageTitle"])
|
||||
end if
|
||||
authorId = ObjectUtils.Dig(responseData, ["metadata", "channelMetadataRenderer", "externalId"])
|
||||
|
||||
thumbnails = ObjectUtils.Dig(responseData, ["metadata", "channelMetadataRenderer", "avatar", "thumbnails"])
|
||||
@@ -103,6 +106,7 @@ namespace Innertube
|
||||
|
||||
tabsNames = []
|
||||
tabsParams = {}
|
||||
tabsTitles = {}
|
||||
|
||||
tabs = ObjectUtils.Dig(responseData, ["contents", "twoColumnBrowseResultsRenderer", "tabs"])
|
||||
if tabs <> invalid
|
||||
@@ -123,13 +127,17 @@ namespace Innertube
|
||||
continue for
|
||||
end if
|
||||
|
||||
tabParams = ObjectUtils.Dig(tabRenderer, ["endpoint", "browseEndpoint", "params"])
|
||||
if tabParams = invalid
|
||||
continue for
|
||||
tabsNames.Push(tabName)
|
||||
|
||||
tabTitle = tabRenderer["title"]
|
||||
if IsString(tabTitle)
|
||||
tabsTitles[tabName] = tabTitle
|
||||
end if
|
||||
|
||||
tabsNames.Push(tabName)
|
||||
tabsParams[tabName] = tabParams
|
||||
tabParams = ObjectUtils.Dig(tabRenderer, ["endpoint", "browseEndpoint", "params"])
|
||||
if IsString(tabParams)
|
||||
tabsParams[tabName] = tabParams
|
||||
end if
|
||||
end for
|
||||
end if
|
||||
|
||||
@@ -151,6 +159,7 @@ namespace Innertube
|
||||
"authorSubTitle": authorSubTitle
|
||||
"tabs": tabsNames
|
||||
"tabsParams": tabsParams
|
||||
"tabsTitles": tabsTitles
|
||||
"items": items
|
||||
}
|
||||
|
||||
|
||||
@@ -6,12 +6,12 @@ import "pkg:/source/utils/Types.bs"
|
||||
|
||||
namespace Innertube
|
||||
|
||||
function CreatePlayerRequest(videoId as string, ctt as string) as object
|
||||
function CreatePlayerRequest(videoId as string, ctt as string, visitorData as string) as object
|
||||
deviceInfo = CreateObject("roDeviceInfo")
|
||||
|
||||
payload = {
|
||||
"videoId": videoId
|
||||
"context": Innertube.CreateContext(Innertube.ClientType.IOS, deviceInfo, ctt)
|
||||
"context": Innertube.CreateContext(Innertube.ClientType.IOS, deviceInfo, ctt, visitorData)
|
||||
"playbackContext": {
|
||||
"contentPlaybackContext": {
|
||||
"vis": 0
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace Innertube
|
||||
deviceInfo = CreateObject("roDeviceInfo")
|
||||
|
||||
payload = {
|
||||
"context": CreateContext(ClientType.Web, deviceInfo, "")
|
||||
"context": CreateContext(ClientType.Web, deviceInfo, "", "")
|
||||
"url": url
|
||||
}
|
||||
|
||||
|
||||
@@ -6,11 +6,11 @@ import "pkg:/source/utils/Types.bs"
|
||||
|
||||
namespace Innertube
|
||||
|
||||
function Search(query as string, searchFilters as object, continuation = "" as string, cancellation = invalid as object) as object
|
||||
function Search(query as string, searchFilters as object, continuation = "" as string, cancellation = invalid as object, raw = false as boolean) as object
|
||||
deviceInfo = CreateObject("roDeviceInfo")
|
||||
|
||||
payload = {
|
||||
context: Innertube.CreateContext(Innertube.ClientType.WEB, deviceInfo, "")
|
||||
context: Innertube.CreateContext(Innertube.ClientType.WEB, deviceInfo, "", "")
|
||||
}
|
||||
|
||||
if continuation <> ""
|
||||
@@ -43,6 +43,10 @@ namespace Innertube
|
||||
}
|
||||
end if
|
||||
|
||||
if raw
|
||||
return response.Json()
|
||||
end if
|
||||
|
||||
feeds = ParseResponseDataForFeeds(response.Json())
|
||||
|
||||
result = {
|
||||
|
||||
@@ -0,0 +1,91 @@
|
||||
import "pkg:/components/Services/Innertube/Constants.bs"
|
||||
import "pkg:/source/services/HttpClient.bs"
|
||||
import "pkg:/source/utils/Logging.bs"
|
||||
import "pkg:/source/utils/ObjectUtils.bs"
|
||||
import "pkg:/source/utils/RegistryUtils.bs"
|
||||
import "pkg:/source/utils/StringUtils.bs"
|
||||
import "pkg:/source/utils/TimeUtils.bs"
|
||||
|
||||
namespace Innertube
|
||||
|
||||
const SESSION_DATA_VERSION = 1
|
||||
const INNERTUBE_VISITOR_DATA_LIFESPAN = 1000 * 60 * 60 * 24
|
||||
|
||||
function GetSessionData() as object
|
||||
sessionData = ReadSessionDataFromRegistry()
|
||||
if sessionData <> invalid
|
||||
return sessionData
|
||||
end if
|
||||
|
||||
sessionData = RequestSessionData()
|
||||
if sessionData = invalid
|
||||
return invalid
|
||||
end if
|
||||
|
||||
RegistryUtils.Write(RegistryUtils.INNERTUBE_SESSION_DATA, FormatJson(sessionData))
|
||||
return sessionData
|
||||
end function
|
||||
|
||||
function RequestSessionData() as object
|
||||
request = HttpClient.Get("https://www.youtube.com/sw.js_data")
|
||||
request.Headers({
|
||||
"Accept-Language": "en-US,en;q=0.9"
|
||||
"User-Agent": INNERTUBE_WEB_USER_AGENT
|
||||
"Accept": "*/*"
|
||||
"Referer": "https://www.youtube.com/sw.js"
|
||||
})
|
||||
|
||||
response = request.Await()
|
||||
if not response.IsSuccess()
|
||||
LogError("Failed to fetch session data", response.ErrorMessage())
|
||||
return invalid
|
||||
end if
|
||||
|
||||
text = ValidString(response.Text())
|
||||
if not text.StartsWith(")]}'")
|
||||
LogError("Invalid session data response", text)
|
||||
return invalid
|
||||
end if
|
||||
|
||||
text = text.Replace(")]}'", "")
|
||||
json = ParseJson(text)
|
||||
if json = invalid
|
||||
LogError("Failed to parse session data", text)
|
||||
return invalid
|
||||
end if
|
||||
|
||||
visitorData = ObjectUtils.Dig(json, [0, 2, 0, 0, 13])
|
||||
if StringUtils.IsNullOrEmpty(visitorData)
|
||||
LogError("Visitor data not found", text)
|
||||
return invalid
|
||||
end if
|
||||
|
||||
return {
|
||||
"__version": SESSION_DATA_VERSION
|
||||
"timestamp": TimeUtils.Now().AsSeconds()
|
||||
"visitorData": visitorData
|
||||
}
|
||||
end function
|
||||
|
||||
function ReadSessionDataFromRegistry() as object
|
||||
sessionData = RegistryUtils.Read(RegistryUtils.INNERTUBE_SESSION_DATA)
|
||||
if StringUtils.IsNullOrEmpty(sessionData)
|
||||
return invalid
|
||||
end if
|
||||
|
||||
sessionData = ParseJson(sessionData)
|
||||
if sessionData = invalid
|
||||
RegistryUtils.Delete(RegistryUtils.INNERTUBE_SESSION_DATA)
|
||||
return invalid
|
||||
end if
|
||||
|
||||
timestamp = sessionData.timestamp
|
||||
nowSeconds = TimeUtils.Now().AsSeconds()
|
||||
if nowSeconds - timestamp > INNERTUBE_VISITOR_DATA_LIFESPAN
|
||||
RegistryUtils.Delete(RegistryUtils.INNERTUBE_SESSION_DATA)
|
||||
return invalid
|
||||
end if
|
||||
|
||||
return sessionData
|
||||
end function
|
||||
end namespace
|
||||
@@ -442,6 +442,16 @@ namespace Invidious
|
||||
|
||||
if response.StatusCode() = 200
|
||||
json = response.Json()
|
||||
' Courses are not yet implemented in Invidious.
|
||||
' In this case, Invidious returns 200, but the response is empty.
|
||||
' https://github.com/iv-org/invidious/issues/5088
|
||||
' https://github.com/iv-org/invidious/issues/5144
|
||||
if json = invalid
|
||||
json = {
|
||||
playlists: []
|
||||
}
|
||||
end if
|
||||
|
||||
return {
|
||||
items: json.playlists
|
||||
continuation: json.continuation
|
||||
|
||||
@@ -82,6 +82,12 @@ namespace InvidiousContent
|
||||
childCount = node.getChildCount()
|
||||
newNodes = []
|
||||
for each video in item.videos
|
||||
' TODO:P1 sometimes we're parsing "recommended playlists" that
|
||||
' show up in the end of the playlist. We should ignore them,
|
||||
' until the parsing is fixed.
|
||||
if ValidString(video.type) = "playlist"
|
||||
continue for
|
||||
end if
|
||||
video.type = "video"
|
||||
videoNode = ToVideoContentNode(invalid, video, instance)
|
||||
if videoNode <> invalid
|
||||
@@ -128,6 +134,7 @@ namespace InvidiousContent
|
||||
node.banner = GetChannelBanner(item.authorBanners)
|
||||
' Important: tabsParams should be set first, because settings that tabs triggers the ChannelView to load feeds
|
||||
SetIfExists(node, "tabsParams", item, "tabsParams")
|
||||
SetIfExists(node, "tabsTitles", item, "tabsTitles")
|
||||
SetIfExists(node, "tabs", item, "tabs")
|
||||
|
||||
return node
|
||||
|
||||
@@ -5,6 +5,7 @@ import "pkg:/components/Services/Invidious/InvidiousService.bs"
|
||||
function VideoContentTask(input as object) as object
|
||||
contentNode = input.content
|
||||
invidiousNode = input.invidious
|
||||
innertubeNode = input.innertube
|
||||
preferencesNode = input.preferences
|
||||
loungeServiceNode = input.loungeService
|
||||
playletServerPort = input.playletServerPort
|
||||
@@ -22,8 +23,9 @@ function VideoContentTask(input as object) as object
|
||||
backend = preferencesNode["playback.backend"]
|
||||
if backend = "playlet"
|
||||
metadata = InnertubeService.GetVideoMetadata(contentNode.videoId, {
|
||||
cancellation: m.top.cancellation
|
||||
ctt: loungeServiceNode.ctt
|
||||
"cancellation": m.top.cancellation
|
||||
"ctt": loungeServiceNode.ctt
|
||||
"visitorData": innertubeNode.visitorData
|
||||
})
|
||||
else
|
||||
metadata = service.GetVideoMetadata(contentNode.videoId, { cancellation: m.top.cancellation })
|
||||
|
||||
@@ -151,6 +151,7 @@ function StartVideoContentTask(videoContentNode as object)
|
||||
m.videoContentTask = AsyncTask.Start(Tasks.VideoContentTask, {
|
||||
content: videoContentNode
|
||||
invidious: m.top.invidious
|
||||
innertube: m.top.innertube
|
||||
preferences: m.top.preferences
|
||||
loungeService: m.top.loungeService
|
||||
playletServerPort: m.top.webServer.port
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
<field id="notifications" type="node" bind="../../Notifications" />
|
||||
<field id="videoQueue" type="node" bind="../../VideoQueue" />
|
||||
<field id="preferences" type="node" bind="../../Preferences" />
|
||||
<field id="innertube" type="node" bind="../../Innertube" />
|
||||
<field id="invidious" type="node" bind="../../Invidious" />
|
||||
<field id="webServer" type="node" bind="../../WebServer" />
|
||||
<field id="loungeService" type="node" bind="../../LoungeService" />
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<field id="player" type="node" />
|
||||
<field id="nowPlaying" type="node" />
|
||||
|
||||
<field id="innertube" type="node" />
|
||||
<field id="invidious" type="node" />
|
||||
<field id="notifications" type="node" />
|
||||
<field id="preferences" type="node" />
|
||||
|
||||
@@ -57,7 +57,11 @@ function OnContentSet() as void
|
||||
end if
|
||||
|
||||
AdjustFocus(videoCount)
|
||||
LoadVideoDetailsIfNeeded()
|
||||
' TODO:P1 LoadVideoDetailsIfNeeded is disabled for now.
|
||||
' Trying to fetch video info (especially one by one) can lead to rate limiting.
|
||||
' That would result in all videos being blocked. So for now, this is just a
|
||||
' nice to have, and should not be used.
|
||||
' LoadVideoDetailsIfNeeded()
|
||||
end function
|
||||
|
||||
function OnKeyEvent(key as string, press as boolean) as boolean
|
||||
@@ -143,6 +147,7 @@ function LoadVideoDetailsIfNeeded() as void
|
||||
|
||||
m.loadDetailsTask = AsyncTask.Start(Tasks.VideoQueueViewContentTask, {
|
||||
videoNodes: m.videosDetailsToLoad
|
||||
innertube: m.top.innertube
|
||||
invidious: m.top.invidious
|
||||
preferences: m.top.preferences
|
||||
index: indexInLoadingArray
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
<field id="jumpToItem" type="integer" alias="queueList.jumpToItem" />
|
||||
<field id="videoQueue" type="node" />
|
||||
<field id="appController" type="node" />
|
||||
<field id="innertube" type="node" />
|
||||
<field id="invidious" type="node" />
|
||||
<field id="preferences" type="node" />
|
||||
<function name="Show" />
|
||||
|
||||
@@ -7,6 +7,7 @@ import "pkg:/source/utils/MathUtils.bs"
|
||||
@asynctask
|
||||
function VideoQueueViewContentTask(input as object) as object
|
||||
videoNodes = input.videoNodes
|
||||
innertubeNode = input.innertube
|
||||
invidiousNode = input.invidious
|
||||
preferencesNode = input.preferences
|
||||
service = new Invidious.InvidiousService(invidiousNode)
|
||||
@@ -22,6 +23,7 @@ function VideoQueueViewContentTask(input as object) as object
|
||||
cancellation: cancellation
|
||||
tryCount: 1
|
||||
fetchNext: false
|
||||
visitorData: innertubeNode.visitorData
|
||||
}
|
||||
|
||||
' TODO:P1: Use InnertubeService.GetVideoInfoBatched instead of loading each video individually
|
||||
|
||||
@@ -6,6 +6,7 @@ namespace VideoQueueViewUtils
|
||||
videoQueueView = CreateObject("roSGNode", "VideoQueueView")
|
||||
videoQueueView.videoQueue = videoQueue
|
||||
videoQueueView.appController = appController
|
||||
videoQueueView.innertube = videoQueue.innertube
|
||||
videoQueueView.invidious = videoQueue.invidious
|
||||
videoQueueView.preferences = videoQueue.preferences
|
||||
appController@.PushScreen(videoQueueView)
|
||||
|
||||
+140
-15
@@ -5,8 +5,10 @@ namespace Http
|
||||
|
||||
class PlayletInvidiousBackendRouter extends HttpRouter
|
||||
|
||||
function new()
|
||||
function new(server as object)
|
||||
super()
|
||||
|
||||
m.innertube = server.task.innertube
|
||||
end function
|
||||
|
||||
@get("/playlet-invidious-backend/authorize_token")
|
||||
@@ -180,11 +182,24 @@ namespace Http
|
||||
end function
|
||||
|
||||
@get("/playlet-invidious-backend/api/v1/trending")
|
||||
@get("/playlet-invidious-backend/api/v1/popular")
|
||||
function GetTrending(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
|
||||
result = InnertubeService.GetTrending({ type: request.query.type })
|
||||
raw = request.query.raw <> invalid
|
||||
|
||||
options = {
|
||||
raw: raw
|
||||
type: request.query.type
|
||||
}
|
||||
|
||||
result = InnertubeService.GetTrending(options)
|
||||
if raw
|
||||
response.Json(result)
|
||||
return true
|
||||
end if
|
||||
|
||||
if result.error <> invalid
|
||||
response.Json(result)
|
||||
response.http_code = 500
|
||||
@@ -207,13 +222,6 @@ namespace Http
|
||||
return true
|
||||
end function
|
||||
|
||||
@get("/playlet-invidious-backend/api/v1/popular")
|
||||
function GetPopular(context as object) as boolean
|
||||
response = context.response
|
||||
response.Redirect("/playlet-invidious-backend/api/v1/trending")
|
||||
return true
|
||||
end function
|
||||
|
||||
@get("/playlet-invidious-backend/api/v1/search/suggestions")
|
||||
function GetSearchSuggestions(context as object) as boolean
|
||||
request = context.request
|
||||
@@ -245,6 +253,11 @@ namespace Http
|
||||
|
||||
query = request.query.q
|
||||
continuation = request.query.continuation
|
||||
raw = request.query.raw <> invalid
|
||||
|
||||
options = {
|
||||
raw: raw
|
||||
}
|
||||
|
||||
searchFilters = {}
|
||||
sort = request.query.sort
|
||||
@@ -268,7 +281,6 @@ namespace Http
|
||||
searchFilters.features = features.Split(",")
|
||||
end if
|
||||
|
||||
options = {}
|
||||
if searchFilters.Count() > 0
|
||||
options.searchFilters = searchFilters
|
||||
end if
|
||||
@@ -283,6 +295,11 @@ namespace Http
|
||||
return true
|
||||
end if
|
||||
|
||||
if raw
|
||||
response.Json(result)
|
||||
return true
|
||||
end if
|
||||
|
||||
if not IsArray(result.feeds) or result.feeds.Count() = 0
|
||||
response.Json({
|
||||
"error": "Failed to search"
|
||||
@@ -305,6 +322,8 @@ namespace Http
|
||||
response = context.response
|
||||
|
||||
url = request.query.url
|
||||
raw = request.query.raw <> invalid
|
||||
|
||||
if StringUtils.IsNullOrEmpty(url)
|
||||
response.Json({
|
||||
"error": "Missing 'url' query parameter"
|
||||
@@ -313,7 +332,7 @@ namespace Http
|
||||
return true
|
||||
end if
|
||||
|
||||
json = InnertubeService.ResolveUrl(url, response)
|
||||
json = InnertubeService.ResolveUrl(url)
|
||||
if json = invalid
|
||||
response.Json({
|
||||
"error": "Failed to resolve URL"
|
||||
@@ -322,6 +341,11 @@ namespace Http
|
||||
return true
|
||||
end if
|
||||
|
||||
if raw
|
||||
response.Json(json)
|
||||
return true
|
||||
end if
|
||||
|
||||
endpoint = json["endpoint"]
|
||||
pageType = ValidString(ObjectUtils.Dig(endpoint, ["commandMetadata", "webCommandMetadata", "webPageType"]))
|
||||
if pageType = "WEB_PAGE_TYPE_UNKNOWN" or pageType = ""
|
||||
@@ -385,6 +409,8 @@ namespace Http
|
||||
return m.GetPlaylist(context)
|
||||
else if route.StartsWith("/playlet-invidious-backend/api/v1/channels/")
|
||||
return m.GetChannel(context)
|
||||
else if route.StartsWith("/playlet-invidious-backend/channel")
|
||||
return m.RedirectChannel(context)
|
||||
end if
|
||||
|
||||
return false
|
||||
@@ -396,8 +422,17 @@ namespace Http
|
||||
route = request.route
|
||||
|
||||
videoId = route.Mid("/playlet-invidious-backend/api/v1/videos/".Len())
|
||||
if videoId.InStr("?") > 0
|
||||
videoId = videoId.Left(videoId.InStr("?"))
|
||||
end if
|
||||
raw = request.query.raw <> invalid
|
||||
|
||||
metadata = InnertubeService.GetVideoMetadata(videoId)
|
||||
options = {
|
||||
"raw": raw
|
||||
"visitorData": m.innertube.visitorData
|
||||
}
|
||||
|
||||
metadata = InnertubeService.GetVideoMetadata(videoId, options)
|
||||
response.Json(metadata)
|
||||
|
||||
if metadata.error <> invalid
|
||||
@@ -413,9 +448,16 @@ namespace Http
|
||||
route = request.route
|
||||
|
||||
playlistId = route.Mid("/playlet-invidious-backend/api/v1/playlists/".Len())
|
||||
if playlistId.InStr("?") > 0
|
||||
playlistId = playlistId.Left(playlistId.InStr("?"))
|
||||
end if
|
||||
continuation = request.query.continuation
|
||||
raw = request.query.raw <> invalid
|
||||
|
||||
options = {
|
||||
raw: raw
|
||||
}
|
||||
|
||||
options = {}
|
||||
if playlistId.StartsWith("RD")
|
||||
if not StringUtils.IsNullOrEmpty(continuation)
|
||||
options.videoId = continuation
|
||||
@@ -435,6 +477,11 @@ namespace Http
|
||||
playlist = InnertubeService.GetPlaylist(playlistId, options)
|
||||
end if
|
||||
|
||||
if raw
|
||||
response.Json(playlist)
|
||||
return true
|
||||
end if
|
||||
|
||||
if playlist.error <> invalid
|
||||
response.Json(playlist)
|
||||
response.http_code = 500
|
||||
@@ -460,10 +507,17 @@ namespace Http
|
||||
route = request.route
|
||||
|
||||
channelAndTab = route.Mid("/playlet-invidious-backend/api/v1/channels/".Len())
|
||||
if channelAndTab.InStr("?") > 0
|
||||
channelAndTab = channelAndTab.Left(channelAndTab.InStr("?"))
|
||||
end if
|
||||
channelAndTab = channelAndTab.Split("/")
|
||||
|
||||
options = {}
|
||||
continuation = request.query.continuation
|
||||
raw = request.query.raw <> invalid
|
||||
|
||||
options = {
|
||||
raw: raw
|
||||
}
|
||||
|
||||
if not StringUtils.IsNullOrEmpty(continuation)
|
||||
options.continuation = continuation
|
||||
@@ -472,6 +526,11 @@ namespace Http
|
||||
if channelAndTab.Count() = 1
|
||||
channelId = channelAndTab[0]
|
||||
channel = InnertubeService.GetChannel(channelId, options)
|
||||
if raw
|
||||
response.Json(channel)
|
||||
return true
|
||||
end if
|
||||
|
||||
if channel.error <> invalid
|
||||
response.Json(channel)
|
||||
response.http_code = 500
|
||||
@@ -494,13 +553,18 @@ namespace Http
|
||||
end if
|
||||
|
||||
channel = InnertubeService.GetChannel(channelId, options)
|
||||
if raw
|
||||
response.Json(channel)
|
||||
return true
|
||||
end if
|
||||
|
||||
if channel.error <> invalid
|
||||
response.Json(channel)
|
||||
response.http_code = 500
|
||||
return true
|
||||
end if
|
||||
|
||||
if _tab = "playlists" or _tab = "podcasts" or _tab = "releases"
|
||||
if _tab = "playlists" or _tab = "podcasts" or _tab = "releases" or _tab = "courses"
|
||||
result = {
|
||||
"playlists": channel.items
|
||||
}
|
||||
@@ -529,6 +593,67 @@ namespace Http
|
||||
|
||||
return false
|
||||
end function
|
||||
|
||||
@get("/playlet-invidious-backend/watch")
|
||||
function RedirectWatch(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
|
||||
videoId = request.query.v
|
||||
t = request.query.t
|
||||
|
||||
if StringUtils.IsNullOrEmpty(videoId)
|
||||
response.Json({
|
||||
"error": "Missing 'v' query parameter"
|
||||
})
|
||||
response.http_code = 400
|
||||
return true
|
||||
end if
|
||||
|
||||
url = `https://redirect.invidious.io/watch?v=${videoId}`
|
||||
if not StringUtils.IsNullOrEmpty(t)
|
||||
url = `${url}&t=${t}`
|
||||
end if
|
||||
response.Redirect(url)
|
||||
return true
|
||||
end function
|
||||
|
||||
@get("/playlet-invidious-backend/playlist")
|
||||
function RedirectPlaylist(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
|
||||
playlistId = request.query.list
|
||||
if StringUtils.IsNullOrEmpty(playlistId)
|
||||
response.Json({
|
||||
"error": "Missing 'list' query parameter"
|
||||
})
|
||||
response.http_code = 400
|
||||
return true
|
||||
end if
|
||||
|
||||
response.Redirect(`https://redirect.invidious.io/playlist?list=${playlistId}`)
|
||||
return true
|
||||
end function
|
||||
|
||||
function RedirectChannel(context as object) as boolean
|
||||
request = context.request
|
||||
response = context.response
|
||||
route = request.route
|
||||
|
||||
channelId = route.Mid("/playlet-invidious-backend/channel/".Len())
|
||||
if StringUtils.IsNullOrEmpty(channelId)
|
||||
response.Json({
|
||||
"error": "Missing 'channelId' path parameter"
|
||||
})
|
||||
response.http_code = 400
|
||||
return true
|
||||
end if
|
||||
|
||||
response.Redirect(`https://redirect.invidious.io/channel/${channelId}`)
|
||||
return true
|
||||
end function
|
||||
|
||||
end class
|
||||
|
||||
end namespace
|
||||
@@ -56,7 +56,7 @@ function SetupRoutes(server as object)
|
||||
server.UseRouter(new Http.DialRouter(server))
|
||||
server.UseRouter(new Http.CacheRouter())
|
||||
server.UseRouter(new Http.RegistryRouter(server))
|
||||
server.UseRouter(new Http.PlayletInvidiousBackendRouter())
|
||||
server.UseRouter(new Http.PlayletInvidiousBackendRouter(server))
|
||||
|
||||
etags = new Http.EtagUtils()
|
||||
server.UseRouter(new Http.HttpStaticFilesRouter("/", "libpkg:/www", etags, { staticFiles: true, staticCompressed: true }))
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
<interface>
|
||||
<field id="appController" type="node" />
|
||||
<field id="preferences" type="node" />
|
||||
<field id="innertube" type="node" />
|
||||
<field id="invidious" type="node" />
|
||||
<field id="profilesService" type="node" />
|
||||
<field id="applicationInfo" type="node" />
|
||||
|
||||
@@ -166,6 +166,15 @@ channel_releases:
|
||||
paginationType: Continuation
|
||||
tryCount: 3
|
||||
|
||||
# This is implemented only by Playlet backend.
|
||||
# https://github.com/iv-org/invidious/issues/5144
|
||||
channel_courses:
|
||||
title: Channel courses
|
||||
url: /api/v1/channels/{ucid}/courses
|
||||
responseHandler: ChannelPlaylistsHandler
|
||||
paginationType: Continuation
|
||||
tryCount: 3
|
||||
|
||||
# This is implemented only by Playlet backend.
|
||||
# Created because auto-generated channels don't have tabs except for "featured"
|
||||
channel_featured:
|
||||
|
||||
@@ -36,6 +36,10 @@
|
||||
<source>OK</source>
|
||||
<translation>OK</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Do not show again</source>
|
||||
<translation>Do not show again</translation>
|
||||
</message>
|
||||
<message>
|
||||
<source>Activate</source>
|
||||
<translation>Activate</translation>
|
||||
|
||||
@@ -2,8 +2,8 @@ title=PlayletLib
|
||||
|
||||
# Do not update version manually, it is auto updated from package.json
|
||||
major_version=0
|
||||
minor_version=35
|
||||
build_version=00004
|
||||
minor_version=36
|
||||
build_version=00001
|
||||
|
||||
ui_resolutions=hd
|
||||
uri_resolution_autosub=$$RES$$,480p,720p,1080p
|
||||
|
||||
@@ -653,11 +653,12 @@ namespace HttpClient
|
||||
return invalid
|
||||
end if
|
||||
m._json = ParseJson(text)
|
||||
' TODO:P2 remove workaround after a fix has landed
|
||||
' TODO:P2 remove workaround (fix landed, but remove after March 2025 as a precaution)
|
||||
if m._json = invalid and m.IsSuccess() and not m._json_workaround_tried = true
|
||||
' A bug was introduced in Roku OS 14.1 that causes ParseJson to return invalid parsing some unicode characters.
|
||||
' So we filter out \uXXXX characters and try to parse again.
|
||||
' These characters are mostly emojis, and can't render anyway.
|
||||
' Update: a fix has landed in 14.1 (tested on 14.1.4.7709)
|
||||
m._json_workaround_tried = true
|
||||
filter = /\\u[0-9a-fA-F]{4}/
|
||||
text = filter.ReplaceAll(text, "")
|
||||
|
||||
@@ -14,6 +14,7 @@ namespace Locale
|
||||
@locale
|
||||
enum Buttons
|
||||
OK = "OK"
|
||||
DotNotShowAgain = "Do not show again"
|
||||
Activate = "Activate"
|
||||
InUse = "In Use"
|
||||
Login = "Login"
|
||||
|
||||
@@ -8,7 +8,9 @@ namespace RegistryUtils
|
||||
const SEARCH_HISTORY = "search_history"
|
||||
const PLAYLET_LIB_URLS = "playlet_lib_urls"
|
||||
const BOOKMARKS = "bookmarks"
|
||||
const MESSAGES = "messages"
|
||||
|
||||
const INNERTUBE_SESSION_DATA = "innertube_session_data"
|
||||
const LAST_LOUNGE_DATA = "last_lounge_data"
|
||||
|
||||
' "invidious_instances" is deprecated, but we keep for migration purposes
|
||||
|
||||
Generated
+529
-1103
File diff suppressed because it is too large.
Load diff
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "playlet-web",
|
||||
"version": "0.35.4",
|
||||
"version": "0.36.1",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
@@ -9,23 +9,23 @@
|
||||
"check": "svelte-check --tsconfig ./tsconfig.json"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@sveltejs/vite-plugin-svelte": "3.1.2",
|
||||
"@tailwindcss/typography": "^0.5.15",
|
||||
"@sveltejs/vite-plugin-svelte": "^5.0.3",
|
||||
"@tailwindcss/typography": "^0.5.16",
|
||||
"@tsconfig/svelte": "^5.0.4",
|
||||
"@vitejs/plugin-legacy": "^5.4.3",
|
||||
"@vitejs/plugin-legacy": "^6.0.0",
|
||||
"autoprefixer": "^10.4.20",
|
||||
"daisyui": "^4.12.23",
|
||||
"dotenv": "^16.4.7",
|
||||
"ip": "^2.0.1",
|
||||
"postcss": "^8.4.49",
|
||||
"svelte": "4.2.19",
|
||||
"svelte-check": "^4.1.1",
|
||||
"postcss": "^8.5.1",
|
||||
"svelte": "^5.19.0",
|
||||
"svelte-check": "^4.1.4",
|
||||
"svelte-preprocess": "^6.0.3",
|
||||
"tailwindcss": "^3.4.17",
|
||||
"terser": "^5.37.0",
|
||||
"tslib": "^2.8.1",
|
||||
"typescript": "^5.7.2",
|
||||
"vite": "^5.4.11",
|
||||
"typescript": "^5.7.3",
|
||||
"vite": "^6.0.7",
|
||||
"vite-plugin-compression": "^0.5.1",
|
||||
"vite-tsconfig-paths": "^5.1.4"
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { tr } from "lib/Stores";
|
||||
import { translate } from "lib/Stores";
|
||||
import { PlayletApi } from "./PlayletApi";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
@@ -31,14 +31,14 @@ export async function fetchLocale(locale: string) {
|
||||
}
|
||||
translations[source[0].textContent] = translation[0].textContent;
|
||||
}
|
||||
tr.set((s) => translations[s] || s);
|
||||
translate.set((s) => translations[s] || s);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
|
||||
export function getPluralString(c: number, zeroString: string, oneString: string, pluralString: string) {
|
||||
const trFn = get(tr);
|
||||
const trFn = get(translate);
|
||||
|
||||
c = c || 0;
|
||||
if (c === 0) {
|
||||
@@ -51,7 +51,7 @@ export function getPluralString(c: number, zeroString: string, oneString: string
|
||||
}
|
||||
|
||||
export function getFormattedPluralString(c: number, zeroString: string, oneString: string, pluralString: string) {
|
||||
const trFn = get(tr);
|
||||
const trFn = get(translate);
|
||||
|
||||
c = c || 0;
|
||||
if (c === 0) {
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
import BookmarksIcon from "../assets/star-icon.svg.svelte";
|
||||
import RemoteIcon from "../assets/remote-control.svg.svelte";
|
||||
|
||||
import { appStateStore, tr } from "lib/Stores";
|
||||
import { appStateStore, translate } from "lib/Stores";
|
||||
import { ScreenNames, type AppState } from "lib/Types";
|
||||
import { onMount } from "svelte";
|
||||
|
||||
@@ -57,7 +57,7 @@
|
||||
<div class="h-6">
|
||||
<SearchIcon />
|
||||
</div>
|
||||
<span class="text-xs">{$tr("Search")}</span>
|
||||
<span class="text-xs">{$translate("Search")}</span>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("home")}
|
||||
@@ -66,7 +66,7 @@
|
||||
<div class="h-6">
|
||||
<HomeIcon />
|
||||
</div>
|
||||
<span class="text-xs">{$tr("Home")}</span>
|
||||
<span class="text-xs">{$translate("Home")}</span>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("bookmarks")}
|
||||
@@ -75,7 +75,7 @@
|
||||
<div class="h-6">
|
||||
<BookmarksIcon />
|
||||
</div>
|
||||
<span class="text-xs">{$tr("Bookmarks")}</span>
|
||||
<span class="text-xs">{$translate("Bookmarks")}</span>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("settings")}
|
||||
@@ -84,7 +84,7 @@
|
||||
<div class="h-6">
|
||||
<SettingsIcon />
|
||||
</div>
|
||||
<span class="text-xs">{$tr("Settings")}</span>
|
||||
<span class="text-xs">{$translate("Settings")}</span>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("remote")}
|
||||
@@ -93,7 +93,7 @@
|
||||
<div class="h-6">
|
||||
<RemoteIcon />
|
||||
</div>
|
||||
<span class="text-xs">{$tr("Remote")}</span>
|
||||
<span class="text-xs">{$translate("Remote")}</span>
|
||||
</button>
|
||||
<button
|
||||
on:click={() => setScreen("info")}
|
||||
@@ -102,6 +102,6 @@
|
||||
<div class="h-6">
|
||||
<InfoIcon />
|
||||
</div>
|
||||
<span class="text-xs">{$tr("Info")}</span>
|
||||
<span class="text-xs">{$translate("Info")}</span>
|
||||
</button>
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { onDestroy, onMount } from "svelte";
|
||||
import { playletStateStore, tr } from "lib/Stores";
|
||||
import { playletStateStore, translate } from "lib/Stores";
|
||||
import { InvidiousApi } from "lib/Api/InvidiousApi";
|
||||
import { PlayletApi } from "./Api/PlayletApi";
|
||||
import VideoCastDialog from "./VideoFeed/VideoCastDialog.svelte";
|
||||
@@ -248,9 +248,11 @@
|
||||
: 'hidden'} fixed w-full h-full bg-base-100/80 z-50 flex justify-center items-center"
|
||||
>
|
||||
{#if isDragging}
|
||||
<div class="text-2xl font-bold">{$tr("Drop a YouTube link here")}</div>
|
||||
<div class="text-2xl font-bold">
|
||||
{$translate("Drop a YouTube link here")}
|
||||
</div>
|
||||
{:else if isLoading}
|
||||
<span class="loading loading-spinner loading-md" />
|
||||
<span class="loading loading-spinner loading-md"></span>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { playletStateStore, tr } from "lib/Stores";
|
||||
import { playletStateStore, translate } from "lib/Stores";
|
||||
import { PlayletApi } from "./Api/PlayletApi";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
<dialog bind:this={modal} class="modal" on:close={onClose}>
|
||||
<form method="dialog" class="modal-box bg-base-100">
|
||||
<div class="flex flex-col items-center">
|
||||
<div class="text-xl font-medium m-4">{$tr("Profiles")}</div>
|
||||
<div class="text-xl font-medium m-4">{$translate("Profiles")}</div>
|
||||
|
||||
{#each profiles as profile}
|
||||
<div class="collapse collapse-arrow bg-base-300 m-1">
|
||||
@@ -112,12 +112,12 @@
|
||||
{#if profile.id !== currentProfile?.id}
|
||||
<button
|
||||
on:click={() => activate(profile.id)}
|
||||
class="btn btn-primary m-1">{$tr("Activate")}</button
|
||||
class="btn btn-primary m-1">{$translate("Activate")}</button
|
||||
>
|
||||
{/if}
|
||||
<button
|
||||
on:click={() => logout(profile.id)}
|
||||
class="btn btn-primary m-1">{$tr("Logout")}</button
|
||||
class="btn btn-primary m-1">{$translate("Logout")}</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
@@ -125,15 +125,15 @@
|
||||
<div class="flex items-center">
|
||||
<button class="btn btn-primary" on:click={login}>
|
||||
<div class="">
|
||||
<div class="text-m">{$tr("Login to Invidious")}</div>
|
||||
<div class="text-m">{$translate("Login to Invidious")}</div>
|
||||
<div class="text-xs font-light">{currentInstance}</div>
|
||||
</div>
|
||||
</button>
|
||||
<button class="btn m-6">{$tr("Close")}</button>
|
||||
<button class="btn m-6">{$translate("Close")}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>{$tr("Close")}</button>
|
||||
<button>{$translate("Close")}</button>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import VideoListRow from "lib/VideoFeed/VideoListRow.svelte";
|
||||
import { bookmarksStore, tr } from "lib/Stores";
|
||||
import { bookmarksStore, translate } from "lib/Stores";
|
||||
|
||||
export let visibility: boolean;
|
||||
</script>
|
||||
@@ -10,13 +10,15 @@
|
||||
<div
|
||||
class="flex flex-col items-center justify-start h-screen w-2/3 mx-auto"
|
||||
>
|
||||
<div class="text-2xl font-bold text-gray-500">{$tr("No Bookmarks")}</div>
|
||||
<div class="text-2xl font-bold text-gray-500">
|
||||
{$translate("No Bookmarks")}
|
||||
</div>
|
||||
<div class="text-gray-500 text-center">
|
||||
{$tr("You currently have no bookmarks.")}<br />
|
||||
{$tr(
|
||||
{$translate("You currently have no bookmarks.")}<br />
|
||||
{$translate(
|
||||
"To add bookmarks, select a video, playlist or channel, and add a bookmark."
|
||||
)}<br />
|
||||
{$tr("Please note that Bookmarks is an experimental feature.")}
|
||||
{$translate("Please note that Bookmarks is an experimental feature.")}
|
||||
</div>
|
||||
</div>
|
||||
{:else}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { getHost } from "lib/Api/Host";
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { playletStateStore, tr } from "lib/Stores";
|
||||
import { playletStateStore, translate } from "lib/Stores";
|
||||
|
||||
export let visibility: boolean;
|
||||
|
||||
@@ -164,9 +164,9 @@ ${JSON.stringify(profilesInfo, null, 2)}
|
||||
|
||||
<div class={visibility ? "" : "hidden"}>
|
||||
<div class="text-base text-center m-8">
|
||||
{$tr("Thank you for using Playlet.")}
|
||||
{$translate("Thank you for using Playlet.")}
|
||||
<br />
|
||||
{@html $tr(feedbackMessageRaw)
|
||||
{@html $translate(feedbackMessageRaw)
|
||||
.replace(
|
||||
"%IssueStart%",
|
||||
`<a class="link" href="${githubUrlIssue}" target="_blank" rel="noopener noreferrer">`
|
||||
@@ -194,11 +194,9 @@ ${JSON.stringify(profilesInfo, null, 2)}
|
||||
</tr>
|
||||
{/each}
|
||||
|
||||
<thead>
|
||||
<tr>
|
||||
<th>App internal state</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tr>
|
||||
<th>App internal state</th>
|
||||
</tr>
|
||||
|
||||
{#each internalStateLinks as item}
|
||||
<tr>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { tr } from "lib/Stores";
|
||||
import { translate } from "lib/Stores";
|
||||
|
||||
let modal;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
modal.close();
|
||||
}
|
||||
|
||||
export let label = $tr("Filters");
|
||||
export let label = $translate("Filters");
|
||||
|
||||
export const filters = {
|
||||
date: "",
|
||||
@@ -38,7 +38,7 @@
|
||||
count += filters.features.length;
|
||||
count += filters.sort ? 1 : 0;
|
||||
|
||||
label = $tr("Filters") + `${count > 0 ? ` (${count})` : ""}`;
|
||||
label = $translate("Filters") + `${count > 0 ? ` (${count})` : ""}`;
|
||||
}
|
||||
|
||||
const options = {
|
||||
@@ -181,37 +181,37 @@
|
||||
<h2 class="text-xl font-bold mb-4">{label}</h2>
|
||||
|
||||
<div class="mb-4">
|
||||
<h3 class="text-lg font-bold mb-2">{$tr("Upload date")}</h3>
|
||||
<h3 class="text-lg font-bold mb-2">{$translate("Upload date")}</h3>
|
||||
<select class="input input-bordered w-full" bind:value={filters.date}>
|
||||
{#each options.date as { title, value }}
|
||||
<option {value}>{$tr(title)}</option>
|
||||
<option {value}>{$translate(title)}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<h3 class="text-lg font-bold mb-2">{$tr("Type")}</h3>
|
||||
<h3 class="text-lg font-bold mb-2">{$translate("Type")}</h3>
|
||||
<select class="input input-bordered w-full" bind:value={filters.type}>
|
||||
{#each options.type as { title, value }}
|
||||
<option {value}>{$tr(title)}</option>
|
||||
<option {value}>{$translate(title)}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<h3 class="text-lg font-bold mb-2">{$tr("Duration")}</h3>
|
||||
<h3 class="text-lg font-bold mb-2">{$translate("Duration")}</h3>
|
||||
<select
|
||||
class="input input-bordered w-full"
|
||||
bind:value={filters.duration}
|
||||
>
|
||||
{#each options.duration as { title, value }}
|
||||
<option {value}>{$tr(title)}</option>
|
||||
<option {value}>{$translate(title)}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<h3 class="text-lg font-bold mb-2">{$tr("Features")}</h3>
|
||||
<h3 class="text-lg font-bold mb-2">{$translate("Features")}</h3>
|
||||
{#each options.features as { title, value }}
|
||||
<label class="flex items-center">
|
||||
<input
|
||||
@@ -220,26 +220,26 @@
|
||||
class="form-checkbox"
|
||||
bind:checked={features_kv[value]}
|
||||
/>
|
||||
<span class="ml-2">{$tr(title)}</span>
|
||||
<span class="ml-2">{$translate(title)}</span>
|
||||
</label>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
<div class="mb-4">
|
||||
<h3 class="text-lg font-bold mb-2">{$tr("Sort by")}</h3>
|
||||
<h3 class="text-lg font-bold mb-2">{$translate("Sort by")}</h3>
|
||||
<select class="input input-bordered w-full" bind:value={filters.sort}>
|
||||
{#each options.sort as { title, value }}
|
||||
<option {value}>{$tr(title)}</option>
|
||||
<option {value}>{$translate(title)}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="flex justify-end">
|
||||
<button class="btn btn-outline">{$tr("Close")}</button>
|
||||
<button class="btn btn-outline">{$translate("Close")}</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>{$tr("Close")}</button>
|
||||
<button>{$translate("Close")}</button>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
import { InvidiousApi } from "lib/Api/InvidiousApi";
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { playletStateStore, searchHistoryStore, tr } from "lib/Stores";
|
||||
import { playletStateStore, searchHistoryStore, translate } from "lib/Stores";
|
||||
import VideoCell from "lib/VideoFeed/VideoCell.svelte";
|
||||
import PlaylistCell from "lib/VideoFeed/PlaylistCell.svelte";
|
||||
import ChannelCell from "lib/VideoFeed/ChannelCell.svelte";
|
||||
@@ -133,7 +133,7 @@
|
||||
<input
|
||||
type="search"
|
||||
dir="auto"
|
||||
placeholder="{$tr('Search')}..."
|
||||
placeholder="{$translate('Search')}..."
|
||||
class="join-item input w-full border border-neutral rounded-full"
|
||||
bind:this={searchBox}
|
||||
bind:value={searchBoxText}
|
||||
@@ -213,14 +213,14 @@
|
||||
await searchVideos(searchContinuation);
|
||||
}}
|
||||
>
|
||||
{$tr("Load more")}
|
||||
{$translate("Load more")}
|
||||
</button>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
{#if isLoading}
|
||||
<div class="w-full h-1/2 z-50 flex justify-center items-center">
|
||||
<span class="loading loading-spinner loading-md" />
|
||||
<span class="loading loading-spinner loading-md"></span>
|
||||
</div>
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { tr, userPreferencesStore } from "lib/Stores";
|
||||
import { translate, userPreferencesStore } from "lib/Stores";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
<div class="form-control m-5">
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text {textSizes[level]}">{$tr(displayText)}</div>
|
||||
<div class="label-text {textSizes[level]}">{$translate(displayText)}</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
name={key}
|
||||
@@ -32,5 +32,5 @@
|
||||
class="checkbox"
|
||||
/>
|
||||
</label>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $translate(description)}</div>
|
||||
</div>
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { InvidiousApi } from "lib/Api/InvidiousApi";
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { tr } from "lib/Stores";
|
||||
import { translate } from "lib/Stores";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
@@ -16,12 +16,14 @@
|
||||
await PlayletApi.clearCache();
|
||||
InvidiousApi.clearCache();
|
||||
|
||||
alert(get(tr)("Cache cleared."));
|
||||
alert(get(translate)("Cache cleared."));
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
<button class="btn m-1" on:click={clearCache}>{$tr("Clear cache")}</button>
|
||||
<div class={textSizes[level]}>{$translate(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $translate(description)}</div>
|
||||
<button class="btn m-1" on:click={clearCache}
|
||||
>{$translate("Clear cache")}</button
|
||||
>
|
||||
</div>
|
||||
+5
-5
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { searchHistoryStore, tr } from "lib/Stores";
|
||||
import { searchHistoryStore, translate } from "lib/Stores";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
@@ -15,14 +15,14 @@
|
||||
await PlayletApi.clearSearchHistory();
|
||||
searchHistoryStore.set([]);
|
||||
|
||||
alert(get(tr)("Search history cleared."));
|
||||
alert(get(translate)("Search history cleared."));
|
||||
}
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
<div class={textSizes[level]}>{$translate(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $translate(description)}</div>
|
||||
<button class="btn m-1" on:click={clearSeachHistory}
|
||||
>{$tr("Clear search history")}</button
|
||||
>{$translate("Clear search history")}</button
|
||||
>
|
||||
</div>
|
||||
@@ -2,7 +2,7 @@
|
||||
import {
|
||||
homeLayoutFileStore,
|
||||
homeLayoutStore,
|
||||
tr,
|
||||
translate,
|
||||
userPreferencesStore,
|
||||
} from "lib/Stores";
|
||||
import ArrowUpIcon from "assets/remote-control/arrow-up.svg.svelte";
|
||||
@@ -89,10 +89,10 @@
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
<div class={textSizes[level]}>{$translate(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $translate(description)}</div>
|
||||
<button class="btn m-1" on:click={openHomeScreenEditor}
|
||||
>{$tr("Edit home screen")}</button
|
||||
>{$translate("Edit home screen")}</button
|
||||
>
|
||||
</div>
|
||||
|
||||
@@ -100,51 +100,57 @@
|
||||
<div class="modal-box bg-base-100">
|
||||
{#if value && homeLayout}
|
||||
<table class="w-full">
|
||||
{#each value as item, i (i)}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="tooltip" data-tip="Move up">
|
||||
<button
|
||||
class="btn btn-outline btn-sm"
|
||||
on:click={() => moveUp(i)}
|
||||
disabled={i === 0}
|
||||
>
|
||||
<ArrowUpIcon />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text">{$tr(homeLayout[item.id].title)}</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
name={item.id}
|
||||
bind:checked={item.enabled}
|
||||
class="toggle toggle-primary"
|
||||
/>
|
||||
</label>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="tooltip" data-tip="Move down">
|
||||
<button
|
||||
class="btn btn-outline btn-sm m-2"
|
||||
on:click={() => moveDown(i)}
|
||||
disabled={i === value.length - 1}
|
||||
>
|
||||
<ArrowDownIcon />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
<tbody>
|
||||
{#each value as item, i (i)}
|
||||
<tr>
|
||||
<td>
|
||||
<div class="tooltip" data-tip="Move up">
|
||||
<button
|
||||
class="btn btn-outline btn-sm"
|
||||
on:click={() => moveUp(i)}
|
||||
disabled={i === 0}
|
||||
>
|
||||
<ArrowUpIcon />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text">
|
||||
{$translate(homeLayout[item.id].title)}
|
||||
</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
name={item.id}
|
||||
bind:checked={item.enabled}
|
||||
class="toggle toggle-primary"
|
||||
/>
|
||||
</label>
|
||||
</td>
|
||||
<td class="text-right">
|
||||
<div class="tooltip" data-tip="Move down">
|
||||
<button
|
||||
class="btn btn-outline btn-sm m-2"
|
||||
on:click={() => moveDown(i)}
|
||||
disabled={i === value.length - 1}
|
||||
>
|
||||
<ArrowDownIcon />
|
||||
</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
<form method="dialog" class="flex justify-center space-x-2">
|
||||
<button class="btn btn-primary" on:click={save}>{$tr("Save")}</button>
|
||||
<button class="btn btn-primary">{$tr("Close")}</button>
|
||||
<button class="btn btn-primary" on:click={save}
|
||||
>{$translate("Save")}</button
|
||||
>
|
||||
<button class="btn btn-primary">{$translate("Close")}</button>
|
||||
</form>
|
||||
{/if}
|
||||
</div>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>{$tr("Close")}</button>
|
||||
<button>{$translate("Close")}</button>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { tr, userPreferencesStore } from "lib/Stores";
|
||||
import { translate, userPreferencesStore } from "lib/Stores";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
const qualityLabels = {
|
||||
@@ -37,7 +37,7 @@
|
||||
}, {});
|
||||
displayValue = originalValue
|
||||
.split(",")
|
||||
.map((item) => $tr(qualityLabels[item] || item))
|
||||
.map((item) => $translate(qualityLabels[item] || item))
|
||||
.join(", ");
|
||||
}
|
||||
}
|
||||
@@ -117,38 +117,42 @@
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
<div class={textSizes[level]}>{$translate(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $translate(description)}</div>
|
||||
<button class="btn m-1" on:click={openQualitySelector}>{displayValue}</button>
|
||||
</div>
|
||||
|
||||
<dialog bind:this={modal} class="modal" on:close={onClose}>
|
||||
<div class="modal-box bg-base-100">
|
||||
<table class="w-full">
|
||||
{#each Object.keys(qualityLabels) as quality}
|
||||
<tr>
|
||||
<td>
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text text-lg">
|
||||
{$tr(qualityLabels[quality])}
|
||||
</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={valueCheckedStates[quality]}
|
||||
on:change={(e) => onChange(e, quality)}
|
||||
class="toggle toggle-primary"
|
||||
/>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
<tbody>
|
||||
{#each Object.keys(qualityLabels) as quality}
|
||||
<tr>
|
||||
<td>
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text text-lg">
|
||||
{$translate(qualityLabels[quality])}
|
||||
</div>
|
||||
<input
|
||||
type="checkbox"
|
||||
checked={valueCheckedStates[quality]}
|
||||
on:change={(e) => onChange(e, quality)}
|
||||
class="toggle toggle-primary"
|
||||
/>
|
||||
</label>
|
||||
</td>
|
||||
</tr>
|
||||
{/each}
|
||||
</tbody>
|
||||
</table>
|
||||
<form method="dialog" class="flex justify-center space-x-2">
|
||||
<button class="btn btn-primary" on:click={save}>{$tr("Save")}</button>
|
||||
<button class="btn btn-primary">{$tr("Close")}</button>
|
||||
<button class="btn btn-primary" on:click={save}
|
||||
>{$translate("Save")}</button
|
||||
>
|
||||
<button class="btn btn-primary">{$translate("Close")}</button>
|
||||
</form>
|
||||
</div>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>{$tr("Close")}</button>
|
||||
<button>{$translate("Close")}</button>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { tr, userPreferencesStore } from "lib/Stores";
|
||||
import { translate, userPreferencesStore } from "lib/Stores";
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
export let displayText: string = "";
|
||||
export let key: string = "";
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
<div class="form-control m-5">
|
||||
<label class="label p-0 cursor-pointer">
|
||||
<div class="label-text {textSizes[level]}">{$tr(displayText)}</div>
|
||||
<div class="label-text {textSizes[level]}">{$translate(displayText)}</div>
|
||||
<div class="join mt-2 mb-2">
|
||||
<button
|
||||
class="join-item btn btn-sm btn-primary"
|
||||
@@ -52,5 +52,5 @@
|
||||
</button>
|
||||
</div>
|
||||
</label>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $translate(description)}</div>
|
||||
</div>
|
||||
+7
-6
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { onMount } from "svelte";
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { playletStateStore, tr } from "lib/Stores";
|
||||
import { playletStateStore, translate } from "lib/Stores";
|
||||
import { ExternalControlProtocol } from "lib/Api/ExternalControlProtocol";
|
||||
import { get } from "svelte/store";
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
version = "latest";
|
||||
}
|
||||
|
||||
const trFn = get(tr);
|
||||
const trFn = get(translate);
|
||||
|
||||
if (
|
||||
confirm(
|
||||
@@ -100,9 +100,9 @@
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class="text-lg">{$tr("Playlet Library version")}</div>
|
||||
<div class="text-lg">{$translate("Playlet Library version")}</div>
|
||||
<div class="text-xs text-gray-500">
|
||||
{$tr(
|
||||
{$translate(
|
||||
"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>
|
||||
@@ -112,13 +112,14 @@
|
||||
bind:value={selectedRelease}
|
||||
class="select select-bordered join-item w-full mr-1"
|
||||
>
|
||||
<option selected value="">{$tr("Latest (default)")}</option>
|
||||
<option selected value="">{$translate("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}>{$tr("Apply")}</button>
|
||||
<button class="join-item btn" on:click={apply}>{$translate("Apply")}</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { tr, userPreferencesStore } from "lib/Stores";
|
||||
import { translate, userPreferencesStore } from "lib/Stores";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
@@ -24,13 +24,13 @@
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $tr(description)}</div>
|
||||
<div class={textSizes[level]}>{$translate(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{@html $translate(description)}</div>
|
||||
|
||||
{#each options as option}
|
||||
<div class="form-control">
|
||||
<label class="label cursor-pointer">
|
||||
<span class="label-text">{$tr(option.displayText)}</span>
|
||||
<span class="label-text">{$translate(option.displayText)}</span>
|
||||
<input
|
||||
type="radio"
|
||||
name={key}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { tr, userPreferencesStore } from "lib/Stores";
|
||||
import { translate, userPreferencesStore } from "lib/Stores";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
const invidiousPublicInstancesLink = `<a class="link" href="https://api.invidious.io" target="_blank" rel="noopener noreferrer">https://api.invidious.io</a>`;
|
||||
@@ -27,10 +27,10 @@
|
||||
</script>
|
||||
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class={textSizes[level]}>{$translate(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">
|
||||
<!-- TODO:P2 this should not be hardcoded here -->
|
||||
{@html $tr(description).replace(
|
||||
{@html $translate(description).replace(
|
||||
"%INVIDIOUS_PUBLIC_INSTANCES%",
|
||||
invidiousPublicInstancesLink
|
||||
)}
|
||||
@@ -45,7 +45,8 @@
|
||||
class="join-item input w-full mr-1"
|
||||
/>
|
||||
{#if inputValue !== currentValue}
|
||||
<button class="join-item btn" on:click={save}>{$tr("Save")}</button>
|
||||
<button class="join-item btn" on:click={save}>{$translate("Save")}</button
|
||||
>
|
||||
{/if}
|
||||
</div>
|
||||
</div>
|
||||
@@ -8,7 +8,7 @@
|
||||
import NumberControl from "./SettingControls/NumberControl.svelte";
|
||||
import ClearCacheControl from "./SettingControls/ClearCacheControl.svelte";
|
||||
import EditQualityControl from "./SettingControls/EditQualityControl.svelte";
|
||||
import { tr } from "lib/Stores";
|
||||
import { translate } from "lib/Stores";
|
||||
|
||||
const textSizes = ["text-2xl", "text-lg", "text-base", "text-sm", "text-xs"];
|
||||
|
||||
@@ -58,8 +58,8 @@
|
||||
/>
|
||||
{:else}
|
||||
<div class="m-5">
|
||||
<div class={textSizes[level]}>{$tr(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{$tr(description)}</div>
|
||||
<div class={textSizes[level]}>{$translate(displayText)}</div>
|
||||
<div class="text-xs text-gray-500">{$translate(description)}</div>
|
||||
</div>
|
||||
{/if}
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
{#if pref.visibility !== "tv"}
|
||||
<SettingsNode {...pref} />
|
||||
{#if i !== $preferencesModelStore.length - 1}
|
||||
<div class="divider" />
|
||||
<div class="divider"></div>
|
||||
{/if}
|
||||
{/if}
|
||||
{/each}
|
||||
|
||||
@@ -23,4 +23,4 @@ export const bookmarksStore = writable([] as any);
|
||||
|
||||
export const searchHistoryStore = writable([] as any);
|
||||
|
||||
export const tr = writable((s: string) => s as any);
|
||||
export const translate = writable((s: string) => s as any);
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { playletStateStore, tr } from "lib/Stores";
|
||||
import { playletStateStore, translate } from "lib/Stores";
|
||||
import ChannelThumbnail from "./ChannelThumbnail.svelte";
|
||||
|
||||
export let author: string | undefined = undefined;
|
||||
@@ -47,16 +47,18 @@
|
||||
<div class="flex flex-col">
|
||||
<div class="join join-vertical m-2">
|
||||
<button class="btn join-item hover:btn-accent" on:click={openOnTv}>
|
||||
{$tr("Open on %1").replace("%1", tvName)}
|
||||
{$translate("Open on %1").replace("%1", tvName)}
|
||||
</button>
|
||||
<button class="btn join-item hover:btn-accent" on:click={openInvidious}>
|
||||
{$tr("Open in Invidious")}
|
||||
{$translate("Open in Invidious")}
|
||||
</button>
|
||||
<button class="btn join-item hover:btn-accent">{$tr("Cancel")}</button>
|
||||
<button class="btn join-item hover:btn-accent"
|
||||
>{$translate("Cancel")}</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>{$tr("Close")}</button>
|
||||
<button>{$translate("Close")}</button>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -41,7 +41,12 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<button class="w-60 p-2" on:click={modal.show()}>
|
||||
<button
|
||||
class="w-60 p-2"
|
||||
on:click={() => {
|
||||
modal.show();
|
||||
}}
|
||||
>
|
||||
<div class="card card-compact bg-base-100 shadow-xl border border-neutral">
|
||||
<ChannelThumbnail bind:author bind:authorThumbnails />
|
||||
<div class="card-body">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { playletStateStore, tr } from "lib/Stores";
|
||||
import { playletStateStore, translate } from "lib/Stores";
|
||||
import PlaylistThumbnail from "./PlaylistThumbnail.svelte";
|
||||
|
||||
export let title: string | undefined = undefined;
|
||||
@@ -102,22 +102,24 @@
|
||||
<div class="flex flex-col">
|
||||
<div class="join join-vertical m-2">
|
||||
<button class="btn join-item hover:btn-accent" on:click={playOnTv}>
|
||||
{$tr("Play on %1").replace("%1", tvName)}
|
||||
{$translate("Play on %1").replace("%1", tvName)}
|
||||
</button>
|
||||
<button class="btn join-item hover:btn-accent" on:click={queueOnTv}>
|
||||
{$tr("Queue on %1").replace("%1", tvName)}
|
||||
{$translate("Queue on %1").replace("%1", tvName)}
|
||||
</button>
|
||||
<button class="btn join-item hover:btn-accent" on:click={openOnTv}>
|
||||
{$tr("Open on %1").replace("%1", tvName)}
|
||||
{$translate("Open on %1").replace("%1", tvName)}
|
||||
</button>
|
||||
<button class="btn join-item hover:btn-accent" on:click={openInvidious}>
|
||||
{$tr("Open in Invidious")}
|
||||
{$translate("Open in Invidious")}
|
||||
</button>
|
||||
<button class="btn join-item hover:btn-accent">{$tr("Cancel")}</button>
|
||||
<button class="btn join-item hover:btn-accent"
|
||||
>{$translate("Cancel")}</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>{$tr("Close")}</button>
|
||||
<button>{$translate("Close")}</button>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { playletStateStore, tr } from "lib/Stores";
|
||||
import { playletStateStore, translate } from "lib/Stores";
|
||||
import PlaylistCastDialog from "./PlaylistCastDialog.svelte";
|
||||
import PlaylistThumbnail from "./PlaylistThumbnail.svelte";
|
||||
import { get } from "svelte/store";
|
||||
@@ -33,7 +33,7 @@
|
||||
return "";
|
||||
}
|
||||
|
||||
const trFn = get(tr);
|
||||
const trFn = get(translate);
|
||||
|
||||
const totalDays = Math.floor(span / 86400);
|
||||
if (totalDays > 365) {
|
||||
@@ -79,7 +79,12 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<button class="w-80 p-2" on:click={modal.show()}>
|
||||
<button
|
||||
class="w-80 p-2"
|
||||
on:click={() => {
|
||||
modal.show();
|
||||
}}
|
||||
>
|
||||
<div class="card card-compact bg-base-100 shadow-xl border border-neutral">
|
||||
<PlaylistThumbnail
|
||||
bind:title
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { playletStateStore, tr } from "lib/Stores";
|
||||
import { playletStateStore, translate } from "lib/Stores";
|
||||
import VideoStartAt from "./VideoStartAt.svelte";
|
||||
import VideoThumbnail from "./VideoThumbnail.svelte";
|
||||
|
||||
@@ -116,19 +116,21 @@
|
||||
/>
|
||||
<div class="join join-vertical m-2">
|
||||
<button class="btn join-item hover:btn-accent" on:click={playOnTv}>
|
||||
{$tr("Play on %1").replace("%1", tvName)}
|
||||
{$translate("Play on %1").replace("%1", tvName)}
|
||||
</button>
|
||||
<button class="btn join-item hover:btn-accent" on:click={queueOnTv}>
|
||||
{$tr("Queue on %1").replace("%1", tvName)}
|
||||
{$translate("Queue on %1").replace("%1", tvName)}
|
||||
</button>
|
||||
<button class="btn join-item hover:btn-accent" on:click={openInvidious}>
|
||||
{$tr("Open in Invidious")}
|
||||
{$translate("Open in Invidious")}
|
||||
</button>
|
||||
<button class="btn join-item hover:btn-accent">{$tr("Cancel")}</button>
|
||||
<button class="btn join-item hover:btn-accent"
|
||||
>{$translate("Cancel")}</button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<form method="dialog" class="modal-backdrop">
|
||||
<button>{$tr("Close")}</button>
|
||||
<button>{$translate("Close")}</button>
|
||||
</form>
|
||||
</dialog>
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { playletStateStore, tr } from "lib/Stores";
|
||||
import { playletStateStore, translate } from "lib/Stores";
|
||||
import VideoCastDialog from "./VideoCastDialog.svelte";
|
||||
import VideoThumbnail from "./VideoThumbnail.svelte";
|
||||
import ChannelCastDialog from "./ChannelCastDialog.svelte";
|
||||
@@ -74,7 +74,7 @@
|
||||
return "";
|
||||
}
|
||||
|
||||
const trFn = get(tr);
|
||||
const trFn = get(translate);
|
||||
|
||||
const currentTime = Math.floor(Date.now() / 1000);
|
||||
let timeLeft = premiereTimestamp - currentTime;
|
||||
@@ -126,7 +126,7 @@
|
||||
if (isNaN(published)) {
|
||||
return "";
|
||||
}
|
||||
const trFn = get(tr);
|
||||
const trFn = get(translate);
|
||||
const currentTime = Math.floor(Date.now() / 1000);
|
||||
const span = currentTime - published;
|
||||
if (span < 1) {
|
||||
@@ -181,7 +181,12 @@
|
||||
}
|
||||
</script>
|
||||
|
||||
<button class="w-80 p-2" on:click={videoModal.show()}>
|
||||
<button
|
||||
class="w-80 p-2"
|
||||
on:click={() => {
|
||||
videoModal.show();
|
||||
}}
|
||||
>
|
||||
<div class="card card-compact bg-base-100 shadow-xl border border-neutral">
|
||||
<VideoThumbnail
|
||||
bind:videoId
|
||||
@@ -197,15 +202,23 @@
|
||||
/>
|
||||
<div class="card-body">
|
||||
<h3 class="card-title text-base line-clamp-2 min-h-12">{title || ""}</h3>
|
||||
<button
|
||||
class="font-semibold link"
|
||||
<span
|
||||
class="font-semibold link cursor-pointer"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
on:click={(e) => {
|
||||
e.stopPropagation();
|
||||
channelModal.show();
|
||||
}}
|
||||
on:keydown={(e) => {
|
||||
if (e.key === "Enter" || e.key === " ") {
|
||||
e.preventDefault();
|
||||
channelModal.show();
|
||||
}
|
||||
}}
|
||||
>
|
||||
{author || ""}
|
||||
</button>
|
||||
</span>
|
||||
<div>{getViewCountDateText()}</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
<script lang="ts">
|
||||
import { InvidiousApi } from "lib/Api/InvidiousApi";
|
||||
import { invidiousVideoApiStore, playletStateStore, tr } from "lib/Stores";
|
||||
import {
|
||||
invidiousVideoApiStore,
|
||||
playletStateStore,
|
||||
translate,
|
||||
} from "lib/Stores";
|
||||
import VideoCell from "./VideoCell.svelte";
|
||||
import PlaylistCell from "./PlaylistCell.svelte";
|
||||
import ChannelCell from "./ChannelCell.svelte";
|
||||
@@ -268,7 +272,7 @@
|
||||
-->
|
||||
{#if feedLoadState !== FeedLoadState.Loaded || videos.length !== 0}
|
||||
<div class="text-lg font-semibold ml-4">
|
||||
{$tr(feed.title)}
|
||||
{$translate(feed.title)}
|
||||
</div>
|
||||
<div
|
||||
class="carousel carousel-center rounded-box w-full space-x-4"
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { tr } from "lib/Stores";
|
||||
import { translate } from "lib/Stores";
|
||||
|
||||
export let checked = false;
|
||||
export let lengthSeconds = undefined;
|
||||
@@ -67,7 +67,7 @@
|
||||
<div class="flex flex-row items-center">
|
||||
<label class="label justify-start cursor-pointer">
|
||||
<input type="checkbox" bind:checked class="checkbox" />
|
||||
<span class="label-text m-2">{$tr("Start at")}</span>
|
||||
<span class="label-text m-2">{$translate("Start at")}</span>
|
||||
</label>
|
||||
<input
|
||||
bind:this={textInputElemet}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { tr } from "lib/Stores";
|
||||
import { translate } from "lib/Stores";
|
||||
|
||||
export let videoId: string | undefined = undefined;
|
||||
export let title: string | undefined = undefined;
|
||||
@@ -77,13 +77,13 @@
|
||||
<div
|
||||
class="absolute bottom-2 right-0 bg-black/70 text-white text-sm rounded-sm font-bold pt-1 pb-1 pr-2 pl-2"
|
||||
>
|
||||
{$tr("UPCOMING")}
|
||||
{$translate("UPCOMING")}
|
||||
</div>
|
||||
{:else 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"
|
||||
>
|
||||
{$tr("LIVE")}
|
||||
{$translate("LIVE")}
|
||||
</div>
|
||||
{:else if lengthSeconds || lengthText}
|
||||
<div
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import './app.css'
|
||||
import App from './App.svelte'
|
||||
import { mount } from 'svelte';
|
||||
|
||||
const app = new App({
|
||||
target: document.getElementById('app')
|
||||
})
|
||||
const app = mount(App, {
|
||||
target: document.getElementById('app')!
|
||||
});
|
||||
|
||||
export default app
|
||||
@@ -72,8 +72,8 @@ export class WebServerPlugin implements CompilerPlugin {
|
||||
return;
|
||||
}
|
||||
|
||||
const routeInfo = this.getRouteInfo(functionStatement);
|
||||
if (!routeInfo) {
|
||||
const routeInfos = this.getRouteInfos(functionStatement);
|
||||
if (!routeInfos || routeInfos.length === 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -83,9 +83,12 @@ export class WebServerPlugin implements CompilerPlugin {
|
||||
}
|
||||
const classConstructor = this.getClassConstructor(classStmt) as MethodStatement;
|
||||
|
||||
const method = routeInfo.method === 'ALL' ? '*' : routeInfo.method;
|
||||
const stmt = new RawCodeStatement(`m.routes.push({ method: "${method}", path: "${routeInfo.route}", router: m, func: "${func.functionStatement?.name.text}" })`)
|
||||
event.editor.arrayPush(classConstructor.func.body.statements, stmt);
|
||||
for (let index = 0; index < routeInfos.length; index++) {
|
||||
const routeInfo = routeInfos[index];
|
||||
const method = routeInfo.method === 'ALL' ? '*' : routeInfo.method;
|
||||
const stmt = new RawCodeStatement(`m.routes.push({ method: "${method}", path: "${routeInfo.route}", router: m, func: "${func.functionStatement?.name.text}" })`)
|
||||
event.editor.arrayPush(classConstructor.func.body.statements, stmt);
|
||||
}
|
||||
},
|
||||
}), {
|
||||
walkMode: WalkMode.visitExpressionsRecursive
|
||||
@@ -102,12 +105,13 @@ export class WebServerPlugin implements CompilerPlugin {
|
||||
return parentClass === httpRouterBaseClass;
|
||||
}
|
||||
|
||||
getRouteInfo(functionStatement: FunctionStatement | undefined) {
|
||||
getRouteInfos(functionStatement: FunctionStatement | undefined) {
|
||||
const annotations = functionStatement?.annotations
|
||||
if (!annotations || annotations.length === 0) {
|
||||
return undefined
|
||||
}
|
||||
|
||||
const routeInfos = [];
|
||||
for (let index = 0; index < annotations.length; index++) {
|
||||
const annotation = annotations[index];
|
||||
if (annotationNames.includes(annotation.name)) {
|
||||
@@ -120,12 +124,14 @@ export class WebServerPlugin implements CompilerPlugin {
|
||||
throw new Error(`Expected string argument for annotation ${annotation.name}`)
|
||||
}
|
||||
|
||||
return {
|
||||
routeInfos.push({
|
||||
method: annotation.name.toUpperCase(),
|
||||
route: args[0]
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return routeInfos;
|
||||
}
|
||||
|
||||
getClass(func: FunctionExpression) {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
// Restarts the Roku app
|
||||
|
||||
const { ArgumentParser } = require('argparse');
|
||||
const getEnvVars = require('./get-env-vars');
|
||||
|
||||
const config = getEnvVars(['ROKU_DEV_TARGET']);
|
||||
|
||||
(async () => {
|
||||
const parser = new ArgumentParser({
|
||||
description: 'Restart Roku app using ECP'
|
||||
});
|
||||
|
||||
parser.add_argument('--app-id', { help: 'App Id' });
|
||||
|
||||
const args = parser.parse_args();
|
||||
let appId = args.app_id || "dev";
|
||||
|
||||
if (appId === "prod") {
|
||||
appId = "693751";
|
||||
}
|
||||
|
||||
const url = `http://${config.ROKU_DEV_TARGET}:8060/launch/${appId}?restart=true`;
|
||||
console.log("Restarting app", appId);
|
||||
await fetch(url, {
|
||||
method: 'POST',
|
||||
body: '',
|
||||
});
|
||||
})();
|
||||
Reference in new issue
Block a user