diff --git a/web/main.js b/web/main.js index e643d58..ecd7efe 100644 --- a/web/main.js +++ b/web/main.js @@ -50,6 +50,19 @@ class DistributedExtension { } } + // Generate UUID with fallback for non-secure contexts + generateUUID() { + if (crypto.randomUUID) { + return crypto.randomUUID(); + } + // Fallback for non-secure contexts + return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + const r = Math.random() * 16 | 0; + const v = c == 'x' ? r : (r & 0x3 | 0x8); + return v.toString(16); + }); + } + injectStyles() { const styleId = 'distributed-styles'; if (!document.getElementById(styleId)) { @@ -1054,8 +1067,8 @@ class DistributedExtension { } async addNewWorker() { - // Generate new worker ID using UUID - const newId = crypto.randomUUID(); + // Generate new worker ID using UUID (fallback for non-secure contexts) + const newId = this.generateUUID(); // Find next available port const usedPorts = this.config.workers.map(w => w.port);