Compare commits

...
23 Commits
Author SHA1 Message Date
Brahim Hadriche 57885a4e8f Release v0.36.0 (#543) 2025-01-16 17:56:40 -05:00
Brahim Hadriche ed5ab70ceb [skip ci] comment 2025-01-16 17:54:31 -05:00
Brahim Hadriche 2f8679bc1c Support for channel "Courses" in Playlet backend 2025-01-16 17:44:56 -05:00
Brahim Hadriche 28c10022bd [skip ci] test tweak 2025-01-16 13:41:08 -05:00
Brahim Hadriche 57cdb59790 [skip ci] simple integration test 2025-01-15 21:14:03 -05:00
Brahim Hadriche f6d8afc2d9 [skip ci] copyright year 2025-01-14 09:17:26 -05:00
Brahim Hadriche 31c4d7e2a0 [skip ci] Update README.md 2025-01-12 09:51:19 -05:00
Brahim Hadriche 4dabd00b2a update dependencies (#542) 2025-01-10 19:54:44 -05:00
Brahim Hadriche 7fab7f7f39 typo 2025-01-10 17:39:30 -05:00
Brahim Hadriche d5508587d2 [skip ci] typo 2025-01-10 17:38:15 -05:00
Brahim Hadriche af4c28a411 skipCreatorOnTheRise: true 2025-01-10 17:34:58 -05:00
Brahim Hadriche 26774d5655 script tweak 2025-01-10 17:12:37 -05:00
Brahim Hadriche 3daa94dee1 A couple of fixes 2025-01-10 16:33:21 -05:00
Brahim Hadriche c95bb85c6e [skip ci] fix focus when there are no public invidious instances 2025-01-10 14:15:20 -05:00
Brahim Hadriche 4b3d1340df refactor dialog palette 2025-01-10 14:14:52 -05:00
Brahim Hadriche 68c8f12f9d Web app to Svelte5 (#541)
* Web app to Svelte5

* ignore ds store

* npm install @rollup/rollup-linux-x64-gnu --save-optional
2025-01-10 09:15:04 -05:00
Brahim Hadriche 66990cfd67 changelog 2025-01-09 21:54:51 -05:00
Brahim Hadriche aab20f2364 Revert "Web app to Svelte5 (#540)"
This reverts commit c534c27ae3.
2025-01-09 21:54:08 -05:00
Brahim Hadriche f987558884 Revert "https://github.com/vitejs/vite/discussions/15532#discussioncomment-8527272"
This reverts commit a04e853328.
2025-01-09 21:54:01 -05:00
Brahim Hadriche fcca018fe8 Revert "Lock file"
This reverts commit 96bbbd0d77.
2025-01-09 21:53:48 -05:00
Brahim Hadriche 96bbbd0d77 Lock file 2025-01-09 21:50:31 -05:00
Brahim Hadriche a04e853328 https://github.com/vitejs/vite/discussions/15532#discussioncomment-8527272 2025-01-09 21:30:43 -05:00
Brahim Hadriche c534c27ae3 Web app to Svelte5 (#540) 2025-01-09 21:22:34 -05:00
66 changed files with 3222 additions and 2388 deletions

No files matched your search

+1
View File
@@ -1,3 +1,4 @@
.DS_Store
build/
dist/
out/
+18
View File
@@ -5,6 +5,24 @@ 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.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
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -2,7 +2,7 @@ openapi: 3.0.0
info:
title: Playlet Web API
version: 0.35.5
version: 0.36.0
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
+43
View File
@@ -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;
}
+24
View File
@@ -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();
})();
+2175 -1021
View File
File diff suppressed because it is too large. Load diff
+10 -5
View File
@@ -1,6 +1,6 @@
{
"name": "playlet",
"version": "0.35.5",
"version": "0.36.0",
"description": "Unofficial YouTube client for Roku",
"devDependencies": {
"@rokucommunity/bslint": "^0.8.27",
@@ -15,19 +15,20 @@
"crypto-js": "^4.2.0",
"dotenv": "^16.4.7",
"fs-extra": "^11.2.0",
"glob": "^11.0.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,10 +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",
"restart-app": "node tools/restart-app.js --app-id dev"
"restart-app": "node tools/restart-app.js"
},
"optionalDependencies": {
"@rollup/rollup-linux-x64-gnu": "^4.30.1"
}
}
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-app",
"version": "0.35.5",
"version": "0.36.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-app",
"version": "0.35.5"
"version": "0.36.0"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-app",
"version": "0.35.5",
"version": "0.36.0",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "rm -rf ../build/playlet-app",
+2 -2
View File
@@ -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=00005
minor_version=36
build_version=00000
ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p
-14
View File
@@ -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
+2 -1
View File
@@ -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
@@ -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
+2 -2
View File
@@ -1,12 +1,12 @@
{
"name": "playlet-lib",
"version": "0.35.5",
"version": "0.36.0",
"lockfileVersion": 2,
"requires": true,
"packages": {
"": {
"name": "playlet-lib",
"version": "0.35.5"
"version": "0.36.0"
}
}
}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-lib",
"version": "0.35.5",
"version": "0.36.0",
"description": "Unofficial YouTube client for Roku",
"scripts": {
"prebuild": "rm -rf ../build/playlet-lib",
@@ -215,6 +215,9 @@ function InitializeTabs()
"playlists": function(authorId as string, author as string, params as string) as object
return CreateChannelFeed("Playlists", "channel_playlists", authorId, author, params)
end function
"courses": function(authorId as string, author as string, params as string) as object
return CreateChannelFeed("Courses", "channel_courses", authorId, author, params)
end function
}
end function
@@ -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
+20
View File
@@ -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()
@@ -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()
@@ -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
@@ -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
@@ -204,7 +204,7 @@ namespace InnertubeService
end if
json = response.Json()
feeds = Innertube.ParseResponseDataForFeeds(json)
feeds = Innertube.ParseResponseDataForFeeds(json, { skipCreatorOnTheRise: true })
result = {
feeds: feeds
@@ -115,7 +115,20 @@ namespace Innertube
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"]
@@ -442,6 +442,15 @@ 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
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
@@ -180,6 +180,7 @@ 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
@@ -207,13 +208,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
@@ -385,6 +379,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
@@ -500,7 +496,7 @@ namespace Http
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 +525,61 @@ 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
if StringUtils.IsNullOrEmpty(videoId)
response.Json({
"error": "Missing 'v' query parameter"
})
response.http_code = 400
return true
end if
response.Redirect(`https://redirect.invidious.io/watch?v=${videoId}`)
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
@@ -166,6 +166,14 @@ channel_releases:
paginationType: Continuation
tryCount: 3
# This is implemented only by Playlet backend.
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:
+2 -2
View File
@@ -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=00005
minor_version=36
build_version=00000
ui_resolutions=hd
uri_resolution_autosub=$$RES$$,480p,720p,1080p
+521 -1099
View File
File diff suppressed because it is too large. Load diff
+8 -8
View File
@@ -1,6 +1,6 @@
{
"name": "playlet-web",
"version": "0.35.5",
"version": "0.36.0",
"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",
"svelte": "^5.17.3",
"svelte-check": "^4.1.3",
"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"
}
+4 -4
View File
@@ -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) {
+7 -7
View File
@@ -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>
+5 -3
View File
@@ -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>
+7 -7
View File
@@ -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>
@@ -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>
@@ -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}
+1 -1
View File
@@ -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>
+20 -7
View File
@@ -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
+4 -3
View File
@@ -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
+14 -8
View File
@@ -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) {
+5 -1
View File
@@ -13,7 +13,11 @@ const config = getEnvVars(['ROKU_DEV_TARGET']);
parser.add_argument('--app-id', { help: 'App Id' });
const args = parser.parse_args();
const appId = args.app_id
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);