feat(desktop): Yoda integration patches on v8.1.1
- macOS-style window controls via gtk-decoration-layout - torrent file preview and context menu improvements - single-instance relay for new torrents/magnet links
This commit is contained in:
parent
00b9748516
commit
99219f90bc
8 changed files with 405 additions and 13 deletions
|
|
@ -133,6 +133,9 @@ export const makeAPI = (configuration: RqbitDesktopConfig): RqbitAPI => {
|
|||
delete: function (id: number): Promise<void> {
|
||||
return invokeAPI<void>("torrent_action_delete", { id });
|
||||
},
|
||||
openOutputFolder: function (path: string): Promise<void> {
|
||||
return invokeAPI<void>("open_output_folder", { path });
|
||||
},
|
||||
getTorrentStreamUrl: () => {
|
||||
return "";
|
||||
},
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { useState } from "react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { listen } from "@tauri-apps/api/event";
|
||||
import { RqbitWebUI } from "rqbit-webui/src/rqbit-web";
|
||||
import { CurrentDesktopState, RqbitDesktopConfig } from "./configuration";
|
||||
import { ConfigModal } from "./configure";
|
||||
|
|
@ -6,6 +7,13 @@ import { IconButton } from "rqbit-webui/src/components/buttons/IconButton";
|
|||
import { BsSliders2 } from "react-icons/bs";
|
||||
import { APIContext } from "rqbit-webui/src/context";
|
||||
import { makeAPI } from "./api";
|
||||
import { useTorrentStore } from "rqbit-webui/src/stores/torrentStore";
|
||||
|
||||
const TORRENTS_CHANGED_EVENT = "rqbit-desktop-torrents-changed";
|
||||
|
||||
type TorrentsChangedPayload = {
|
||||
id?: number;
|
||||
};
|
||||
|
||||
export const RqbitDesktop: React.FC<{
|
||||
version: string;
|
||||
|
|
@ -18,6 +26,31 @@ export const RqbitDesktop: React.FC<{
|
|||
);
|
||||
let [configurationOpened, setConfigurationOpened] = useState<boolean>(false);
|
||||
|
||||
useEffect(() => {
|
||||
if (!configured) {
|
||||
return;
|
||||
}
|
||||
|
||||
let cancelled = false;
|
||||
const unlisten = listen<TorrentsChangedPayload>(TORRENTS_CHANGED_EVENT, (event) => {
|
||||
if (event.payload.id != null) {
|
||||
useTorrentStore.getState().focusTorrent(event.payload.id);
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
if (cancelled) {
|
||||
return;
|
||||
}
|
||||
useTorrentStore.getState().refreshTorrents();
|
||||
}, 250);
|
||||
});
|
||||
|
||||
return () => {
|
||||
cancelled = true;
|
||||
unlisten.then((cleanup) => cleanup());
|
||||
};
|
||||
}, [configured]);
|
||||
|
||||
const configButton = (
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue