feat: add support for multiple integration kind options (#127)
* feat: add support for multiple integration kind options * fix: deepsource issue JS-0417 missing use callback
This commit is contained in:
@@ -11,112 +11,112 @@ export const integrationSecretKinds = objectKeys(integrationSecretKindObject);
|
||||
export const integrationDefs = {
|
||||
sabNzbd: {
|
||||
name: "SABnzbd",
|
||||
secretKinds: ["apiKey"],
|
||||
secretKinds: [["apiKey"]],
|
||||
iconUrl:
|
||||
"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/sabnzbd.png",
|
||||
category: ["useNetClient"],
|
||||
},
|
||||
nzbGet: {
|
||||
name: "NZBGet",
|
||||
secretKinds: ["username", "password"],
|
||||
secretKinds: [["username", "password"]],
|
||||
iconUrl:
|
||||
"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/nzbget.png",
|
||||
category: ["useNetClient"],
|
||||
},
|
||||
deluge: {
|
||||
name: "Deluge",
|
||||
secretKinds: ["password"],
|
||||
secretKinds: [["password"]],
|
||||
iconUrl:
|
||||
"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/deluge.png",
|
||||
category: ["downloadClient"],
|
||||
},
|
||||
transmission: {
|
||||
name: "Transmission",
|
||||
secretKinds: ["username", "password"],
|
||||
secretKinds: [["username", "password"]],
|
||||
iconUrl:
|
||||
"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/transmission.png",
|
||||
category: ["downloadClient"],
|
||||
},
|
||||
qBittorrent: {
|
||||
name: "qBittorrent",
|
||||
secretKinds: ["username", "password"],
|
||||
secretKinds: [["username", "password"]],
|
||||
iconUrl:
|
||||
"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/qbittorrent.png",
|
||||
category: ["downloadClient"],
|
||||
},
|
||||
sonarr: {
|
||||
name: "Sonarr",
|
||||
secretKinds: ["apiKey"],
|
||||
secretKinds: [["apiKey"]],
|
||||
iconUrl:
|
||||
"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/sonarr.png",
|
||||
category: ["calendar"],
|
||||
},
|
||||
radarr: {
|
||||
name: "Radarr",
|
||||
secretKinds: ["apiKey"],
|
||||
secretKinds: [["apiKey"]],
|
||||
iconUrl:
|
||||
"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/radarr.png",
|
||||
category: ["calendar"],
|
||||
},
|
||||
lidarr: {
|
||||
name: "Lidarr",
|
||||
secretKinds: ["apiKey"],
|
||||
secretKinds: [["apiKey"]],
|
||||
iconUrl:
|
||||
"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/lidarr.png",
|
||||
category: ["calendar"],
|
||||
},
|
||||
readarr: {
|
||||
name: "Readarr",
|
||||
secretKinds: ["apiKey"],
|
||||
secretKinds: [["apiKey"]],
|
||||
iconUrl:
|
||||
"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/readarr.png",
|
||||
category: ["calendar"],
|
||||
},
|
||||
jellyfin: {
|
||||
name: "Jellyfin",
|
||||
secretKinds: ["username", "password"],
|
||||
secretKinds: [["username", "password"], ["apiKey"]],
|
||||
iconUrl:
|
||||
"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/jellyfin.png",
|
||||
category: ["mediaService"],
|
||||
},
|
||||
plex: {
|
||||
name: "Plex",
|
||||
secretKinds: ["apiKey"],
|
||||
secretKinds: [["apiKey"]],
|
||||
iconUrl:
|
||||
"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/plex.png",
|
||||
category: ["mediaService"],
|
||||
},
|
||||
jellyseerr: {
|
||||
name: "Jellyseerr",
|
||||
secretKinds: ["apiKey"],
|
||||
secretKinds: [["apiKey"]],
|
||||
iconUrl:
|
||||
"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/jellyseerr.png",
|
||||
category: ["mediaSearch", "mediaRequest"],
|
||||
},
|
||||
overseerr: {
|
||||
name: "Overseerr",
|
||||
secretKinds: ["apiKey"],
|
||||
secretKinds: [["apiKey"]],
|
||||
iconUrl:
|
||||
"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/overseerr.png",
|
||||
category: ["mediaSearch", "mediaRequest"],
|
||||
},
|
||||
piHole: {
|
||||
name: "Pi-hole",
|
||||
secretKinds: ["apiKey"],
|
||||
secretKinds: [["apiKey"]],
|
||||
iconUrl:
|
||||
"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/pi-hole.png",
|
||||
category: ["dnsHole"],
|
||||
},
|
||||
adGuardHome: {
|
||||
name: "AdGuard Home",
|
||||
secretKinds: ["username", "password"],
|
||||
secretKinds: [["username", "password"]],
|
||||
iconUrl:
|
||||
"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/adguard-home.png",
|
||||
category: ["dnsHole"],
|
||||
},
|
||||
homeAssistant: {
|
||||
name: "Home Assistant",
|
||||
secretKinds: ["apiKey"],
|
||||
secretKinds: [["apiKey"]],
|
||||
iconUrl:
|
||||
"https://cdn.jsdelivr.net/gh/walkxcode/dashboard-icons@master/png/home-assistant.png",
|
||||
category: [],
|
||||
@@ -126,7 +126,7 @@ export const integrationDefs = {
|
||||
{
|
||||
name: string;
|
||||
iconUrl: string;
|
||||
secretKinds: IntegrationSecretKind[];
|
||||
secretKinds: [IntegrationSecretKind[], ...IntegrationSecretKind[][]]; // at least one secret kind set is required
|
||||
category: IntegrationCategory[];
|
||||
}
|
||||
>;
|
||||
@@ -137,9 +137,14 @@ export const getIconUrl = (integration: IntegrationKind) =>
|
||||
export const getIntegrationName = (integration: IntegrationKind) =>
|
||||
integrationDefs[integration].name;
|
||||
|
||||
export const getSecretKinds = (
|
||||
export const getDefaultSecretKinds = (
|
||||
integration: IntegrationKind,
|
||||
): IntegrationSecretKind[] => integrationDefs[integration]?.secretKinds ?? null;
|
||||
): IntegrationSecretKind[] => integrationDefs[integration]?.secretKinds[0];
|
||||
|
||||
export const getAllSecretKindOptions = (
|
||||
integration: IntegrationKind,
|
||||
): [IntegrationSecretKind[], ...IntegrationSecretKind[][]] =>
|
||||
integrationDefs[integration]?.secretKinds;
|
||||
|
||||
export const integrationKinds = objectKeys(integrationDefs);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user