mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 07:25:48 +01:00
🐛 Fix issue with api endpoints caused by new integration format
This commit is contained in:
@@ -31,8 +31,10 @@ async function Post(req: NextApiRequest, res: NextApiResponse) {
|
||||
const options = {
|
||||
host: url.hostname,
|
||||
port: url.port,
|
||||
login: service.integration.properties.username,
|
||||
hash: service.integration.properties.password,
|
||||
login:
|
||||
service.integration.properties.find((x) => x.field === 'username')?.value ?? undefined,
|
||||
hash:
|
||||
service.integration.properties.find((x) => x.field === 'password')?.value ?? undefined,
|
||||
};
|
||||
|
||||
const nzbGet = NzbgetClient(options);
|
||||
@@ -49,13 +51,14 @@ async function Post(req: NextApiRequest, res: NextApiResponse) {
|
||||
break;
|
||||
}
|
||||
case 'sabnzbd': {
|
||||
if (!service.integration.properties.apiKey) {
|
||||
const apiKey = service.integration.properties.find((x) => x.field === 'apiKey')?.value;
|
||||
if (!apiKey) {
|
||||
throw new Error(`API Key for service "${service.name}" is missing`);
|
||||
}
|
||||
|
||||
const { origin } = new URL(service.url);
|
||||
|
||||
result = await new Client(origin, service.integration.properties.apiKey).queuePause();
|
||||
result = await new Client(origin, apiKey).queuePause();
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
||||
Reference in New Issue
Block a user