feat: cross-platform titlebar, video transfers and client cleanup
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped
Continuous Integration / build_web (push) Failing after 0s
Continuous Integration / build (macos-latest) (push) Skipped
Continuous Integration / build (ubuntu-22.04) (push) Skipped
Continuous Integration / build (windows-11-arm) (push) Skipped
Continuous Integration / build (windows-latest) (push) Skipped
Continuous Integration / nightly_release (push) Skipped
Adds frameless-window controls for Windows/Linux (native traffic lights on macOS), keeps transfers at the current position for video, lets the video player use the same sync/device controls as the media bar, and removes dead code plus assorted UI/perf issues.
This commit is contained in:
1 parent
4bdd0139bf
commit
6675a55957
26 files changed
+561
-316
No files matched your search
@@ -18,6 +18,12 @@
|
||||
"notification:default",
|
||||
"core:webview:allow-internal-toggle-devtools",
|
||||
"core:window:allow-start-dragging",
|
||||
"core:window:allow-minimize",
|
||||
"core:window:allow-maximize",
|
||||
"core:window:allow-unmaximize",
|
||||
"core:window:allow-toggle-maximize",
|
||||
"core:window:allow-close",
|
||||
"core:window:allow-is-maximized",
|
||||
"dialog:default",
|
||||
"upload:allow-download",
|
||||
"clipboard-manager:allow-write-text",
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"clipboard-manager":{"default_permission":{"identifier":"default","description":"No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n","permissions":[]},"permissions":{"allow-clear":{"identifier":"allow-clear","description":"Enables the clear command without any pre-configured scope.","commands":{"allow":["clear"],"deny":[]}},"allow-read-image":{"identifier":"allow-read-image","description":"Enables the read_image command without any pre-configured scope.","commands":{"allow":["read_image"],"deny":[]}},"allow-read-text":{"identifier":"allow-read-text","description":"Enables the read_text command without any pre-configured scope.","commands":{"allow":["read_text"],"deny":[]}},"allow-write-html":{"identifier":"allow-write-html","description":"Enables the write_html command without any pre-configured scope.","commands":{"allow":["write_html"],"deny":[]}},"allow-write-image":{"identifier":"allow-write-image","description":"Enables the write_image command without any pre-configured scope.","commands":{"allow":["write_image"],"deny":[]}},"allow-write-secret":{"identifier":"allow-write-secret","description":"Enables the write_secret command without any pre-configured scope.","commands":{"allow":["write_secret"],"deny":[]}},"allow-write-text":{"identifier":"allow-write-text","description":"Enables the write_text command without any pre-configured scope.","commands":{"allow":["write_text"],"deny":[]}},"deny-clear":{"identifier":"deny-clear","description":"Denies the clear command without any pre-configured scope.","commands":{"allow":[],"deny":["clear"]}},"deny-read-image":{"identifier":"deny-read-image","description":"Denies the read_image command without any pre-configured scope.","commands":{"allow":[],"deny":["read_image"]}},"deny-read-text":{"identifier":"deny-read-text","description":"Denies the read_text command without any pre-configured scope.","commands":{"allow":[],"deny":["read_text"]}},"deny-write-html":{"identifier":"deny-write-html","description":"Denies the write_html command without any pre-configured scope.","commands":{"allow":[],"deny":["write_html"]}},"deny-write-image":{"identifier":"deny-write-image","description":"Denies the write_image command without any pre-configured scope.","commands":{"allow":[],"deny":["write_image"]}},"deny-write-secret":{"identifier":"deny-write-secret","description":"Denies the write_secret command without any pre-configured scope.","commands":{"allow":[],"deny":["write_secret"]}},"deny-write-text":{"identifier":"deny-write-text","description":"Denies the write_text command without any pre-configured scope.","commands":{"allow":[],"deny":["write_text"]}}},"permission_sets":{},"global_scope_schema":null},"core":{"default_permission":{"identifier":"default","description":"Default core plugins set.","permissions":["core:path:default","core:event:default","core:window:default","core:webview:default","core:app:default","core:image:default","core:resources:default","core:menu:default","core:tray:default"]},"permissions":{},"permission_sets":{},"global_scope_schema":null},"core:app":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-version","allow-name","allow-tauri-version","allow-identifier","allow-bundle-type","allow-register-listener","allow-remove-listener","allow-supports-multiple-windows"]},"permissions":{"allow-app-hide":{"identifier":"allow-app-hide","description":"Enables the app_hide command without any pre-configured scope.","commands":{"allow":["app_hide"],"deny":[]}},"allow-app-show":{"identifier":"allow-app-show","description":"Enables the app_show command without any pre-configured scope.","commands":{"allow":["app_show"],"deny":[]}},"allow-bundle-type":{"identifier":"allow-bundle-type","description":"Enables the bundle_type command without any pre-configured scope.","commands":{"allow":["bundle_type"],"deny":[]}},"allow-default-window-icon":{"identifier":"allow-default-window-icon","description":"Enables the default_window_icon command without any pre-configured scope.","commands":{"allow":["default_window_icon"],"deny":[]}},"allow-exit":{"identifier":"allow-exit","description":"Enables the exit command without any pre-configured scope.","commands":{"allow":["exit"],"deny":[]}},"allow-fetch-data-store-identifiers":{"identifier":"allow-fetch-data-store-identifiers","description":"Enables the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":["fetch_data_store_identifiers"],"deny":[]}},"allow-identifier":{"identifier":"allow-identifier","description":"Enables the identifier command without any pre-configured scope.","commands":{"allow":["identifier"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","coLine truncated
|
||||
{"clipboard-manager":{"default_permission":{"identifier":"default","description":"No features are enabled by default, as we believe\nthe clipboard can be inherently dangerous and it is \napplication specific if read and/or write access is needed.\n\nClipboard interaction needs to be explicitly enabled.\n","permissions":[]},"permissions":{"allow-clear":{"identifier":"allow-clear","description":"Enables the clear command without any pre-configured scope.","commands":{"allow":["clear"],"deny":[]}},"allow-read-image":{"identifier":"allow-read-image","description":"Enables the read_image command without any pre-configured scope.","commands":{"allow":["read_image"],"deny":[]}},"allow-read-text":{"identifier":"allow-read-text","description":"Enables the read_text command without any pre-configured scope.","commands":{"allow":["read_text"],"deny":[]}},"allow-write-html":{"identifier":"allow-write-html","description":"Enables the write_html command without any pre-configured scope.","commands":{"allow":["write_html"],"deny":[]}},"allow-write-image":{"identifier":"allow-write-image","description":"Enables the write_image command without any pre-configured scope.","commands":{"allow":["write_image"],"deny":[]}},"allow-write-secret":{"identifier":"allow-write-secret","description":"Enables the write_secret command without any pre-configured scope.","commands":{"allow":["write_secret"],"deny":[]}},"allow-write-text":{"identifier":"allow-write-text","description":"Enables the write_text command without any pre-configured scope.","commands":{"allow":["write_text"],"deny":[]}},"deny-clear":{"identifier":"deny-clear","description":"Denies the clear command without any pre-configured scope.","commands":{"allow":[],"deny":["clear"]}},"deny-read-image":{"identifier":"deny-read-image","description":"Denies the read_image command without any pre-configured scope.","commands":{"allow":[],"deny":["read_image"]}},"deny-read-text":{"identifier":"deny-read-text","description":"Denies the read_text command without any pre-configured scope.","commands":{"allow":[],"deny":["read_text"]}},"deny-write-html":{"identifier":"deny-write-html","description":"Denies the write_html command without any pre-configured scope.","commands":{"allow":[],"deny":["write_html"]}},"deny-write-image":{"identifier":"deny-write-image","description":"Denies the write_image command without any pre-configured scope.","commands":{"allow":[],"deny":["write_image"]}},"deny-write-secret":{"identifier":"deny-write-secret","description":"Denies the write_secret command without any pre-configured scope.","commands":{"allow":[],"deny":["write_secret"]}},"deny-write-text":{"identifier":"deny-write-text","description":"Denies the write_text command without any pre-configured scope.","commands":{"allow":[],"deny":["write_text"]}}},"permission_sets":{},"global_scope_schema":null},"core":{"default_permission":{"identifier":"default","description":"Default core plugins set.","permissions":["core:path:default","core:event:default","core:window:default","core:webview:default","core:app:default","core:image:default","core:resources:default","core:menu:default","core:tray:default"]},"permissions":{},"permission_sets":{},"global_scope_schema":null},"core:app":{"default_permission":{"identifier":"default","description":"Default permissions for the plugin.","permissions":["allow-version","allow-name","allow-tauri-version","allow-identifier","allow-bundle-type","allow-register-listener","allow-remove-listener","allow-supports-multiple-windows"]},"permissions":{"allow-app-hide":{"identifier":"allow-app-hide","description":"Enables the app_hide command without any pre-configured scope.","commands":{"allow":["app_hide"],"deny":[]}},"allow-app-show":{"identifier":"allow-app-show","description":"Enables the app_show command without any pre-configured scope.","commands":{"allow":["app_show"],"deny":[]}},"allow-bundle-type":{"identifier":"allow-bundle-type","description":"Enables the bundle_type command without any pre-configured scope.","commands":{"allow":["bundle_type"],"deny":[]}},"allow-default-window-icon":{"identifier":"allow-default-window-icon","description":"Enables the default_window_icon command without any pre-configured scope.","commands":{"allow":["default_window_icon"],"deny":[]}},"allow-exit":{"identifier":"allow-exit","description":"Enables the exit command without any pre-configured scope.","commands":{"allow":["exit"],"deny":[]}},"allow-fetch-data-store-identifiers":{"identifier":"allow-fetch-data-store-identifiers","description":"Enables the fetch_data_store_identifiers command without any pre-configured scope.","commands":{"allow":["fetch_data_store_identifiers"],"deny":[]}},"allow-identifier":{"identifier":"allow-identifier","description":"Enables the identifier command without any pre-configured scope.","commands":{"allow":["identifier"],"deny":[]}},"allow-name":{"identifier":"allow-name","description":"Enables the name command without any pre-configured scope.","coLine truncated
|
||||
@@ -1 +1 @@
|
||||
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["window-state:default","global-shortcut:default","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","shell:default"],"platforms":["macOS","windows","linux"]},"main-capabilities":{"identifier":"main-capabilities","description":"Capability for desktop window","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","store:allow-clear","store:allow-delete","store:allow-keys","store:allow-load","updater:allow-check","updater:allow-download-and-install","updater:allow-download","updater:allow-install","notification:default","core:webview:allow-internal-toggle-devtools","core:window:allow-start-dragging","dialog:default","upload:allow-download","clipboard-manager:allow-write-text","shell:default","shell:allow-open"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","core:window:allow-set-fullscreen","shell:default"]}}
|
||||
{"desktop-capability":{"identifier":"desktop-capability","description":"","local":true,"windows":["main"],"permissions":["window-state:default","global-shortcut:default","global-shortcut:allow-is-registered","global-shortcut:allow-register","global-shortcut:allow-unregister","shell:default"],"platforms":["macOS","windows","linux"]},"main-capabilities":{"identifier":"main-capabilities","description":"Capability for desktop window","local":true,"windows":["main"],"permissions":["store:allow-get","store:allow-set","store:allow-save","store:allow-clear","store:allow-delete","store:allow-keys","store:allow-load","updater:allow-check","updater:allow-download-and-install","updater:allow-download","updater:allow-install","notification:default","core:webview:allow-internal-toggle-devtools","core:window:allow-start-dragging","core:window:allow-minimize","core:window:allow-maximize","core:window:allow-unmaximize","core:window:allow-toggle-maximize","core:window:allow-close","core:window:allow-is-maximized","dialog:default","upload:allow-download","clipboard-manager:allow-write-text","shell:default","shell:allow-open"]},"migrated":{"identifier":"migrated","description":"permissions that were migrated from v1","local":true,"windows":["main"],"permissions":["core:path:default","core:event:default","core:window:default","core:app:default","core:resources:default","core:menu:default","core:tray:default","core:window:allow-set-fullscreen","shell:default"]}}
|
||||
@@ -2666,6 +2666,168 @@
|
||||
"const": "log:deny-log",
|
||||
"markdownDescription": "Denies the log command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Default permissions for MCP Bridge plugin\n#### This default permission set includes:\n\n- `allow-capture-native-screenshot`\n- `allow-emit-event`\n- `allow-execute-command`\n- `allow-execute-js`\n- `allow-get-backend-state`\n- `allow-get-ipc-events`\n- `allow-get-window-info`\n- `allow-list-windows`\n- `allow-report-ipc-event`\n- `allow-request-script-injection`\n- `allow-script-result`\n- `allow-start-ipc-monitor`\n- `allow-stop-ipc-monitor`",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:default",
|
||||
"markdownDescription": "Default permissions for MCP Bridge plugin\n#### This default permission set includes:\n\n- `allow-capture-native-screenshot`\n- `allow-emit-event`\n- `allow-execute-command`\n- `allow-execute-js`\n- `allow-get-backend-state`\n- `allow-get-ipc-events`\n- `allow-get-window-info`\n- `allow-list-windows`\n- `allow-report-ipc-event`\n- `allow-request-script-injection`\n- `allow-script-result`\n- `allow-start-ipc-monitor`\n- `allow-stop-ipc-monitor`"
|
||||
},
|
||||
{
|
||||
"description": "Enables the capture_native_screenshot command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:allow-capture-native-screenshot",
|
||||
"markdownDescription": "Enables the capture_native_screenshot command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the emit_event command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:allow-emit-event",
|
||||
"markdownDescription": "Enables the emit_event command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the execute_command command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:allow-execute-command",
|
||||
"markdownDescription": "Enables the execute_command command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the execute_js command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:allow-execute-js",
|
||||
"markdownDescription": "Enables the execute_js command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the get_backend_state command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:allow-get-backend-state",
|
||||
"markdownDescription": "Enables the get_backend_state command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the get_ipc_events command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:allow-get-ipc-events",
|
||||
"markdownDescription": "Enables the get_ipc_events command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the get_window_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:allow-get-window-info",
|
||||
"markdownDescription": "Enables the get_window_info command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the list_windows command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:allow-list-windows",
|
||||
"markdownDescription": "Enables the list_windows command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the report_ipc_event command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:allow-report-ipc-event",
|
||||
"markdownDescription": "Enables the report_ipc_event command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the request_script_injection command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:allow-request-script-injection",
|
||||
"markdownDescription": "Enables the request_script_injection command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the script_result command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:allow-script-result",
|
||||
"markdownDescription": "Enables the script_result command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the start_ipc_monitor command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:allow-start-ipc-monitor",
|
||||
"markdownDescription": "Enables the start_ipc_monitor command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Enables the stop_ipc_monitor command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:allow-stop-ipc-monitor",
|
||||
"markdownDescription": "Enables the stop_ipc_monitor command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the capture_native_screenshot command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:deny-capture-native-screenshot",
|
||||
"markdownDescription": "Denies the capture_native_screenshot command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the emit_event command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:deny-emit-event",
|
||||
"markdownDescription": "Denies the emit_event command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the execute_command command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:deny-execute-command",
|
||||
"markdownDescription": "Denies the execute_command command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the execute_js command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:deny-execute-js",
|
||||
"markdownDescription": "Denies the execute_js command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the get_backend_state command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:deny-get-backend-state",
|
||||
"markdownDescription": "Denies the get_backend_state command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the get_ipc_events command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:deny-get-ipc-events",
|
||||
"markdownDescription": "Denies the get_ipc_events command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the get_window_info command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:deny-get-window-info",
|
||||
"markdownDescription": "Denies the get_window_info command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the list_windows command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:deny-list-windows",
|
||||
"markdownDescription": "Denies the list_windows command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the report_ipc_event command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:deny-report-ipc-event",
|
||||
"markdownDescription": "Denies the report_ipc_event command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the request_script_injection command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:deny-request-script-injection",
|
||||
"markdownDescription": "Denies the request_script_injection command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the script_result command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:deny-script-result",
|
||||
"markdownDescription": "Denies the script_result command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the start_ipc_monitor command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:deny-start-ipc-monitor",
|
||||
"markdownDescription": "Denies the start_ipc_monitor command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "Denies the stop_ipc_monitor command without any pre-configured scope.",
|
||||
"type": "string",
|
||||
"const": "mcp-bridge:deny-stop-ipc-monitor",
|
||||
"markdownDescription": "Denies the stop_ipc_monitor command without any pre-configured scope."
|
||||
},
|
||||
{
|
||||
"description": "This permission set configures which\nnotification features are by default exposed.\n\n#### Granted Permissions\n\nIt allows all notification related features.\n\n\n#### This default permission set includes:\n\n- `allow-is-permission-granted`\n- `allow-request-permission`\n- `allow-notify`\n- `allow-register-action-types`\n- `allow-register-listener`\n- `allow-remove-listener`\n- `allow-cancel`\n- `allow-get-pending`\n- `allow-remove-active`\n- `allow-get-active`\n- `allow-check-permissions`\n- `allow-show`\n- `allow-batch`\n- `allow-list-channels`\n- `allow-delete-channel`\n- `allow-create-channel`\n- `allow-permission-state`",
|
||||
"type": "string",
|
||||
|
||||
@@ -14,6 +14,18 @@ fn main() {
|
||||
);
|
||||
|
||||
builder
|
||||
.setup(|_app| {
|
||||
// Frameless window outside macOS. macOS uses the native overlay
|
||||
// titlebar with its traffic lights.
|
||||
#[cfg(not(target_os = "macos"))]
|
||||
{
|
||||
use tauri::Manager;
|
||||
if let Some(window) = _app.get_webview_window("main") {
|
||||
window.set_decorations(false)?;
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
})
|
||||
.plugin(tauri_plugin_shell::init())
|
||||
.plugin(tauri_plugin_global_shortcut::Builder::new().build())
|
||||
.plugin(tauri_plugin_window_state::Builder::new().build())
|
||||
|
||||
@@ -7,15 +7,13 @@ import React, { useCallback, useState } from "react";
|
||||
import "./appBar.scss";
|
||||
|
||||
import { useShallow } from "zustand/shallow";
|
||||
// removed search placeholder; library state now managed via zustand
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { useCentralStore } from "@/utils/store/central";
|
||||
import useHeaderStore from "@/utils/store/header";
|
||||
import useSearchStore from "@/utils/store/search";
|
||||
import BackButton from "../buttons/backButton";
|
||||
import CastButton from "../buttons/castButton";
|
||||
import { UserAvatarMenu } from "../userAvatarMenu";
|
||||
import { NavigationDrawer } from "./navigationDrawer";
|
||||
import WindowControls from "../windowControls";
|
||||
|
||||
const MemoizeBackButton = React.memo(BackButton);
|
||||
|
||||
@@ -32,7 +30,15 @@ const HIDDEN_PATHS = [
|
||||
"/home",
|
||||
];
|
||||
|
||||
export const AppBar = () => {
|
||||
/** Whether the global app header is drawn for this route. */
|
||||
export const shouldShowAppBar = (pathname: string) =>
|
||||
!HIDDEN_PATHS.some(
|
||||
(path) =>
|
||||
(pathname.startsWith(path) && pathname !== "/player/audio") ||
|
||||
pathname === "/",
|
||||
);
|
||||
|
||||
const AppBarContent = () => {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
|
||||
@@ -40,13 +46,7 @@ export const AppBar = () => {
|
||||
useShallow((s) => s.toggleSearchDialog),
|
||||
);
|
||||
|
||||
const display = !HIDDEN_PATHS.some(
|
||||
(path) =>
|
||||
(location.pathname.startsWith(path) &&
|
||||
location.pathname !== "/player/audio") ||
|
||||
location.pathname === "/",
|
||||
);
|
||||
|
||||
// This hook subscribes to page scroll; keep it out of hidden routes.
|
||||
const trigger = useScrollTrigger({
|
||||
disableHysteresis: true,
|
||||
threshold: 20,
|
||||
@@ -54,11 +54,6 @@ export const AppBar = () => {
|
||||
|
||||
const [showDrawer, setShowDrawer] = useState(false);
|
||||
|
||||
const _handleNavigateToSearch = useCallback(
|
||||
() => navigate({ to: "/search", search: { query: "" } }),
|
||||
[navigate],
|
||||
);
|
||||
|
||||
const handleDrawerClose = useCallback(() => {
|
||||
setShowDrawer(false);
|
||||
}, []);
|
||||
@@ -74,53 +69,66 @@ export const AppBar = () => {
|
||||
|
||||
useHeaderStore(useShallow((s) => ({ pageTitle: s.pageTitle })));
|
||||
|
||||
if (!display) {
|
||||
return null;
|
||||
}
|
||||
if (display) {
|
||||
return (
|
||||
<>
|
||||
<MuiAppBar
|
||||
return (
|
||||
<>
|
||||
<MuiAppBar
|
||||
data-tauri-drag-region
|
||||
className={
|
||||
trigger
|
||||
? "appBar flex flex-row flex-justify-spaced-between elevated"
|
||||
: "appBar flex flex-row flex-justify-spaced-between"
|
||||
}
|
||||
elevation={0}
|
||||
color="transparent"
|
||||
>
|
||||
<div
|
||||
className="flex flex-row"
|
||||
data-tauri-drag-region
|
||||
className={
|
||||
trigger
|
||||
? "appBar flex flex-row flex-justify-spaced-between elevated"
|
||||
: "appBar flex flex-row flex-justify-spaced-between"
|
||||
}
|
||||
elevation={0}
|
||||
color="transparent"
|
||||
style={{ gap: "0.6em" }}
|
||||
>
|
||||
<div className="flex flex-row" data-tauri-drag-region style={{ gap: "0.6em" }}>
|
||||
<IconButton onClick={handleDrawerOpen}>
|
||||
<span className="material-symbols-rounded">menu</span>
|
||||
</IconButton>
|
||||
<MemoizeBackButton />
|
||||
<IconButton onClick={handleNavigateToHome}>
|
||||
<span
|
||||
className={
|
||||
location.pathname === "/home"
|
||||
? "material-symbols-rounded fill"
|
||||
: "material-symbols-rounded"
|
||||
}
|
||||
>
|
||||
home
|
||||
</span>
|
||||
</IconButton>
|
||||
</div>
|
||||
<IconButton onClick={handleDrawerOpen} aria-label="Open navigation">
|
||||
<span className="material-symbols-rounded">menu</span>
|
||||
</IconButton>
|
||||
<MemoizeBackButton />
|
||||
<IconButton onClick={handleNavigateToHome} aria-label="Home">
|
||||
<span
|
||||
className={
|
||||
location.pathname === "/home"
|
||||
? "material-symbols-rounded fill"
|
||||
: "material-symbols-rounded"
|
||||
}
|
||||
>
|
||||
home
|
||||
</span>
|
||||
</IconButton>
|
||||
</div>
|
||||
|
||||
<div className="flex flex-row" data-tauri-drag-region style={{ gap: "0.6em" }}>
|
||||
<CastButton />
|
||||
<IconButton onClick={toggleSearchDialog}>
|
||||
<span className="material-symbols-rounded">search</span>
|
||||
</IconButton>
|
||||
<IconButton onClick={handleNavigateToFavorite}>
|
||||
<span className="material-symbols-rounded">favorite</span>
|
||||
</IconButton>
|
||||
<UserAvatarMenu />
|
||||
</div>
|
||||
</MuiAppBar>
|
||||
<NavigationDrawer open={showDrawer} onClose={handleDrawerClose} />
|
||||
</>
|
||||
);
|
||||
}
|
||||
<div
|
||||
className="flex flex-row"
|
||||
data-tauri-drag-region
|
||||
style={{ gap: "0.6em" }}
|
||||
>
|
||||
<CastButton />
|
||||
<IconButton onClick={toggleSearchDialog} aria-label="Search">
|
||||
<span className="material-symbols-rounded">search</span>
|
||||
</IconButton>
|
||||
<IconButton
|
||||
onClick={handleNavigateToFavorite}
|
||||
aria-label="Favorites"
|
||||
>
|
||||
<span className="material-symbols-rounded">favorite</span>
|
||||
</IconButton>
|
||||
<UserAvatarMenu />
|
||||
<WindowControls />
|
||||
</div>
|
||||
</MuiAppBar>
|
||||
<NavigationDrawer open={showDrawer} onClose={handleDrawerClose} />
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
||||
export const AppBar = () => {
|
||||
const location = useLocation();
|
||||
if (!shouldShowAppBar(location.pathname)) return null;
|
||||
return <AppBarContent />;
|
||||
};
|
||||
@@ -195,7 +195,7 @@ const PlayButton = ({
|
||||
},
|
||||
});
|
||||
const handleClick = (
|
||||
e: MouseEvent<HTMLAnchorElement | MouseEvent>,
|
||||
e: MouseEvent<HTMLElement>,
|
||||
currentEpisodeId?: string | undefined,
|
||||
) => {
|
||||
e.stopPropagation();
|
||||
|
||||
@@ -3,8 +3,14 @@ import Typography from "@mui/material/Typography";
|
||||
import { red } from "@mui/material/colors";
|
||||
import React from "react";
|
||||
|
||||
export const ErrorNotice = ({ error }: { error?: Error }) => {
|
||||
console.error(error);
|
||||
export const ErrorNotice = ({ error }: { error?: unknown }) => {
|
||||
const normalizedError =
|
||||
error instanceof Error
|
||||
? error
|
||||
: error
|
||||
? new Error(String(error))
|
||||
: undefined;
|
||||
console.error(normalizedError ?? error);
|
||||
return (
|
||||
<Box
|
||||
sx={{
|
||||
@@ -57,8 +63,9 @@ export const ErrorNotice = ({ error }: { error?: Error }) => {
|
||||
fontFamily: "JetBrains Mono Variable",
|
||||
}}
|
||||
>
|
||||
{error
|
||||
? error.stack || `${error.name}: ${error.message}`
|
||||
{normalizedError
|
||||
? normalizedError.stack ||
|
||||
`${normalizedError.name}: ${normalizedError.message}`
|
||||
: "Unknown error"}
|
||||
</Typography>
|
||||
</Box>
|
||||
|
||||
@@ -84,6 +84,7 @@ const PlaybackSync = () => {
|
||||
|
||||
const tick = async () => {
|
||||
if (busy || cancelled) return;
|
||||
if (document.visibilityState !== "visible") return;
|
||||
busy = true;
|
||||
try {
|
||||
const sessions = (await sessionApi.getSessions()).data;
|
||||
|
||||
@@ -98,7 +98,11 @@ const AudioPlayer = () => {
|
||||
return result.data;
|
||||
},
|
||||
enabled: !!api && !!user?.Id,
|
||||
refetchInterval: 3000,
|
||||
// Do not keep polling the server while the window is hidden.
|
||||
refetchInterval: () =>
|
||||
document.visibilityState === "visible" ? 3000 : false,
|
||||
refetchIntervalInBackground: false,
|
||||
staleTime: 1500,
|
||||
networkMode: "always",
|
||||
});
|
||||
|
||||
@@ -188,11 +192,13 @@ const AudioPlayer = () => {
|
||||
// Layout hooks (home hero rail) reserve space for the bar. Use explicit
|
||||
// visibility rather than the DOM: during the exit animation the element is
|
||||
// still mounted but already off-screen.
|
||||
const isFullPlayer =
|
||||
location.pathname === "/player" || location.pathname === "/player/audio";
|
||||
useEffect(() => {
|
||||
const visible = barVisible && location.pathname !== "/player/audio";
|
||||
const visible = barVisible && !isFullPlayer;
|
||||
document.body.classList.toggle("has-player-bar", visible);
|
||||
return () => document.body.classList.remove("has-player-bar");
|
||||
}, [barVisible, location.pathname]);
|
||||
}, [barVisible, isFullPlayer]);
|
||||
|
||||
// Sync local audio element.
|
||||
useEffect(() => {
|
||||
@@ -523,7 +529,7 @@ const AudioPlayer = () => {
|
||||
});
|
||||
};
|
||||
|
||||
if (!barVisible || location.pathname === "/player/audio") {
|
||||
if (!barVisible || isFullPlayer) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { getSessionApi } from "@jellyfin/sdk/lib/utils/api/session-api";
|
||||
import { IconButton, Slider, Typography } from "@mui/material";
|
||||
import { IconButton, Slider, Tooltip, Typography } from "@mui/material";
|
||||
import { WebviewWindow as appWindow } from "@tauri-apps/api/webviewWindow";
|
||||
import { AnimatePresence, motion } from "motion/react";
|
||||
import React, {
|
||||
@@ -18,6 +18,7 @@ import BubbleSlider from "@/components/playback/videoPlayer/bubbleSlider";
|
||||
import { secToTicks } from "@/utils/date/time";
|
||||
import { useApiInContext } from "@/utils/store/api";
|
||||
import { usePlaybackStore } from "@/utils/store/playback";
|
||||
import useSyncPlayback from "@/utils/store/syncPlayback";
|
||||
import CaptionsButton from "./buttons/CaptionsButton";
|
||||
import ChaptersListButton from "./buttons/ChaptersListButton";
|
||||
import ForwardButton from "./buttons/ForwardButton";
|
||||
@@ -54,6 +55,18 @@ const VideoPlayerControls = ({
|
||||
const playerOSDRef = useRef<HTMLDivElement>(null);
|
||||
|
||||
const api = useApiInContext((state) => state.api);
|
||||
const syncEnabled = useSyncPlayback((state) => state.enabled);
|
||||
const syncMaster = useSyncPlayback((state) => state.master);
|
||||
const startSync = useSyncPlayback((state) => state.start);
|
||||
const stopSync = useSyncPlayback((state) => state.stop);
|
||||
const syncThisVideo = syncEnabled && syncMaster?.sessionId === null;
|
||||
const toggleSync = () => {
|
||||
if (syncThisVideo) {
|
||||
stopSync();
|
||||
return;
|
||||
}
|
||||
if (itemId) startSync({ itemId, sessionId: null });
|
||||
};
|
||||
const {
|
||||
mediaSourceId,
|
||||
itemId,
|
||||
@@ -120,7 +133,9 @@ const VideoPlayerControls = ({
|
||||
};
|
||||
}, [increaseVolumeByStep, decreaseVolumeByStep]);
|
||||
|
||||
const [clickTimeout, setClickTimeout] = useState<NodeJS.Timeout | null>(null);
|
||||
const [clickTimeout, setClickTimeout] = useState<ReturnType<
|
||||
typeof setTimeout
|
||||
> | null>(null);
|
||||
const [showVolumeControl, setShowVolumeControl] = useState(false);
|
||||
|
||||
const [settingsMenuRef, setSettingsMenuRef] =
|
||||
@@ -319,6 +334,21 @@ const VideoPlayerControls = ({
|
||||
startIndex: useQueue.getState().currentItemIndex,
|
||||
})}
|
||||
/>
|
||||
<Tooltip
|
||||
title={syncThisVideo ? "Stop device sync" : "Sync playback"}
|
||||
>
|
||||
<IconButton
|
||||
aria-label="Sync playback"
|
||||
onClick={toggleSync}
|
||||
sx={
|
||||
syncThisVideo
|
||||
? { color: "var(--mui-palette-primary-main)" }
|
||||
: undefined
|
||||
}
|
||||
>
|
||||
<span className="material-symbols-rounded">sync</span>
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
<QueueButton />
|
||||
|
||||
<ChaptersListButton />
|
||||
|
||||
@@ -250,6 +250,7 @@ const RemoteControlDialog = () => {
|
||||
{nowPlaying.Name}
|
||||
{nowPlaying.Genres?.length ? (
|
||||
<Chip
|
||||
component="span"
|
||||
size="small"
|
||||
label={nowPlaying.Genres[0]}
|
||||
sx={{ ml: 1 }}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
import React, { useCallback, useMemo } from "react";
|
||||
|
||||
import { Dialog, Slide } from "@mui/material";
|
||||
// import { useKonamiEasterEgg } from "../../utils/misc/konami";
|
||||
|
||||
export const EasterEgg = () => {
|
||||
// const [easterEgg, setEasterEgg] = useKonamiEasterEgg();
|
||||
|
||||
// // Memoize the onClose function
|
||||
// const handleClose = useCallback(() => {
|
||||
// setEasterEgg(false);
|
||||
// }, [setEasterEgg]);
|
||||
|
||||
// // Memoize the sx object
|
||||
// const dialogSx = useMemo(
|
||||
// () => ({
|
||||
// background: "black",
|
||||
// }),
|
||||
// [],
|
||||
// );
|
||||
|
||||
// return (
|
||||
// <>
|
||||
// <Dialog open={easterEgg} onClose={handleClose} sx={dialogSx}>
|
||||
// <iframe
|
||||
// width="560"
|
||||
// height="315"
|
||||
// src="https://www.youtube.com/embed/dQw4w9WgXcQ?autoplay=1&disablekb=1"
|
||||
// title="EasterEgg"
|
||||
// allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share"
|
||||
// />
|
||||
// </Dialog>
|
||||
// <Slide direction="up" in={easterEgg} mountOnEnter unmountOnExit>
|
||||
// <img
|
||||
// src="https://i.gifer.com/PYh.gif"
|
||||
// loading="lazy"
|
||||
// width={320}
|
||||
// height={320}
|
||||
// alt="nyan cat gif"
|
||||
// style={{
|
||||
// zIndex: "99999999",
|
||||
// position: "fixed",
|
||||
// bottom: 0,
|
||||
// left: 0,
|
||||
// objectFit: "cover",
|
||||
// }}
|
||||
// />
|
||||
// </Slide>
|
||||
// </>
|
||||
// );
|
||||
return <></>;
|
||||
};
|
||||
@@ -0,0 +1,73 @@
|
||||
import { getCurrentWindow } from "@tauri-apps/api/window";
|
||||
import React, { useEffect, useState } from "react";
|
||||
|
||||
import "./windowControls.scss";
|
||||
|
||||
const isMac = navigator.userAgent.includes("Macintosh");
|
||||
|
||||
const WindowsControls = () => {
|
||||
const [maximized, setMaximized] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const appWindow = getCurrentWindow();
|
||||
let disposed = false;
|
||||
let timer: number | undefined;
|
||||
const sync = () => {
|
||||
window.clearTimeout(timer);
|
||||
timer = window.setTimeout(() => {
|
||||
appWindow.isMaximized().then((value) => {
|
||||
if (!disposed) setMaximized(value);
|
||||
});
|
||||
}, 120);
|
||||
};
|
||||
appWindow.isMaximized().then((value) => {
|
||||
if (!disposed) setMaximized(value);
|
||||
});
|
||||
const unlisten = appWindow.onResized(sync);
|
||||
return () => {
|
||||
disposed = true;
|
||||
window.clearTimeout(timer);
|
||||
unlisten.then((off) => off()).catch(() => undefined);
|
||||
};
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="window-controls">
|
||||
<button
|
||||
type="button"
|
||||
aria-label="Minimize"
|
||||
title="Minimize"
|
||||
onClick={() => getCurrentWindow().minimize()}
|
||||
>
|
||||
<span className="material-symbols-rounded">remove</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
aria-label={maximized ? "Restore" : "Maximize"}
|
||||
title={maximized ? "Restore" : "Maximize"}
|
||||
onClick={() => getCurrentWindow().toggleMaximize()}
|
||||
>
|
||||
<span className="material-symbols-rounded">
|
||||
{maximized ? "filter_none" : "crop_square"}
|
||||
</span>
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
className="window-controls-close"
|
||||
aria-label="Close"
|
||||
title="Close"
|
||||
onClick={() => getCurrentWindow().close()}
|
||||
>
|
||||
<span className="material-symbols-rounded">close</span>
|
||||
</button>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Window buttons for frameless windows on Windows/Linux. macOS keeps its
|
||||
* native traffic lights (overlay titlebar), so this renders nothing there.
|
||||
*/
|
||||
const WindowControls = () => (isMac ? null : <WindowsControls />);
|
||||
|
||||
export default WindowControls;
|
||||
@@ -0,0 +1,40 @@
|
||||
import { useLocation } from "@tanstack/react-router";
|
||||
import React, { useEffect } from "react";
|
||||
import { shouldShowAppBar } from "@/components/appBar/appBar";
|
||||
import WindowControls from ".";
|
||||
|
||||
import "./windowControls.scss";
|
||||
|
||||
const isMac = navigator.userAgent.includes("Macintosh");
|
||||
|
||||
const WindowChromeContent = () => {
|
||||
useEffect(() => {
|
||||
document.body.classList.add("has-window-chrome");
|
||||
return () => document.body.classList.remove("has-window-chrome");
|
||||
}, []);
|
||||
|
||||
return (
|
||||
<div className="window-chrome">
|
||||
<div className="window-chrome-drag" data-tauri-drag-region />
|
||||
<div className="window-chrome-controls">
|
||||
<WindowControls />
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
/**
|
||||
* Frameless-window fallback for pages that do not draw the app header:
|
||||
* a small drag strip plus the window buttons in the top-right corner.
|
||||
*/
|
||||
const WindowChrome = () => {
|
||||
const { pathname } = useLocation();
|
||||
if (isMac) return null;
|
||||
if (pathname === "/home" || shouldShowAppBar(pathname)) return null;
|
||||
// The video player has its own fullscreen UI.
|
||||
if (pathname.startsWith("/player")) return null;
|
||||
|
||||
return <WindowChromeContent />;
|
||||
};
|
||||
|
||||
export default WindowChrome;
|
||||
@@ -0,0 +1,72 @@
|
||||
.window-controls {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
flex: 0 0 auto;
|
||||
margin-left: 0.35rem;
|
||||
border-radius: 10px;
|
||||
overflow: hidden;
|
||||
background: rgb(255 255 255 / 0.04);
|
||||
|
||||
button {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 42px;
|
||||
height: 38px;
|
||||
padding: 0;
|
||||
border: 0;
|
||||
background: transparent;
|
||||
color: rgb(255 255 255 / 0.82);
|
||||
cursor: pointer;
|
||||
transition: background-color 0.12s ease, color 0.12s ease;
|
||||
|
||||
.material-symbols-rounded {
|
||||
font-size: 1.05rem;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
background: rgb(255 255 255 / 0.12);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
&-close:hover {
|
||||
background: #d63b3b;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
html.is-windows .home-header .window-controls,
|
||||
html.is-linux .home-header .window-controls {
|
||||
margin-left: 0.6rem;
|
||||
}
|
||||
|
||||
// Reserve a strip for the custom titlebar on routes without the app header.
|
||||
html.is-windows body.has-window-chrome #root,
|
||||
html.is-linux body.has-window-chrome #root {
|
||||
padding-top: 44px;
|
||||
}
|
||||
|
||||
.window-chrome {
|
||||
position: fixed;
|
||||
inset: 0 0 auto;
|
||||
z-index: 10000;
|
||||
pointer-events: none;
|
||||
|
||||
&-drag {
|
||||
height: 10px;
|
||||
width: 100%;
|
||||
pointer-events: auto;
|
||||
}
|
||||
|
||||
&-controls {
|
||||
position: absolute;
|
||||
top: 4px;
|
||||
right: 8px;
|
||||
pointer-events: auto;
|
||||
border-radius: 12px;
|
||||
background: rgb(10 11 15 / 0.72);
|
||||
box-shadow: 0 8px 24px rgb(0 0 0 / 0.35);
|
||||
backdrop-filter: blur(14px);
|
||||
}
|
||||
}
|
||||
+8
-2
@@ -104,9 +104,15 @@ function ProviderWrapper() {
|
||||
}
|
||||
|
||||
const init = async () => {
|
||||
// The window is frameless-ish on macOS (overlay titlebar): the app header is the titlebar.
|
||||
if (navigator.userAgent.includes("Macintosh")) {
|
||||
// Frameless titlebar: macOS keeps the native traffic lights; Windows and
|
||||
// Linux use the custom window buttons in the header.
|
||||
const userAgent = navigator.userAgent;
|
||||
if (userAgent.includes("Macintosh")) {
|
||||
document.documentElement.classList.add("is-macos");
|
||||
} else if (userAgent.includes("Windows")) {
|
||||
document.documentElement.classList.add("is-windows");
|
||||
} else {
|
||||
document.documentElement.classList.add("is-linux");
|
||||
}
|
||||
|
||||
// Layout transitions during a live window resize cause visible wobble
|
||||
|
||||
@@ -30,7 +30,7 @@ import RemoteControlDialog from "@/components/remoteControl";
|
||||
import RouterLoading from "@/components/routerLoading";
|
||||
import Search from "@/components/search";
|
||||
import Updater from "@/components/updater";
|
||||
import { EasterEgg } from "@/components/utils/easterEgg";
|
||||
import WindowChrome from "@/components/windowControls/windowChrome";
|
||||
|
||||
type ApiContext = {
|
||||
api: Api | undefined;
|
||||
@@ -48,7 +48,6 @@ export const Route = createRootRouteWithContext<ApiContext>()({
|
||||
<ThemeProvider theme={theme}>
|
||||
<SnackbarProvider maxSnack={5}>
|
||||
<CssBaseline />
|
||||
<EasterEgg />
|
||||
{/* <NProgress /> */}
|
||||
|
||||
<RouterLoading />
|
||||
@@ -58,6 +57,7 @@ export const Route = createRootRouteWithContext<ApiContext>()({
|
||||
<Search />
|
||||
<RemoteControlDialog />
|
||||
<AppBar />
|
||||
<WindowChrome />
|
||||
<AudioPlayer />
|
||||
<PlaybackSync />
|
||||
<OverlayScrollbar />
|
||||
|
||||
@@ -6,6 +6,7 @@ import React, { useCallback, useState } from "react";
|
||||
import { NavigationDrawer } from "@/components/appBar/navigationDrawer";
|
||||
import CastButton from "@/components/buttons/castButton";
|
||||
import { UserAvatarMenu } from "@/components/userAvatarMenu";
|
||||
import WindowControls from "@/components/windowControls";
|
||||
import useSearchStore from "@/utils/store/search";
|
||||
|
||||
type HomeHeaderProps = {
|
||||
@@ -95,6 +96,7 @@ const HomeHeader = ({ libraries, onNewAndPopular }: HomeHeaderProps) => {
|
||||
<span className="material-symbols-rounded">favorite</span>
|
||||
</IconButton>
|
||||
<UserAvatarMenu />
|
||||
<WindowControls />
|
||||
</div>
|
||||
</header>
|
||||
<NavigationDrawer
|
||||
|
||||
@@ -176,9 +176,20 @@ export function VideoPlayer() {
|
||||
|
||||
const handleReady = async () => {
|
||||
if (api && !isPlayerReady && player.current) {
|
||||
player.current.currentTime = ticksToSec(
|
||||
userDataLastPlayedPositionTicks ?? 0,
|
||||
);
|
||||
const target = ticksToSec(userDataLastPlayedPositionTicks ?? 0);
|
||||
const seekToStartPosition = () => {
|
||||
if (!player.current) return;
|
||||
if (usePlaybackStore.getState().metadata.item?.Id !== itemId) return;
|
||||
const drift = Math.abs(player.current.currentTime - target);
|
||||
if (target > 1 && drift > 5) {
|
||||
player.current.currentTime = target;
|
||||
}
|
||||
};
|
||||
player.current.currentTime = target;
|
||||
// HLS players can reset their position once the manifest loads;
|
||||
// re-apply the transfer/resume position after startup.
|
||||
window.setTimeout(seekToStartPosition, 700);
|
||||
window.setTimeout(seekToStartPosition, 1800);
|
||||
|
||||
if (navigator.mediaSession && mediaSource) {
|
||||
navigator.mediaSession.metadata = new MediaMetadata({
|
||||
@@ -527,7 +538,7 @@ export function VideoPlayer() {
|
||||
}
|
||||
}, []);
|
||||
|
||||
const idleTimerRef = useRef<NodeJS.Timeout | null>(null);
|
||||
const idleTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||
|
||||
// Function to clear the existing idle timer
|
||||
const clearIdleTimer = useCallback(() => {
|
||||
|
||||
@@ -200,6 +200,11 @@ h1 {
|
||||
}
|
||||
}
|
||||
|
||||
/* Keep the end of every page reachable above the floating player bar. */
|
||||
body.has-player-bar #root {
|
||||
padding-bottom: 104px;
|
||||
}
|
||||
|
||||
.audio-playing .scrollY {
|
||||
padding-bottom: 9em !important;
|
||||
}
|
||||
|
||||
@@ -56,6 +56,8 @@ export interface PlaybackInfoOptions {
|
||||
currentEpisodeId?: string;
|
||||
playlistItem?: boolean;
|
||||
playlistItemId?: string;
|
||||
/** Start the stream at this position (used by transfers). */
|
||||
startPositionTicks?: number;
|
||||
}
|
||||
|
||||
export async function getPlaybackInfo(
|
||||
@@ -70,6 +72,7 @@ export async function getPlaybackInfo(
|
||||
currentEpisodeId,
|
||||
playlistItem,
|
||||
playlistItemId,
|
||||
startPositionTicks,
|
||||
} = options;
|
||||
|
||||
let result: any;
|
||||
@@ -223,7 +226,8 @@ export async function getPlaybackInfo(
|
||||
audioStreamIndex: Number(audioStreamIndex),
|
||||
subtitleStreamIndex: currentSubTrack === "nosub" ? -1 : currentSubTrack,
|
||||
itemId: targetItem.Id,
|
||||
startTimeTicks: targetItem.UserData?.PlaybackPositionTicks,
|
||||
startTimeTicks:
|
||||
startPositionTicks ?? targetItem.UserData?.PlaybackPositionTicks,
|
||||
userId: userId,
|
||||
mediaSourceId: targetItem.MediaSources?.[0]?.Id,
|
||||
playbackInfoDto: {
|
||||
|
||||
@@ -191,7 +191,9 @@ export const transferSessionToLocal = async (
|
||||
enableUserData: true,
|
||||
})
|
||||
).data.Items?.[0] ?? item;
|
||||
const playback = await getPlaybackInfo(api, userId, fullItem);
|
||||
const playback = await getPlaybackInfo(api, userId, fullItem, {
|
||||
startPositionTicks: positionTicks,
|
||||
});
|
||||
const queueItems: BaseItemDto[] = playback.item?.Items?.length
|
||||
? playback.item.Items
|
||||
: queue;
|
||||
@@ -211,15 +213,28 @@ export const transferSessionToLocal = async (
|
||||
});
|
||||
}
|
||||
|
||||
// Transfer, not cast: the remote device should stop.
|
||||
try {
|
||||
await getSessionApi(api).sendPlaystateCommand({
|
||||
sessionId: session.Id,
|
||||
command: "Stop",
|
||||
controllingUserId: userId,
|
||||
});
|
||||
} catch (error) {
|
||||
console.warn("Could not stop the remote session", error);
|
||||
// Transfer, not cast: the remote device should stop. Some clients drop
|
||||
// Stop or ignore it while switching streams, so fall back to Pause and
|
||||
// verify that it actually stopped.
|
||||
for (const command of [PlaystateCommand.Stop, PlaystateCommand.Pause]) {
|
||||
try {
|
||||
await getSessionApi(api).sendPlaystateCommand({
|
||||
sessionId: session.Id,
|
||||
command,
|
||||
controllingUserId: userId,
|
||||
});
|
||||
} catch (error) {
|
||||
console.warn("Could not stop the remote session", error);
|
||||
}
|
||||
await sleep(400);
|
||||
try {
|
||||
const target = (await getSessionApi(api).getSessions()).data.find(
|
||||
(entry) => entry.Id === session.Id,
|
||||
);
|
||||
if (!target?.NowPlayingItem || target.PlayState?.IsPaused) return kind;
|
||||
} catch {
|
||||
return kind;
|
||||
}
|
||||
}
|
||||
|
||||
return kind;
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
import { useState } from "react";
|
||||
import useKonami from "react-use-konami";
|
||||
|
||||
export const useKonamiEasterEgg = () => {
|
||||
const [easterEgg, setEasterEgg] = useState(false);
|
||||
const sixtyNine = () => {
|
||||
setEasterEgg(true);
|
||||
};
|
||||
|
||||
useKonami(sixtyNine, {
|
||||
code: [
|
||||
"ArrowUp",
|
||||
"ArrowUp",
|
||||
"ArrowDown",
|
||||
"ArrowDown",
|
||||
"ArrowLeft",
|
||||
"ArrowRight",
|
||||
"ArrowLeft",
|
||||
"ArrowRight",
|
||||
"b",
|
||||
"a",
|
||||
],
|
||||
});
|
||||
|
||||
return [easterEgg, setEasterEgg] as const;
|
||||
};
|
||||
@@ -1,142 +0,0 @@
|
||||
import { WebviewWindow } from "@tauri-apps/api/webviewWindow";
|
||||
import type ReactPlayer from "react-player";
|
||||
|
||||
type VideoPlayerState = {
|
||||
ref: React.RefObject<ReactPlayer | null>;
|
||||
isPlayerReady: boolean;
|
||||
isPlayerPlaying: boolean;
|
||||
isPlayerMuted: boolean;
|
||||
isPlayerFullscreen: boolean;
|
||||
/**
|
||||
* Volume of the player
|
||||
* @type {number} 0 to 1
|
||||
*/
|
||||
playerVolume: number;
|
||||
isSeeking: boolean;
|
||||
sliderSeek: number;
|
||||
/**
|
||||
* Progress of the video
|
||||
* @type {number} in C# ticks
|
||||
*/
|
||||
progress: number;
|
||||
isHovering: boolean;
|
||||
};
|
||||
|
||||
export enum VideoPlayerActionKind {
|
||||
SET_PLAYER_REF = "SET_PLAYER_REF",
|
||||
SET_PLAYER_READY = "SET_PLAYER_READY",
|
||||
SET_PLAYER_PLAYING = "SET_PLAYER_PLAYING",
|
||||
SET_PLAYER_MUTED = "SET_PLAYER_MUTED",
|
||||
SET_PLAYER_FULLSCREEN = "SET_PLAYER_FULLSCREEN",
|
||||
SET_PLAYER_VOLUME = "SET_PLAYER_VOLUME",
|
||||
SET_PLAYER_VOLUME_UP_BY_STEP = "SET_PLAYER_VOLUME_BY_STEP",
|
||||
SET_PLAYER_VOLUME_DOWN_BY_STEP = "SET_PLAYER_VOLUME_DOWN_STEP",
|
||||
SET_SEEKING = "SET_SEEKING",
|
||||
SET_SLIDER_SEEK = "SET_SLIDER_SEEK",
|
||||
SET_PROGRESS = "SET_PROGRESS",
|
||||
SET_HOVERING = "SET_HOVERING",
|
||||
TOGGLE_PLAYER_PLAYING = "TOGGLE_PLAYER_PLAYING",
|
||||
TOGGLE_PLAYER_FULLSCREEN = "TOGGLE_PLAYER_FULLSCREEN",
|
||||
TOGGLE_PLAYER_MUTED = "TOGGLE_PLAYER_MUTED",
|
||||
}
|
||||
|
||||
export interface VideoPlayerAction {
|
||||
type: VideoPlayerActionKind;
|
||||
payload?: number | boolean | React.RefObject<HTMLVideoElement>;
|
||||
}
|
||||
|
||||
const reducer = (
|
||||
state: VideoPlayerState,
|
||||
action: VideoPlayerAction,
|
||||
): VideoPlayerState => {
|
||||
switch (action.type) {
|
||||
case VideoPlayerActionKind.SET_PLAYER_REF:
|
||||
return {
|
||||
...state,
|
||||
ref: action.payload as unknown as React.RefObject<ReactPlayer | null>,
|
||||
};
|
||||
case VideoPlayerActionKind.SET_PLAYER_READY:
|
||||
return {
|
||||
...state,
|
||||
isPlayerReady: action.payload as boolean,
|
||||
};
|
||||
case VideoPlayerActionKind.SET_PLAYER_PLAYING:
|
||||
return {
|
||||
...state,
|
||||
isPlayerPlaying: action.payload as boolean,
|
||||
};
|
||||
case VideoPlayerActionKind.SET_PLAYER_MUTED:
|
||||
return {
|
||||
...state,
|
||||
isPlayerMuted: action.payload as boolean,
|
||||
};
|
||||
case VideoPlayerActionKind.SET_PLAYER_FULLSCREEN:
|
||||
return {
|
||||
...state,
|
||||
isPlayerFullscreen: action.payload as boolean,
|
||||
};
|
||||
case VideoPlayerActionKind.SET_PLAYER_VOLUME:
|
||||
return {
|
||||
...state,
|
||||
playerVolume: action.payload as number,
|
||||
};
|
||||
case VideoPlayerActionKind.SET_SEEKING:
|
||||
return {
|
||||
...state,
|
||||
isSeeking: action.payload as boolean,
|
||||
};
|
||||
case VideoPlayerActionKind.SET_SLIDER_SEEK:
|
||||
return {
|
||||
...state,
|
||||
sliderSeek: action.payload as number,
|
||||
};
|
||||
case VideoPlayerActionKind.SET_PROGRESS:
|
||||
return {
|
||||
...state,
|
||||
progress: action.payload as number,
|
||||
};
|
||||
case VideoPlayerActionKind.SET_HOVERING:
|
||||
return {
|
||||
...state,
|
||||
isHovering: action.payload as boolean,
|
||||
};
|
||||
case VideoPlayerActionKind.TOGGLE_PLAYER_PLAYING:
|
||||
return {
|
||||
...state,
|
||||
isPlayerPlaying: !state.isPlayerPlaying,
|
||||
};
|
||||
case VideoPlayerActionKind.TOGGLE_PLAYER_FULLSCREEN: {
|
||||
WebviewWindow.getCurrent().setFullscreen(!state.isPlayerFullscreen);
|
||||
return {
|
||||
...state,
|
||||
isPlayerFullscreen: !state.isPlayerFullscreen,
|
||||
};
|
||||
}
|
||||
case VideoPlayerActionKind.TOGGLE_PLAYER_MUTED:
|
||||
return {
|
||||
...state,
|
||||
isPlayerMuted: !state.isPlayerMuted,
|
||||
};
|
||||
case VideoPlayerActionKind.SET_PLAYER_VOLUME_UP_BY_STEP:
|
||||
return {
|
||||
...state,
|
||||
playerVolume: Math.min(
|
||||
1,
|
||||
Math.max(0, state.playerVolume + (action.payload as number)),
|
||||
),
|
||||
};
|
||||
case VideoPlayerActionKind.SET_PLAYER_VOLUME_DOWN_BY_STEP:
|
||||
return {
|
||||
...state,
|
||||
playerVolume: Math.min(
|
||||
1,
|
||||
Math.max(0, state.playerVolume - (action.payload as number)),
|
||||
),
|
||||
};
|
||||
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
};
|
||||
|
||||
export default reducer;
|
||||
@@ -130,7 +130,7 @@ type PlaybackStoreState = {
|
||||
* This is used to show the volume change indicator in the UI
|
||||
*/
|
||||
isVolumeInidcatorVisible: boolean;
|
||||
volumeIndicatorVisibleTimeoutId: NodeJS.Timeout | null;
|
||||
volumeIndicatorVisibleTimeoutId: ReturnType<typeof setTimeout> | null;
|
||||
};
|
||||
|
||||
type PlaybackStoreActions = {
|
||||
@@ -690,7 +690,11 @@ export const playItem = (args: {
|
||||
state.playbackStream = args.playbackStream;
|
||||
state.playsessionId = args.playsessionId;
|
||||
state.metadata = args.metadata;
|
||||
state.playerState.currentTime = args.userDataPlayedPositionTicks;
|
||||
// Transfers pass an explicit start position; it must win over the
|
||||
// item's saved resume point (otherwise the video jumps back).
|
||||
state.playerState.currentTime =
|
||||
args.metadata.userDataLastPlayedPositionTicks ??
|
||||
args.userDataPlayedPositionTicks;
|
||||
state.userId = args.userId;
|
||||
state.playerState.isPlayerPlaying = true;
|
||||
state.playerState.isPlayerReady = false; // Reset player ready state
|
||||
|
||||
Reference in new issue
Block a user