fix: replace crypto.randomUUID with polyfill for HTTP contexts

crypto.randomUUID() is only available in secure contexts (HTTPS/localhost).
Add uuid() utility with fallback for HTTP deployments.
This commit is contained in:
t8y2
2026-05-05 23:51:07 +08:00
parent 4e5a7cb40a
commit 0aa562f6ee
16 changed files with 48 additions and 23 deletions
+3 -2
View File
@@ -1,4 +1,5 @@
import { useI18n } from "vue-i18n";
import { uuid } from "@/lib/utils";
import { useConnectionStore } from "@/stores/connectionStore";
import { useQueryStore } from "@/stores/queryStore";
import { useToast } from "@/composables/useToast";
@@ -41,7 +42,7 @@ export function useFileDrop() {
const dataQuery = getDataFileQuery(path);
if (dataQuery) {
const config: ConnectionConfig = {
id: crypto.randomUUID(),
id: uuid(),
name: `[Preview] ${name}`,
db_type: "duckdb",
driver_profile: "duckdb",
@@ -64,7 +65,7 @@ export function useFileDrop() {
const dbType = getDbType(path);
if (!dbType) continue;
const config: ConnectionConfig = {
id: crypto.randomUUID(),
id: uuid(),
name,
db_type: dbType,
driver_profile: dbType,