pinokiod 1.3.97 → 1.3.99

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.
@@ -16,6 +16,7 @@ class C {
16
16
  => cloudflared tunnel --url http://localhost:8080
17
17
  */
18
18
 
19
+ console.log("*tunnel", req.params)
19
20
 
20
21
  let pipe_uri
21
22
  if (req.params.passcode) {
@@ -64,6 +64,7 @@ class Local {
64
64
  */
65
65
 
66
66
  let current_env = await Environment.get2(req.parent.path, kernel)
67
+ console.log({ current_env })
67
68
 
68
69
  // if the key at current_env.PINOKIO_SHARE_VAR (by default it's 'url') is the variable being set, trigger the share logic
69
70
  if (current_env.PINOKIO_SHARE_VAR && current_env.PINOKIO_SHARE_VAR in req.params) {
@@ -293,10 +293,12 @@ const init_folders = async (homedir) => {
293
293
 
294
294
  // Get the actual environment variable at specific path
295
295
  const get2 = async (filepath, kernel) => {
296
+ console.log("Get2")
296
297
  let api_path = Util.api_path(filepath, kernel)
297
298
  let default_env = await get(kernel.homedir)
298
299
  let api_env = await get(api_path)
299
- let current_env = Object.assign(process.env, default_env, api_env)
300
+ console.log({ api_path, default_env, api_env, process_env: process.env })
301
+ let current_env = Object.assign({}, process.env, default_env, api_env)
300
302
  return current_env
301
303
  }
302
304
  const get = async (homedir) => {
package/kernel/util.js CHANGED
@@ -87,6 +87,7 @@ const escapeStringRegexp = (string) => {
87
87
  }
88
88
 
89
89
  const update_env = async (filepath, changes) => {
90
+ console.log("update_env", { filepath, changes })
90
91
  const env = await fs.promises.readFile(filepath, "utf8")
91
92
  let append = false;
92
93
  const newval = Object.keys(changes).reduce((result, varname) => {
@@ -95,6 +96,7 @@ const update_env = async (filepath, changes) => {
95
96
  .replace(returnPattern, returnReplacement)
96
97
  .trim();
97
98
  const safeName = escapeStringRegexp(varname);
99
+ console.log({ value, safeName, result, varname })
98
100
  const varPattern = new RegExp(`^(${h}*${safeName}${h}*=${h}*)\\S*(${h}*)$`, "gm");
99
101
  if (varPattern.test(result)) {
100
102
  const safeValue = value.replace(groupPattern, groupReplacement);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "1.3.97",
3
+ "version": "1.3.99",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/pipe/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  const { createProxyMiddleware } = require('http-proxy-middleware');
2
- const { yellow, green, blue } = require('kleur');
2
+ const { red, yellow, green, blue } = require('kleur');
3
3
 
4
4
  const path = require('path')
5
5
  const { createHttpTerminator } = require('http-terminator')
@@ -56,21 +56,25 @@ class Pipe {
56
56
  ip,
57
57
  agent
58
58
  }
59
- let log = `\r\n[${event.time}] Login from ${event.ip} | ${event.agent}\r\n`
60
- console.log(log)
61
- // this.kernel.api.ondata({
62
- // id: scriptPath,
63
- // type: "notify",
64
- // data: {
65
- // html: `<div><h6>${event.time}</h6><div>IP: ${event.ip}</div>`
66
- // }
67
- // })
59
+ this.kernel.api.ondata({
60
+ id: scriptPath,
61
+ type: "notify",
62
+ data: {
63
+ silent: true,
64
+ html: `<div><b>[${password}] ${event.ip}</b><br><div>${event.time}</div><div>${event.agent}</div>`
65
+ }
66
+ })
67
+
68
+ let passcode_log = red(password)
69
+ let timestamp_log = yellow(event.time)
70
+ let ip_log = blue(event.ip)
71
+ let browser_log = event.agent
68
72
  this.kernel.api.ondata({
69
73
  type: "stream",
70
74
  kernel: true,
71
75
  id: scriptPath,
72
76
  data: {
73
- raw: yellow(log)
77
+ raw: `\r\n[${passcode_log}]\t${timestamp_log}\t${ip_log}\t${browser_log}\r\n`
74
78
  }
75
79
  })
76
80
  req.session.authenticated = true;
@@ -15,7 +15,7 @@ body {
15
15
  color: white;
16
16
  }
17
17
  main {
18
- max-width: 500px;
18
+ max-width: 300px;
19
19
  width: 100%;
20
20
  text-align: center;
21
21
  text-transform: lowercase;
@@ -35,8 +35,8 @@ main input {
35
35
  /*
36
36
  background: rgba(0,0,0,0.06);
37
37
  */
38
- font-size: 14px;
39
- border-radius: 0;
38
+ font-size: 16px;
39
+ border-radius: 10px 0 0 10px;
40
40
 
41
41
  }
42
42
  main button {
@@ -45,6 +45,8 @@ main button {
45
45
  padding: 10px;
46
46
  box-sizing: border-box;
47
47
  border: none;
48
+ font-size: 16px;
49
+ border-radius: 0 10px 10px 0;
48
50
  }
49
51
  .error {
50
52
  border-left: 3px solid red;
@@ -67,7 +69,7 @@ h1 {
67
69
  -->
68
70
  <h1>PINOKIO</h1>
69
71
  <form method="POST" action="/pinokio/login">
70
- <input autofocus placeholder="enter passcode" type="password" name="password" required>
72
+ <input autofocus placeholder="Enter passcode" type="password" name="password" required>
71
73
  <button type="submit">Login</button>
72
74
  </form>
73
75
  <% if (error) { %>
package/server/index.js CHANGED
@@ -1993,6 +1993,7 @@ class Server {
1993
1993
  //let home = this.kernel.homedir
1994
1994
  let home = this.kernel.store.get("home")
1995
1995
  this.app.get("/", async (req, res) => {
1996
+ console.log("req", req)
1996
1997
  if (req.query.mode !== "settings" && !home) {
1997
1998
  res.redirect("/?mode=settings")
1998
1999
  return
@@ -173,6 +173,7 @@ h1 {
173
173
  font-size: 50px;
174
174
  font-family: georgia;
175
175
  font-style: italic;
176
+ padding-bottom: 20px;
176
177
  }
177
178
  footer {
178
179
  background: none;
@@ -263,6 +264,7 @@ document.addEventListener("DOMContentLoaded", async () => {
263
264
  </header>
264
265
  <% } %>
265
266
  <div id='editor' class='<%=init ? "hidden" : ''%>'>
267
+ <h1>Configure</h1>
266
268
  <% items.forEach((item) => { %>
267
269
  <% if (item.type === "comment") { %>
268
270
  <div class='comment'><%=item.val.replaceAll(/^[ #]+/g, "")%></div>
@@ -389,6 +389,7 @@ document.addEventListener("DOMContentLoaded", async () => {
389
389
  if (packet.data.type) {
390
390
  payload.type = packet.data.type
391
391
  }
392
+ payload.silent = packet.data.silent
392
393
  payload.callbacks = {
393
394
  onClick: () => {
394
395
  let params = packet.data
@@ -295,15 +295,6 @@ hr {
295
295
  <i class="fa-solid fa-circle-notch fa-spin"></i> Stand by. Do not close this window..
296
296
  </div>
297
297
  <% if (locals.bin) { %>
298
- <hr/>
299
- <div class='advanced'>
300
- <h1>Advanced Settings</h1>
301
- <br>
302
- <br>
303
- <div>Edit the system ENVIRONMENT file to customize pinokio system wide settings, such as where files are stored, terminal behavior, etc.</div>
304
- <br>
305
- <a class='btn' href="/env"><i class="fa-regular fa-pen-to-square"></i> Edit ENVIRONMENT</a>
306
- </div>
307
298
  <hr/>
308
299
  <div class='troubleshoot'>
309
300
  <h1>Troubleshoot</h1>
@@ -352,6 +343,15 @@ hr {
352
343
  </div>
353
344
  </div>
354
345
  <hr/>
346
+ <div class='advanced'>
347
+ <h1>Advanced Settings</h1>
348
+ <br>
349
+ <br>
350
+ <div>Edit the system ENVIRONMENT file to customize pinokio system wide settings, such as where files are stored, terminal behavior, etc.</div>
351
+ <br>
352
+ <a class='btn' href="/env"><i class="fa-regular fa-pen-to-square"></i> Edit ENVIRONMENT</a>
353
+ </div>
354
+ <hr/>
355
355
  <% } %>
356
356
  </div>
357
357
  </div>
@@ -74,9 +74,10 @@ td.key {
74
74
 
75
75
  }
76
76
  #editor {
77
+ margin: 0 auto;
77
78
  box-sizing: border-box;
78
79
  max-width: 800px;
79
- padding: 20px;
80
+ padding: 50px;
80
81
  }
81
82
  header .runner {
82
83
  padding: 10px 0 0;
@@ -203,6 +204,12 @@ body.dark .cloudflare-running {
203
204
  box-sizing: border-box;
204
205
  border: 1px solid rgba(0,0,0,0.1);
205
206
  }
207
+ h1 {
208
+ font-size: 50px;
209
+ font-family: georgia;
210
+ font-style: italic;
211
+ padding-bottom: 10px;
212
+ }
206
213
 
207
214
  </style>
208
215
  <script>
@@ -293,9 +300,9 @@ document.addEventListener("DOMContentLoaded", async () => {
293
300
  </div>
294
301
  <div class='env-item'>
295
302
  <% if (config.PINOKIO_SHARE_LOCAL.toString() === "true") { %>
296
- <input type="checkbox" id="PINOKIO_SHARE_LOCAL" name="local" checked />
303
+ <input type="checkbox" data-id="PINOKIO_SHARE_LOCAL" name="local" checked />
297
304
  <% } else { %>
298
- <input type="checkbox" id="PINOKIO_SHARE_LOCAL" name="local" />
305
+ <input type="checkbox" data-id="PINOKIO_SHARE_LOCAL" name="local" />
299
306
  <% } %>
300
307
  <label for="local"><i class="fa-solid fa-network-wired"></i> Share with Local Network</label>
301
308
  <ul>