verteilen-core 1.2.20 → 1.2.22

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.
@@ -64,7 +64,7 @@ class ServerDetail {
64
64
  message: `${x.websocket.url} \n${x.uuid}`
65
65
  };
66
66
  if (this.feedback.electron) {
67
- this.feedback.electron('makeToast', p);
67
+ this.feedback.electron()?.send('makeToast', p);
68
68
  }
69
69
  if (this.feedback.socket && this.backend.Boradcasting) {
70
70
  this.backend.Boradcasting('makeToast', p);
@@ -80,7 +80,7 @@ class ServerDetail {
80
80
  message: `${x.websocket.url} \n${x.uuid}`
81
81
  };
82
82
  if (this.feedback.electron) {
83
- this.feedback.electron('makeToast', p);
83
+ this.feedback.electron()?.send('makeToast', p);
84
84
  }
85
85
  if (this.feedback.socket && this.backend.Boradcasting) {
86
86
  this.backend.Boradcasting('makeToast', p);
@@ -94,7 +94,7 @@ class ServerDetail {
94
94
  };
95
95
  shellReply = (data, p) => {
96
96
  if (this.feedback.electron) {
97
- this.feedback.electron("shellReply", data);
97
+ this.feedback.electron()?.send("shellReply", data);
98
98
  }
99
99
  if (this.feedback.socket) {
100
100
  if (p == undefined)
@@ -110,7 +110,7 @@ class ServerDetail {
110
110
  };
111
111
  folderReply = (data, p) => {
112
112
  if (this.feedback.electron) {
113
- this.feedback.electron("folderReply", data);
113
+ this.feedback.electron()?.send("folderReply", data);
114
114
  }
115
115
  if (this.feedback.socket) {
116
116
  if (p == undefined)
@@ -217,33 +217,33 @@ class ServerDetail {
217
217
  };
218
218
  node_list = (socket) => {
219
219
  const p = this.websocket_manager?.targets;
220
- if (socket != undefined) {
220
+ if (this.feedback.socket != undefined) {
221
221
  const h = {
222
222
  name: "node_list-feedback",
223
223
  data: this.websocket_manager?.targets
224
224
  };
225
- socket.send(JSON.stringify(h));
225
+ this.feedback.socket(JSON.stringify(h));
226
226
  }
227
227
  return p;
228
228
  };
229
229
  node_add = (socket, url, id) => {
230
230
  const p = this.websocket_manager.server_start(url, id);
231
- if (socket != undefined) {
231
+ if (this.feedback.socket != undefined) {
232
232
  const h = {
233
233
  name: "node_add-feedback",
234
234
  data: p
235
235
  };
236
- socket.send(JSON.stringify(h));
236
+ this.feedback.socket(JSON.stringify(h));
237
237
  }
238
238
  };
239
239
  node_update = (socket) => {
240
240
  const p = this.websocket_manager?.server_update();
241
- if (socket != undefined) {
241
+ if (this.feedback.socket != undefined) {
242
242
  const h = {
243
243
  name: "node_update-feedback",
244
244
  data: [p]
245
245
  };
246
- socket.send(JSON.stringify(h));
246
+ this.feedback.socket(JSON.stringify(h));
247
247
  }
248
248
  return p;
249
249
  };
@@ -133,7 +133,7 @@ const CreatePluginLoader = (loader, memory, socket, feedback) => {
133
133
  const p = { title: "Import Failed", type: "error", message: `Cannot find the json from url ${url}, or maybe just the wrong token` };
134
134
  const h = { name: "makeToast", data: JSON.stringify(p) };
135
135
  if (feedback.electron) {
136
- feedback.electron("makeToast", JSON.stringify(p));
136
+ feedback.electron()?.send("makeToast", JSON.stringify(p));
137
137
  }
138
138
  if (feedback.socket) {
139
139
  feedback.socket(JSON.stringify(h));
@@ -189,7 +189,7 @@ const CreatePluginLoader = (loader, memory, socket, feedback) => {
189
189
  const p = { title: x[0], type: "error", message: x[1] };
190
190
  const h = { name: "makeToast", data: JSON.stringify(p) };
191
191
  if (feedback.electron) {
192
- feedback.electron("makeToast", JSON.stringify(p));
192
+ feedback.electron()?.send("makeToast", JSON.stringify(p));
193
193
  }
194
194
  if (feedback.socket) {
195
195
  feedback.socket(JSON.stringify(h));
@@ -237,7 +237,7 @@ const CreatePluginLoader = (loader, memory, socket, feedback) => {
237
237
  const p = { title: "Import Failed", type: "error", message: `Cannot find the json from url ${url}, or maybe just the wrong token` };
238
238
  const h = { name: "makeToast", data: JSON.stringify(p) };
239
239
  if (feedback.electron) {
240
- feedback.electron("makeToast", JSON.stringify(p));
240
+ feedback.electron()?.send("makeToast", JSON.stringify(p));
241
241
  }
242
242
  if (feedback.socket) {
243
243
  feedback.socket(JSON.stringify(h));
@@ -2,13 +2,16 @@ import { Execute_ConsoleServerManager, PluginPageData } from "../interface";
2
2
  import { ServerDetail } from "./detail";
3
3
  import { MemoryData, RecordIOBase, RecordLoader } from "./io";
4
4
  import { PluginLoader } from "./plugin";
5
- export type Caller_Electron = (channel: string, ...args: any[]) => void;
5
+ export type Caller_Electron_Send = (channel: string, ...args: any[]) => void;
6
+ export interface Caller_Electron {
7
+ send: Caller_Electron_Send;
8
+ }
6
9
  export type Caller_Socket = (data: any) => void;
7
10
  export type TypeMap = {
8
11
  [key: string]: Function;
9
12
  };
10
13
  export interface PluginFeedback {
11
- electron: Caller_Electron | undefined;
14
+ electron: (() => (Caller_Electron | undefined)) | undefined;
12
15
  socket: Caller_Socket | undefined;
13
16
  }
14
17
  export declare class Server {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "verteilen-core",
3
- "version": "1.2.20",
3
+ "version": "1.2.22",
4
4
  "license": "MIT",
5
5
  "homepage": "https://verteilen.github.io/wiki/",
6
6
  "author": "Elly",
@@ -136,7 +136,7 @@ export class ServerDetail {
136
136
  message: `${x.websocket.url} \n${x.uuid}`
137
137
  }
138
138
  if(this.feedback.electron){
139
- this.feedback.electron('makeToast', p)
139
+ this.feedback.electron()?.send('makeToast', p)
140
140
  }
141
141
  if(this.feedback.socket && this.backend.Boradcasting){
142
142
  this.backend.Boradcasting('makeToast', p)
@@ -153,7 +153,7 @@ export class ServerDetail {
153
153
  message: `${x.websocket.url} \n${x.uuid}`
154
154
  }
155
155
  if(this.feedback.electron){
156
- this.feedback.electron('makeToast', p)
156
+ this.feedback.electron()?.send('makeToast', p)
157
157
  }
158
158
  if(this.feedback.socket && this.backend.Boradcasting){
159
159
  this.backend.Boradcasting('makeToast', p)
@@ -175,7 +175,7 @@ export class ServerDetail {
175
175
  */
176
176
  shellReply = (data:Single, p?:WebsocketPack) => {
177
177
  if(this.feedback.electron){
178
- this.feedback.electron("shellReply", data)
178
+ this.feedback.electron()?.send("shellReply", data)
179
179
  }
180
180
  if(this.feedback.socket){
181
181
  if(p == undefined) return
@@ -196,7 +196,7 @@ export class ServerDetail {
196
196
  */
197
197
  folderReply = (data:ShellFolder, p?:WebsocketPack) => {
198
198
  if(this.feedback.electron){
199
- this.feedback.electron("folderReply", data)
199
+ this.feedback.electron()?.send("folderReply", data)
200
200
  }
201
201
  if(this.feedback.socket){
202
202
  if(p == undefined) return
@@ -303,33 +303,33 @@ export class ServerDetail {
303
303
 
304
304
  node_list = (socket:any) => {
305
305
  const p = this.websocket_manager?.targets
306
- if(socket != undefined){
306
+ if(this.feedback.socket != undefined){
307
307
  const h:Header = {
308
308
  name: "node_list-feedback",
309
309
  data: this.websocket_manager?.targets
310
310
  }
311
- socket.send(JSON.stringify(h))
311
+ this.feedback.socket(JSON.stringify(h))
312
312
  }
313
313
  return p
314
314
  }
315
315
  node_add = (socket:any, url:string, id:string) => {
316
316
  const p = this.websocket_manager!.server_start(url, id)
317
- if(socket != undefined){
317
+ if(this.feedback.socket != undefined){
318
318
  const h:Header = {
319
319
  name: "node_add-feedback",
320
320
  data: p
321
321
  }
322
- socket.send(JSON.stringify(h))
322
+ this.feedback.socket(JSON.stringify(h))
323
323
  }
324
324
  }
325
325
  node_update = (socket:any) => {
326
326
  const p = this.websocket_manager?.server_update()
327
- if(socket != undefined){
327
+ if(this.feedback.socket != undefined){
328
328
  const h:Header = {
329
329
  name: "node_update-feedback",
330
330
  data: [p]
331
331
  }
332
- socket.send(JSON.stringify(h))
332
+ this.feedback.socket(JSON.stringify(h))
333
333
  }
334
334
  return p
335
335
  }
@@ -166,7 +166,7 @@ export const CreatePluginLoader = (loader:RecordIOBase, memory:PluginPageData, s
166
166
  const p:ToastData = { title: "Import Failed", type: "error", message: `Cannot find the json from url ${url}, or maybe just the wrong token` }
167
167
  const h:Header = { name: "makeToast", data: JSON.stringify(p) }
168
168
  if (feedback.electron){
169
- feedback.electron("makeToast", JSON.stringify(p))
169
+ feedback.electron()?.send("makeToast", JSON.stringify(p))
170
170
  }
171
171
  if (feedback.socket){
172
172
  feedback.socket(JSON.stringify(h))
@@ -219,7 +219,7 @@ export const CreatePluginLoader = (loader:RecordIOBase, memory:PluginPageData, s
219
219
  const p:ToastData = { title: x[0], type: "error", message: x[1] }
220
220
  const h:Header = { name: "makeToast", data: JSON.stringify(p) }
221
221
  if (feedback.electron){
222
- feedback.electron("makeToast", JSON.stringify(p))
222
+ feedback.electron()?.send("makeToast", JSON.stringify(p))
223
223
  }
224
224
  if (feedback.socket){
225
225
  feedback.socket(JSON.stringify(h))
@@ -264,7 +264,7 @@ export const CreatePluginLoader = (loader:RecordIOBase, memory:PluginPageData, s
264
264
  const p:ToastData = { title: "Import Failed", type: "error", message: `Cannot find the json from url ${url}, or maybe just the wrong token` }
265
265
  const h:Header = { name: "makeToast", data: JSON.stringify(p) }
266
266
  if (feedback.electron){
267
- feedback.electron("makeToast", JSON.stringify(p))
267
+ feedback.electron()?.send("makeToast", JSON.stringify(p))
268
268
  }
269
269
  if (feedback.socket){
270
270
  feedback.socket(JSON.stringify(h))
@@ -3,12 +3,15 @@ import { ServerDetail } from "./detail";
3
3
  import { CreateRecordMemoryLoader, MemoryData, RecordIOBase, RecordLoader } from "./io";
4
4
  import { PluginLoader } from "./plugin";
5
5
 
6
- export type Caller_Electron = (channel: string, ...args: any[]) => void
6
+ export type Caller_Electron_Send = (channel: string, ...args: any[]) => void
7
+ export interface Caller_Electron {
8
+ send: Caller_Electron_Send
9
+ }
7
10
  export type Caller_Socket = (data: any) => void
8
11
  export type TypeMap = { [key:string]:Function }
9
12
 
10
13
  export interface PluginFeedback {
11
- electron:Caller_Electron | undefined
14
+ electron:(() => (Caller_Electron | undefined)) | undefined
12
15
  socket:Caller_Socket | undefined
13
16
  }
14
17