Rename Aria2c to Aria2
This commit is contained in:
parent
3b207f3250
commit
26c8296621
@ -5,14 +5,14 @@ description: Aria2 Widget Configuration
|
|||||||
|
|
||||||
Learn more about [Aria2](https://github.com/aria2/aria2).
|
Learn more about [Aria2](https://github.com/aria2/aria2).
|
||||||
|
|
||||||
Find your API key in aria2c configuration file `aria2c.conf`: `rpc-secret`.
|
Find your API key in aria2 configuration file `aria2c.conf`: `rpc-secret`.
|
||||||
To make it work, JSON RPC in Aria2 should be enabled.
|
To make it work, JSON RPC in Aria2 should be enabled.
|
||||||
|
|
||||||
Optionally, `jsonrpc` endpoint path could be adjusted via `endpoint` widget config.
|
Optionally, `jsonrpc` endpoint path could be adjusted via `endpoint` widget config.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
widget:
|
widget:
|
||||||
type: aria2c
|
type: aria2
|
||||||
url: http://aria2c.host.or.ip
|
url: http://aria2.host.or.ip
|
||||||
key: apikey
|
key: apikey
|
||||||
```
|
```
|
||||||
|
|||||||
@ -1008,10 +1008,10 @@
|
|||||||
"merges": "Merge Requests",
|
"merges": "Merge Requests",
|
||||||
"projects": "Projects"
|
"projects": "Projects"
|
||||||
},
|
},
|
||||||
"aria2c": {
|
"aria2": {
|
||||||
"active": "Active",
|
"active": "Active",
|
||||||
"waiting": "Waiting",
|
"waiting": "Waiting",
|
||||||
"download": "↓",
|
"download": "Download",
|
||||||
"upload": "↑"
|
"upload": "Upload"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
37
src/widgets/aria2/component.jsx
Normal file
37
src/widgets/aria2/component.jsx
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
import { useTranslation } from "next-i18next";
|
||||||
|
|
||||||
|
import Container from "components/services/widget/container";
|
||||||
|
import Block from "components/services/widget/block";
|
||||||
|
import useWidgetAPI from "utils/proxy/use-widget-api";
|
||||||
|
|
||||||
|
export default function Component({ service }) {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
const { widget } = service;
|
||||||
|
|
||||||
|
const { data: aria2Data, error: aria2Error } = useWidgetAPI(widget);
|
||||||
|
|
||||||
|
if (aria2Error) {
|
||||||
|
return <Container service={service} error={aria2Error} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!aria2Data) {
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="aria2.active" />
|
||||||
|
<Block label="aria2.waiting" />
|
||||||
|
<Block label="aria2.download" />
|
||||||
|
<Block label="aria2.upload" />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Container service={service}>
|
||||||
|
<Block label="aria2.active" value={t("common.number", { value: aria2Data.numActive })} />
|
||||||
|
<Block label="aria2.waiting" value={t("common.number", { value: aria2Data.numWaiting })} />
|
||||||
|
<Block label="aria2.download" value={t("common.byterate", { value: parseInt(aria2Data.downloadSpeed, 10) })} />
|
||||||
|
<Block label="aria2.upload" value={t("common.byterate", { value: parseInt(aria2Data.uploadSpeed, 10) })} />
|
||||||
|
</Container>
|
||||||
|
);
|
||||||
|
}
|
||||||
@ -56,7 +56,7 @@ export default async function ariaProxyHandler(req, res) {
|
|||||||
|
|
||||||
return res.status(200).send(rawData.result);
|
return res.status(200).send(rawData.result);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return res.status(500).json({ error: { message: e?.toString() ?? "Error parsing aria2c rpc data", url, data } });
|
return res.status(500).json({ error: { message: e?.toString() ?? "Error parsing aria2 rpc data", url, data } });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1,37 +0,0 @@
|
|||||||
import { useTranslation } from "next-i18next";
|
|
||||||
|
|
||||||
import Container from "components/services/widget/container";
|
|
||||||
import Block from "components/services/widget/block";
|
|
||||||
import useWidgetAPI from "utils/proxy/use-widget-api";
|
|
||||||
|
|
||||||
export default function Component({ service }) {
|
|
||||||
const { t } = useTranslation();
|
|
||||||
|
|
||||||
const { widget } = service;
|
|
||||||
|
|
||||||
const { data: aria2cData, error: aria2cError } = useWidgetAPI(widget);
|
|
||||||
|
|
||||||
if (aria2cError) {
|
|
||||||
return <Container service={service} error={aria2cError} />;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!aria2cData) {
|
|
||||||
return (
|
|
||||||
<Container service={service}>
|
|
||||||
<Block label="aria2c.active" />
|
|
||||||
<Block label="aria2c.waiting" />
|
|
||||||
<Block label="aria2c.download" />
|
|
||||||
<Block label="aria2c.upload" />
|
|
||||||
</Container>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Container service={service}>
|
|
||||||
<Block label="aria2c.active" value={t("common.number", { value: aria2cData.numActive })} />
|
|
||||||
<Block label="aria2c.waiting" value={t("common.number", { value: aria2cData.numWaiting })} />
|
|
||||||
<Block label="aria2c.download" value={t("common.byterate", { value: parseInt(aria2cData.downloadSpeed, 10) })} />
|
|
||||||
<Block label="aria2c.upload" value={t("common.byterate", { value: parseInt(aria2cData.uploadSpeed, 10) })} />
|
|
||||||
</Container>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@ -3,7 +3,7 @@ import dynamic from "next/dynamic";
|
|||||||
const components = {
|
const components = {
|
||||||
adguard: dynamic(() => import("./adguard/component")),
|
adguard: dynamic(() => import("./adguard/component")),
|
||||||
argocd: dynamic(() => import("./argocd/component")),
|
argocd: dynamic(() => import("./argocd/component")),
|
||||||
aria2c: dynamic(() => import("./aria2c/component")),
|
aria2: dynamic(() => import("./aria2/component")),
|
||||||
atsumeru: dynamic(() => import("./atsumeru/component")),
|
atsumeru: dynamic(() => import("./atsumeru/component")),
|
||||||
audiobookshelf: dynamic(() => import("./audiobookshelf/component")),
|
audiobookshelf: dynamic(() => import("./audiobookshelf/component")),
|
||||||
authentik: dynamic(() => import("./authentik/component")),
|
authentik: dynamic(() => import("./authentik/component")),
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
import adguard from "./adguard/widget";
|
import adguard from "./adguard/widget";
|
||||||
import argocd from "./argocd/widget";
|
import argocd from "./argocd/widget";
|
||||||
import aria2c from "./aria2c/widget";
|
import aria2 from "./aria2/widget";
|
||||||
import atsumeru from "./atsumeru/widget";
|
import atsumeru from "./atsumeru/widget";
|
||||||
import audiobookshelf from "./audiobookshelf/widget";
|
import audiobookshelf from "./audiobookshelf/widget";
|
||||||
import authentik from "./authentik/widget";
|
import authentik from "./authentik/widget";
|
||||||
@ -135,7 +135,7 @@ import zabbix from "./zabbix/widget";
|
|||||||
const widgets = {
|
const widgets = {
|
||||||
adguard,
|
adguard,
|
||||||
argocd,
|
argocd,
|
||||||
aria2c,
|
aria2,
|
||||||
atsumeru,
|
atsumeru,
|
||||||
audiobookshelf,
|
audiobookshelf,
|
||||||
authentik,
|
authentik,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user