Skip to content

Commit

Permalink
v5.6.0-beta.1 (#116)
Browse files Browse the repository at this point in the history
* Fix displaying versions in web/desktop
* Update deps
* Tag 5.6.0-beta.1
  • Loading branch information
ikatson authored Apr 6, 2024
1 parent 5eb01ac commit e18a711
Show file tree
Hide file tree
Showing 13 changed files with 628 additions and 672 deletions.
209 changes: 106 additions & 103 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion crates/librqbit/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "librqbit"
version = "5.6.0-beta.0"
version = "5.6.0-beta.1"
authors = ["Igor Katson <[email protected]>"]
edition = "2021"
description = "The main library used by rqbit torrent client. The binary is just a small wrapper on top of it."
Expand Down
2 changes: 1 addition & 1 deletion crates/librqbit/webui/dist/assets/index.css

Large diffs are not rendered by default.

28 changes: 14 additions & 14 deletions crates/librqbit/webui/dist/assets/index.js

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions crates/librqbit/webui/dist/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
"src": "assets/logo.svg"
},
"index.css": {
"file": "assets/index-d46108e9.css",
"file": "assets/index-58bde067.css",
"src": "index.css"
},
"index.html": {
"css": [
"assets/index-d46108e9.css"
"assets/index-58bde067.css"
],
"file": "assets/index-87e26627.js",
"file": "assets/index-3519fca6.js",
"isEntry": true,
"src": "index.html"
}
Expand Down
13 changes: 9 additions & 4 deletions crates/librqbit/webui/src/components/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,21 @@ import { MagnetInput } from "./buttons/MagnetInput";
// @ts-ignore
import Logo from "../../assets/logo.svg?react";

export const Header = ({ title }: { title: string }) => {
const [name, version] = title.split("-");
export const Header = ({
title,
version,
}: {
title: string;
version: string;
}) => {
return (
<header className="bg-slate-50 drop-shadow-lg flex flex-wrap justify-center lg:justify-between items-center dark:bg-slate-800 mb-3">
<div className="flex flex-nowrap items-center justify-between m-2">
<Logo className="w-10 h-10 p-1" alt="logo" />
<h1 className="flex items-center dark:text-white">
<div className="text-3xl">{name}</div>
<div className="text-3xl">{title}</div>
<div className="bg-blue-100 text-blue-800 text-xl font-semibold me-2 px-2.5 py-0.5 rounded ms-2 dark:bg-blue-900 dark:text-white">
{version}
v{version}
</div>
</h1>
</div>
Expand Down
10 changes: 5 additions & 5 deletions crates/librqbit/webui/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,32 @@ import { API } from "./http-api";
import "./globals.css";

const RootWithVersion = () => {
let [title, setTitle] = useState<string>("rqbit web UI");
let [version, setVersion] = useState<string>("");
useEffect(() => {
const refreshVersion = () =>
API.getVersion().then(
(version) => {
setVersion(version);
const title = `rqbit web UI - v${version}`;
setTitle(title);
document.title = title;
return 10000;
},
(e) => {
return 1000;
}
},
);
return customSetInterval(refreshVersion, 0);
}, []);

return (
<APIContext.Provider value={API}>
<RqbitWebUI title={title} />
<RqbitWebUI title="rqbit web UI" version={version} />
</APIContext.Provider>
);
};

ReactDOM.createRoot(document.getElementById("app") as HTMLInputElement).render(
<StrictMode>
<RootWithVersion />
</StrictMode>
</StrictMode>,
);
19 changes: 7 additions & 12 deletions crates/librqbit/webui/src/rqbit-web.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,26 @@ export interface ContextType {

export const RqbitWebUI = (props: {
title: string;
version: string;
menuButtons?: JSX.Element[];
}) => {
let [logsOpened, setLogsOpened] = useState<boolean>(false);
const setCloseableError = useErrorStore((state) => state.setCloseableError);
const setOtherError = useErrorStore((state) => state.setOtherError);

const API = useContext(APIContext);

const setTorrents = useTorrentStore((state) => state.setTorrents);
const setTorrentsLoading = useTorrentStore(
(state) => state.setTorrentsLoading
(state) => state.setTorrentsLoading,
);
const setRefreshTorrents = useTorrentStore(
(state) => state.setRefreshTorrents
(state) => state.setRefreshTorrents,
);

const refreshTorrents = async () => {
setTorrentsLoading(true);
let torrents = await API.listTorrents().finally(() =>
setTorrentsLoading(false)
setTorrentsLoading(false),
);
setTorrents(torrents.torrents);
};
Expand All @@ -60,20 +60,15 @@ export const RqbitWebUI = (props: {
setOtherError({ text: "Error refreshing torrents", details: e });
console.error(e);
return 5000;
}
},
),
0
0,
);
}, []);

const context: ContextType = {
setCloseableError,
refreshTorrents,
};

return (
<div className="dark:bg-gray-900 dark:text-gray-200 min-h-screen">
<Header title={props.title} />
<Header title={props.title} version={props.version} />
<div className="relative">
{/* Menu buttons */}
<div className="absolute top-0 start-0 pl-2 z-10">
Expand Down
2 changes: 1 addition & 1 deletion crates/rqbit/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "rqbit"
version = "5.6.0-beta.0"
version = "5.6.0-beta.1"
authors = ["Igor Katson <[email protected]>"]
edition = "2021"
description = "A bittorrent command line client and server."
Expand Down
22 changes: 11 additions & 11 deletions desktop/index.html
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>rqbit web 4.0.0-beta.0</title>
<link rel="icon" type="image/svg+xml" href="assets/logo.svg" />
</head>
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>rqbit desktop</title>
<link rel="icon" type="image/svg+xml" href="assets/logo.svg" />
</head>

<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
</body>
</html>
Loading

0 comments on commit e18a711

Please sign in to comment.