fixed UUID creation bug when accessing master over network
This commit is contained in:
+15
-2
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user