pinokiod 3.18.3 → 3.18.5

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.
@@ -73,10 +73,13 @@ class Api {
73
73
  meta.icon = meta.icon ? `/api/${api_name}/${meta.icon}?raw=true` : "/pinokio-black.png"
74
74
  meta.path = api_path
75
75
  meta.name = meta.title
76
- meta.link = `/pinokio/browser/${api_name}/dev#n1`
76
+ //meta.link = `/pinokio/browser/${api_name}/dev#n1`
77
+ meta.link = `/p/${api_name}/dev#n1`
77
78
  meta.web_path = `/api/${api_name}`
78
- meta.ui = `/pinokio/browser/${api_name}`
79
- meta.browse = `/pinokio/browser/${api_name}/dev`
79
+ //meta.ui = `/pinokio/browser/${api_name}`
80
+ meta.ui = `/p/${api_name}`
81
+ //meta.browse = `/pinokio/browser/${api_name}/dev`
82
+ meta.browse = `/p/${api_name}/dev`
80
83
  if (!pinokio && !pinokio2 && !pinokio3 ) {
81
84
  meta.init_required = true
82
85
  }
package/kernel/index.js CHANGED
@@ -191,11 +191,13 @@ class Kernel {
191
191
  let result
192
192
  if (type === "web") {
193
193
  if (chunks[0] === "api") {
194
- result = "/pinokio/browser/" + chunks.slice(1).join("/")
194
+ //result = "/pinokio/browser/" + chunks.slice(1).join("/")
195
+ result = "/p/" + chunks.slice(1).join("/")
195
196
  }
196
197
  } else if (type === "browse" || type === "dev") {
197
198
  if (chunks[0] === "api") {
198
- result = "/pinokio/browser/" + chunks.slice(1).join("/") + "/dev"
199
+ //result = "/pinokio/browser/" + chunks.slice(1).join("/") + "/dev"
200
+ result = "/p/" + chunks.slice(1).join("/") + "/dev"
199
201
  }
200
202
  // } else if (type === "web") {
201
203
  // result = "/" + chunks.join("/")
@@ -8,7 +8,6 @@ class CustomDomainRouter extends Processor {
8
8
  this.common = new Common(router)
9
9
  }
10
10
  handle (peer) {
11
- console.log("CustomDomainRouter", peer)
12
11
  for(let domain in this.router.custom_domains) {
13
12
  let port = this.router.custom_domains[domain]
14
13
  this.common.handle({
@@ -16,13 +15,6 @@ class CustomDomainRouter extends Processor {
16
15
  dial: `127.0.0.1:${port}`,
17
16
  host: this.router.kernel.peer.host,
18
17
  })
19
- /*
20
- this.common.handle({
21
- match: `${domain}.${peer.name}.localhost`,
22
- dial: `${peer.host}:${port"127.0.0.1",
23
- host: this.router.kernel.peer.host,
24
- })
25
- */
26
18
  }
27
19
  }
28
20
  }
@@ -206,7 +206,6 @@ class Router {
206
206
  if (this.kernel.peer.active) {
207
207
  for(let host in this.kernel.peer.info) {
208
208
  let peer = this.kernel.peer.info[host]
209
- console.log(">>>>>>>>>>>>>>>>PEER", peer)
210
209
  if (peer.host === this.kernel.peer.host) {
211
210
  this.peer_home_router.handle(peer)
212
211
  this.peer_variable_router.handle(peer)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.18.3",
3
+ "version": "3.18.5",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -277,7 +277,8 @@ class Server {
277
277
  if (x.run) {
278
278
  browser_url = "/env/api/" + x.name
279
279
  } else {
280
- browser_url = "/pinokio/browser/" + x.name
280
+ //browser_url = "/pinokio/browser/" + x.name
281
+ browser_url = "/p/" + x.name
281
282
  }
282
283
  let browser_browse_url = browser_url + "/dev"
283
284
  return {
@@ -333,6 +334,30 @@ class Server {
333
334
  }
334
335
  }
335
336
  }
337
+ async current_urls(current_path) {
338
+ let router_running = await this.check_router_up()
339
+ let u = new URL("http://localhost:42000")
340
+
341
+ let current_urls = {}
342
+
343
+ // http
344
+ if (current_path) {
345
+ u.pathname = current_path
346
+ }
347
+ current_urls.http = u.toString()
348
+
349
+ // https
350
+ if (router_running.success) {
351
+ let u = new URL("https://pinokio.localhost")
352
+ if (current_path) {
353
+ u.pathname = current_path
354
+ }
355
+ current_urls.https = u.toString()
356
+ }
357
+
358
+ return current_urls
359
+ }
360
+
336
361
  async chrome(req, res, type) {
337
362
 
338
363
  let { requirements, install_required, requirements_pending, error } = await this.kernel.bin.check({
@@ -487,6 +512,7 @@ class Server {
487
512
  feed = this.newsfeed(gitRemote)
488
513
  }
489
514
 
515
+
490
516
  await this.kernel.plugin.init()
491
517
  let plugin = await this.getPlugin(name)
492
518
  let plugin_menu = null
@@ -494,7 +520,12 @@ class Server {
494
520
  let running_dynamic = this.running_dynamic(name, plugin.menu)
495
521
  plugin_menu = plugin.menu.concat(running_dynamic)
496
522
  }
523
+
524
+
525
+ let current_urls = await this.current_urls(req.originalUrl.slice(1))
526
+
497
527
  const result = {
528
+ current_urls,
498
529
  path: this.kernel.path("api", name),
499
530
  plugin_menu,
500
531
  portal: this.portal,
@@ -529,9 +560,9 @@ class Server {
529
560
  if (!this.kernel.proto.config) {
530
561
  await this.kernel.proto.init()
531
562
  }
532
- if (!this.kernel.plugin.config) {
533
- await this.kernel.plugin.init()
534
- }
563
+ // if (!this.kernel.plugin.config) {
564
+ // await this.kernel.plugin.init()
565
+ // }
535
566
  res.render("app", result)
536
567
  }
537
568
  getVariationUrls(req) {
@@ -1398,7 +1429,8 @@ class Server {
1398
1429
  //url: p + "/" + x.name,
1399
1430
  url: _p + "/" + x.name,
1400
1431
  // url: `${U}/${x.name}`,
1401
- browser_url: "/pinokio/browser/" + x.name
1432
+ //browser_url: "/pinokio/browser/" + x.name
1433
+ browser_url: "/p/" + x.name
1402
1434
  }
1403
1435
  })
1404
1436
 
@@ -1456,9 +1488,12 @@ class Server {
1456
1488
  }
1457
1489
  }
1458
1490
 
1491
+ let current_urls = await this.current_urls()
1492
+
1459
1493
  if (meta) {
1460
1494
  items = running.concat(notRunning)
1461
1495
  res.render("index", {
1496
+ current_urls,
1462
1497
  portal: this.portal,
1463
1498
  install: this.install,
1464
1499
  folders: null,
@@ -2374,6 +2409,7 @@ class Server {
2374
2409
  }
2375
2410
  }
2376
2411
  async getPlugin(name) {
2412
+ console.log("getPlugin", name)
2377
2413
  if (this.kernel.plugin.config) {
2378
2414
  try {
2379
2415
  let info = new Info(this.kernel)
@@ -2398,6 +2434,46 @@ class Server {
2398
2434
 
2399
2435
  }
2400
2436
  }
2437
+ async check_router_up() {
2438
+ console.log("/check_router_up")
2439
+ // check if caddy is runnign properly
2440
+ // try https://pinokio.localhost
2441
+ // if it works, proceed
2442
+ // if not, redirect
2443
+ let https_running = false
2444
+ try {
2445
+ let res = await axios.get(`http://127.0.0.1:2019/config/`, {
2446
+ timeout: 2000
2447
+ })
2448
+ let test = /pinokio\.localhost/.test(JSON.stringify(res.data))
2449
+ if (test) {
2450
+ https_running = true
2451
+ }
2452
+ } catch (e) {
2453
+ console.log(e)
2454
+ }
2455
+ console.log({ https_running })
2456
+ if (!https_running) {
2457
+ return { error: "pinokio.host not yet available" }
2458
+ }
2459
+
2460
+
2461
+ // check if pinokio.localhost router is running
2462
+ let router_running = false
2463
+ let router = this.kernel.router.published()
2464
+ for(let ip in router) {
2465
+ let domains = router[ip]
2466
+ if (domains.includes("pinokio.localhost")) {
2467
+ router_running = true
2468
+ break
2469
+ }
2470
+ }
2471
+ if (!router_running) {
2472
+ return { error: "pinokio.localhost not yet available" }
2473
+ }
2474
+
2475
+ return { success: true }
2476
+ }
2401
2477
 
2402
2478
  async start(options) {
2403
2479
  this.debug = false
@@ -2829,51 +2905,8 @@ class Server {
2829
2905
  }))
2830
2906
 
2831
2907
  this.app.get("/check_router_up", ex(async (req, res) => {
2832
- console.log("/check_router_up")
2833
- // check if caddy is runnign properly
2834
- // try https://pinokio.localhost
2835
- // if it works, proceed
2836
- // if not, redirect
2837
- let https_running = false
2838
- try {
2839
- let res = await axios.get(`http://127.0.0.1:2019/config/`, {
2840
- timeout: 2000
2841
- })
2842
- let test = /pinokio\.localhost/.test(JSON.stringify(res.data))
2843
- if (test) {
2844
- https_running = true
2845
- }
2846
- } catch (e) {
2847
- console.log(e)
2848
- }
2849
- console.log({ https_running })
2850
- if (!https_running) {
2851
- res.json({ error: "pinokio.host not yet available" })
2852
- // res.redirect("/setup/connect?callback=/connect/" + req.params.provider)
2853
- return
2854
- }
2855
-
2856
-
2857
- // check if pinokio.localhost router is running
2858
- let router_running = false
2859
- let router = this.kernel.router.published()
2860
- for(let ip in router) {
2861
- let domains = router[ip]
2862
- if (domains.includes("pinokio.localhost")) {
2863
- router_running = true
2864
- break
2865
- }
2866
- }
2867
- console.log({ router_running })
2868
- if (!router_running) {
2869
- res.json({ error: "pinokio.localhost not yet available" })
2870
- // res.redirect("/setup/connect?callback=/connect/" + req.params.provider)
2871
- return
2872
- }
2873
-
2874
- console.log("router is up")
2875
-
2876
- res.json({ success: true })
2908
+ let response = await this.check_router_up()
2909
+ res.json(response)
2877
2910
  }))
2878
2911
 
2879
2912
  /*
@@ -3445,6 +3478,10 @@ class Server {
3445
3478
  await rimraf(caddy_path)
3446
3479
  let caddy_path2 = this.kernel.path("cache/XDG_CONFIG_HOME/caddy")
3447
3480
  await rimraf(caddy_path2)
3481
+
3482
+ let custom_network_path = path.resolve(home, "network/system")
3483
+ await fse.remove(custom_network_path)
3484
+
3448
3485
  res.json({ success: true })
3449
3486
  }))
3450
3487
  this.app.get("/requirements_check/:name", ex(async (req, res) => {
@@ -3616,7 +3653,8 @@ class Server {
3616
3653
  // await fs.promises.writeFile(meta_path, JSON.stringify(meta, null, 2))
3617
3654
 
3618
3655
  res.json({
3619
- success: "/pinokio/browser/"+folder
3656
+ //success: "/pinokio/browser/"+folder
3657
+ success: "/p/"+folder
3620
3658
  })
3621
3659
  } catch (e) {
3622
3660
  res.json({
@@ -3630,7 +3668,8 @@ class Server {
3630
3668
  try {
3631
3669
  await fs.promises.cp(src_path, dest_path, { recursive: true })
3632
3670
  res.json({
3633
- success: "/pinokio/browser/"+ req.body.dest + "/dev"
3671
+ //success: "/pinokio/browser/"+ req.body.dest + "/dev"
3672
+ success: "/p/"+ req.body.dest + "/dev"
3634
3673
  })
3635
3674
  } catch (e) {
3636
3675
  res.json({
@@ -4103,7 +4142,8 @@ class Server {
4103
4142
  }
4104
4143
  } else {
4105
4144
  // if pinokio.js doesn't exist, send to /browser/:name
4106
- res.redirect(`/pinokio/browser/${req.params.name}`)
4145
+ //res.redirect(`/pinokio/browser/${req.params.name}`)
4146
+ res.redirect(`/p/${req.params.name}`)
4107
4147
  }
4108
4148
  }))
4109
4149
  this.app.get("/share/:name", ex(async (req, res) => {
@@ -4285,7 +4325,7 @@ class Server {
4285
4325
  }
4286
4326
  }))
4287
4327
  this.app.get("/pinokio/dynamic/:name", ex(async (req, res) => {
4288
- await this.kernel.plugin.init()
4328
+ // await this.kernel.plugin.init()
4289
4329
  let plugin = await this.getPlugin(req.params.name)
4290
4330
  let html = ""
4291
4331
  if (plugin && plugin.menu && Array.isArray(plugin.menu)) {
@@ -4436,6 +4476,7 @@ class Server {
4436
4476
  res.json({ success: true })
4437
4477
  }))
4438
4478
  this.app.get("/pinokio/browser", ex(async (req, res) => {
4479
+ console.log("GET /pinokio/browser")
4439
4480
  if (req.query && req.query.uri) {
4440
4481
  let uri = req.query.uri
4441
4482
  let p = this.kernel.api.resolveBrowserPath(uri)
@@ -4459,6 +4500,18 @@ class Server {
4459
4500
  console.log("run mode")
4460
4501
  this.chrome(req, res, "run")
4461
4502
  }))
4503
+ this.app.get("/p/:name/dev", ex(async (req, res) => {
4504
+ console.log("browse mode")
4505
+ this.chrome(req, res, "browse")
4506
+ }))
4507
+ this.app.get("/p/:name/browse", ex(async (req, res) => {
4508
+ console.log("browse mode")
4509
+ this.chrome(req, res, "browse")
4510
+ }))
4511
+ this.app.get("/p/:name", ex(async (req, res) => {
4512
+ console.log("run mode")
4513
+ this.chrome(req, res, "run")
4514
+ }))
4462
4515
  this.app.post("/pinokio/delete", ex(async (req, res) => {
4463
4516
  try {
4464
4517
  if (req.body.type === 'bin') {
@@ -4930,6 +4983,15 @@ class Server {
4930
4983
  this.app.get("/check", ex((req, res) => {
4931
4984
  res.json({ success: true })
4932
4985
  }))
4986
+ this.app.post("/onrestart", ex(async (req, res) => {
4987
+ console.log("post /onrestart")
4988
+ if (this.onrestart) {
4989
+ this.onrestart()
4990
+ } else {
4991
+ await this.start({ debug: this.debug, browser: this.browser })
4992
+ res.json({ success: true })
4993
+ }
4994
+ }))
4933
4995
  this.app.post("/restart", ex(async (req, res) => {
4934
4996
  console.log("post /restart")
4935
4997
  this.start({ debug: this.debug, browser: this.browser })
@@ -104,6 +104,8 @@ body.dark *::-webkit-scrollbar-thumb {
104
104
  border-radius: 0 !important;
105
105
  border: 2px dotted silver !important;
106
106
  }
107
+ .app-btns {
108
+ }
107
109
  .drawer {
108
110
  max-height: 100000px;
109
111
  overflow: hidden;
@@ -143,6 +145,48 @@ body.dark .dynamic.selected {
143
145
  */
144
146
  }
145
147
 
148
+ .url-bar {
149
+ font-family: verdana;
150
+ font-size: 13px;
151
+ line-height: 15px;
152
+ padding: 0 10px;
153
+ font-weight: normal;
154
+ flex-grow: 1;
155
+ }
156
+ .url-bar .http-url:hover {
157
+ color: firebrick;
158
+ border-color: firebrick;
159
+ }
160
+ .url-bar .https-url:hover {
161
+ color: firebrick;
162
+ border-color: firebrick;
163
+ }
164
+ .url-bar .https-url {
165
+ cursor: pointer;
166
+ display: block;
167
+ text-decoration: none;
168
+ /*
169
+ color: #83ab32;
170
+ */
171
+ color: silver;
172
+ /*
173
+ padding-left: 5px;
174
+ border-left: 10px solid #83ab32;
175
+ */
176
+ }
177
+ .url-bar .http-url {
178
+ cursor: pointer;
179
+ display: block;
180
+ text-decoration: none;
181
+ /*
182
+ color: royalblue;
183
+ */
184
+ color: silver;
185
+ /*
186
+ padding-left: 5px;
187
+ border-left: 10px solid royalblue;
188
+ */
189
+ }
146
190
 
147
191
  .loader-container {
148
192
  background: rgba(0,0,0,0.2) !important;
@@ -587,7 +631,11 @@ form.search > * {
587
631
  margin: 10px;
588
632
  */
589
633
  }
634
+ body.dark form.search {
635
+ border-left: 10px solid rgba(255,255,255,0.1);
636
+ }
590
637
  form.search {
638
+ border-left: 10px solid rgba(0,0,0,0.04);
591
639
  padding: 0px;
592
640
  /*
593
641
  background: #F5F4FA;
@@ -595,6 +643,7 @@ form.search {
595
643
  margin: 0;
596
644
  display: flex;
597
645
  flex-grow: 1;
646
+ padding: 10px;
598
647
  }
599
648
  .input-form {
600
649
  padding: 10px;
@@ -747,13 +747,21 @@ body.dark .appcanvas {
747
747
  <button class='btn2' id='back'><div><i class="fa-solid fa-chevron-left"></i></div><div>Prev</div></button>
748
748
  <button class='btn2' id='forward'><div><i class="fa-solid fa-chevron-right"></i></div><div>Next</div></button>
749
749
  <button class='btn2' id='refresh-page'><div><i class="fa-solid fa-rotate-right"></i></div><div>Refresh</div></button>
750
- <a class='btn2 create-new' id='create-new-folder'><div><i class="fa-solid fa-folder-plus"></i></div><div>Create</div></a>
750
+ <div class='url-bar'>
751
+ <% if (current_urls.https) { %>
752
+ <a class='https-url' target="_blank" href="<%=current_urls.https%>"><i class="fa-solid fa-square-arrow-up-right"></i> <%=current_urls.https%></a>
753
+ <% } %>
754
+ <% if (current_urls.http) { %>
755
+ <a class='http-url' target="_blank" href="<%=current_urls.http%>"><i class="fa-solid fa-square-arrow-up-right"></i> <%=current_urls.http%></a>
756
+ <% } %>
757
+ </div>
751
758
  <a href="/network" class='btn2'><div><i class="fa-solid fa-wifi"></i></div><div>Network</div></a>
752
759
  <a href="/connect" class='btn2'><div><i class="fa-solid fa-circle-user"></i></div><div>Connect</div></a>
760
+ <!--
753
761
  <input type='url' id='location' readonly value="<%=execUrl%>">
754
762
  <a id='open-location' target="_blank" features="browser"><i class="fa-solid fa-arrow-up-right-from-square"></i></a>
763
+ -->
755
764
  <div class='nav-btns'>
756
- <a class='btn2' id='explore' href="/?mode=explore"><div><i class="fa-solid fa-magnifying-glass"></i></div><div>Discover</div></a>
757
765
  <a class='btn2' href="<%=portal%>" target="_blank"><div><i class="fa-solid fa-question"></i></div><div>Help</div></a>
758
766
  <button class='btn2' id='genlog'><div><i class="fa-solid fa-laptop-code"></i></div><div>Logs</div></button>
759
767
  <a id='downloadlogs' download class='hidden btn2' href="/pinokio/logs.zip"><div><i class="fa-solid fa-download"></i></div><div>Download logs</div></a>
@@ -1106,14 +1114,14 @@ body.dark .appcanvas {
1106
1114
 
1107
1115
  //document.querySelector("#location").value = url
1108
1116
 
1109
- document.querySelector("#open-location").setAttribute('href', target.href)
1110
- if (target.pathname.startsWith("/run")) {
1111
- document.querySelector("#location").value = target.pathname.slice(4)
1112
- } else if (target.pathname.startsWith("/api")) {
1113
- document.querySelector("#location").value = target.pathname
1114
- } else {
1115
- document.querySelector("#location").value = target.href
1116
- }
1117
+ // document.querySelector("#open-location").setAttribute('href', target.href)
1118
+ // if (target.pathname.startsWith("/run")) {
1119
+ // document.querySelector("#location").value = target.pathname.slice(4)
1120
+ // } else if (target.pathname.startsWith("/api")) {
1121
+ // document.querySelector("#location").value = target.pathname
1122
+ // } else {
1123
+ // document.querySelector("#location").value = target.href
1124
+ // }
1117
1125
 
1118
1126
 
1119
1127
  // select the selected target element (tab)
@@ -195,12 +195,10 @@ pre {
195
195
  <button class='btn2' id='back'><div><i class="fa-solid fa-chevron-left"></i></div><div>Prev</div></button>
196
196
  <button class='btn2' id='forward'><div><i class="fa-solid fa-chevron-right"></i></div><div>Next</div></button>
197
197
  <button class='btn2' id='refresh-page'><div><i class="fa-solid fa-rotate-right"></i></div><div>Refresh</div></button>
198
- <a class='btn2 create-new' id='create-new-folder'><div><i class="fa-solid fa-folder-plus"></i></div><div>Create</div></a>
198
+ <div class='flexible'></div>
199
199
  <a href="/network" class='btn2'><div><i class="fa-solid fa-wifi"></i></div><div>Network</div></a>
200
200
  <a href="/connect" class='btn2'><div><i class="fa-solid fa-circle-user"></i></div><div>Connect</div></a>
201
- <div class='flexible'></div>
202
201
  <div class='nav-btns'>
203
- <a class='btn2' id='explore' href="/?mode=explore"><div><i class="fa-solid fa-magnifying-glass"></i></div><div>Discover</div></a>
204
202
  <a class='btn2' href="<%=portal%>" target="_blank"><div><i class="fa-solid fa-question"></i></div><div>Help</div></a>
205
203
  <a class='btn2' href="/?mode=settings"><div><i class="fa-solid fa-gear"></i></div><div>Settings</div></a>
206
204
  <button id='new-window' title='open a new window' class='btn2' data-agent="<%=agent%>"><div><i class="fa-solid fa-plus"></i></div><div>Window</div></button>
@@ -222,6 +222,7 @@ body.dark .config {
222
222
  <script src="/sweetalert2.js"></script>
223
223
  <script src="/common.js"></script>
224
224
  <script src="/opener.js"></script>
225
+ <script src="/nav.js"></script>
225
226
  </head>
226
227
  <body class='<%=theme%>' data-agent="<%=agent%>">
227
228
  <header class='navheader grabbable'>
@@ -230,12 +231,10 @@ body.dark .config {
230
231
  <button class='btn2' id='back'><div><i class="fa-solid fa-chevron-left"></i></div><div>Prev</div></button>
231
232
  <button class='btn2' id='forward'><div><i class="fa-solid fa-chevron-right"></i></div><div>Next</div></button>
232
233
  <button class='btn2' id='refresh-page'><div><i class="fa-solid fa-rotate-right"></i></div><div>Refresh</div></button>
233
- <a class='btn2 create-new' id='create-new-folder'><div><i class="fa-solid fa-folder-plus"></i></div><div>Create</div></a>
234
+ <div class='flexible'></div>
234
235
  <a href="/network" class='btn2'><div><i class="fa-solid fa-wifi"></i></div><div>Network</div></a>
235
236
  <a href="/connect" class='btn2'><div><i class="fa-solid fa-circle-user"></i></div><div>Connect</div></a>
236
- <div class='flexible'></div>
237
237
  <div class='nav-btns'>
238
- <a class='btn2' id='explore' href="/?mode=explore"><div><i class="fa-solid fa-magnifying-glass"></i></div><div>Discover</div></a>
239
238
  <a class='btn2' href="<%=portal%>" target="_blank"><div><i class="fa-solid fa-question"></i></div><div>Help</div></a>
240
239
  <button class='btn2' id='genlog'><div><i class="fa-solid fa-laptop-code"></i></div><div>Logs</div></button>
241
240
  <a id='downloadlogs' download class='hidden btn2' href="/pinokio/logs.zip"><div><i class="fa-solid fa-download"></i></div><div>Download logs</div></a>
@@ -115,12 +115,10 @@ body.frozen {
115
115
  <button class='btn2' id='back'><div><i class="fa-solid fa-chevron-left"></i></div><div>Prev</div></button>
116
116
  <button class='btn2' id='forward'><div><i class="fa-solid fa-chevron-right"></i></div><div>Next</div></button>
117
117
  <button class='btn2' id='refresh-page'><div><i class="fa-solid fa-rotate-right"></i></div><div>Refresh</div></button>
118
- <a class='btn2 create-new' id='create-new-folder'><div><i class="fa-solid fa-folder-plus"></i></div><div>Create</div></a>
119
118
  <a href="/network" class='btn2'><div><i class="fa-solid fa-wifi"></i></div><div>Network</div></a>
120
119
  <a href="/connect" class='btn2'><div><i class="fa-solid fa-circle-user"></i></div><div>Connect</div></a>
121
120
  <div class='flexible'></div>
122
121
  <div class='nav-btns'>
123
- <a class='btn2' id='explore' href="/?mode=explore"><div><i class="fa-solid fa-magnifying-glass"></i></div><div>Discover</div></a>
124
122
  <a class='btn2' href="<%=portal%>" target="_blank"><div><i class="fa-solid fa-question"></i></div><div>Help</div></a>
125
123
  <button class='btn2' id='genlog'><div><i class="fa-solid fa-laptop-code"></i></div><div>Logs</div></button>
126
124
  <a id='downloadlogs' download class='hidden btn2' href="/pinokio/logs.zip"><div><i class="fa-solid fa-download"></i></div><div>Download logs</div></a>
@@ -247,7 +247,8 @@ document.addEventListener("DOMContentLoaded", async () => {
247
247
  })
248
248
  console.log("res" ,res)
249
249
  <% if (init && name) { %>
250
- location.href = "/pinokio/browser/<%=name%>"
250
+ //location.href = "/pinokio/browser/<%=name%>"
251
+ location.href = "/p/<%=name%>"
251
252
  <% } else { %>
252
253
  n.Noty({
253
254
  text: `Updated!`
@@ -124,12 +124,10 @@ body main iframe {
124
124
  <button class='btn2' id='back'><div><i class="fa-solid fa-chevron-left"></i></div><div>Prev</div></button>
125
125
  <button class='btn2' id='forward'><div><i class="fa-solid fa-chevron-right"></i></div><div>Next</div></button>
126
126
  <button class='btn2' id='refresh-page'><div><i class="fa-solid fa-rotate-right"></i></div><div>Refresh</div></button>
127
- <a class='btn2 create-new' id='create-new-folder'><div><i class="fa-solid fa-folder-plus"></i></div><div>Create</div></a>
127
+ <div class='flexible'></div>
128
128
  <a href="/network" class='btn2'><div><i class="fa-solid fa-wifi"></i></div><div>Network</div></a>
129
129
  <a href="/connect" class='btn2'><div><i class="fa-solid fa-circle-user"></i></div><div>Connect</div></a>
130
- <div class='flexible'></div>
131
130
  <div class='nav-btns'>
132
- <a class='btn2' id='explore' href="/?mode=explore"><div><i class="fa-solid fa-magnifying-glass"></i></div><div>Discover</div></a>
133
131
  <a class='btn2' href="<%=portal%>" target="_blank"><div><i class="fa-solid fa-question"></i></div><div>Help</div></a>
134
132
  <button class='btn2' id='genlog'><div><i class="fa-solid fa-laptop-code"></i></div><div>Logs</div></button>
135
133
  <a id='downloadlogs' download class='hidden btn2' href="/pinokio/logs.zip"><div><i class="fa-solid fa-download"></i></div><div>Download logs</div></a>
@@ -182,7 +182,6 @@ body.dark .browser-options-row {
182
182
  </form>
183
183
  <% if (ishome) { %>
184
184
  <div class='nav-btns'>
185
- <a class='btn2' id='explore' href="/?mode=explore"><div><i class="fa-solid fa-magnifying-glass"></i></div><div>Discover</div></a>
186
185
  <a class='btn2' href="<%=portal%>" target="_blank"><div><i class="fa-solid fa-question"></i></div><div>Help</div></a>
187
186
  <% if (agent === "electron") { %>
188
187
  <a class='btn2' data-filepath="<%=filepath%>"><div><i class="fa-regular fa-folder-open"></i></div><div>Files</div></a>
@@ -209,12 +209,10 @@ hr {
209
209
  <button class='btn2' id='back'><div><i class="fa-solid fa-chevron-left"></i></div><div>Prev</div></button>
210
210
  <button class='btn2' id='forward'><div><i class="fa-solid fa-chevron-right"></i></div><div>Next</div></button>
211
211
  <button class='btn2' id='refresh-page'><div><i class="fa-solid fa-rotate-right"></i></div><div>Refresh</div></button>
212
- <a class='btn2 create-new' id='create-new-folder'><div><i class="fa-solid fa-folder-plus"></i></div><div>Create</div></a>
213
212
  <a href="/network" class='btn2'><div><i class="fa-solid fa-wifi"></i></div><div>Network</div></a>
214
213
  <a href="/connect" class='btn2'><div><i class="fa-solid fa-circle-user"></i></div><div>Connect</div></a>
215
214
  <div class='flexible'></div>
216
215
  <div class='nav-btns'>
217
- <a class='btn2' id='explore' href="/?mode=explore"><div><i class="fa-solid fa-magnifying-glass"></i></div><div>Discover</div></a>
218
216
  <a class='btn2' href="<%=portal%>" target="_blank"><div><i class="fa-solid fa-question"></i></div><div>Help</div></a>
219
217
  <button class='btn2' id='genlog'><div><i class="fa-solid fa-laptop-code"></i></div><div>Logs</div></button>
220
218
  <a id='downloadlogs' download class='hidden btn2' href="/pinokio/logs.zip"><div><i class="fa-solid fa-download"></i></div><div>Download logs</div></a>
@@ -257,10 +257,8 @@ body.dark .item .tile .badge {
257
257
  <button class='btn2' id='back'><div><i class="fa-solid fa-chevron-left"></i></div><div>Prev</div></button>
258
258
  <button class='btn2' id='forward'><div><i class="fa-solid fa-chevron-right"></i></div><div>Next</div></button>
259
259
  <button class='btn2' id='refresh-page'><div><i class="fa-solid fa-rotate-right"></i></div><div>Refresh</div></button>
260
- <a class='btn2 create-new' id='create-new-folder'><div><i class="fa-solid fa-folder-plus"></i></div><div>Create</div></a>
261
260
  <div class='flexible'></div>
262
261
  <div class='nav-btns'>
263
- <a class='btn2' id='explore' href="/?mode=explore"><div><i class="fa-solid fa-magnifying-glass"></i></div><div>Discover</div></a>
264
262
  <a class='btn2' href="/?mode=help"><div><i class="fa-regular fa-face-smile"></i></div><div>Community</div></a>
265
263
  <a class='btn2' href="/?mode=settings"><div><i class="fa-solid fa-gear"></i></div><div>Settings</div></a>
266
264
  <button id='new-window' title='open a new window' class='btn2' data-agent="<%=agent%>"><div><i class="fa-solid fa-plus"></i></div><div>Window</div></button>
@@ -117,7 +117,6 @@ a.badge {
117
117
  }
118
118
  body.dark .btn {
119
119
  color: white;
120
- border: 1px solid rgba(255,255,255,0.3);
121
120
  }
122
121
  body.dark .badge {
123
122
  background: rgba(255,255,255,0.1);
@@ -247,10 +246,14 @@ body.dark .open-menu, body.dark .browse {
247
246
  <button class='btn2' id='back'><div><i class="fa-solid fa-chevron-left"></i></div><div>Prev</div></button>
248
247
  <button class='btn2' id='forward'><div><i class="fa-solid fa-chevron-right"></i></div><div>Next</div></button>
249
248
  <button class='btn2' id='refresh-page'><div><i class="fa-solid fa-rotate-right"></i></div><div>Refresh</div></button>
250
- <a class='btn2 create-new' id='create-new-folder'><div><i class="fa-solid fa-folder-plus"></i></div><div>Create</div></a>
251
- <!--
252
- <a href="/new" class='btn2'><div><i class='fa-solid fa-folder-plus'></i></div><div>Create</div></a>
253
- -->
249
+ <div class='url-bar'>
250
+ <% if (current_urls.https) { %>
251
+ <a class='https-url' target="_blank" href="<%=current_urls.https%>"><i class="fa-solid fa-square-arrow-up-right"></i> <%=current_urls.https%></a>
252
+ <% } %>
253
+ <% if (current_urls.http) { %>
254
+ <a class='http-url' target="_blank" href="<%=current_urls.http%>"><i class="fa-solid fa-square-arrow-up-right"></i> <%=current_urls.http%></a>
255
+ <% } %>
256
+ </div>
254
257
  <a href="/network" class='btn2'><div><i class="fa-solid fa-wifi"></i></div><div>Network</div></a>
255
258
  <a href="/connect" class='btn2'><div><i class="fa-solid fa-circle-user"></i></div><div>Connect</div></a>
256
259
  <!--
@@ -264,15 +267,8 @@ body.dark .open-menu, body.dark .browse {
264
267
  <a class='path' href="<%=path.path%>"><%-path.name%></a>
265
268
  <% } %>
266
269
  <% }) %>
267
- <form class='search'>
268
- <% if (display.includes("form")) { %>
269
- <input type='search' class="flexible" placeholder='Filter downloaded apps'>
270
- <% } else { %>
271
- <% } %>
272
- </form>
273
270
  <% if (ishome) { %>
274
271
  <div class='nav-btns'>
275
- <a class='btn2' id='explore' href="/?mode=explore"><div><i class="fa-solid fa-magnifying-glass"></i></div><div>Discover</div></a>
276
272
  <a class='btn2' href="<%=portal%>" target="_blank"><div><i class="fa-solid fa-question"></i></div><div>Help</div></a>
277
273
  <button class='btn2' id='genlog'><div><i class="fa-solid fa-laptop-code"></i></div><div>Logs</div></button>
278
274
  <a id='downloadlogs' download class='hidden btn2' href="/pinokio/logs.zip"><div><i class="fa-solid fa-download"></i></div><div>Download logs</div></a>
@@ -306,51 +302,16 @@ body.dark .open-menu, body.dark .browse {
306
302
  <div id='terminal' class='hidden'></div>
307
303
  <div class='container'>
308
304
  <% if (ishome) { %>
309
- <% if (running.length === 0 && notRunning.length === 0) { %>
310
- <% } else { %>
311
- <% if (false) { %>
312
- <div class='browser-options'>
313
- <% if (agent === "electron") { %>
314
- <div class='browser-options-row'>
315
- <% if (agent === "electron") { %>
316
- <a href="/" target="_blank" class='btn' features="browser"><div><i class="fa-solid fa-square-up-right"></i> Open</div></a>
317
- <% } else { %>
318
- <a href="/" target="_blank" class='btn'><div><i class="fa-solid fa-square-up-right"></i> Open</div></a>
319
- <% } %>
320
- <div class='flexible'>
321
- <h3><i class="fa-solid fa-bolt"></i> Instant Launch</h3>
322
- <div>(Experimental) Directly open pinokio apps from your favorite browser address bar at localhost. If an app you're trying to use is already running, it will instantly load. If it's not, the app will first launch and then load the website.</div>
323
- </div>
324
- </div>
325
- <% } %>
326
- <div class='browser-options-row'>
327
- <a href="/network" class='btn'><div><i class="fa-solid fa-gauge"></i> Configure</div></a>
328
- <div class='flexible'>
329
- <h3><i class="fa-solid fa-wifi"></i> Local Sharing</h3>
330
- <div>Serve Pinokio, installed apps, and even external apps (example: Ollama) to any device on the same network.</div>
331
- </div>
332
- </div>
333
- <div class='browser-options-row hidden'>
334
- <% if (cloudflare_pub) { %>
335
- <a id='cloudflare-stop' class='btn'><div><i class="fa-solid fa-stop"></i> Stop</div></a>
336
- <div class='flexible'>
337
- <h3>Public Share</h3>
338
- <div>Open up your Pinokio server to the open internet (anyone with the URL can access)</div>
339
- <span class='badge'><i class="fa-solid fa-circle-notch fa-spin"></i> Running at <a href="<%=cloudflare_pub%>" target="_blank" features="browser"><%=cloudflare_pub%></a></span>
340
- <a id='cloudflare-qr' class='badge'><i class="fa-solid fa-qrcode"></i> Scan QR Code</a>
341
- </div>
342
- <% } else { %>
343
- <a id='cloudflare' class='btn'><div><i class="fa-solid fa-play"></i> Start</div></a>
344
- <a id='cloudflare-starting' class='btn disabled hidden'><div><i class="fa-solid fa-circle-notch fa-spin"></i> Starting</div></a>
345
- <div class='flexible'>
346
- <h3>Public Share</h3>
347
- <div>Open up your Pinokio server to the open internet (anyone with the URL can access)</div>
348
- </div>
349
- <% } %>
350
- </div>
351
- </div>
305
+ <form class='search'>
306
+ <div class='app-btns'>
307
+ <a class='btn create-new' id='create-new-folder'><i class="fa-solid fa-folder-plus"></i> Create</a>
308
+ <a class='btn' id='explore' href="/?mode=explore"><i class="fa-solid fa-magnifying-glass"></i> Discover</a>
309
+ </div>
310
+ <% if (display.includes("form")) { %>
311
+ <input type='search' class="flexible" placeholder='Filter downloaded apps'>
312
+ <% } else { %>
352
313
  <% } %>
353
- <% } %>
314
+ </form>
354
315
  <% if (running.length > 0) { %>
355
316
  <div class='running-apps'>
356
317
  <!--
@@ -302,8 +302,13 @@ body.dark .config {
302
302
  .config-row input[type=text] {
303
303
  padding: 7px;
304
304
  }
305
- .btn.save {
305
+ .btn {
306
306
  padding: 8px;
307
+ margin-right: 10px;
308
+ }
309
+ .btn.reset {
310
+ background: firebrick;
311
+ color: white !important;
307
312
  }
308
313
  .switcher {
309
314
  position: relative;
@@ -408,6 +413,7 @@ table h3 {
408
413
  <script src="/sweetalert2.js"></script>
409
414
  <script src="/common.js"></script>
410
415
  <script src="/opener.js"></script>
416
+ <script src="/nav.js"></script>
411
417
  </head>
412
418
  <body class='<%=theme%>' data-agent="<%=agent%>">
413
419
  <header class='navheader grabbable'>
@@ -416,12 +422,10 @@ table h3 {
416
422
  <button class='btn2' id='back'><div><i class="fa-solid fa-chevron-left"></i></div><div>Prev</div></button>
417
423
  <button class='btn2' id='forward'><div><i class="fa-solid fa-chevron-right"></i></div><div>Next</div></button>
418
424
  <button class='btn2' id='refresh-page'><div><i class="fa-solid fa-rotate-right"></i></div><div>Refresh</div></button>
419
- <a class='btn2 create-new' id='create-new-folder'><div><i class="fa-solid fa-folder-plus"></i></div><div>Create</div></a>
425
+ <div class='flexible'></div>
420
426
  <a href="/network" class='btn2'><div><i class="fa-solid fa-wifi"></i></div><div>Network</div></a>
421
427
  <a href="/connect" class='btn2'><div><i class="fa-solid fa-circle-user"></i></div><div>Connect</div></a>
422
- <div class='flexible'></div>
423
428
  <div class='nav-btns'>
424
- <a class='btn2' id='explore' href="/?mode=explore"><div><i class="fa-solid fa-magnifying-glass"></i></div><div>Discover</div></a>
425
429
  <a class='btn2' href="<%=portal%>" target="_blank"><div><i class="fa-solid fa-question"></i></div><div>Help</div></a>
426
430
  <button class='btn2' id='genlog'><div><i class="fa-solid fa-laptop-code"></i></div><div>Logs</div></button>
427
431
  <a id='downloadlogs' download class='hidden btn2' href="/pinokio/logs.zip"><div><i class="fa-solid fa-download"></i></div><div>Download logs</div></a>
@@ -457,7 +461,7 @@ table h3 {
457
461
  <div class='advanced'>
458
462
  <div class='row'>
459
463
  <div id='advanced-label' class='link-label label'>Advanced</div>
460
- <div id='reset-label' class='link-label label'>Reset HTTPS Certificates</div>
464
+ <div id='reset-label' class='link-label label'>Reset</div>
461
465
  </div>
462
466
  </div>
463
467
  </div>
@@ -554,7 +558,7 @@ table h3 {
554
558
  document.querySelector("#reset-label").addEventListener("click", async (e) => {
555
559
  e.preventDefault()
556
560
  e.stopPropagation()
557
- let ok = confirm("are you sure you want to re-generate http certificates?")
561
+ let ok = confirm("Are you sure you want to reset the network config? (The peer router will be updated to the latest version; 2. A new HTTPS certificate will be generated)")
558
562
  if (ok) {
559
563
  let r = await fetch("/network/reset", {
560
564
  method: "post",
@@ -278,9 +278,6 @@ body.dark .keys pre {
278
278
  <button class='btn2' id='back'><div><i class="fa-solid fa-chevron-left"></i></div><div>Prev</div></button>
279
279
  <button class='btn2' id='forward'><div><i class="fa-solid fa-chevron-right"></i></div><div>Next</div></button>
280
280
  <button class='btn2' id='refresh-page'><div><i class="fa-solid fa-rotate-right"></i></div><div>Refresh</div></button>
281
- <a class='btn2 create-new' id='create-new-folder'><div><i class="fa-solid fa-folder-plus"></i></div><div>Create</div></a>
282
- <a href="/network" class='btn2'><div><i class="fa-solid fa-wifi"></i></div><div>Network</div></a>
283
- <a href="/connect" class='btn2'><div><i class="fa-solid fa-circle-user"></i></div><div>Connect</div></a>
284
281
  <% paths.forEach((path) => { %>
285
282
  <% if (path.action) { %>
286
283
  <a class='path nav-button' id="<%=path.id%>" onclick="<%=path.action%>"><%-path.name%></a>
@@ -289,8 +286,9 @@ body.dark .keys pre {
289
286
  <% } %>
290
287
  <% }) %>
291
288
  <div class='flexible'></div>
289
+ <a href="/network" class='btn2'><div><i class="fa-solid fa-wifi"></i></div><div>Network</div></a>
290
+ <a href="/connect" class='btn2'><div><i class="fa-solid fa-circle-user"></i></div><div>Connect</div></a>
292
291
  <div class='nav-btns'>
293
- <a class='btn2' id='explore' href="/?mode=explore"><div><i class="fa-solid fa-magnifying-glass"></i></div><div>Discover</div></a>
294
292
  <a class='btn2' href="<%=portal%>" target="_blank"><div><i class="fa-solid fa-question"></i></div><div>Help</div></a>
295
293
  <button class='btn2' id='genlog'><div><i class="fa-solid fa-laptop-code"></i></div><div>Logs</div></button>
296
294
  <a id='downloadlogs' download class='hidden btn2' href="/pinokio/logs.zip"><div><i class="fa-solid fa-download"></i></div><div>Download logs</div></a>
@@ -644,11 +642,38 @@ console.log("body", body)
644
642
  allowOutsideClick: false,
645
643
  allowEscapeKey: false,
646
644
  allowEnterKey: false,
647
- showConfirmButton: false,
648
- didOpen: () => {
649
- Swal.showLoading();
645
+ confirmButtonText: "Restart",
646
+ // showConfirmButton: false,
647
+ // didOpen: () => {
648
+ // Swal.showLoading();
649
+ // }
650
+ }).then((result) => {
651
+ if (result.isConfirmed) {
652
+ fetch("/onrestart", {
653
+ method: "POST",
654
+ headers: { "Content-Type": "application/json" },
655
+ body: JSON.stringify({})
656
+ }).then((res) => {
657
+ return res.json()
658
+ })
659
+ setInterval(async () => {
660
+ try {
661
+ let res = await fetch("/check").then((res) => {
662
+ return res.json()
663
+ })
664
+ if (res.success) {
665
+ document.querySelector(".loading").classList.add("hidden")
666
+ setTimeout(() => {
667
+ location.href = "/"
668
+ }, 1000)
669
+ }
670
+ } catch (e) {
671
+ console.log(e)
672
+ }
673
+ }, 1000)
650
674
  }
651
- });
675
+ })
676
+
652
677
  } else {
653
678
  //alert("Successfully updated the pinokio home to " + val)
654
679
  fetch("/restart", {