mirror of
https://github.com/ajnart/homarr.git
synced 2025-11-10 23:45:48 +01:00
🔀 Merge pull request #252 from LarveyOfficial/fix-multiple-download-clients
🐛Allow multiple of the same torrent client +1
This commit is contained in:
@@ -298,53 +298,64 @@ export function AddAppShelfItemForm(props: { setOpened: (b: boolean) => void } &
|
||||
</>
|
||||
)}
|
||||
{form.values.type === 'qBittorrent' && (
|
||||
<>
|
||||
<TextInput
|
||||
required
|
||||
label="Username"
|
||||
placeholder="admin"
|
||||
value={form.values.username}
|
||||
onChange={(event) => {
|
||||
form.setFieldValue('username', event.currentTarget.value);
|
||||
}}
|
||||
error={form.errors.username && 'Invalid username'}
|
||||
/>
|
||||
<TextInput
|
||||
required
|
||||
label="Password"
|
||||
placeholder="adminadmin"
|
||||
value={form.values.password}
|
||||
onChange={(event) => {
|
||||
form.setFieldValue('password', event.currentTarget.value);
|
||||
}}
|
||||
error={form.errors.password && 'Invalid password'}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{(form.values.type === 'Deluge' ||
|
||||
form.values.type === 'Transmission' ||
|
||||
form.values.type === 'qBittorrent') && (
|
||||
<>
|
||||
<TextInput
|
||||
label="Username"
|
||||
placeholder="admin"
|
||||
value={form.values.username}
|
||||
onChange={(event) => {
|
||||
form.setFieldValue('username', event.currentTarget.value);
|
||||
}}
|
||||
error={form.errors.username && 'Invalid username'}
|
||||
/>
|
||||
<TextInput
|
||||
label="Password"
|
||||
placeholder="password"
|
||||
value={form.values.password}
|
||||
onChange={(event) => {
|
||||
form.setFieldValue('password', event.currentTarget.value);
|
||||
}}
|
||||
error={form.errors.password && 'Invalid password'}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
<>
|
||||
<TextInput
|
||||
required
|
||||
label="Username"
|
||||
placeholder="admin"
|
||||
value={form.values.username}
|
||||
onChange={(event) => {
|
||||
form.setFieldValue('username', event.currentTarget.value);
|
||||
}}
|
||||
error={form.errors.username && 'Invalid username'}
|
||||
/>
|
||||
<TextInput
|
||||
required
|
||||
label="Password"
|
||||
placeholder="adminadmin"
|
||||
value={form.values.password}
|
||||
onChange={(event) => {
|
||||
form.setFieldValue('password', event.currentTarget.value);
|
||||
}}
|
||||
error={form.errors.password && 'Invalid password'}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{form.values.type === 'Deluge' && (
|
||||
<>
|
||||
<TextInput
|
||||
label="Password"
|
||||
placeholder="password"
|
||||
value={form.values.password}
|
||||
onChange={(event) => {
|
||||
form.setFieldValue('password', event.currentTarget.value);
|
||||
}}
|
||||
error={form.errors.password && 'Invalid password'}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
{form.values.type === 'Transmission' && (
|
||||
<>
|
||||
<TextInput
|
||||
label="Username"
|
||||
placeholder="admin"
|
||||
value={form.values.username}
|
||||
onChange={(event) => {
|
||||
form.setFieldValue('username', event.currentTarget.value);
|
||||
}}
|
||||
error={form.errors.username && 'Invalid username'}
|
||||
/>
|
||||
<TextInput
|
||||
label="Password"
|
||||
placeholder="adminadmin"
|
||||
value={form.values.password}
|
||||
onChange={(event) => {
|
||||
form.setFieldValue('password', event.currentTarget.value);
|
||||
}}
|
||||
error={form.errors.password && 'Invalid password'}
|
||||
/>
|
||||
</>
|
||||
)}
|
||||
</Group>
|
||||
</ScrollArea>
|
||||
</Tabs.Tab>
|
||||
|
||||
@@ -9,50 +9,56 @@ async function Post(req: NextApiRequest, res: NextApiResponse) {
|
||||
// Get the type of service from the request url
|
||||
const torrents: NormalizedTorrent[] = [];
|
||||
const { config }: { config: Config } = req.body;
|
||||
const qBittorrentService = config.services
|
||||
.filter((service) => service.type === 'qBittorrent')
|
||||
.at(0);
|
||||
const delugeService = config.services.filter((service) => service.type === 'Deluge').at(0);
|
||||
const transmissionService = config.services
|
||||
.filter((service) => service.type === 'Transmission')
|
||||
.at(0);
|
||||
if (!qBittorrentService && !delugeService && !transmissionService) {
|
||||
const qBittorrentServices = config.services
|
||||
.filter((service) => service.type === 'qBittorrent');
|
||||
|
||||
const delugeServices = config.services.filter((service) => service.type === 'Deluge');
|
||||
const transmissionServices = config.services
|
||||
.filter((service) => service.type === 'Transmission');
|
||||
|
||||
if (!qBittorrentServices && !delugeServices && !transmissionServices) {
|
||||
return res.status(500).json({
|
||||
statusCode: 500,
|
||||
message: 'Missing service',
|
||||
message: 'Missing services',
|
||||
});
|
||||
}
|
||||
if (qBittorrentService) {
|
||||
torrents.push(
|
||||
...(
|
||||
await new QBittorrent({
|
||||
baseUrl: qBittorrentService.url,
|
||||
username: qBittorrentService.username,
|
||||
password: qBittorrentService.password,
|
||||
}).getAllData()
|
||||
).torrents
|
||||
);
|
||||
if (qBittorrentServices) {
|
||||
for (const service of qBittorrentServices) {
|
||||
torrents.push(
|
||||
...(
|
||||
await new QBittorrent({
|
||||
baseUrl: service.url,
|
||||
username: service.username,
|
||||
password: service.password,
|
||||
}).getAllData()
|
||||
).torrents
|
||||
);
|
||||
}
|
||||
}
|
||||
if (delugeService) {
|
||||
torrents.push(
|
||||
...(
|
||||
await new Deluge({
|
||||
baseUrl: delugeService.url,
|
||||
password: 'password' in delugeService ? delugeService.password : '',
|
||||
}).getAllData()
|
||||
).torrents
|
||||
);
|
||||
if (delugeServices) {
|
||||
for (const service of delugeServices) {
|
||||
torrents.push(
|
||||
...(
|
||||
await new Deluge({
|
||||
baseUrl: service.url,
|
||||
password: 'password' in service ? service.password : '',
|
||||
}).getAllData()
|
||||
).torrents
|
||||
)
|
||||
}
|
||||
}
|
||||
if (transmissionService) {
|
||||
torrents.push(
|
||||
...(
|
||||
await new Transmission({
|
||||
baseUrl: transmissionService.url,
|
||||
username: transmissionService.username,
|
||||
password: 'password' in transmissionService ? transmissionService.password : '',
|
||||
}).getAllData()
|
||||
).torrents
|
||||
);
|
||||
if (transmissionServices) {
|
||||
for (const service of transmissionServices) {
|
||||
torrents.push(
|
||||
...(
|
||||
await new Transmission({
|
||||
baseUrl: service.url,
|
||||
username: 'username' in service ? service.username : '',
|
||||
password: 'password' in service ? service.password : '',
|
||||
}).getAllData()
|
||||
).torrents
|
||||
);
|
||||
}
|
||||
}
|
||||
res.status(200).json(torrents);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user