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
|
||||
- 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
|
||||
- Channels and Playlists can be opened on TV from web app
|
||||
|
||||
### Fixed
|
||||
|
||||
|
||||
@@ -204,6 +204,29 @@ paths:
|
||||
responses:
|
||||
"204":
|
||||
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:
|
||||
get:
|
||||
summary: Get Playlet lib URLs
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
namespace ChannelUtils
|
||||
function Open(contentNode as object)
|
||||
function Open(contentNode as object, appController = invalid as object)
|
||||
channelView = CreateObject("roSGNode", "ChannelView")
|
||||
m.appController@.PushScreen(channelView)
|
||||
if appController = invalid
|
||||
appController = m.appController
|
||||
end if
|
||||
appController@.PushScreen(channelView)
|
||||
channelView@.BindNode(invalid)
|
||||
channelView.content = contentNode
|
||||
end function
|
||||
|
||||
@@ -60,6 +60,7 @@
|
||||
<PlayletWebServer
|
||||
id="WebServer"
|
||||
port="8888"
|
||||
appController="bind:/AppController"
|
||||
applicationInfo="bind:../ApplicationInfo"
|
||||
invidious="bind:../Invidious"
|
||||
preferences="bind:../Preferences"
|
||||
|
||||
@@ -21,6 +21,7 @@ function InitializeBindings()
|
||||
"preferences": "../Preferences"
|
||||
},
|
||||
"WebServer": {
|
||||
"appController": "/AppController",
|
||||
"applicationInfo": "../ApplicationInfo",
|
||||
"invidious": "../Invidious",
|
||||
"preferences": "../Preferences",
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
namespace PlaylistUtils
|
||||
function Open(contentNode as object)
|
||||
function Open(contentNode as object, appController = invalid as object)
|
||||
playlistView = CreateObject("roSGNode", "PlaylistView")
|
||||
m.appController@.PushScreen(playlistView)
|
||||
if appController = invalid
|
||||
appController = m.appController
|
||||
end if
|
||||
appController@.PushScreen(playlistView)
|
||||
playlistView@.BindNode(invalid)
|
||||
playlistView.content = contentNode
|
||||
end function
|
||||
|
||||
@@ -58,6 +58,14 @@ namespace VideoUtils
|
||||
return m.top.getScene().findNode("VideoContainer")
|
||||
end function
|
||||
|
||||
function IsVideoPlayerFullScreen() as boolean
|
||||
videoContainer = GetVideoContainer()
|
||||
if videoContainer = invalid
|
||||
return false
|
||||
end if
|
||||
return videoContainer.fullscreen
|
||||
end function
|
||||
|
||||
function ToggleVideoPictureInPicture() as boolean
|
||||
videoPlayer = GetVideoPlayer()
|
||||
if videoPlayer = invalid
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace Http
|
||||
|
||||
' This is an endpoint allowing the web app to make an authenticated request
|
||||
' 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
|
||||
request = context.request
|
||||
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/SearchHistoryRouter.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/EtagMiddleware.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.PlayQueueRouter())
|
||||
server.UseRouter(new Http.BookmarksRouter())
|
||||
server.UseRouter(new Http.ViewRouter())
|
||||
server.UseRouter(new Http.SearchHistoryRouter())
|
||||
server.UseRouter(new Http.PlayletLibUrlsRouter())
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<component name="PlayletWebServer" extends="WebServer" includes="AutoBind">
|
||||
<interface>
|
||||
<field id="appController" type="node" />
|
||||
<field id="preferences" type="node" />
|
||||
<field id="invidious" type="node" />
|
||||
<field id="applicationInfo" type="node" />
|
||||
|
||||
@@ -114,6 +114,20 @@ export class PlayletApi {
|
||||
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() {
|
||||
const response = await fetch(`${PlayletApi.host()}/api/search-history`);
|
||||
return await response.json();
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { PlayletApi } from "lib/Api/PlayletApi";
|
||||
import { playletStateStore } from "lib/Stores";
|
||||
|
||||
export let author: string | undefined = undefined;
|
||||
@@ -32,7 +33,7 @@
|
||||
}
|
||||
|
||||
async function openChannelOnTv() {
|
||||
// TODO:P1 open channel on TV
|
||||
await PlayletApi.openChannel(authorId);
|
||||
}
|
||||
|
||||
function openInvidiousInNewTab() {
|
||||
@@ -65,12 +66,12 @@
|
||||
<form method="dialog" class="modal-box bg-base-100">
|
||||
<h3 class="text-lg m-5">{author}</h3>
|
||||
<div class="flex flex-col">
|
||||
<!-- <button class="btn m-2" on:click={openChannelOnTv}
|
||||
>Open on {tvName}</button
|
||||
> -->
|
||||
<button class="btn m-2" on:click={openInvidiousInNewTab}
|
||||
>Open in Invidious</button
|
||||
>
|
||||
<button class="btn m-2" on:click={openChannelOnTv}>
|
||||
Open on {tvName}
|
||||
</button>
|
||||
<button class="btn m-2" on:click={openInvidiousInNewTab}>
|
||||
Open in Invidious
|
||||
</button>
|
||||
<button class="btn m-2">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@@ -55,6 +55,10 @@
|
||||
await PlayletApi.queuePlaylist(playlistId, title, videoCount);
|
||||
}
|
||||
|
||||
async function openPlaylistOnTv() {
|
||||
await PlayletApi.openPlaylist(playlistId);
|
||||
}
|
||||
|
||||
function openInvidiousInNewTab() {
|
||||
let url = `${invidiousInstance}/playlist?list=${playlistId}`;
|
||||
window.open(url);
|
||||
@@ -89,15 +93,18 @@
|
||||
<form method="dialog" class="modal-box bg-base-100">
|
||||
<h3 class="text-lg m-5">{title}</h3>
|
||||
<div class="flex flex-col">
|
||||
<button class="btn m-2" on:click={playPlaylistOnTv}
|
||||
>Play on {tvName}</button
|
||||
>
|
||||
<button class="btn m-2" on:click={queuePlaylistOnTv}
|
||||
>Queue on {tvName}
|
||||
<button class="btn m-2" on:click={playPlaylistOnTv}>
|
||||
Play on {tvName}
|
||||
</button>
|
||||
<button class="btn m-2" on:click={queuePlaylistOnTv}>
|
||||
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 class="btn m-2" on:click={openInvidiousInNewTab}
|
||||
>Open in Invidious</button
|
||||
>
|
||||
<button class="btn m-2">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in new issue
Block a user