Move magnet handler registration
Moved magnet handler registration to general settings.
This commit is contained in:
parent
e28749e465
commit
94e9a8ccd0
4 changed files with 27 additions and 23 deletions
|
|
@ -37,13 +37,7 @@
|
|||
<i class="fas fa-cog" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Settings</span>
|
||||
</a>
|
||||
<button class="navbar-item" type="button" (click)="registerMagnetHandler()">
|
||||
<span class="icon">
|
||||
<i class="fas fa-magnet" aria-hidden="true"></i>
|
||||
</span>
|
||||
<span>Register Magnet Handler</span>
|
||||
</button>
|
||||
</a>
|
||||
<a class="navbar-item" *ngIf="profile" href="{{ providerLink }}" target="_blank" rel="noopener">
|
||||
<span class="icon">
|
||||
<i class="fas fa-euro-sign" aria-hidden="true"></i>
|
||||
|
|
|
|||
|
|
@ -57,22 +57,6 @@ export class NavbarComponent implements OnInit {
|
|||
});
|
||||
}
|
||||
|
||||
public registerMagnetHandler(): void {
|
||||
if (window.location.protocol !== "https:") {
|
||||
alert("Magnet link registration requires a secure connection. Please ensure your site is being served over HTTPS to enable this feature.");
|
||||
return;
|
||||
}
|
||||
|
||||
const handlerUrl = `${window.location.origin}/add?magnet=%s`;
|
||||
|
||||
if (navigator.registerProtocolHandler) {
|
||||
navigator.registerProtocolHandler("magnet", handlerUrl);
|
||||
alert("Your browser will display a prompt asking if you'd like to add the client as the default application for magnet links. Please confirm to complete the setup.");
|
||||
} else {
|
||||
alert("Magnet link registration failed. Your browser does not support registering custom protocol handlers.");
|
||||
}
|
||||
}
|
||||
|
||||
public logout(): void {
|
||||
this.authService.logout().subscribe(
|
||||
() => {
|
||||
|
|
|
|||
|
|
@ -141,6 +141,16 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div class="field" *ngIf="activeTab === 0">
|
||||
<label class="label">Allow client to handle magnet links</label>
|
||||
<div class="control">
|
||||
<button class="button is-info" type="button" (click)="registerMagnetHandler()">
|
||||
<span>Register Handler</span>
|
||||
</button>
|
||||
</div>
|
||||
<p class="help">This will register the client as your browser's default handler for magnet links. Clicking a magnet link will automatically open it in the new torrent screen for downloading.</p>
|
||||
</div>
|
||||
|
||||
<div class="field" *ngIf="activeTab < 99">
|
||||
<div class="control">
|
||||
<button class="button is-success" (click)="ok()" [disabled]="saving" [ngClass]="{ 'is-loading': saving }">
|
||||
|
|
|
|||
|
|
@ -139,4 +139,20 @@ export class SettingsComponent implements OnInit {
|
|||
},
|
||||
);
|
||||
}
|
||||
|
||||
public registerMagnetHandler(): void {
|
||||
if (window.location.protocol !== "https:") {
|
||||
alert("Magnet link handler registration requires a secure connection. Please ensure the client is being served over HTTPS to enable this feature.");
|
||||
return;
|
||||
}
|
||||
|
||||
const handlerUrl = `${window.location.origin}/add?magnet=%s`;
|
||||
|
||||
if (navigator.registerProtocolHandler) {
|
||||
navigator.registerProtocolHandler("magnet", handlerUrl);
|
||||
alert("Your browser will display a prompt asking if you'd like to add the client as the default application for magnet links. Please confirm to complete the setup.");
|
||||
} else {
|
||||
alert("Magnet link registration failed. Your browser does not support registering custom protocol handlers.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue