1 parent
8975861615
commit
549913ef7d
14 files changed
+129
-20
No files matched your search
@@ -29,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Also adds thumbnails/preview in trick play mode
|
- Also adds thumbnails/preview in trick play mode
|
||||||
- Known issue: thumbnails might appear cropped/misaligned at the end of videos. This will be addressed in a later release.
|
- Known issue: thumbnails might appear cropped/misaligned at the end of videos. This will be addressed in a later release.
|
||||||
- Search filters in web app
|
- Search filters in web app
|
||||||
|
- Channels and Playlists can be opened on TV from web app
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
|
|
||||||
|
|||||||
@@ -204,6 +204,29 @@ paths:
|
|||||||
responses:
|
responses:
|
||||||
"204":
|
"204":
|
||||||
description: No Content
|
description: No Content
|
||||||
|
/api/view/open:
|
||||||
|
get:
|
||||||
|
summary: Open a channel view or a playlist view
|
||||||
|
description: Open a channel view or a playlist view. If a video is playing in full screen, it is shrinked.
|
||||||
|
operationId: openView
|
||||||
|
parameters:
|
||||||
|
- name: channelId
|
||||||
|
in: query
|
||||||
|
description: The ID of the channel to open
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
- name: playlistId
|
||||||
|
in: query
|
||||||
|
description: The ID of the playlist to open
|
||||||
|
required: false
|
||||||
|
schema:
|
||||||
|
type: string
|
||||||
|
responses:
|
||||||
|
"204":
|
||||||
|
description: No Content
|
||||||
|
"400":
|
||||||
|
description: Bad Request
|
||||||
/api/playlet-lib-urls:
|
/api/playlet-lib-urls:
|
||||||
get:
|
get:
|
||||||
summary: Get Playlet lib URLs
|
summary: Get Playlet lib URLs
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
namespace ChannelUtils
|
namespace ChannelUtils
|
||||||
function Open(contentNode as object)
|
function Open(contentNode as object, appController = invalid as object)
|
||||||
channelView = CreateObject("roSGNode", "ChannelView")
|
channelView = CreateObject("roSGNode", "ChannelView")
|
||||||
m.appController@.PushScreen(channelView)
|
if appController = invalid
|
||||||
|
appController = m.appController
|
||||||
|
end if
|
||||||
|
appController@.PushScreen(channelView)
|
||||||
channelView@.BindNode(invalid)
|
channelView@.BindNode(invalid)
|
||||||
channelView.content = contentNode
|
channelView.content = contentNode
|
||||||
end function
|
end function
|
||||||
|
|||||||
@@ -60,6 +60,7 @@
|
|||||||
<PlayletWebServer
|
<PlayletWebServer
|
||||||
id="WebServer"
|
id="WebServer"
|
||||||
port="8888"
|
port="8888"
|
||||||
|
appController="bind:/AppController"
|
||||||
applicationInfo="bind:../ApplicationInfo"
|
applicationInfo="bind:../ApplicationInfo"
|
||||||
invidious="bind:../Invidious"
|
invidious="bind:../Invidious"
|
||||||
preferences="bind:../Preferences"
|
preferences="bind:../Preferences"
|
||||||
|
|||||||
@@ -21,6 +21,7 @@ function InitializeBindings()
|
|||||||
"preferences": "../Preferences"
|
"preferences": "../Preferences"
|
||||||
},
|
},
|
||||||
"WebServer": {
|
"WebServer": {
|
||||||
|
"appController": "/AppController",
|
||||||
"applicationInfo": "../ApplicationInfo",
|
"applicationInfo": "../ApplicationInfo",
|
||||||
"invidious": "../Invidious",
|
"invidious": "../Invidious",
|
||||||
"preferences": "../Preferences",
|
"preferences": "../Preferences",
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
namespace PlaylistUtils
|
namespace PlaylistUtils
|
||||||
function Open(contentNode as object)
|
function Open(contentNode as object, appController = invalid as object)
|
||||||
playlistView = CreateObject("roSGNode", "PlaylistView")
|
playlistView = CreateObject("roSGNode", "PlaylistView")
|
||||||
m.appController@.PushScreen(playlistView)
|
if appController = invalid
|
||||||
|
appController = m.appController
|
||||||
|
end if
|
||||||
|
appController@.PushScreen(playlistView)
|
||||||
playlistView@.BindNode(invalid)
|
playlistView@.BindNode(invalid)
|
||||||
playlistView.content = contentNode
|
playlistView.content = contentNode
|
||||||
end function
|
end function
|
||||||
|
|||||||
@@ -58,6 +58,14 @@ namespace VideoUtils
|
|||||||
return m.top.getScene().findNode("VideoContainer")
|
return m.top.getScene().findNode("VideoContainer")
|
||||||
end function
|
end function
|
||||||
|
|
||||||
|
function IsVideoPlayerFullScreen() as boolean
|
||||||
|
videoContainer = GetVideoContainer()
|
||||||
|
if videoContainer = invalid
|
||||||
|
return false
|
||||||
|
end if
|
||||||
|
return videoContainer.fullscreen
|
||||||
|
end function
|
||||||
|
|
||||||
function ToggleVideoPictureInPicture() as boolean
|
function ToggleVideoPictureInPicture() as boolean
|
||||||
videoPlayer = GetVideoPlayer()
|
videoPlayer = GetVideoPlayer()
|
||||||
if videoPlayer = invalid
|
if videoPlayer = invalid
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ namespace Http
|
|||||||
|
|
||||||
' This is an endpoint allowing the web app to make an authenticated request
|
' This is an endpoint allowing the web app to make an authenticated request
|
||||||
' without needing the Invidious token
|
' without needing the Invidious token
|
||||||
' TODO:P2 this should be a POST request
|
' This is a GET not a POST for better caching
|
||||||
m.Get("/invidious/authenticated-request", function(context as object) as boolean
|
m.Get("/invidious/authenticated-request", function(context as object) as boolean
|
||||||
request = context.request
|
request = context.request
|
||||||
response = context.response
|
response = context.response
|
||||||
|
|||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import "pkg:/components/ChannelView/ChannelUtils.bs"
|
||||||
|
import "pkg:/components/PlaylistView/PlaylistUtils.bs"
|
||||||
|
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
|
||||||
|
|
||||||
|
namespace Http
|
||||||
|
|
||||||
|
class ViewRouter extends HttpRouter
|
||||||
|
|
||||||
|
function new()
|
||||||
|
super()
|
||||||
|
|
||||||
|
m.Get("/api/view/open", function(context as object) as boolean
|
||||||
|
request = context.request
|
||||||
|
response = context.response
|
||||||
|
appController = context.server.task.appController
|
||||||
|
|
||||||
|
playlistId = request.query.playlistId
|
||||||
|
authorId = request.query.authorId
|
||||||
|
|
||||||
|
if not StringUtils.IsNullOrEmpty(playlistId)
|
||||||
|
contentNode = InvidiousContent.ToPlaylistContentNode(invalid, { playlistId: playlistId }, invalid)
|
||||||
|
PlaylistUtils.Open(contentNode, appController)
|
||||||
|
if VideoUtils.IsVideoPlayerOpen() and VideoUtils.IsVideoPlayerFullScreen()
|
||||||
|
VideoUtils.ToggleVideoPictureInPicture()
|
||||||
|
end if
|
||||||
|
response.Default(204, "OK")
|
||||||
|
else if not StringUtils.IsNullOrEmpty(authorId)
|
||||||
|
contentNode = InvidiousContent.ToChannelContentNode(invalid, { authorId: authorId }, invalid)
|
||||||
|
ChannelUtils.Open(contentNode, appController)
|
||||||
|
if VideoUtils.IsVideoPlayerOpen() and VideoUtils.IsVideoPlayerFullScreen()
|
||||||
|
VideoUtils.ToggleVideoPictureInPicture()
|
||||||
|
end if
|
||||||
|
response.Default(204, "OK")
|
||||||
|
else
|
||||||
|
response.Default(400, "Invalid request")
|
||||||
|
end if
|
||||||
|
|
||||||
|
return true
|
||||||
|
end function)
|
||||||
|
end function
|
||||||
|
|
||||||
|
end class
|
||||||
|
|
||||||
|
end namespace
|
||||||
@@ -6,6 +6,7 @@ import "pkg:/components/Web/PlayletWebServer/Middleware/PlayQueueRouter.bs"
|
|||||||
import "pkg:/components/Web/PlayletWebServer/Middleware/PreferencesRouter.bs"
|
import "pkg:/components/Web/PlayletWebServer/Middleware/PreferencesRouter.bs"
|
||||||
import "pkg:/components/Web/PlayletWebServer/Middleware/SearchHistoryRouter.bs"
|
import "pkg:/components/Web/PlayletWebServer/Middleware/SearchHistoryRouter.bs"
|
||||||
import "pkg:/components/Web/PlayletWebServer/Middleware/StateApiRouter.bs"
|
import "pkg:/components/Web/PlayletWebServer/Middleware/StateApiRouter.bs"
|
||||||
|
import "pkg:/components/Web/PlayletWebServer/Middleware/ViewRouter.bs"
|
||||||
import "pkg:/components/Web/WebServer/Middleware/CorsMiddleware.bs"
|
import "pkg:/components/Web/WebServer/Middleware/CorsMiddleware.bs"
|
||||||
import "pkg:/components/Web/WebServer/Middleware/EtagMiddleware.bs"
|
import "pkg:/components/Web/WebServer/Middleware/EtagMiddleware.bs"
|
||||||
import "pkg:/components/Web/WebServer/Middleware/HttpStaticFilesRouter.bs"
|
import "pkg:/components/Web/WebServer/Middleware/HttpStaticFilesRouter.bs"
|
||||||
@@ -40,6 +41,7 @@ function SetupRoutes(server as object)
|
|||||||
server.UseRouter(new Http.InvidiousRouter())
|
server.UseRouter(new Http.InvidiousRouter())
|
||||||
server.UseRouter(new Http.PlayQueueRouter())
|
server.UseRouter(new Http.PlayQueueRouter())
|
||||||
server.UseRouter(new Http.BookmarksRouter())
|
server.UseRouter(new Http.BookmarksRouter())
|
||||||
|
server.UseRouter(new Http.ViewRouter())
|
||||||
server.UseRouter(new Http.SearchHistoryRouter())
|
server.UseRouter(new Http.SearchHistoryRouter())
|
||||||
server.UseRouter(new Http.PlayletLibUrlsRouter())
|
server.UseRouter(new Http.PlayletLibUrlsRouter())
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
<component name="PlayletWebServer" extends="WebServer" includes="AutoBind">
|
<component name="PlayletWebServer" extends="WebServer" includes="AutoBind">
|
||||||
<interface>
|
<interface>
|
||||||
|
<field id="appController" type="node" />
|
||||||
<field id="preferences" type="node" />
|
<field id="preferences" type="node" />
|
||||||
<field id="invidious" type="node" />
|
<field id="invidious" type="node" />
|
||||||
<field id="applicationInfo" type="node" />
|
<field id="applicationInfo" type="node" />
|
||||||
|
|||||||
@@ -114,6 +114,20 @@ export class PlayletApi {
|
|||||||
return await response.json();
|
return await response.json();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static async openPlaylist(playlistId) {
|
||||||
|
if (!playlistId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await fetch(`${PlayletApi.host()}/api/view/open?playlistId=${playlistId}`);
|
||||||
|
}
|
||||||
|
|
||||||
|
static async openChannel(authorId) {
|
||||||
|
if (!authorId) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
await fetch(`${PlayletApi.host()}/api/view/open?authorId=${authorId}`);
|
||||||
|
}
|
||||||
|
|
||||||
static async getSearchHistory() {
|
static async getSearchHistory() {
|
||||||
const response = await fetch(`${PlayletApi.host()}/api/search-history`);
|
const response = await fetch(`${PlayletApi.host()}/api/search-history`);
|
||||||
return await response.json();
|
return await response.json();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
|
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||||
import { playletStateStore } from "lib/Stores";
|
import { playletStateStore } from "lib/Stores";
|
||||||
|
|
||||||
export let author: string | undefined = undefined;
|
export let author: string | undefined = undefined;
|
||||||
@@ -32,7 +33,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function openChannelOnTv() {
|
async function openChannelOnTv() {
|
||||||
// TODO:P1 open channel on TV
|
await PlayletApi.openChannel(authorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function openInvidiousInNewTab() {
|
function openInvidiousInNewTab() {
|
||||||
@@ -65,12 +66,12 @@
|
|||||||
<form method="dialog" class="modal-box bg-base-100">
|
<form method="dialog" class="modal-box bg-base-100">
|
||||||
<h3 class="text-lg m-5">{author}</h3>
|
<h3 class="text-lg m-5">{author}</h3>
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<!-- <button class="btn m-2" on:click={openChannelOnTv}
|
<button class="btn m-2" on:click={openChannelOnTv}>
|
||||||
>Open on {tvName}</button
|
Open on {tvName}
|
||||||
> -->
|
</button>
|
||||||
<button class="btn m-2" on:click={openInvidiousInNewTab}
|
<button class="btn m-2" on:click={openInvidiousInNewTab}>
|
||||||
>Open in Invidious</button
|
Open in Invidious
|
||||||
>
|
</button>
|
||||||
<button class="btn m-2">Cancel</button>
|
<button class="btn m-2">Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -55,6 +55,10 @@
|
|||||||
await PlayletApi.queuePlaylist(playlistId, title, videoCount);
|
await PlayletApi.queuePlaylist(playlistId, title, videoCount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function openPlaylistOnTv() {
|
||||||
|
await PlayletApi.openPlaylist(playlistId);
|
||||||
|
}
|
||||||
|
|
||||||
function openInvidiousInNewTab() {
|
function openInvidiousInNewTab() {
|
||||||
let url = `${invidiousInstance}/playlist?list=${playlistId}`;
|
let url = `${invidiousInstance}/playlist?list=${playlistId}`;
|
||||||
window.open(url);
|
window.open(url);
|
||||||
@@ -89,15 +93,18 @@
|
|||||||
<form method="dialog" class="modal-box bg-base-100">
|
<form method="dialog" class="modal-box bg-base-100">
|
||||||
<h3 class="text-lg m-5">{title}</h3>
|
<h3 class="text-lg m-5">{title}</h3>
|
||||||
<div class="flex flex-col">
|
<div class="flex flex-col">
|
||||||
<button class="btn m-2" on:click={playPlaylistOnTv}
|
<button class="btn m-2" on:click={playPlaylistOnTv}>
|
||||||
>Play on {tvName}</button
|
Play on {tvName}
|
||||||
>
|
</button>
|
||||||
<button class="btn m-2" on:click={queuePlaylistOnTv}
|
<button class="btn m-2" on:click={queuePlaylistOnTv}>
|
||||||
>Queue on {tvName}
|
Queue on {tvName}
|
||||||
|
</button>
|
||||||
|
<button class="btn m-2" on:click={openPlaylistOnTv}>
|
||||||
|
Open on {tvName}
|
||||||
|
</button>
|
||||||
|
<button class="btn m-2" on:click={openInvidiousInNewTab}>
|
||||||
|
Open in Invidious
|
||||||
</button>
|
</button>
|
||||||
<button class="btn m-2" on:click={openInvidiousInNewTab}
|
|
||||||
>Open in Invidious</button
|
|
||||||
>
|
|
||||||
<button class="btn m-2">Cancel</button>
|
<button class="btn m-2">Cancel</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
Reference in new issue
Block a user