Remove crypto and replace with npm uuid package
This commit is contained in:
+3
-2
@@ -1,5 +1,6 @@
|
||||
import type { BUN_SQLITE_WGUI_CLIENT_RULES } from "@/db/types/db";
|
||||
import type { ClientRuleProtocol, ClientRuleType } from "@/src/types";
|
||||
import { v4 as uuidv4 } from "uuid";
|
||||
|
||||
export type ClientRuleDraft = {
|
||||
local_id: string;
|
||||
@@ -14,7 +15,7 @@ type CreateParams = Partial<ClientRuleDraft>;
|
||||
|
||||
export function createClientRuleDraft(params?: CreateParams): ClientRuleDraft {
|
||||
return {
|
||||
local_id: crypto.randomUUID(),
|
||||
local_id: uuidv4(),
|
||||
rule_type: "destination",
|
||||
destination: "",
|
||||
ports: "",
|
||||
@@ -29,7 +30,7 @@ export function clientRuleToDraft({
|
||||
rule: BUN_SQLITE_WGUI_CLIENT_RULES;
|
||||
}): ClientRuleDraft {
|
||||
return {
|
||||
local_id: String(rule.id || crypto.randomUUID()),
|
||||
local_id: String(rule.id || uuidv4()),
|
||||
id: rule.id,
|
||||
rule_type: rule.rule_type == "all" ? "all" : "destination",
|
||||
destination: rule.destination || "",
|
||||
|
||||
Reference in New Issue
Block a user