pinokiod 3.19.80 → 3.19.82

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.
@@ -122,12 +122,15 @@ module.exports = {
122
122
  { name: "node", },
123
123
  { name: "cli", },
124
124
  { name: "uv", },
125
+ { name: "caddy", },
126
+ { name: "py", },
125
127
  ])
126
128
  let conda_requirements = [
127
129
  zip_cmd,
128
130
  "uv",
129
131
  "node",
130
132
  "git",
133
+ "caddy",
131
134
  ]
132
135
  if (platform === "win32") {
133
136
  requirements.push({ name: "registry" })
@@ -1,7 +1,3 @@
1
- ---
2
-
3
- # Usage
4
-
5
1
  When you log into Github here, the login will be used for the git installed within Pinokio.
6
2
 
7
3
  Logging into Github lets you do things like:
@@ -36,12 +36,12 @@ class Proto {
36
36
  process.stdout.write(e.raw)
37
37
  })
38
38
  }
39
- let exists3 = await this.kernel.exists("prototype/CLI.md")
39
+ let exists3 = await this.kernel.exists("prototype/PTERM.md")
40
40
  if (!exists3) {
41
41
  await this.kernel.download({
42
42
  uri: "https://raw.githubusercontent.com/pinokiocomputer/pterm/refs/heads/main/README.md",
43
43
  path: this.kernel.path("prototype"),
44
- filename: "CLI.md"
44
+ filename: "PTERM.md"
45
45
  }, (e) => {
46
46
  process.stdout.write(e.raw)
47
47
  })
@@ -73,9 +73,9 @@ class Proto {
73
73
  let readme_path = this.kernel.path("prototype/PINOKIO.md")
74
74
  await fs.promises.cp(readme_path, path.resolve(cwd, name, "PINOKIO.md"))
75
75
 
76
- // copy cli.md
77
- let cli_readme_path = this.kernel.path("prototype/CLI.md")
78
- await fs.promises.cp(cli_readme_path, path.resolve(cwd, name, "CLI.md"))
76
+ // copy pterm.md
77
+ let cli_readme_path = this.kernel.path("prototype/PTERM.md")
78
+ await fs.promises.cp(cli_readme_path, path.resolve(cwd, name, "PTERM.md"))
79
79
 
80
80
 
81
81
  return { success: "/p/" + name }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.19.80",
3
+ "version": "3.19.82",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -4424,6 +4424,23 @@ class Server {
4424
4424
  let dir = this.kernel.path("api", req.params[0])
4425
4425
  let config = await this.kernel.git.config(dir)
4426
4426
 
4427
+ let hosts = ""
4428
+ let hosts_file = this.kernel.path("config/gh/hosts.yml")
4429
+ let e = await this.exists(hosts_file)
4430
+ console.log({ hosts_file, e })
4431
+ if (e) {
4432
+ hosts = await fs.promises.readFile(hosts_file, "utf8")
4433
+ console.log( { hosts: `#${hosts}#` })
4434
+ if (hosts.startsWith("{}")) {
4435
+ hosts = ""
4436
+ }
4437
+ }
4438
+ console.log("hosts", hosts)
4439
+
4440
+ let connected = (hosts.length > 0)
4441
+ console.log({ connected })
4442
+
4443
+
4427
4444
  let remote = null
4428
4445
  if (config["remote \"origin\""]) {
4429
4446
  remote = config["remote \"origin\""].url
@@ -4490,7 +4507,10 @@ class Server {
4490
4507
  console.log("git status matrix error", err)
4491
4508
  }
4492
4509
 
4510
+
4511
+
4493
4512
  res.render("git", {
4513
+ connected,
4494
4514
  changes,
4495
4515
  dir,
4496
4516
  config,
@@ -155,13 +155,17 @@ document.addEventListener("DOMContentLoaded", async () => {
155
155
  <% } %>
156
156
  <% if (!install_required) { %>
157
157
  let editor = ace.edit("editor");
158
- editor.setTheme("ace/theme/tomorrow");
159
158
  //editor.setTheme("ace/theme/github_light_default");
160
159
  //editor.setTheme("ace/theme/ambiance");
161
- //editor.setTheme("ace/theme/idle_fingers");
160
+ <% if (theme === "dark") { %>
161
+ editor.setTheme("ace/theme/idle_fingers");
162
+ <% } else { %>
163
+ editor.setTheme("ace/theme/tomorrow");
164
+ <% } %>
162
165
  //editor.setTheme("ace/theme/nord_dark");
163
166
  //editor.setTheme("ace/theme/textmate");
164
167
  editor.setOptions({
168
+ wrap: true,
165
169
  // maxLines: Infinity, // set to a large number
166
170
  minLines: 1 // set to a small number
167
171
  });
@@ -4,7 +4,7 @@
4
4
  <link href="/css/solid.min.css" rel="stylesheet">
5
5
  <link href="/css/regular.min.css" rel="stylesheet">
6
6
  <link href="/css/brands.min.css" rel="stylesheet">
7
- <link href="/style.css" rel="stylesheet"/>
7
+ <script src="/opener.js"></script>
8
8
  <% if (agent === "electron") { %>
9
9
  <link href="/electron.css" rel="stylesheet"/>
10
10
  <% } %>
@@ -14,10 +14,43 @@
14
14
  max-width: 800px;
15
15
  box-sizing: border-box;
16
16
  }
17
+ body {
18
+ margin: 0;
19
+ font-family: Sans-serif;
20
+ font-size: 14px;
21
+ display: flex;
22
+ flex-direction: column;
23
+ height: 100%;
24
+ }
25
+ aside {
26
+ min-width: 200px;
27
+ position: sticky;
28
+ top: 0;
29
+ }
30
+ aside .item.selected {
31
+ background: royalblue;
32
+ color: white;
33
+ }
34
+ aside .item {
35
+ display: block;
36
+ text-decoration: none;
37
+ color: royalblue;
38
+ padding: 10px;
39
+ background: rgba(0,0,0,0.1);
40
+ }
41
+ nav {
42
+ padding: 10px;
43
+ display: flex;
44
+ }
45
+ /*
17
46
  nav {
18
47
  position: sticky;
19
48
  top: 0;
20
49
  }
50
+ */
51
+ body.dark nav a.btn, nav a.btn {
52
+ background: royalblue;
53
+ }
21
54
  nav a {
22
55
  display: block;
23
56
  padding: 10px;
@@ -27,12 +60,18 @@ label {
27
60
  display: block;
28
61
  padding: 10px;
29
62
  }
63
+ body.dark nav {
64
+ background: rgba(0,0,0,0.4);
65
+ }
30
66
  nav label {
31
67
  display: block;
32
68
  padding: 10px;
33
69
  }
34
70
  main {
35
- padding: 20px;
71
+ display: flex;
72
+ overflow: auto;
73
+ scroll-behavior: smooth;
74
+ flex-grow: 1;
36
75
  }
37
76
  main iframe {
38
77
  width: 100%;
@@ -42,7 +81,16 @@ main img {
42
81
  width: 100%;
43
82
  }
44
83
  main h2 {
45
- margin: 0 0 10px;
84
+ padding: 20px 10px;
85
+ margin: 0;
86
+ font-size: 16px;
87
+ }
88
+ body.dark .changes {
89
+ color: white;
90
+ }
91
+ .changes {
92
+ height: 100%;
93
+ flex-grow: 1;
46
94
  }
47
95
  pre.l {
48
96
  /*
@@ -90,61 +138,146 @@ pre.l {
90
138
  color: #555;
91
139
  }
92
140
  .diff-block {
93
- max-height: 300px;
94
141
  background: rgba(0, 0, 0, 0.04);
95
- padding: 0 20px 20px;
96
142
  overflow: auto;
97
143
  }
144
+ body.dark h2 {
145
+ color: white;
146
+ }
147
+ body.dark main h3 {
148
+ color: white;
149
+ }
98
150
  main h3 {
99
151
  margin: 0;
100
152
  background: rgba(0, 0, 0, 0.04);
101
153
  padding: 15px;
102
- margin-top: 30px;
103
154
  font-size: 14px;
104
155
  }
156
+ body.dark .chunk {
157
+ border: 10px solid white;
158
+ }
159
+ .chunk {
160
+ border: 10px solid silver;
161
+ margin-bottom: 10px;
162
+ }
163
+ .filler {
164
+ height: 100%;
165
+ }
166
+ .chunk.selected, body.dark .chunk.selected {
167
+ border: 10px solid royalblue;
168
+ }
105
169
 
106
170
  .add { background: #e6ffed; color: green; }
107
171
  .del { background: #ffeef0; color: red; }
108
172
  .context { background: #f8f8f8; }
109
173
  .btn {
110
174
  margin-right: 10px;
175
+ cursor: pointer;
176
+ border: none;
177
+ text-decoration: none;
178
+ padding: 10px;
179
+ border-radius: 3px;
180
+ background: black;
181
+ color: white;
182
+ font-size: 12px;
183
+ display: inline-block;
184
+ }
185
+ body.dark .empty {
186
+ background: rgba(255,255,255,0.1);
187
+ }
188
+ .empty {
189
+ text-align: center;
190
+ padding: 200px 40px;
191
+ opacity: 0.5;
192
+ background: rgba(0,0,0,0.04);
111
193
  }
112
194
  </style>
113
195
  </head>
114
196
  <body class='<%=theme%>' data-platform="<%=platform%>" data-agent="<%=agent%>">
115
197
  <nav>
116
198
  <% if (remote) { %>
117
- <a href="/run/scripts/git/push.json?cwd=<%=encodeURIComponent(dir)%>" class='btn'><i class="fa-brands fa-github"></i> Publish to GitHub</a>
199
+ <% if (connected) { %>
200
+ <a href="/run/scripts/git/push.json?cwd=<%=encodeURIComponent(dir)%>" class='btn'><i class="fa-brands fa-github"></i> Publish to GitHub</a>
201
+ <% } else { %>
202
+ <a class='btn' data-redirect="/github" target="_blank">Publish to GitHub</a>
203
+ <% } %>
118
204
  <a href="/run/scripts/git/commit.json?cwd=<%=encodeURIComponent(dir)%>" class='btn'><i class="fa-solid fa-floppy-disk"></i> Commit (Save the current version)</a>
119
205
  <a href="<%=remote%>" target="_blank"><%=remote%></a>
120
206
  <% } else { %>
121
- <a href="/run/scripts/git/create.json?cwd=<%=encodeURIComponent(dir)%>" class='btn'><i class="fa-brands fa-github"></i> Create on GitHub</a>
207
+ <% if (connected) { %>
208
+ <a href="/run/scripts/git/create.json?cwd=<%=encodeURIComponent(dir)%>" class='btn'><i class="fa-brands fa-github"></i> Create on GitHub</a>
209
+ <% } else { %>
210
+ <a class='btn' data-redirect="/github" target="_blank">Create on GitHub</a>
211
+ <% } %>
122
212
  <a href="/run/scripts/git/commit.json?cwd=<%=encodeURIComponent(dir)%>" class='btn'><i class="fa-solid fa-floppy-disk"></i> Commit (Save the current version)</a>
123
213
  <% } %>
124
214
  </nav>
125
215
  <main>
126
- <h2>Changed Files</h2>
127
- <% if (changes && changes.length > 0) { %>
128
- <% changes.forEach(({ file, status, binary, diff, webpath }) => { %>
129
- <h3>[<%= status %>] <%= file %></h3>
130
- <% if (binary) { %>
131
- <div class="binary-notice">[Binary file <%= status %>]</div>
132
- <iframe src="<%=webpath%>"></iframe>
216
+ <aside>
217
+ <h2><i class="fa-solid fa-code-compare"></i> Changes</h2>
218
+ <% if (changes && changes.length > 0) { %>
219
+ <% changes.forEach(({ file, status, binary, diff, webpath }) => { %>
220
+ <a class='item' data-selector="<%=file%>" href="#<%=file%>"><%=file%></a>
221
+ <% }) %>
222
+ <% } %>
223
+ </aside>
224
+ <div class='changes'>
225
+ <% if (changes && changes.length > 0) { %>
226
+ <% changes.forEach(({ file, status, binary, diff, webpath }) => { %>
227
+ <div id="<%=file%>" class='chunk' data-selection="<%=file%>">
228
+ <h3>[<%= status %>] <%= file %></h3>
229
+ <% if (binary) { %>
230
+ <div class="binary-notice">[Binary file <%= status %>]</div>
231
+ <iframe src="<%=webpath%>"></iframe>
232
+ <% } else { %>
233
+ <div class="diff-block">
234
+ <% diff.forEach(({ line, lineOld, lineNew, type }) => { %>
235
+ <div class="diff-line <%= type %>">
236
+ <span class="lnum old"><%= lineOld !== '' ? lineOld : '' %></span>
237
+ <span class="lnum new"><%= lineNew !== '' ? lineNew : '' %></span>
238
+ <span class="code"><%= (type === 'add' ? '+ ' : type === 'del' ? '- ' : ' ') + line %></span>
239
+ </div>
240
+ <% }); %>
241
+ </div>
242
+ <% } %>
243
+ </div>
244
+ <% }); %>
245
+ <div class='filler'></div>
133
246
  <% } else { %>
134
- <div class="diff-block">
135
- <% diff.forEach(({ line, lineOld, lineNew, type }) => { %>
136
- <div class="diff-line <%= type %>">
137
- <span class="lnum old"><%= lineOld !== '' ? lineOld : '' %></span>
138
- <span class="lnum new"><%= lineNew !== '' ? lineNew : '' %></span>
139
- <span class="code"><%= (type === 'add' ? '+ ' : type === 'del' ? '- ' : ' ') + line %></span>
140
- </div>
141
- <% }); %>
142
- </div>
247
+ <div class='empty'>No changes</div>
143
248
  <% } %>
144
- <% }); %>
145
- <% } else { %>
146
- <div class='empty'>No changes</div>
147
- <% } %>
249
+ </div>
148
250
  </main>
251
+ <script>
252
+ document.querySelector("nav").addEventListener("click", (e) => {
253
+ let redirect = e.target.getAttribute("[data-redirect]")
254
+ if (redirect) {
255
+ const c = confirm("Please connect with GitHub first")
256
+ if (c) {
257
+ console.log("redirect")
258
+ } else {
259
+ e.preventDefault()
260
+ e.stopPropagation()
261
+ }
262
+ }
263
+ })
264
+ document.querySelector("aside").addEventListener("click", (e) => {
265
+ if (e.target.classList.contains("item")) {
266
+ document.querySelectorAll(".item").forEach((el) => {
267
+ el.classList.remove("selected")
268
+ })
269
+ e.target.classList.add("selected")
270
+
271
+
272
+
273
+ let selector = e.target.getAttribute("data-selector")
274
+ console.log({ selector })
275
+ document.querySelectorAll(".chunk").forEach((el) => {
276
+ el.classList.remove("selected")
277
+ })
278
+ document.querySelector(`[data-selection='${selector}']`).classList.add("selected")
279
+ }
280
+ })
281
+ </script>
149
282
  </body>
150
283
  </html>
@@ -61,8 +61,6 @@ body {
61
61
  align-items: center;
62
62
  }
63
63
  .btn {
64
- margin: 5px;
65
- width: 100px;
66
64
  text-align: center;
67
65
  padding: 10px;
68
66
  background: black;
@@ -108,7 +106,9 @@ main {
108
106
  display: flex;
109
107
  justify-content: center;
110
108
  margin: 0 auto;
109
+ /*
111
110
  max-width: 800px;
111
+ */
112
112
  width: 100%;
113
113
  align-items: center;
114
114
  }
@@ -126,20 +126,26 @@ main {
126
126
  display: block;
127
127
  margin-bottom: 5px;
128
128
  }
129
- .setup-items .gitconfig-footer .btn {
130
- margin: 0 0 5px;
129
+ .setup-items .gitconfig-footer {
130
+ text-align: center;
131
+ }
132
+ .setup-items .btn {
133
+ width: 100%;
134
+ margin-bottom: 10px;
131
135
  }
132
136
  .setup-items .gitconfig {
133
137
  flex-grow: 1;
134
- padding: 30px;
135
- background: rgba(0,0,0,0.04) !important;
136
138
  margin-bottom: 20px;
137
139
  }
138
- .setup-items pre {
140
+ body.dark .setup-items pre, body.dark .setup-items .pre {
141
+ background: rgba(255,255,255,0.04) !important;
142
+ }
143
+ .setup-items pre, .setup-items .pre {
144
+ box-sizing: border-box;
145
+ margin: 10px 0 20px;
139
146
  width: 100%;
140
- padding: 30px;
147
+ padding: 20px;
141
148
  background: rgba(0,0,0,0.04) !important;
142
- margin-bottom: 20px;
143
149
  }
144
150
  .head {
145
151
  padding: 30px;
@@ -194,7 +200,28 @@ hr {
194
200
  }
195
201
  #readme {
196
202
  flex-grow: 1;
197
- padding: 30px;
203
+ }
204
+ .cols {
205
+ max-width: 1000px;
206
+ margin: 0 auto;
207
+ display: flex;
208
+ }
209
+ body.dark .column {
210
+ background: rgba(0,0,0,0.1);
211
+ }
212
+ .column {
213
+ background: rgba(0,0,0,0.04);
214
+ margin: 10px;
215
+ width: 50%;
216
+ padding: 20px;
217
+ box-sizing: border-box;
218
+ }
219
+ .column h1 {
220
+ padding: 5px;
221
+ letter-spacing: -1px;
222
+ }
223
+ ol {
224
+ padding-inline-start: 20px;
198
225
  }
199
226
  </style>
200
227
  <script src="/hotkeys.min.js"></script>
@@ -226,38 +253,48 @@ hr {
226
253
  <div class='head'>
227
254
  <h3><i class="fa-brands fa-github"></i><br><br>Connect with Github</h3>
228
255
  </div>
229
- <div class='setup-items'>
230
- <form class='gitconfig'>
231
- <div class='field'>
232
- <label>username</label>
233
- <input id='username' type='text' value="<%=gitconfig.user && gitconfig.user.name ? gitconfig.user.name : ''%>">
256
+ <div class='cols'>
257
+ <div class='column'>
258
+ <h1>GitHub</h1>
259
+ <div class='setup-items'>
260
+ <% if (hosts.length > 0) { %>
261
+ <pre><%=hosts%></pre>
262
+ <% } else { %>
263
+ <pre>not logged in</pre>
264
+ <% } %>
234
265
  </div>
235
- <div class='field'>
236
- <label>email</label>
237
- <input id='email' type='text' value="<%=gitconfig.user && gitconfig.user.email ? gitconfig.user.email : ''%>">
266
+ <div class='setup-items'>
267
+ <% items.forEach((item) => { %>
268
+ <a class='btn' href="<%=item.url%>">
269
+ <i class="<%=item.icon%>"></i> <%=item.title%>
270
+ </a>
271
+ <% }) %>
238
272
  </div>
239
- <div class='gitconfig-footer'>
240
- <button class='btn'>Update</button>
241
- <div>gitconfig stored in ~/pinokio/gitconfig file </div>
273
+ <div class='setup-items'>
274
+ <div id='readme'><%-readme%></div>
242
275
  </div>
243
- </form>
244
- </div>
245
- <div class='setup-items'>
246
- <% if (hosts.length > 0) { %>
247
- <pre><%=hosts%></pre>
248
- <% } else { %>
249
- <pre>not logged in</pre>
250
- <% } %>
251
- </div>
252
- <div class='setup-items'>
253
- <% items.forEach((item) => { %>
254
- <a class='btn' href="<%=item.url%>">
255
- <i class="<%=item.icon%>"></i> <%=item.title%>
256
- </a>
257
- <% }) %>
258
- </div>
259
- <div class='setup-items'>
260
- <div id='readme'><%-readme%></div>
276
+ </div>
277
+ <div class='column'>
278
+ <h1>Git Config</h1>
279
+ <div class='setup-items'>
280
+ <form class='gitconfig'>
281
+ <div class='pre'>
282
+ <div class='field'>
283
+ <label>username</label>
284
+ <input id='username' type='text' value="<%=gitconfig.user && gitconfig.user.name ? gitconfig.user.name : ''%>">
285
+ </div>
286
+ <div class='field'>
287
+ <label>email</label>
288
+ <input id='email' type='text' value="<%=gitconfig.user && gitconfig.user.email ? gitconfig.user.email : ''%>">
289
+ </div>
290
+ </div>
291
+ <div class='gitconfig-footer'>
292
+ <button class='btn'><i class="fa-solid fa-check"></i> Update</button>
293
+ <div>gitconfig stored in ~/pinokio/gitconfig file </div>
294
+ </div>
295
+ </form>
296
+ </div>
297
+ </div>
261
298
  </div>
262
299
  </main>
263
300
  <script>