diff --git a/client/src/app/add-new-torrent/add-new-torrent.component.ts b/client/src/app/add-new-torrent/add-new-torrent.component.ts index d87829b..fb71bc2 100644 --- a/client/src/app/add-new-torrent/add-new-torrent.component.ts +++ b/client/src/app/add-new-torrent/add-new-torrent.component.ts @@ -3,6 +3,7 @@ import { Router } from '@angular/router'; import { TorrentService } from 'src/app/torrent.service'; import { Torrent, TorrentFileAvailability } from '../models/torrent.model'; import { SettingsService } from '../settings.service'; +import { ActivatedRoute } from '@angular/router'; @Component({ selector: 'app-add-new-torrent', @@ -48,9 +49,15 @@ export class AddNewTorrentComponent implements OnInit { private router: Router, private torrentService: TorrentService, private settingsService: SettingsService, + private activatedRoute: ActivatedRoute ) {} ngOnInit(): void { + this.activatedRoute.queryParams.subscribe(params => { + if (params['magnet']) { + this.magnetLink = decodeURIComponent(params['magnet']); + } + }); this.settingsService.get().subscribe((settings) => { const providerSetting = settings.first((m) => m.key === 'Provider:Provider'); this.provider = providerSetting.enumValues[providerSetting.value as number]; diff --git a/client/src/app/settings/settings.component.html b/client/src/app/settings/settings.component.html index e10d21b..7b3c537 100644 --- a/client/src/app/settings/settings.component.html +++ b/client/src/app/settings/settings.component.html @@ -141,6 +141,28 @@ +
+ +
+ +
+

+ {{ + canRegisterMagnetHandler + ? "This will attempt to register the client as your browser's default handler for magnet links and automatically open them in the new torrent screen for downloading." + : "Magnet link registration is unavailable because either your browser does not support it or the client is not being served to you in a secure context." + }} +

+
+