mirror of
https://github.com/idanoo/autobrr
synced 2025-07-25 17:59:14 +00:00
feat: add support for proxies to use with IRC and Indexers (#1421)
* feat: add support for proxies * fix(http): release handler * fix(migrations): define proxy early * fix(migrations): pg proxy * fix(proxy): list update delete * fix(proxy): remove log and imports * feat(irc): use proxy * feat(irc): tests * fix(web): update imports for ProxyForms.tsx * fix(database): migration * feat(proxy): test * feat(proxy): validate proxy type * feat(proxy): validate and test * feat(proxy): improve validate and test * feat(proxy): fix db schema * feat(proxy): add db tests * feat(proxy): handle http errors * fix(http): imports * feat(proxy): use proxy for indexer downloads * feat(proxy): indexerforms select proxy * feat(proxy): handle torrent download * feat(proxy): skip if disabled * feat(proxy): imports * feat(proxy): implement in Feeds * feat(proxy): update helper text indexer proxy * feat(proxy): add internal cache
This commit is contained in:
parent
472d327308
commit
bc0f4cc055
59 changed files with 2533 additions and 371 deletions
|
@ -389,6 +389,20 @@ export const APIClient = {
|
|||
body: notification
|
||||
})
|
||||
},
|
||||
proxy: {
|
||||
list: () => appClient.Get<Proxy[]>("api/proxy"),
|
||||
getByID: (id: number) => appClient.Get<Proxy>(`api/proxy/${id}`),
|
||||
store: (proxy: ProxyCreate) => appClient.Post("api/proxy", {
|
||||
body: proxy
|
||||
}),
|
||||
update: (proxy: Proxy) => appClient.Put(`api/proxy/${proxy.id}`, {
|
||||
body: proxy
|
||||
}),
|
||||
delete: (id: number) => appClient.Delete(`api/proxy/${id}`),
|
||||
test: (proxy: Proxy) => appClient.Post("api/proxy/test", {
|
||||
body: proxy
|
||||
})
|
||||
},
|
||||
release: {
|
||||
find: (query?: string) => appClient.Get<ReleaseFindResponse>(`api/release${query}`),
|
||||
findRecent: () => appClient.Get<ReleaseFindResponse>("api/release/recent"),
|
||||
|
|
|
@ -11,7 +11,7 @@ import {
|
|||
FeedKeys,
|
||||
FilterKeys,
|
||||
IndexerKeys,
|
||||
IrcKeys, NotificationKeys,
|
||||
IrcKeys, NotificationKeys, ProxyKeys,
|
||||
ReleaseKeys,
|
||||
SettingsKeys
|
||||
} from "@api/query_keys";
|
||||
|
@ -137,3 +137,17 @@ export const ReleasesIndexersQueryOptions = () =>
|
|||
placeholderData: keepPreviousData,
|
||||
staleTime: Infinity
|
||||
});
|
||||
|
||||
export const ProxiesQueryOptions = () =>
|
||||
queryOptions({
|
||||
queryKey: ProxyKeys.lists(),
|
||||
queryFn: () => APIClient.proxy.list(),
|
||||
refetchOnWindowFocus: false
|
||||
});
|
||||
|
||||
export const ProxyByIdQueryOptions = (proxyId: number) =>
|
||||
queryOptions({
|
||||
queryKey: ProxyKeys.detail(proxyId),
|
||||
queryFn: async ({queryKey}) => await APIClient.proxy.getByID(queryKey[2]),
|
||||
retry: false,
|
||||
});
|
||||
|
|
|
@ -79,4 +79,11 @@ export const NotificationKeys = {
|
|||
lists: () => [...NotificationKeys.all, "list"] as const,
|
||||
details: () => [...NotificationKeys.all, "detail"] as const,
|
||||
detail: (id: number) => [...NotificationKeys.details(), id] as const
|
||||
};
|
||||
};
|
||||
|
||||
export const ProxyKeys = {
|
||||
all: ["proxy"] as const,
|
||||
lists: () => [...ProxyKeys.all, "list"] as const,
|
||||
details: () => [...ProxyKeys.all, "detail"] as const,
|
||||
detail: (id: number) => [...ProxyKeys.details(), id] as const
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue