mirror of
https://github.com/Kareadita/Kavita.git
synced 2025-08-07 09:01:25 -04:00
Fix Import section not showing up in settings (#3849)
This commit is contained in:
parent
fc4ba4509f
commit
5e54306fd0
@ -51,7 +51,7 @@ export class SettingSwitchComponent implements AfterContentInit {
|
||||
const inputElement = element.querySelector('input');
|
||||
|
||||
// If no id, generate a random id and assign it to the input
|
||||
inputElement.id = crypto.randomUUID();
|
||||
inputElement.id = this.generateId();
|
||||
|
||||
if (inputElement && inputElement.id) {
|
||||
this.labelId = inputElement.id;
|
||||
@ -62,4 +62,13 @@ export class SettingSwitchComponent implements AfterContentInit {
|
||||
});
|
||||
}
|
||||
|
||||
private generateId(): string {
|
||||
if (crypto && crypto.randomUUID) {
|
||||
return crypto.randomUUID();
|
||||
}
|
||||
|
||||
// Fallback for browsers without crypto.randomUUID (which has happened multiple times in my user base)
|
||||
return 'id-' + Math.random().toString(36).substr(2, 9) + '-' + Date.now().toString(36);
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user