@scrypted/server 0.7.68 → 0.7.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @scrypted/server might be problematic. Click here for more details.

package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@scrypted/server",
3
- "version": "0.7.68",
3
+ "version": "0.7.70",
4
4
  "description": "",
5
5
  "dependencies": {
6
6
  "@mapbox/node-pre-gyp": "^1.0.10",
@@ -318,6 +318,11 @@ class PluginRemote:
318
318
 
319
319
  port = clusterObject['port']
320
320
  proxyId = clusterObject['proxyId']
321
+ if port == clusterPort:
322
+ newValue = self.peer.localProxyMap.get(id, None)
323
+ if not newValue:
324
+ raise Exception('ipc object not found?')
325
+ return newValue
321
326
 
322
327
  clusterPeerPromise = clusterPeers.get(port)
323
328
  if not clusterPeerPromise:
@@ -355,11 +360,12 @@ class PluginRemote:
355
360
 
356
361
  def onProxySerialization(value: Any, proxyId: str):
357
362
  properties: dict = rpc.RpcPeer.prepareProxyProperties(value) or {}
358
- properties['__cluster'] = {
359
- 'id': clusterId,
360
- 'proxyId': proxyId,
361
- 'port': clusterPort,
362
- }
363
+ if not properties.get('__cluster', None):
364
+ properties['__cluster'] = {
365
+ 'id': clusterId,
366
+ 'proxyId': proxyId,
367
+ 'port': clusterPort,
368
+ }
363
369
  return properties
364
370
 
365
371
  self.peer.onProxySerialization = onProxySerialization
@@ -96,9 +96,11 @@ export function startPluginRemote(mainFilename: string, pluginId: string, peerSe
96
96
 
97
97
  peer.onProxySerialization = (value, proxyId) => {
98
98
  const properties = RpcPeer.prepareProxyProperties(value) || {};
99
- properties.__cluster = {
100
- ...clusterEntry,
101
- proxyId,
99
+ if (!properties.__cluster) {
100
+ properties.__cluster = {
101
+ ...clusterEntry,
102
+ proxyId,
103
+ }
102
104
  }
103
105
  return properties;
104
106
  }
@@ -109,6 +111,13 @@ export function startPluginRemote(mainFilename: string, pluginId: string, peerSe
109
111
  if (clusterObject?.id !== clusterId)
110
112
  return value;
111
113
  const { port, proxyId } = clusterObject;
114
+ if (port === clusterPort) {
115
+ // this is a local object.
116
+ const newValue = peer.localProxyMap.get(proxyId);
117
+ if (!newValue)
118
+ throw new Error('ipc object not found?');
119
+ return newValue;
120
+ }
112
121
 
113
122
  let clusterPeerPromise = clusterPeers.get(port);
114
123
  if (!clusterPeerPromise) {
@@ -136,6 +145,12 @@ export function startPluginRemote(mainFilename: string, pluginId: string, peerSe
136
145
  const newValue = await connectRPCObject(proxyId, portSecret);
137
146
  if (!newValue)
138
147
  throw new Error('ipc object not found?');
148
+ // reassign the cluster identity in case this object gets passed back into the cluster.
149
+ newValue.__cluster = {
150
+ id: clusterId,
151
+ port,
152
+ proxyId,
153
+ };
139
154
  return newValue;
140
155
  }
141
156
  catch (e) {