feat(download-clients): add transmission (#350)

This commit is contained in:
Ludvig Lundgren 2022-07-10 18:01:58 +02:00 committed by GitHub
parent b03edbfc87
commit 7eefeb54c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 200 additions and 21 deletions

View file

@ -176,6 +176,11 @@ export const DownloadClientTypeOptions: RadioFieldsetOption[] = [
description: "Add torrents directly to Deluge 2",
value: "DELUGE_V2"
},
{
label: "Transmission",
description: "Add torrents directly to Transmission",
value: "TRANSMISSION"
},
{
label: "Radarr",
description: "Send to Radarr and let it decide",
@ -202,6 +207,7 @@ export const DownloadClientTypeNameMap: Record<DownloadClientType | string, stri
"DELUGE_V1": "Deluge v1",
"DELUGE_V2": "Deluge v2",
"QBITTORRENT": "qBittorrent",
"TRANSMISSION": "Transmission",
"RADARR": "Radarr",
"SONARR": "Sonarr",
"LIDARR": "Lidarr",
@ -216,6 +222,7 @@ export const ActionTypeOptions: RadioFieldsetOption[] = [
{ label: "qBittorrent", description: "Add torrents directly to qBittorrent", value: "QBITTORRENT" },
{ label: "Deluge", description: "Add torrents directly to Deluge", value: "DELUGE_V1" },
{ label: "Deluge v2", description: "Add torrents directly to Deluge 2", value: "DELUGE_V2" },
{ label: "Transmission", description: "Add torrents directly to Transmission", value: "TRANSMISSION" },
{ label: "Radarr", description: "Send to Radarr and let it decide", value: "RADARR" },
{ label: "Sonarr", description: "Send to Sonarr and let it decide", value: "SONARR" },
{ label: "Lidarr", description: "Send to Lidarr and let it decide", value: "LIDARR" },
@ -230,6 +237,7 @@ export const ActionTypeNameMap = {
"DELUGE_V1": "Deluge v1",
"DELUGE_V2": "Deluge v2",
"QBITTORRENT": "qBittorrent",
"TRANSMISSION": "Transmission",
"RADARR": "Radarr",
"SONARR": "Sonarr",
"LIDARR": "Lidarr",

View file

@ -13,8 +13,7 @@ import { toast } from "react-hot-toast";
import Toast from "../../components/notifications/Toast";
import { useToggle } from "../../hooks/hooks";
import { DeleteModal } from "../../components/modals";
import { NumberFieldWide, PasswordFieldWide, SwitchGroupWide, TextFieldWide } from "../../components/inputs/input_wide";
import { RadioFieldsetWide } from "../../components/inputs/radio";
import { NumberFieldWide, PasswordFieldWide, SwitchGroupWide, TextFieldWide, RadioFieldsetWide } from "../../components/inputs";
import DownloadClient from "../../screens/settings/DownloadClient";
interface InitialValuesSettings {
@ -137,6 +136,33 @@ function FormFieldsQbit() {
);
}
function FormFieldsTransmission() {
const {
values: { tls }
} = useFormikContext<InitialValues>();
return (
<Fragment>
<TextFieldWide name="host" label="Host" help="Eg. client.domain.ltd, domain.ltd/client, domain.ltd"/>
<NumberFieldWide name="port" label="Port" help="Port for Transmission"/>
<div className="py-6 px-6 space-y-6 sm:py-0 sm:space-y-0 sm:divide-y sm:divide-gray-200 dark:divide-gray-700">
<SwitchGroupWide name="tls" label="TLS"/>
{tls && (
<Fragment>
<SwitchGroupWide name="tls_skip_verify" label="Skip TLS verification (insecure)"/>
</Fragment>
)}
</div>
<TextFieldWide name="username" label="Username"/>
<PasswordFieldWide name="password" label="Password"/>
</Fragment>
);
}
export interface componentMapType {
[key: string]: React.ReactElement;
}
@ -145,6 +171,7 @@ export const componentMap: componentMapType = {
DELUGE_V1: <FormFieldsDefault/>,
DELUGE_V2: <FormFieldsDefault/>,
QBITTORRENT: <FormFieldsQbit/>,
TRANSMISSION: <FormFieldsTransmission/>,
RADARR: <FormFieldsArr/>,
SONARR: <FormFieldsArr/>,
LIDARR: <FormFieldsArr/>,
@ -221,7 +248,7 @@ function FormFieldsRules() {
export const rulesComponentMap: componentMapType = {
DELUGE_V1: <FormFieldsRulesBasic/>,
DELUGE_V2: <FormFieldsRulesBasic/>,
QBITTORRENT: <FormFieldsRules/>
QBITTORRENT: <FormFieldsRules/>,
};
interface formButtonsProps {

View file

@ -819,6 +819,35 @@ function FilterActionsItem({ action, clients, idx, remove }: FilterActionsItemPr
</div>
</div>
);
case "TRANSMISSION":
return (
<div>
<div className="mt-6 grid grid-cols-12 gap-6">
<DownloadClientSelect
name={`actions.${idx}.client_id`}
action={action}
clients={clients}
/>
<div className="col-span-12 sm:col-span-6">
<TextField
name={`actions.${idx}.save_path`}
label="Save path"
columns={6}
/>
</div>
</div>
<div className="mt-6 grid grid-cols-12 gap-6">
<div className="col-span-6">
<SwitchGroup
name={`actions.${idx}.paused`}
label="Add paused"
/>
</div>
</div>
</div>
);
case "RADARR":
case "SONARR":
case "LIDARR":

View file

@ -2,6 +2,7 @@ type DownloadClientType =
"QBITTORRENT" |
"DELUGE_V1" |
"DELUGE_V2" |
"TRANSMISSION" |
"RADARR" |
"SONARR" |
"LIDARR" |