pinokiod 3.8.148 → 3.8.150

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.
Files changed (45) hide show
  1. package/kernel/api/index.js +0 -10
  2. package/kernel/api/script/index.js +0 -2
  3. package/kernel/bin/caddy.js +6 -9
  4. package/kernel/bin/conda.js +4 -9
  5. package/kernel/bin/index.js +213 -81
  6. package/kernel/bin/setup.js +130 -0
  7. package/kernel/environment.js +50 -1
  8. package/kernel/index.js +15 -60
  9. package/kernel/info.js +0 -3
  10. package/kernel/kv.js +3 -0
  11. package/kernel/loader.js +3 -12
  12. package/kernel/peer.js +11 -16
  13. package/kernel/procs.js +1 -4
  14. package/kernel/prototype.js +12 -9
  15. package/kernel/router/common.js +31 -41
  16. package/kernel/router/connector.js +33 -64
  17. package/kernel/router/index.js +51 -124
  18. package/kernel/router/localhost_home_router.js +7 -18
  19. package/kernel/router/localhost_variable_router.js +0 -1
  20. package/kernel/router/peer_port_router.js +2 -3
  21. package/kernel/router/processor.js +0 -3
  22. package/kernel/shell.js +0 -23
  23. package/kernel/shells.js +0 -16
  24. package/package.json +1 -1
  25. package/server/index.js +145 -318
  26. package/server/public/fscreator.js +1 -1
  27. package/server/public/install.js +2 -2
  28. package/server/public/style.css +4 -0
  29. package/server/socket.js +0 -27
  30. package/server/views/bootstrap.ejs +6 -1
  31. package/server/views/download.ejs +7 -1
  32. package/server/views/editor.ejs +7 -3
  33. package/server/views/file_explorer.ejs +7 -1
  34. package/server/views/index.ejs +7 -1
  35. package/server/views/install.ejs +8 -5
  36. package/server/views/minterm.ejs +7 -3
  37. package/server/views/network.ejs +3 -1
  38. package/server/views/prototypes.ejs +1 -1
  39. package/server/views/setup.ejs +254 -0
  40. package/server/views/setup_home.ejs +181 -0
  41. package/server/views/terminal.ejs +7 -4
  42. package/kernel/caddy2.js +0 -666
  43. package/kernel/peer2.js +0 -83
  44. package/kernel/router/root.js +0 -54
  45. package/kernel/tree-kill.js +0 -167
@@ -439,4 +439,53 @@ const get_raw = async (homedir) => {
439
439
  }
440
440
  return current_env
441
441
  }
442
- module.exports = { ENV, get, get2, init_folders }
442
+
443
+ const requirements = async (script, filepath, kernel) => {
444
+ let pre_items = []
445
+ let requires_instantiation = false
446
+ if (script && script.pre) {
447
+ let env = await get2(filepath, kernel)
448
+ for(let item of script.pre) {
449
+ if (item.env) {
450
+ // if index is not set, use 0 as default (for key)
451
+ if (!item.index) {
452
+ item.index = 0
453
+ }
454
+ if (item.key) {
455
+ const hasProtocol = /^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(item.key);
456
+ const url = new URL(hasProtocol ? item.key : `https://${item.key}`);
457
+ item.host = url.host
458
+ item.val = await kernel.kv.get(item.host, item.index)
459
+ } else {
460
+ item.host = ""
461
+ }
462
+
463
+ if (env[item.env]) {
464
+ item.val = env[item.env]
465
+ } else {
466
+ if (item.default) {
467
+ if (typeof item.default === 'object') {
468
+ if (item.default.key) {
469
+ const hasProtocol = /^[a-zA-Z][a-zA-Z\d+\-.]*:\/\//.test(item.default.key);
470
+ const url = new URL(hasProtocol ? item.default.key : `https://${item.default.key}`);
471
+ item.host = url.host
472
+
473
+ let index = item.default.index || 0
474
+ item.index = index
475
+ item.val = await kernel.kv.get(item.host, index)
476
+ } else {
477
+ item.host = ""
478
+ }
479
+ } else {
480
+ item.val = item.default
481
+ }
482
+ }
483
+ requires_instantiation = true
484
+ }
485
+ pre_items.push(item)
486
+ }
487
+ }
488
+ }
489
+ return { items: pre_items, requires_instantiation }
490
+ }
491
+ module.exports = { ENV, get, get2, init_folders, requirements }
package/kernel/index.js CHANGED
@@ -118,21 +118,6 @@ class Kernel {
118
118
  }
