feat(releases): support magnet links (#730)

* feat(releases): support magnet links

* feat(feeds): support magnet links

* feat(actions): log messages

* fix: component warning

* fix: check hasprefix instead of hassuffix for magnet

* feat(release): resolve magnet uri from link

* fix(actions): deluge use magnet uri

* fix(macros): add `MagnetURI` var

* fix(actions): run magnet resolving before macros

* feat(feeds): set download type on creation
This commit is contained in:
ze0s 2023-02-28 22:16:10 +01:00 committed by GitHub
parent c6101cc765
commit ca196f0bf1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
32 changed files with 770 additions and 260 deletions

View file

@ -5,11 +5,13 @@ import { toast } from "react-hot-toast";
import Toast from "../../components/notifications/Toast";
import { SlideOver } from "../../components/panels";
import { NumberFieldWide, PasswordFieldWide, SwitchGroupWide, TextFieldWide } from "../../components/inputs";
import { SelectFieldBasic } from "../../components/inputs/select_wide";
import { componentMapType } from "./DownloadClientForms";
import { sleep } from "../../utils";
import { useState } from "react";
import { ImplementationBadges } from "../../screens/settings/Indexer";
import { useFormikContext } from "formik";
import { FeedDownloadTypeOptions } from "../../domain/constants";
interface UpdateProps {
isOpen: boolean;
@ -29,6 +31,7 @@ interface InitialValues {
interval: number;
timeout: number;
max_age: number;
settings: FeedSettings;
}
export function FeedUpdateForm({ isOpen, toggle, feed }: UpdateProps) {
@ -110,7 +113,8 @@ export function FeedUpdateForm({ isOpen, toggle, feed }: UpdateProps) {
cookie: feed.cookie || "",
interval: feed.interval,
timeout: feed.timeout,
max_age: feed.max_age
max_age: feed.max_age,
settings: feed.settings
};
return (
@ -186,6 +190,8 @@ function FormFieldsTorznab() {
help="Torznab url"
/>
<SelectFieldBasic name="settings.download_type" label="Download type" options={FeedDownloadTypeOptions} />
<PasswordFieldWide name="api_key" label="API key" />
{interval < 15 && <WarningLabel />}
@ -210,6 +216,8 @@ function FormFieldsRSS() {
help="RSS url"
/>
<SelectFieldBasic name="settings.download_type" label="Download type" options={FeedDownloadTypeOptions} />
{interval < 15 && <WarningLabel />}
<NumberFieldWide name="interval" label="Refresh interval" help="Minutes. Recommended 15-30. Too low and risk ban."/>
<NumberFieldWide name="timeout" label="Refresh timeout" help="Seconds to wait before cancelling refresh."/>

View file

@ -15,9 +15,10 @@ import { APIClient } from "../../api/APIClient";
import { PasswordFieldWide, SwitchGroupWide, TextFieldWide } from "../../components/inputs";
import { SlideOver } from "../../components/panels";
import Toast from "../../components/notifications/Toast";
import { SelectFieldCreatable } from "../../components/inputs/select_wide";
import { SelectFieldBasic, SelectFieldCreatable } from "../../components/inputs/select_wide";
import { CustomTooltip } from "../../components/tooltips/CustomTooltip";
import { FeedDownloadTypeOptions } from "../../domain/constants";
const Input = (props: InputProps) => (
<components.Input
@ -123,6 +124,14 @@ const FeedSettingFields = (ind: IndexerDefinition, indexer: string) => {
}
return null;
})}
<SelectFieldBasic
name="feed.settings.download_type"
label="Download type"
options={FeedDownloadTypeOptions}
tooltip={<span>Some feeds needs to force set as Magnet.</span>}
help="Set to Torrent or Magnet depending on indexer."
/>
</div>
)}
</Fragment>
@ -154,6 +163,14 @@ const RSSFeedSettingFields = (ind: IndexerDefinition, indexer: string) => {
}
return null;
})}
<SelectFieldBasic
name="feed.settings.download_type"
label="Download type"
options={FeedDownloadTypeOptions}
tooltip={<span>Some feeds needs to force set as Magnet.</span>}
help="Set to Torrent or Magnet depending on indexer."
/>
</div>
)}
</Fragment>
@ -243,7 +260,8 @@ export function IndexerAddForm({ isOpen, toggle }: AddProps) {
api_key: formData.feed.api_key,
interval: 30,
timeout: 60,
indexer_id: 0
indexer_id: 0,
settings: formData.feed.settings
};
mutation.mutate(formData as Indexer, {
@ -264,7 +282,8 @@ export function IndexerAddForm({ isOpen, toggle }: AddProps) {
url: formData.feed.url,
interval: 30,
timeout: 60,
indexer_id: 0
indexer_id: 0,
settings: formData.feed.settings
};
mutation.mutate(formData as Indexer, {