Update ui/src/app/app.ts

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This commit is contained in:
Shiva Sai K 2026-01-04 19:47:15 +05:30 committed by GitHub
parent 00e26fa6ac
commit 4ce5a5f28b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -296,12 +296,22 @@ export class App implements AfterViewInit, OnInit {
} }
maxRetryAttemptsChanged() { maxRetryAttemptsChanged() {
// Ensure value is between 1 and 10 // Ensure value is a valid integer between 1 and 10
if (this.maxRetryAttempts < 1) { let attempts = Number(this.maxRetryAttempts);
this.maxRetryAttempts = 1;
} else if (this.maxRetryAttempts > 10) { if (!Number.isFinite(attempts)) {
this.maxRetryAttempts = 10; attempts = 1;
} }
attempts = Math.round(attempts);
if (attempts < 1) {
attempts = 1;
} else if (attempts > 10) {
attempts = 10;
}
this.maxRetryAttempts = attempts;
this.cookieService.set('metube_max_retry_attempts', this.maxRetryAttempts.toString(), { expires: 3650 }); this.cookieService.set('metube_max_retry_attempts', this.maxRetryAttempts.toString(), { expires: 3650 });
} }