feat(uuid): implement UUID generation for non-secure contexts and replace crypto.randomUUID() usage

This commit is contained in:
PeymanHonarjoo
2026-10-12 16:50:52 +03:30
parent e268631386
commit 0af55f52a3
7 changed files with 64 additions and 15 deletions
+6 -5
View File
@@ -14,6 +14,7 @@ import { ThemeService } from '../../services/theme/theme.service';
import { DocumentsService } from '../../services/documents/documents.service';
import { AuthService } from '../../services/auth/auth.service';
import { HttpService } from '../../services/http-request/http.service';
import { uuid } from '../../shared/utils/uuid';
import {
AiModelConfigCardComponent,
AiModelConfig,
@@ -434,7 +435,7 @@ export class SettingsPage implements OnInit, OnDestroy {
progress: 0,
status: 'uploading',
error: null,
idempotencyKey: crypto.randomUUID(),
idempotencyKey: uuid(),
});
}
}
@@ -931,7 +932,7 @@ export class SettingsPage implements OnInit, OnDestroy {
checked: [],
note: '',
excludedGroupIds: [],
idempotencyKey: crypto.randomUUID(),
idempotencyKey: uuid(),
};
}
}
@@ -1023,7 +1024,7 @@ export class SettingsPage implements OnInit, OnDestroy {
this.toastr.warning('هنوز شواهد بازبینی تکمیل نشده‌اند.');
return;
}
const key = this.retryKeys.get(doc.id) ?? crypto.randomUUID();
const key = this.retryKeys.get(doc.id) ?? uuid();
this.retryKeys.set(doc.id, key);
this.documentsService.retryDocument(doc.id, key).subscribe({
next: () => {
@@ -1051,7 +1052,7 @@ export class SettingsPage implements OnInit, OnDestroy {
checked: [],
note: '',
excludedGroupIds: [],
idempotencyKey: crypto.randomUUID(),
idempotencyKey: uuid(),
}
);
}
@@ -1169,7 +1170,7 @@ export class SettingsPage implements OnInit, OnDestroy {
this.toastr.warning('سند در حال حاضر قابل تلاش مجدد نیست.');
return;
}
const key = this.retryKeys.get(doc.id) ?? crypto.randomUUID();
const key = this.retryKeys.get(doc.id) ?? uuid();
this.retryKeys.set(doc.id, key);
this.documentsService.retryDocument(doc.id, key).subscribe({
next: (res: RetryResult) => {