pinokiod 3.11.0 → 3.11.6

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 (41) hide show
  1. package/kernel/bin/git.js +34 -21
  2. package/kernel/bin/index.js +7 -7
  3. package/kernel/bin/setup.js +80 -30
  4. package/kernel/index.js +19 -6
  5. package/kernel/peer.js +4 -3
  6. package/kernel/prototype.js +1 -1
  7. package/kernel/shell.js +5 -0
  8. package/kernel/shells.js +15 -0
  9. package/package.json +1 -1
  10. package/server/index.js +152 -39
  11. package/server/public/common.js +5 -0
  12. package/server/public/nav.js +1 -0
  13. package/server/public/style.css +2 -2
  14. package/server/socket.js +5 -0
  15. package/server/views/app.ejs +9 -6
  16. package/server/views/connect/x.ejs +7 -2
  17. package/server/views/connect.ejs +2 -1
  18. package/server/views/download.ejs +3 -2
  19. package/server/views/editor.ejs +2 -2
  20. package/server/views/env_editor.ejs +1 -1
  21. package/server/views/explore.ejs +2 -1
  22. package/server/views/file_explorer.ejs +2 -1
  23. package/server/views/frame.ejs +1 -1
  24. package/server/views/general_editor.ejs +1 -1
  25. package/server/views/github.ejs +19 -6
  26. package/server/views/help.ejs +2 -1
  27. package/server/views/index.ejs +22 -0
  28. package/server/views/install.ejs +25 -2
  29. package/server/views/keys.ejs +31 -12
  30. package/server/views/network.ejs +2 -1
  31. package/server/views/pre.ejs +1 -1
  32. package/server/views/prototype/old_index.ejs +1 -1
  33. package/server/views/prototype/show.ejs +1 -1
  34. package/server/views/required_env_editor.ejs +1 -1
  35. package/server/views/settings.ejs +2 -1
  36. package/server/views/setup.ejs +78 -42
  37. package/server/views/setup_home.ejs +1 -1
  38. package/server/views/share_editor.ejs +1 -1
  39. package/server/views/shell.ejs +31 -3
  40. package/server/views/sidebar.ejs +1 -1
  41. package/server/views/terminal.ejs +19 -2
package/kernel/bin/git.js CHANGED
@@ -12,34 +12,47 @@ class Git {
12
12
  }
13
13
  }
14
14
  async install(req, ondata) {
15
+ console.log("GIT install")
16
+ await this.kernel.bin.exec({
17
+ message: [
18
+ "conda clean -y --all",
19
+ `conda install -y -c conda-forge ${this.cmd()}`
20
+ ]
21
+ }, ondata)
15
22
  if (this.kernel.platform === "darwin") {
23
+ console.log("brew install gh")
16
24
  await this.kernel.bin.exec({
17
- conda: { skip: true },
18
- message: "brew install gh",
19
- }, ondata)
20
- } else {
21
- await this.kernel.bin.exec({
25
+ // conda: { skip: true },
22
26
  message: [
23
- "conda clean -y --all",
24
- `conda install -y -c conda-forge ${this.cmd()}`
25
- ]
26
- }, ondata)
27
+ "echo $PATH",
28
+ "which brew",
29
+ "brew install gh",
30
+ ],
31
+ }, (e) => {
32
+ process.stdout.write(e.raw)
33
+ ondata(e)
34
+ })
27
35
  }
28
36
  await fs.promises.mkdir(this.kernel.path("config/gh"), { recursive: true }).catch((e) => { })
29
- // if (this.kernel.platform === 'win32') {
30
- // let gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
31
- // // check if gitconfig exists
32
- // let exists = await this.kernel.api.exists(gitconfig_path)
33
- // // if not, create one
34
- // if (!exists) {
35
- // await fs.promises.copyFile(
36
- // path.resolve(__dirname, "..", "gitconfig_template"),
37
- // gitconfig_path
38
- // )
39
- // }
40
- // }
37
+
38
+ let gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
39
+ // check if gitconfig exists
40
+ let exists = await this.kernel.api.exists(gitconfig_path)
41
+ // if not, create one
42
+ if (!exists) {
43
+ await fs.promises.copyFile(
44
+ path.resolve(__dirname, "..", "gitconfig_template"),
45
+ gitconfig_path
46
+ )
47
+ }
41
48
  }
42
49
  async installed() {
50
+ let gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
51
+ let exists = await this.kernel.api.exists(gitconfig_path)
52
+ if (!exists) {
53
+ return false;
54
+ }
55
+
43
56
  if (this.kernel.platform === "darwin") {
44
57
  let gh_config_exists = await this.kernel.exists("config/gh")
45
58
  return this.kernel.bin.installed.conda && this.kernel.bin.installed.conda.has("git") && this.kernel.bin.installed.brew.has("gh") && gh_config_exists
@@ -285,13 +285,13 @@ class Bin {
285
285
  await fs.promises.writeFile(pipconfig_path, pipconfigStr)
286
286
  }
287
287
 
288
- // add gitconfig => support git lfs, long path, etc.
289
- let gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
290
- // check if gitconfig exists
291
- await fs.promises.copyFile(
292
- path.resolve(__dirname, "..", "gitconfig_template"),
293
- gitconfig_path
294
- )
288
+ // // add gitconfig => support git lfs, long path, etc.
289
+ // let gitconfig_path = path.resolve(this.kernel.homedir, "gitconfig")
290
+ // // check if gitconfig exists
291
+ // await fs.promises.copyFile(
292
+ // path.resolve(__dirname, "..", "gitconfig_template"),
293
+ // gitconfig_path
294
+ // )
295
295
 
296
296
  for(let mod of this.mods) {
297
297
  if (mod.mod.start) {
@@ -1,8 +1,15 @@
1
1
  const os = require('os')
2
2
  let platform = os.platform()
3
+ let zip_cmd
4
+ if (platform === 'win32') {
5
+ zip_cmd = "7zip"
6
+ } else {
7
+ zip_cmd = "p7zip"
8
+ }
3
9
  module.exports = {
4
10
  ai: (kernel) => {
5
11
  let conda_requirements = [
12
+ zip_cmd,
6
13
  "uv",
7
14
  "node",
8
15
  "huggingface",
@@ -12,19 +19,21 @@ module.exports = {
12
19
  ]
13
20
  let requirements = [
14
21
  { name: "conda", },
22
+ { name: "zip", },
23
+ ]
24
+ if (platform === "darwin") {
25
+ requirements.push({ name: "brew" })
26
+ }
27
+ requirements = requirements.concat([
15
28
  { name: "git", },
16
- // { name: "zip", },
17
29
  { name: "node", },
18
30
  { name: "ffmpeg", },
19
31
  // { name: "caddy", }
20
- ]
32
+ ])
21
33
  if (platform === "win32") {
22
34
  requirements.push({ name: "registry" })
23
35
  requirements.push({ name: "vs" })
24
36
  }
25
- if (platform === "darwin") {
26
- requirements.push({ name: "brew" })
27
- }
28
37
  if (platform === "linux") {
29
38
  requirements.push({ name: "gxx" })
30
39
  conda_requirements.push("gxx")
@@ -49,34 +58,50 @@ module.exports = {
49
58
  }
50
59
  },
51
60
  javascript: (kernel) => {
61
+ let requirements = [
62
+ { name: "conda", },
63
+ { name: "zip", },
64
+ ]
65
+ if (platform === "darwin") {
66
+ requirements.push({ name: "brew" })
67
+ }
68
+ requirements = requirements.concat([
69
+ { name: "git", },
70
+ { name: "node", },
71
+ { name: "py" },
72
+ ])
52
73
  return {
53
74
  icon: "fa-brands fa-js",
54
75
  title: "Node.js",
55
76
  description: "Set up self-contained node.js development environment",
56
- requirements: [
57
- { name: "conda", },
58
- { name: "git", },
59
- { name: "node", },
60
- { name: "py" },
61
- ],
77
+ requirements,
62
78
  conda_requirements: [
79
+ zip_cmd,
63
80
  "node",
64
81
  "git",
65
82
  ]
66
83
  }
67
84
  },
68
85
  python: (kernel) => {
86
+ let requirements = [
87
+ { name: "conda", },
88
+ { name: "zip", },
89
+ ]
90
+ if (platform === "darwin") {
91
+ requirements.push({ name: "brew" })
92
+ }
93
+ requirements = requirements.concat([
94
+ { name: "git", },
95
+ { name: "uv", },
96
+ { name: "py" },
97
+ ])
69
98
  return {
70
99
  icon: "fa-brands fa-python",
71
100
  title: "Python",
72
101
  description: "Set up self-contained python development environment",
73
- requirements: [
74
- { name: "conda", },
75
- { name: "git", },
76
- { name: "uv", },
77
- { name: "py" },
78
- ],
102
+ requirements,
79
103
  conda_requirements: [
104
+ zip_cmd,
80
105
  "uv",
81
106
  "git",
82
107
  ]
@@ -85,11 +110,18 @@ module.exports = {
85
110
  dev: (kernel) => {
86
111
  let requirements = [
87
112
  { name: "conda", },
113
+ { name: "zip", },
114
+ ]
115
+ if (platform === "darwin") {
116
+ requirements.push({ name: "brew" })
117
+ }
118
+ requirements = requirements.concat([
88
119
  { name: "git", },
89
120
  { name: "node", },
90
121
  { name: "uv", },
91
- ]
122
+ ])
92
123
  let conda_requirements = [
124
+ zip_cmd,
93
125
  "uv",
94
126
  "node",
95
127
  "git",
@@ -114,34 +146,52 @@ module.exports = {
114
146
  }
115
147
  },
116
148
  network: (kernel) => {
149
+ let requirements = [
150
+ { name: "conda", },
151
+ { name: "zip", },
152
+ ]
153
+ if (platform === "darwin") {
154
+ requirements.push({ name: "brew" })
155
+ }
156
+ requirements = requirements.concat([
157
+ { name: "git", },
158
+ { name: "caddy", },
159
+ { name: "py", },
160
+ ])
161
+ console.log("Setup.network", requirements)
117
162
  return {
118
163
  icon: "fa-solid fa-wifi",
119
164
  title: "Network",
120
165
  description: "Automatic HTTPS and local network sharing for ALL local apps",
121
- requirements: [
122
- { name: "conda", },
123
- { name: "git", },
124
- { name: "caddy", },
125
- { name: "py", },
126
- ],
166
+ requirements,
127
167
  conda_requirements: [
168
+ zip_cmd,
128
169
  "git",
129
170
  "caddy"
130
171
  ]
131
172
  }
132
173
  },
133
174
  connect: (kernel) => {
175
+ let requirements = [
176
+ { name: "conda", },
177
+ { name: "zip", },
178
+ ]
179
+ if (platform === "darwin") {
180
+ requirements.push({ name: "brew" })
181
+ }
182
+ requirements = requirements.concat([
183
+ { name: "git", },
184
+ { name: "caddy", },
185
+ { name: "py", },
186
+ ])
187
+ console.log("Setup.connect", requirements)
134
188
  return {
135
189
  icon: "fa-solid fa-wifi",
136
190
  title: "API Connect",
137
191
  description: "Connect with 3rd party APIs",
138
- requirements: [
139
- { name: "conda", },
140
- { name: "git", },
141
- { name: "caddy", },
142
- { name: "py", },
143
- ],
192
+ requirements,
144
193
  conda_requirements: [
194
+ zip_cmd,
145
195
  "git",
146
196
  "caddy"
147
197
  ]
package/kernel/index.js CHANGED
@@ -264,14 +264,20 @@ class Kernel {
264
264
  }
265
265
  async refresh(notify_peers) {
266
266
  let env = await Environment.get(this.homedir)
267
- let peer_active = false
267
+ let peer_active = true
268
268
  // if PINOKIO_NETWORK_SHARE is 0 or false, turn it off
269
- if (env && env.PINOKIO_NETWORK_ACTIVE && (env.PINOKIO_NETWORK_ACTIVE==="1" || env.PINOKIO_NETWORK_ACTIVE.toLowerCase()==="true")) {
270
- peer_active = true
269
+ // By default it should be on.
270
+ // It's off if the value is set, and it's 0 or false
271
+
272
+ //if (env && env.PINOKIO_NETWORK_ACTIVE && (env.PINOKIO_NETWORK_ACTIVE==="1" || env.PINOKIO_NETWORK_ACTIVE.toLowerCase()==="true")) {
273
+ if (env && env.PINOKIO_NETWORK_ACTIVE && (env.PINOKIO_NETWORK_ACTIVE==="0" || env.PINOKIO_NETWORK_ACTIVE.toLowerCase()==="false")) {
274
+ peer_active = false
271
275
  }
272
- let https_active = false
273
- if (env && env.PINOKIO_HTTPS_ACTIVE && (env.PINOKIO_HTTPS_ACTIVE==="1" || env.PINOKIO_HTTPS_ACTIVE.toLowerCase()==="true")) {
274
- https_active = true
276
+ let https_active = true
277
+ //if (env && env.PINOKIO_HTTPS_ACTIVE && (env.PINOKIO_HTTPS_ACTIVE==="1" || env.PINOKIO_HTTPS_ACTIVE.toLowerCase()==="true")) {
278
+ if (env && env.PINOKIO_HTTPS_ACTIVE && (env.PINOKIO_HTTPS_ACTIVE==="0" || env.PINOKIO_HTTPS_ACTIVE.toLowerCase()==="false")) {
279
+ //https_active = true
280
+ https_active = false
275
281
  }
276
282
  // console.log("kernel.refresh", { active, notify_peers })
277
283
 
@@ -643,6 +649,13 @@ class Kernel {
643
649
  // 2. mkdir all the folders if not already created
644
650
  await Environment.init_folders(this.homedir)
645
651
 
652
+ // if key.json doesn't exist, create an empty json file
653
+ let ee = await this.exists(this.homedir, "key.json")
654
+ if (!ee) {
655
+ await fs.promises.writeFile(path.resolve(this.homedir, "key.json"), JSON.stringify({}))
656
+ }
657
+
658
+
646
659
 
647
660
  // // 3. check if Caddyfile exists
648
661
  // let e2 = await this.exists(this.homedir, "Caddyfile")
package/kernel/peer.js CHANGED
@@ -29,10 +29,11 @@ class PeerDiscovery {
29
29
  let env = await Environment.get(kernel.homedir)
30
30
 
31
31
  // by default expose to the local network
32
- this.active = false
32
+ this.active = true
33
33
  // if PINOKIO_NETWORK_SHARE is 0 or false, turn it off
34
- if (env && env.PINOKIO_NETWORK_ACTIVE && (env.PINOKIO_NETWORK_ACTIVE==="1" || env.PINOKIO_NETWORK_ACTIVE.toLowerCase()==="true")) {
35
- this.active = true
34
+ if (env && env.PINOKIO_NETWORK_ACTIVE && (env.PINOKIO_NETWORK_ACTIVE==="0" || env.PINOKIO_NETWORK_ACTIVE.toLowerCase()==="false")) {
35
+ //if (env && env.PINOKIO_NETWORK_ACTIVE && (env.PINOKIO_NETWORK_ACTIVE==="1" || env.PINOKIO_NETWORK_ACTIVE.toLowerCase()==="true")) {
36
+ this.active = false
36
37
  }
37
38
 
38
39
  this.name = os.userInfo().username
@@ -30,7 +30,7 @@ class Proto {
30
30
  console.log("--config", config)
31
31
  this.config = config
32
32
 
33
- if (this.config.menu) {
33
+ if (this.config && this.config.menu) {
34
34
  this.config.menu.push({
35
35
  icon: "fa-solid fa-rotate",
36
36
  text: "Update",
package/kernel/shell.js CHANGED
@@ -318,6 +318,11 @@ class Shell {
318
318
 
319
319
  // return this.id
320
320
  }
321
+ resize({ cols, rows }) {
322
+ console.log("RESIZE", { cols, rows })
323
+ this.ptyProcess.resize(cols, rows)
324
+ this.vt.resize(cols, rows)
325
+ }
321
326
  emit2(message) {
322
327
  let i = 0;
323
328
  const interval = setInterval(() => {
package/kernel/shells.js CHANGED
@@ -257,6 +257,21 @@ class Shells {
257
257
  let response = await this.send(params, ondata)
258
258
  return response
259
259
  }
260
+ resize(params) {
261
+ /*
262
+ params := {
263
+ "id": <shell id>,
264
+ "resize": {
265
+ "cols": <cols>,
266
+ "rows": <rows>,
267
+ }
268
+ }
269
+ */
270
+ let session = this.get(params.id)
271
+ if (session) {
272
+ session.resize(params.resize)
273
+ }
274
+ }
260
275
  emit(params) {
261
276
  /*
262
277
  params := {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.11.0",
3
+ "version": "3.11.6",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -2449,6 +2449,13 @@ class Server {
2449
2449
  let p2 = path.resolve(home, "prototype")
2450
2450
  await fse.remove(p2)
2451
2451
 
2452
+ let p3 = path.resolve(home, "plugin")
2453
+ await fse.remove(p3)
2454
+
2455
+ let gitconfig = path.resolve(home, "gitconfig")
2456
+ await fse.remove(gitconfig)
2457
+
2458
+
2452
2459
  console.log("[TRY] Updating to the new version")
2453
2460
  this.kernel.store.set("version", this.version.pinokiod)
2454
2461
  console.log("[DONE] Updating to the new version")
@@ -2770,6 +2777,51 @@ class Server {
2770
2777
  // }
2771
2778
  }))
2772
2779
 
2780
+ this.app.get("/check_router_up", ex(async (req, res) => {
2781
+ // check if caddy is runnign properly
2782
+ // try https://pinokio.localhost
2783
+ // if it works, proceed
2784
+ // if not, redirect
2785
+ let https_running = false
2786
+ try {
2787
+ let res = await axios.get(`http://127.0.0.1:2019/config/`, {
2788
+ timeout: 2000
2789
+ })
2790
+ let test = /pinokio\.localhost/.test(JSON.stringify(res.data))
2791
+ if (test) {
2792
+ https_running = true
2793
+ }
2794
+ } catch (e) {
2795
+ console.log(e)
2796
+ }
2797
+ console.log({ https_running })
2798
+ if (!https_running) {
2799
+ res.json({ error: "pinokio.host not yet available" })
2800
+ // res.redirect("/setup/connect?callback=/connect/" + req.params.provider)
2801
+ return
2802
+ }
2803
+
2804
+
2805
+ // check if pinokio.localhost router is running
2806
+ let router_running = false
2807
+ let router = this.kernel.router.published()
2808
+ for(let ip in router) {
2809
+ let domains = router[ip]
2810
+ if (domains.includes("pinokio.localhost")) {
2811
+ router_running = true
2812
+ break
2813
+ }
2814
+ }
2815
+ console.log({ router_running })
2816
+ if (!router_running) {
2817
+ res.json({ error: "pinokio.localhost not yet available" })
2818
+ // res.redirect("/setup/connect?callback=/connect/" + req.params.provider)
2819
+ return
2820
+ }
2821
+
2822
+ res.json({ success: true })
2823
+ }))
2824
+
2773
2825
  /*
2774
2826
  GET /connect => display connection options
2775
2827
  - github
@@ -2804,32 +2856,13 @@ class Server {
2804
2856
  let { requirements, install_required, requirements_pending, error } = await this.kernel.bin.check({
2805
2857
  bin: this.kernel.bin.preset("connect"),
2806
2858
  })
2807
- console.log({ requirements_pending, install_required })
2859
+ console.log("1", { requirements_pending, install_required })
2808
2860
  if (!requirements_pending && install_required) {
2861
+ console.log("REDIRECT", req.params.provider)
2809
2862
  res.redirect("/setup/connect?callback=/connect/" + req.params.provider)
2810
2863
  return
2811
2864
  }
2812
2865
 
2813
- // check if router is running
2814
- let router_running = false
2815
- let router = this.kernel.router.published()
2816
- for(let ip in router) {
2817
- let domains = router[ip]
2818
- if (domains.includes("pinokio.localhost")) {
2819
- router_running = true
2820
- break
2821
- }
2822
- }
2823
- console.log({ router_running })
2824
- if (!router_running) {
2825
- res.redirect("/setup/connect?callback=/connect/" + req.params.provider)
2826
- return
2827
- }
2828
-
2829
- // check if caddy is runnign properly
2830
- // try https://pinokio.localhost
2831
- // if it works, proceed
2832
- // if not, redirect
2833
2866
  let https_running = false
2834
2867
  try {
2835
2868
  let res = await axios.get(`http://127.0.0.1:2019/config/`, {
@@ -2844,10 +2877,30 @@ class Server {
2844
2877
  }
2845
2878
  console.log({ https_running })
2846
2879
  if (!https_running) {
2880
+ // res.json({ error: "pinokio.host not yet available" })
2847
2881
  res.redirect("/setup/connect?callback=/connect/" + req.params.provider)
2848
2882
  return
2849
2883
  }
2850
2884
 
2885
+
2886
+ // check if pinokio.localhost router is running
2887
+ let router_running = false
2888
+ let router = this.kernel.router.published()
2889
+ for(let ip in router) {
2890
+ let domains = router[ip]
2891
+ if (domains.includes("pinokio.localhost")) {
2892
+ router_running = true
2893
+ break
2894
+ }
2895
+ }
2896
+ console.log({ router_running })
2897
+ if (!router_running) {
2898
+ // res.json({ error: "pinokio.localhost not yet available" })
2899
+ res.redirect("/setup/connect?callback=/connect/" + req.params.provider)
2900
+ return
2901
+ }
2902
+
2903
+
2851
2904
  let readme = await this.kernel.connect[req.params.provider].readme()
2852
2905
  res.render(`connect/${req.params.provider}`, {
2853
2906
  portal: this.portal,
@@ -3022,28 +3075,63 @@ class Server {
3022
3075
  }
3023
3076
  let md = await fs.promises.readFile(path.resolve(__dirname, "..", "kernel/connect/providers/github/README.md"), "utf8")
3024
3077
  let readme = marked.parse(md)
3078
+
3079
+ let hosts = ""
3080
+ let hosts_file = this.kernel.path("config/gh/hosts.yml")
3081
+ let e = await this.exists(hosts_file)
3082
+ console.log({ hosts_file, e })
3083
+ if (e) {
3084
+ hosts = await fs.promises.readFile(hosts_file, "utf8")
3085
+ console.log( { hosts: `#${hosts}#` })
3086
+ if (hosts.startsWith("{}")) {
3087
+ hosts = ""
3088
+ }
3089
+ }
3090
+ console.log("hosts", hosts)
3091
+
3092
+ let items
3093
+ if (hosts.length > 0) {
3094
+ // logged in => display logout
3095
+ items = [{
3096
+ icon: "fa-solid fa-circle-xmark",
3097
+ title: "Logout",
3098
+ description: "Log out of Github",
3099
+ url: "/github/logout"
3100
+ }]
3101
+ } else {
3102
+ // logged out => display login
3103
+ items = [{
3104
+ icon: "fa-solid fa-key",
3105
+ title: "Login",
3106
+ description: "Log into Github",
3107
+ url: "/github/login"
3108
+ }]
3109
+ }
3110
+
3025
3111
  res.render("github", {
3112
+ hosts,
3026
3113
  readme,
3027
3114
  portal: this.portal,
3028
3115
  logo: this.logo,
3029
3116
  theme: this.theme,
3030
3117
  agent: this.agent,
3031
- items: [{
3032
- icon: "fa-solid fa-key",
3033
- title: "Login",
3034
- description: "Log into Github",
3035
- url: "/github/login"
3036
- }, {
3037
- icon: "fa-solid fa-check",
3038
- title: "Status",
3039
- description: "Check Github login status",
3040
- url: "/github/status"
3041
- }, {
3042
- icon: "fa-solid fa-circle-xmark",
3043
- title: "Logout",
3044
- description: "Log out of Github",
3045
- url: "/github/logout"
3046
- }]
3118
+ items
3119
+ // items: [{
3120
+ // icon: "fa-solid fa-key",
3121
+ // title: "Login",
3122
+ // description: "Log into Github",
3123
+ // url: "/github/login"
3124
+ //// }, {
3125
+ //// icon: "fa-solid fa-check",
3126
+ //// title: "Status",
3127
+ //// description: "Check Github login status",
3128
+ //// url: "/github/status"
3129
+ // }, {
3130
+ // icon: "fa-solid fa-circle-xmark",
3131
+ // title: "Logout",
3132
+ // description: "Log out of Github",
3133
+ // url: "/github/logout"
3134
+ // }]
3047
3135
  })
3048
3136
  }))
3049
3137
  this.app.get("/github/status", ex(async (req, res) => {
@@ -3067,7 +3155,7 @@ class Server {
3067
3155
  params.set("message", encodeURIComponent(message))
3068
3156
  params.set("path", this.kernel.homedir)
3069
3157
  // params.set("kill", "/Logged in/i")
3070
- params.set("kill_message", "Click to return home")
3158
+ // params.set("kill_message", "Click to return home")
3071
3159
  params.set("callback", encodeURIComponent("/github"))
3072
3160
  params.set("id", id)
3073
3161
  params.set("target", "_top")
@@ -3091,7 +3179,7 @@ class Server {
3091
3179
  params.set("input", true)
3092
3180
  params.set("path", this.kernel.homedir)
3093
3181
  params.set("kill", "/Logged in/i")
3094
- params.set("kill_message", "Your Github account is now connected.")
3182
+ // params.set("kill_message", "Your Github account is now connected.")
3095
3183
  params.set("callback", encodeURIComponent("/github"))
3096
3184
  params.set("id", id)
3097
3185
  params.set("target", "_top")
@@ -3229,14 +3317,38 @@ class Server {
3229
3317
  bin
3230
3318
  })
3231
3319
  // set dependencies for conda
3320
+ let cr = new Set()
3232
3321
  for(let i=0; i<requirements.length; i++) {
3233
3322
  let r = requirements[i]
3234
3323
  if (r.name === "conda") {
3235
3324
  requirements[i].dependencies = bin.conda_requirements
3325
+ if (bin.conda_requirements) {
3326
+ for(let r of bin.conda_requirements) {
3327
+ cr.add(r)
3328
+ }
3329
+ }
3236
3330
  }
3237
3331
  }
3332
+
3333
+ // if the setup mode includes caddy, wait
3334
+ let wait = null
3335
+ if (cr.has("caddy")) {
3336
+ wait = "caddy"
3337
+ }
3338
+ console.log({ wait, cr })
3339
+
3238
3340
  let current = req.query.callback || req.originalUrl
3341
+ console.log("render setup", { current })
3342
+
3343
+ // console.log("2", { requirements_pending, install_required })
3344
+ // if (!requirements_pending && !install_required) {
3345
+ // console.log("redirect", current)
3346
+ // res.redirect(current)
3347
+ // return
3348
+ // }
3349
+ //
3239
3350
  res.render("setup", {
3351
+ wait,
3240
3352
  error,
3241
3353
  current,
3242
3354
  install_required,
@@ -4392,6 +4504,7 @@ class Server {
4392
4504
  res.redirect("/pinokio/install")
4393
4505
  }))
4394
4506
  this.app.get("/pinokio/install", ex((req, res) => {
4507
+ console.log("render /pinokio/install")
4395
4508
  let requirements = req.session.requirements
4396
4509
  let callback = req.session.callback
4397
4510
  req.session.requirements = null
@@ -48,6 +48,11 @@ document.addEventListener("DOMContentLoaded", () => {
48
48
  history.forward()
49
49
  })
50
50
  }
51
+ if (document.querySelector("#refresh-page")) {
52
+ document.querySelector("#refresh-page").addEventListener("click", (e) => {
53
+ location.reload()
54
+ })
55
+ }
51
56
  if (document.querySelector("#genlog")) {
52
57
  document.querySelector("#genlog").addEventListener("click", (e) => {
53
58
  e.preventDefault()