119
119
  }
120
120
  }
121
- // path_exists(...args) {
122
- // return this.info.exists(...args)
123
- // }
124
- // path_resolve(...args) {
125
- // return this.info.path(...args)
126
- // }
127
- // script_running(...args) {
128
- // return this.info.running(...args)
129
- // }
130
- // script_local(...args) {
131
- // return this.info.local(...args)
132
- // }
133
- // script_global(...args) {
134
- // return this.info.global(...args)
135
- // }
136
121
  async env(...args) {
137
122
  let folderpath
138
123
  if (args) {
@@ -267,55 +252,40 @@ class Kernel {
267
252
  active = true
268
253
  }
269
254
  // console.log("kernel.refresh", { active, notify_peers })
270
- if (active) {
255
+
256
+ let installed = await this.bin.check_installed({ name: "caddy" })
257
+ console.log("caddy installed?", installed)
258
+ if (installed && active) {
271
259
 
272
260
  // 1. get the process list
273
- // console.log("Step 1: Get process list")
274
261
  await this.processes.refresh()
275
- // console.log("Process info", this.processes.info)
276
262
 
277
263
  // 2. refresh peer info to reflect the proc info
278
264
  await this.peer.refresh()
279
265
 
280
- // 3. set current local host router info
281
- // console.log("Step 3: Set current local host router")
266
+ // 3. load custom routers from ~/pinokio/network
267
+ await this.router.init()
268
+
269
+ // 4. set current local host router info
282
270
  await this.router.local()
283
- // console.log("router mapping after step 3", this.router.info)
284
271
 
285
- // 4. refresh peer info to reflect the updated router info
272
+ // 5. refresh peer info to reflect the updated router info
286
273
  await this.peer.refresh()
287
274
 
288
- // 4. tell peers to refresh
275
+ // 6. tell peers to refresh
289
276
  if (notify_peers) {
290
- // console.log("Step 4: notify peers to refresh")
291
277
  await this.peer.notify_peers()
292
278
  }
293
279
 
294
- // 4. update remote router
295
- // console.log("Step 5: Set remote routers")
280
+ // 7. update remote router
296
281
  await this.router.remote()
297
- // console.log("router mapping after step 5", this.router.info)
298
282
 
283
+ // 8. update caddy config
299
284
  await this.router.update()
300
285
 
286
+ // 9. announce self to the peer network
287
+ this.peer.announce()
301
288
 
302
- // await Promise.all([
303
- // // refresh proc info
304
- // this.processes.refresh(),
305
- // // refresh peer info
306
- // this.peer.refresh()
307
- // ])
308
- // console.log("proc info", this.processes.info)
309
- // console.log("peer info", this.peer.info)
310
- // // refresh router info
311
- // await this.router.refresh()
312
- // console.log("router info", this.router.published())
313
- //// await this.peer.refresh()
314
- //
315
- // if (notify_peers) {
316
- // // broadcast to peers to refresh
317
- // await this.peer.notify_peers()
318
- // }
319
289
  }
320
290
  }
321
291
  async clearLog(group) {
@@ -528,25 +498,13 @@ class Kernel {
528
498
  let home = this.store.get("home")
529
499
 
530
500
  // reset shells if they exist
531
- console.log("KERNEL INIT")
532
501
  if (this.shell) {
533
- console.log("> shell reset")
534
502
  this.shell.reset()
535
503
  }
536
504
  if (this.peer) {
537
- console.log("> peer stop")
538
505
  this.peer.stop()
539
506
  }
540
507
 
541
- // // kill all processes just in case
542
- // await new Promise((resolve, reject) => {
543
- // console.log("killing child processes for", process.pid)
544
- // kill(process.pid, {}, 'SIGKILL', () => {
545
- // console.log("child procs killed for", process.pid)
546
- // resolve()
547
- // });
548
- // })
549
-
550
508
  this.info = new Info(this)
551
509
  this.pipe = new Pipe(this)
552
510
  this.proto = new Proto(this)
@@ -668,10 +626,8 @@ class Kernel {
668
626
  this.bin.init().then(() => {
669
627
  if (this.homedir) {
670
628
  this.shell.init().then(async () => {
671
- this.bin.check_bin()
672
- console.log(">>>> 1")
629
+ // this.bin.check()
673
630
  if (this.envs) {
674
- console.log(">>>> 2")
675
631
  this.template.update({
676
632
  env: this.envs,
677
633
  envs: this.envs,
@@ -720,7 +676,6 @@ class Kernel {
720
676
  }
721
677
  }
722
678
  }
723
- console.log(">>>>>> d")
724
679
  clearInterval(interval)
725
680
  setTimeout(() => {
726
681
  this.launch_complete = true
package/kernel/info.js CHANGED
@@ -40,16 +40,13 @@ class Info {
40
40
  running(...args) {
41
41
  let cwd = path.dirname(this.caller())
42
42
  let resolved_path = path.resolve(cwd, ...args)
43
- console.log("api.running", this.kernel.api.running)
44
43
  let running = this.kernel.api.running[resolved_path]
45
- console.log("info.running", { cwd, resolved_path, running })
46
44
  return running ? running : false
47
45
  }
48
46
  exists(...args) {
49
47
  let cwd = path.dirname(this.caller())
50
48
  let resolved_path = path.resolve(cwd, ...args)
51
49
  let exists = fs.existsSync(resolved_path)
52
- console.log("info.exists", { cwd, resolved_path, exists })
53
50
  return exists ? exists: false
54
51
  }
55
52
  local(...args) {
package/kernel/kv.js CHANGED
@@ -12,6 +12,9 @@ class KV {
12
12
  json[host] = []
13
13
  }
14
14
  // if index doesn't exist, set index 0
15
+ if (!index) {
16
+ index = 0
17
+ }
15
18
  json[host][index] = val
16
19
  await fs.promises.writeFile(filePath, JSON.stringify(json, null, 2), 'utf8')
17
20
  }
package/kernel/loader.js CHANGED
@@ -6,14 +6,6 @@ const clearModule = require('clear-module');
6
6
 
7
7
  class Loader {
8
8
  async load(_path) {
9
-
10
- // let exists = await new Promise(r=>fs.access(_path, fs.constants.F_OK, e => r(!e)))
11
- // if (!exists) {
12
- // console.log(`[load] ${_path} does not exist`)
13
- // return { resolved: null }
14
- // }
15
-
16
-
17
9
  let resolved
18
10
  let dirname
19
11
  let extension = path.extname(_path)
@@ -40,30 +32,29 @@ class Loader {
40
32
  resolved = null
41
33
  }
42
34
  } catch (e) {
43
- console.log(`[did not load] ${_path}`)
44
35
  resolved = null
45
36
  }
46
37
  }
38
+ if (!resolved) {
39
+ console.log(`[did not load] ${_path}`)
40
+ }
47
41
  return { resolved, extension, dirname }
48
42
  }
49
43
  async requireJSON(filepath) {
50
44
  let config
51
45
  try { config = require(filepath) } catch (e) {
52
- console.log(`[did not load] ${filepath}`)
53
46
  }
54
47
  return config
55
48
  }
56
49
  async requireJS(filepath) {
57
50
  let config
58
51
  try { config = require(filepath) } catch (e) {
59
- console.log(`[did not load] ${filepath}`)
60
52
  }
61
53
  try {
62
54
  // if the required module is a class, return the instantiated object
63
55
  return new config();
64
56
  } catch (e) {
65
57
  // otherwise return normally
66
- console.log(`[did not load] ${filepath}`)
67
58
  return config
68
59
  }
69
60
  }
package/kernel/peer.js CHANGED
@@ -10,6 +10,7 @@ class PeerDiscovery {
10
10
  this.peers = new Set();
11
11
  this.host = this._getLocalIPAddress()
12
12
  this.default_port = 42000
13
+ this.peers.add(this.host)
13
14
  // this.start();
14
15
  }
15
16
  stop() {
@@ -19,6 +20,9 @@ class PeerDiscovery {
19
20
  this.socket.close()
20
21
  }
21
22
  }
23
+ announce() {
24
+ this.socket.send(this.message, 0, this.message.length, this.port, '192.168.1.255');
25
+ }
22
26
  async start(kernel) {
23
27
  let env = await Environment.get(kernel.homedir)
24
28
 
@@ -36,12 +40,9 @@ class PeerDiscovery {
36
40
 
37
41
  if (this.active) {
38
42
  // Listen for incoming pings
39
- console.log("kernel.peer start")
40
43
  this.socket = dgram.createSocket('udp4');
41
44
  this.socket.on('message', (msg, rinfo) => {
42
- // console.log("peer message", { msg, rinfo })
43
45
  const ip = rinfo.address;
44
- // console.log({rinfo})
45
46
  if (msg.toString() === this.message.toString() && this._isLocalLAN(ip)) {
46
47
  if (!this.peers.has(ip)) {
47
48
  console.log(`Discovered peer: ${ip}`);
@@ -62,16 +63,13 @@ class PeerDiscovery {
62
63
 
63
64
  this.socket.setBroadcast(true);
64
65
 
65
- // Send broadcast pings every interval
66
- this.interval_handle = setInterval(() => {
67
- // console.log("send message to peers")
68
- //this.socket.send(this.message, 0, this.message.length, this.port, '127.0.0.1');
69
- //console.log("sent to 127.0.0.1")
70
- //this.socket.send(this.message, 0, this.message.length, this.port, '255.255.255.255');
71
- this.socket.send(this.message, 0, this.message.length, this.port, '192.168.1.255');
72
- //console.log("sent to 255.255.255.255")
73
- // console.log("sent message")
74
- }, this.interval);
66
+ this.announce()
67
+
68
+ // // Send broadcast pings every interval
69
+ // this.interval_handle = setInterval(() => {
70
+ // //this.socket.send(this.message, 0, this.message.length, this.port, '255.255.255.255');
71
+ // this.socket.send(this.message, 0, this.message.length, this.port, '192.168.1.255');
72
+ // }, this.interval);
75
73
  });
76
74
  }
77
75
  }
@@ -86,7 +84,6 @@ class PeerDiscovery {
86
84
  }
87
85
  }
88
86
  async _broadcast(host) {
89
- // console.log("peer _broadcast", host)
90
87
  try {
91
88
  let res = await axios.post(`http://${host}:${this.default_port}/pinokio/peer/refresh`, {
92
89
  timeout: 2000
@@ -119,7 +116,6 @@ class PeerDiscovery {
119
116
  let peer_info = await Promise.all(refresh_peers.map((host) => {
120
117
  return this._refresh(host)
121
118
  }))
122
- // console.log({ peer_info })
123
119
  for(let i=0; i<peer_info.length; i++) {
124
120
  let peer = peer_info[i]
125
121
  if (peer) {
@@ -129,7 +125,6 @@ class PeerDiscovery {
129
125
  }
130
126
  }
131
127
  }
132
- // console.log("REFRESH", this.info)
133
128
  this.refreshing = false
134
129
  return this.info
135
130
  }
package/kernel/procs.js CHANGED
@@ -98,16 +98,13 @@ class Procs {
98
98
  const fullname = pidToName[pid] || 'Unknown';
99
99
  const name = fullname.split(path.sep).pop()
100
100
  if (["caddy", "caddy.exe"].includes(name)) {
101
+ this.caddy_pid = pid
101
102
  return null
102
103
  } else {
103
104
  map["" + pid] = fullname
104
105
  return { port, pid , name, fullname, ip }
105
106
  }
106
107
  }).filter((x) => { return x })
107
- // list = list.filter((item) => {
108
- // return !["caddy", "caddy.exe"].includes(item.name.toLowerCase())
109
- // })
110
- // console.log("#LIST", { list, size: list.length })
111
108
  resolve(list)
112
109
  });
113
110
  });
@@ -1,5 +1,6 @@
1
1
  const fs = require('fs')
2
2
  const path = require('path')
3
+ const { glob, sync, hasMagic } = require('glob-gitignore')
3
4
  class Proto {
4
5
  constructor(kernel) {
5
6
  this.kernel = kernel
@@ -10,24 +11,26 @@ class Proto {
10
11
  let exists = await this.kernel.exists("prototype")
11
12
  if (!exists) {
12
13
  console.log("prototype doesn't exist. cloning...")
14
+ await fs.promises.mkdir(this.kernel.path("prototype"), { recursive: true }).catch((e) => { })
13
15
  await this.kernel.exec({
14
- message: "git clone https://github.com/peanutcocktail/prototype",
15
- path: this.kernel.homedir
16
+ message: "git clone https://github.com/peanutcocktail/prototype system",
17
+ path: this.kernel.path("prototype")
16
18
  }, (e) => {
17
19
  process.stdout.write(e.raw)
18
20
  })
19
21
  }
20
- // get all prototypes
22
+
23
+
24
+ let cwd = path.resolve(this.kernel.homedir, "prototype")
25
+ let prototype_paths = (await glob('**/pinokio.js', { cwd }))
21
26
  let prototype_dir = path.resolve(this.kernel.homedir, "prototype")
22
- let prototypes = await fs.promises.readdir(prototype_dir, { withFileTypes: true })
23
- prototypes = prototypes.filter(d => d.isDirectory()).map(d => d.name);
24
- console.log({ prototypes })
25
27
  this.items = []
26
28
  this.kv = {}
27
- for(let proto of prototypes) {
28
- let pinokiojs = path.resolve(prototype_dir, proto, "pinokio.js")
29
+ for(let prototype_path of prototype_paths) {
30
+ let proto = path.dirname(prototype_path)
31
+ let pinokiojs = path.resolve(prototype_dir, prototype_path)
29
32
  let config = await this.kernel.require(pinokiojs)
30
- if (config && config.type === "prototype") {
33
+ if (config && config.create && typeof config.create === "function") {
31
34
  if (config.icon) {
32
35
  config.icon = "/prototype/" + proto + "/" + config.icon
33
36
  } else {
@@ -1,50 +1,40 @@
1
- class Common {
1
+ const Processor = require('./processor')
2
+ class Common extends Processor {
2
3
  constructor (router) {
4
+ super()
3
5
  this.router = router
4
6
  }
5
7
  handle({ match, dial, host }) {
6
- this.router.config.apps.http.servers.main.routes.push({
7
- "match": [{ "host": [match] }],
8
- "handle": [
9
- {
10
- "handler": "reverse_proxy",
11
- "upstreams": [{ "dial": dial }],
12
- "headers": {
13
- "request": {
14
- "set": {
15
- "Origin": ["http://127.0.0.1:11434"],
16
- "X-Forwarded-Proto": ["https"],
17
- "X-Forwarded-Host": ["{http.request.host}"]
18
- }
19
- },
20
- "response": {
21
- "set": {
22
- "Access-Control-Allow-Origin": ["*"],
23
- "Access-Control-Allow-Methods": ["GET, POST, OPTIONS, PUT, DELETE"],
24
- "Access-Control-Allow-Headers": ["*"],
25
- "Vary": ["Origin"]
26
- }
27
- }
8
+ let handler = [{
9
+ "handler": "reverse_proxy",
10
+ "upstreams": [{ "dial": dial }],
11
+ "headers": {
12
+ "request": {
13
+ "set": {
14
+ "X-Forwarded-Proto": ["https"],
15
+ "X-Forwarded-Host": ["{http.request.host}"]
28
16
  }
29
17
  },
30
- //{
31
- // "handler": "headers",
32
- // "request": {
33
- // "set": {
34
- // "X-Forwarded-Proto": ["https"],
35
- // "X-Forwarded-Host": ["{http.request.host}"]
36
- // }
37
- // },
38
- // "response": {
39
- // "set": {
40
- // "Access-Control-Allow-Origin": ["*"],
41
- // "Access-Control-Allow-Methods": ["GET, POST, OPTIONS, PUT, DELETE"],
42
- // "Access-Control-Allow-Headers": ["*"],
43
- // "Vary": ["Origin"]
44
- // }
45
- // }
46
- //}
47
- ]
18
+ "response": {
19
+ "set": {
20
+ "Access-Control-Allow-Origin": ["*"],
21
+ "Access-Control-Allow-Methods": ["GET, POST, OPTIONS, PUT, DELETE"],
22
+ "Access-Control-Allow-Headers": ["*"],
23
+ "Vary": ["Origin"]
24
+ }
25
+ }
26
+ }
27
+ }]
28
+
29
+ // if the dial port has been overridden by router.custom_routers, use that instead
30
+ let parsed_dial = this.parse_ip(dial)
31
+ let override_handler = this.router.custom_routers[String(parsed_dial.port)]
32
+ if (override_handler) {
33
+ handler = override_handler
34
+ }
35
+ this.router.config.apps.http.servers.main.routes.push({
36
+ "match": [{ "host": [match] }],
37
+ "handle": handler
48
38
  })
49
39
  this.router.add({ host, dial, match })
50
40
  }
@@ -1,60 +1,48 @@
1
- class Connector {
1
+ const Processor = require('./processor')
2
+ class Connector extends Processor {
2
3
  constructor(router) {
4
+ super()
3
5
  this.router = router
4
6
  }
5
7
  handle ({ match, connector, dial, }) {
6
- // console.log("connector.handle", { match, connector, dial })
7
8
  let connector_name = connector.host + ":" + connector.port
8
9
  let listener = "0.0.0.0:PORT_PLACEHOLDER_" + connector_name
9
10
  let listener_pointer = connector.host + ":PORT_PLACEHOLDER_" + connector_name
10
11
  let port_placeholder = "PORT_PLACEHOLDER_" + connector_name
11
- // console.log("CONNECTING", { listener, dial, listener_pointer, match })
12
+
13
+ let handler = [{
14
+ "handler": "reverse_proxy",
15
+ "upstreams": [{ "dial": dial }],
16
+ "headers": {
17
+ "request": {
18
+ "set": {
19
+ "X-Forwarded-Proto": ["{http.request.header.X-Forwarded-Proto}"],
20
+ //"X-Forwarded-Proto": ["{http.request.scheme}"],
21
+ //"X-Forwarded-Proto": ["https"],
22
+ //"X-Forwarded-Host": ["{http.request.host}"]
23
+ }
24
+ },
25
+ "response": {
26
+ "set": {
27
+ "Access-Control-Allow-Origin": ["*"],
28
+ "Access-Control-Allow-Methods": ["GET, POST, OPTIONS, PUT, DELETE"],
29
+ "Access-Control-Allow-Headers": ["*"],
30
+ "Vary": ["Origin"]
31
+ }
32
+ }
33
+ }
34
+ }]
35
+ // if the dial port has been overridden by router.custom_routers, use that instead
36
+ let parsed_dial = this.parse_ip(dial)
37
+ let override_handler = this.router.custom_routers[String(parsed_dial.port)]
38
+ if (override_handler) {
39
+ handler = override_handler
40
+ }
12
41
  if(!this.router.config.apps.http.servers[connector_name]) {
13
42
  this.router.config.apps.http.servers[connector_name] = {
14
43
  "listen": [listener],
15
44
  "routes": [{
16
- "handle": [
17
- {
18
- "handler": "reverse_proxy",
19
- "upstreams": [{ "dial": dial }],
20
- "headers": {
21
- "request": {
22
- "set": {
23
- "Origin": ["http://127.0.0.1:11434"],
24
- "X-Forwarded-Proto": ["{http.request.header.X-Forwarded-Proto}"],
25
- //"X-Forwarded-Proto": ["{http.request.scheme}"],
26
- //"X-Forwarded-Proto": ["https"],
27
- //"X-Forwarded-Host": ["{http.request.host}"]
28
- }
29
- },
30
- "response": {
31
- "set": {
32
- "Access-Control-Allow-Origin": ["*"],
33
- "Access-Control-Allow-Methods": ["GET, POST, OPTIONS, PUT, DELETE"],
34
- "Access-Control-Allow-Headers": ["*"],
35
- "Vary": ["Origin"]
36
- }
37
- }
38
- }
39
- },
40
- // {
41
- // "handler": "headers",
42
- // "request": {
43
- // "set": {
44
- // "X-Forwarded-Proto": ["https"],
45
- // "X-Forwarded-Host": ["{http.request.host}"]
46
- // }
47
- // },
48
- // "response": {
49
- // "set": {
50
- // "Access-Control-Allow-Origin": ["*"],
51
- // "Access-Control-Allow-Methods": ["GET, POST, OPTIONS, PUT, DELETE"],
52
- // "Access-Control-Allow-Headers": ["*"],
53
- // "Vary": ["Origin"]
54
- // }
55
- // }
56
- // }
57
- ]
45
+ "handle": handler
58
46
  }]
59
47
  }
60
48
  }
@@ -85,28 +73,9 @@ class Connector {
85
73
  }
86
74
  }
87
75
  },
88
- // {
89
- // "handler": "headers",
90
- // "request": {
91
- // "set": {
92
- // "X-Forwarded-Proto": ["https"],
93
- // "X-Forwarded-Host": ["{http.request.host}"]
94
- // }
95
- // },
96
- // "response": {
97
- // "set": {
98
- // "Access-Control-Allow-Origin": ["*"],
99
- // "Access-Control-Allow-Methods": ["GET, POST, OPTIONS, PUT, DELETE"],
100
- // "Access-Control-Allow-Headers": ["*"],
101
- // "Vary": ["Origin"]
102
- // }
103
- // }
104
- // }
105
76
  ]
106
77
  })
107
78
  this.router.add({ host: connector.host, dial: listener_pointer, match })
108
- // this.router._tree[connector_name] = dial
109
- // this.router._tree[connector_name] = dial
110
79
  }
111
80
  }
112
81
  module.exports = Connector