diff --git a/server/package-lock.json b/server/package-lock.json index fecc8a914..c4d2dcd25 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -1,12 +1,12 @@ { "name": "@scrypted/server", - "version": "0.5.10", + "version": "0.5.11", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@scrypted/server", - "version": "0.5.10", + "version": "0.5.11", "license": "ISC", "dependencies": { "@ffmpeg-installer/ffmpeg": "^1.1.0", diff --git a/server/package.json b/server/package.json index 61e61ea2a..5b2f95c07 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "@scrypted/server", - "version": "0.5.10", + "version": "0.5.11", "description": "", "dependencies": { "@ffmpeg-installer/ffmpeg": "^1.1.0", diff --git a/server/src/plugin/plugin-device.ts b/server/src/plugin/plugin-device.ts index a5936b25f..115f73319 100644 --- a/server/src/plugin/plugin-device.ts +++ b/server/src/plugin/plugin-device.ts @@ -203,27 +203,16 @@ export class PluginDeviceProxyHandler implements PrimitiveProxyHandler, Scr } return this.mixinTable[0].entry.then(entry => { - let persist = !entry.error; if (entry.error) { - console.error('Mixin device creation completed with error.'); - const allInterfaces = new Set(entry.allInterfaces); + console.error('Mixin device creation completed with error. Merging with previous interface set to retain device descriptor.'); const previousInterfaces = getState(pluginDevice, ScryptedInterfaceProperty.interfaces) as string[] || []; - - let containsAll = true; - while (containsAll && previousInterfaces.length) { - containsAll &&= allInterfaces.has(previousInterfaces.pop()); - } - - persist = containsAll; - if (persist) - console.log('Mixin device completed with interface same set or super set of previous set. Persisting.') + const allInterfaces = new Set([...entry.allInterfaces, ...previousInterfaces]); + entry.allInterfaces = [...allInterfaces]; } - if (persist) { - const changed = this.scrypted.stateManager.setPluginDeviceState(pluginDevice, ScryptedInterfaceProperty.interfaces, PluginDeviceProxyHandler.sortInterfaces(entry.allInterfaces)); - if (changed) - this.scrypted.notifyPluginDeviceDescriptorChanged(pluginDevice); - } + const changed = this.scrypted.stateManager.setPluginDeviceState(pluginDevice, ScryptedInterfaceProperty.interfaces, PluginDeviceProxyHandler.sortInterfaces(entry.allInterfaces)); + if (changed) + this.scrypted.notifyPluginDeviceDescriptorChanged(pluginDevice); return pluginDevice; }); }