Added automatic download mechanism

- Added tooltips to options
- Updated privacy policy
This commit is contained in:
2024-02-18 14:38:34 +01:00
parent 78f32c4f64
commit d9e621165d
4 changed files with 47 additions and 23 deletions

View File

@ -4,7 +4,7 @@ import {DevelopmentStore} from "../../store/DevelopmentStore";
import {FormsModule} from "@angular/forms";
import {DecimalPipe, NgClass, NgIf} from "@angular/common";
import funfacts from "../../assets/funfacts";
import {RouterLink} from "@angular/router";
import {ActivatedRoute, RouterLink} from "@angular/router";
@Component({
selector: 'app-download',
@ -40,8 +40,21 @@ export class DownloadComponent {
funfact: string = "";
constructor(private developmentStore: DevelopmentStore) {
constructor(private developmentStore: DevelopmentStore, private activatedRoute: ActivatedRoute) {
this.funfact = funfacts[Math.floor(Math.random() * funfacts.length)];
this.activatedRoute.queryParams.subscribe(params => {
const fileId = params['fileId'];
const password = params['password'];
if(password) {
this.filePassword = password;
}
if(fileId) {
this.inputFileId = fileId;
this.requestDownload();
}
});
this.speedTest();
}
@ -70,6 +83,11 @@ export class DownloadComponent {
return;
}
else if(this.downloadInfo?.passwordProtected) {
if(this.filePassword) {
console.log("Requesting download with password");
this.downloadFile();
return;
}
this.waitingForPassword = true;
console.log("Password protected");
}