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:
ze0s 2024-09-02 11:10:45 +02:00 committed by GitHub
parent 472d327308
commit bc0f4cc055
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
59 changed files with 2533 additions and 371 deletions

View file

@ -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"),

View file

@ -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,
});

View file

@ -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
};