pinokiod 1.0.30 → 1.0.31

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.
package/kernel/shell.js CHANGED
@@ -31,6 +31,11 @@ class Shell {
31
31
  this.platform = os.platform()
32
32
  this.logs = {}
33
33
  this.shell = this.platform === 'win32' ? 'cmd.exe' : 'bash';
34
+
35
+ // Windows: /D => ignore AutoRun Registry Key
36
+ // Others: --noprofile => ignore .bash_profile, --norc => ignore .bashrc
37
+ this.args = this.platform === 'win32' ? ["/D"] : ["--noprofile", "--norc"]
38
+
34
39
  //this.vt = new Terminal({ allowProposedApi: true, scrollback: 5, })
35
40
  // this.vt = new Terminal({
36
41
  // allowProposedApi: true,
@@ -113,6 +118,9 @@ class Shell {
113
118
  this.env.GRADIO_TEMP_DIR = path.resolve(this.kernel.homedir, "cache", "GRADIO_TEMP_DIR")
114
119
  this.env.PIP_CONFIG_FILE = path.resolve(this.kernel.homedir, "pipconfig")
115
120
 
121
+ this.env.PS1 = "<<PINOKIO SHELL>> "
122
+ // this.env.PROMPT_COMMAND = "export PS1=\"<<PINOKIO SHELL>> \""
123
+
116
124
  let PATH_KEY;
117
125
  if (this.env.Path) {
118
126
  PATH_KEY = "Path"
@@ -182,6 +190,8 @@ class Shell {
182
190
  // automatically add self to the shells registry
183
191
  this.kernel.shell.add(this)
184
192
 
193
+ console.log("** this.env", this.env)
194
+
185
195
  if (params.sudo) {
186
196
  let options = {
187
197
  name: "Pinokio",
@@ -352,7 +362,7 @@ class Shell {
352
362
  //let re = /([\r\n]+[^\r\n]+)(\1)/gs
353
363
  let re = /(.+)(\1)/gs
354
364
  console.log("get prompt - pty.spawn", config)
355
- let term = pty.spawn(this.shell, [], config)
365
+ let term = pty.spawn(this.shell, this.args, config)
356
366
  console.log("terminal spawned", term)
357
367
  let ready
358
368
  console.log("create terminal for prompt")
@@ -544,7 +554,7 @@ class Shell {
544
554
  if (!this.ptyProcess) {
545
555
  // ptyProcess doesn't exist => create
546
556
  this.done = false
547
- this.ptyProcess = pty.spawn(this.shell, [], config)
557
+ this.ptyProcess = pty.spawn(this.shell, this.args, config)
548
558
  this.ptyProcess.onData((data) => {
549
559
  if (!this.done) {
550
560
  this.queue.push(data)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "1.0.30",
3
+ "version": "1.0.31",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -1849,9 +1849,25 @@ class Server {
1849
1849
  theme: this.theme,
1850
1850
  agent: this.agent,
1851
1851
  src: "/_api/" + name,
1852
- rawpath
1852
+ rawpath,
1853
1853
  })
1854
1854
  })
1855
+ this.app.post("/pinokio/delete", async (req, res) => {
1856
+ if (req.body.name) {
1857
+ let folderPath = this.kernel.path("api", req.body.name)
1858
+ console.log("delete", folderPath)
1859
+ await rimraf(folderPath)
1860
+ await new Promise((resolve, reject) => {
1861
+ setTimeout(() => {
1862
+ resolve()
1863
+ }, 5000)
1864
+ })
1865
+ console.log("deleted")
1866
+ res.json({ success: true })
1867
+ } else {
1868
+ res.json({ error: e.stack })
1869
+ }
1870
+ })
1855
1871
  // this.app.get("/pinokio/shell_state", (req, res) => {
1856
1872
  // let states = this.kernel.shell.shells.map((s) => {
1857
1873
  // return {
@@ -135,7 +135,8 @@ const createTerm = () => {
135
135
  //theme: xtermTheme.Piatto_Light,
136
136
  //theme: xtermTheme.Github,
137
137
  //theme: xtermTheme.Cobalt_Neon, // top legibility
138
- theme: xtermTheme.Duotone_Dark,
138
+ //theme: xtermTheme.Duotone_Dark,
139
+ theme: xtermTheme.FrontEndDelight,
139
140
  //theme: xtermTheme.Seafoam_Pastel,
140
141
  //theme: xtermTheme.IC_Green_PPL,
141
142
  //theme: xtermTheme.FunForrest,
@@ -7,19 +7,21 @@
7
7
  */
8
8
  /*
9
9
  --dark-nav-bg: #161616;
10
- */
11
10
  --dark-nav-bg: rgb(31, 29, 39);
11
+ */
12
+ --dark-nav-bg: rgb(27, 28, 29);
12
13
 
14
+ --dark-bg: rgb(27, 28, 29);
13
15
  /*
14
16
  --dark-bg: #202020;
15
- */
16
17
  --dark-bg: rgb(31, 29, 39);
18
+ */
17
19
  --light-bg: rgba(0,0,150,0.05);
18
20
 
19
21
  --light-thin: rgba(0,0,0,0.1);
20
22
  --dark-thin: rgba(255,255,255,0.03);
21
23
 
22
- --dark-color: rgba(255,255,255,0.9);
24
+ --dark-color: rgba(255,255,255,0.8);
23
25
  --light-color: rgba(0,0,0,0.9);
24
26
 
25
27
  --dark-fade: rgba(255,255,255,0.6);
@@ -43,7 +45,10 @@
43
45
  --light-btn-color: white;
44
46
 
45
47
  --dark-btn-bg: rgba(0,0,0,0.8);
48
+ /*
46
49
  --dark-btn-color: #b7a1ff;
50
+ */
51
+ --dark-btn-color: whitesmoke;
47
52
  }
48
53
  body.columns footer {
49
54
  }
@@ -77,14 +82,19 @@ footer pre {
77
82
  background: none !important;
78
83
  }
79
84
  footer {
85
+ font-family: verdana;
80
86
  overflow: hidden;
87
+ font-size: 11px;
88
+ font-weight: normal;
81
89
  /*
82
90
  overflow: auto;
83
91
  */
84
92
  box-sizing: border-box;
85
93
  color: var(--dark-color);
86
94
  background: var(--dark-bg);
95
+ /*
87
96
  border-top: 1px solid rgba(255,255,255,0.05);
97
+ */
88
98
  display: flex;
89
99
  align-items: center;
90
100
  padding: 10px;
@@ -99,6 +109,8 @@ footer b {
99
109
  flex-shrink: 0;
100
110
  color: var(--dark-btn-color);
101
111
  margin-right: 10px;
112
+ font-weight: normal;
113
+ font-size: 11px;
102
114
  /*
103
115
  background: var(--dark-btn-color);
104
116
  color: var(--dark-bg);
@@ -837,9 +849,12 @@ body.dark .line:hover {
837
849
  vertical-align: middle;
838
850
  font-weight: normal;
839
851
  }
852
+ body.dark .line .avatar i {
853
+ color: var(--dark-btn-color);
854
+ }
840
855
  .line .avatar i {
841
856
  font-size: 60px;
842
- color: var(--dark-btn-color);
857
+ color: var(--dark-bg);
843
858
  }
844
859
  .line .description {
845
860
  font-size: 13px;
@@ -132,7 +132,8 @@ document.addEventListener("DOMContentLoaded", () => {
132
132
  //theme: xtermTheme.Seafoam_Pastel,
133
133
  //theme: xtermTheme.IC_Green_PPL,
134
134
  //theme: xtermTheme.FunForrest,
135
- theme: xtermTheme.Jackie_Brown,
135
+ //theme: xtermTheme.Jackie_Brown,
136
+ theme: xtermTheme.FrontEndDelight,
136
137
  //theme: xtermTheme.Ocean,
137
138
 
138
139
  //theme: xtermTheme.Blazer,
@@ -30,6 +30,12 @@ body {
30
30
  .menu {
31
31
  overflow: auto;
32
32
  }
33
+ body.dark .m {
34
+ border-top: 1px solid rgba(255,255,255,0.04);
35
+ }
36
+ .m {
37
+ border-top: 1px solid rgba(0,0,0,0.04);
38
+ }
33
39
  .container {
34
40
  display: flex;
35
41
  flex-direction: column;
@@ -196,6 +202,9 @@ body.dark .header-item.cursor {
196
202
  border-left: 5px solid gold;
197
203
  */
198
204
  }
205
+ .frame-link {
206
+ cursor: pointer;
207
+ }
199
208
  body .frame-link.selected {
200
209
  /*
201
210
  border-right: 10px solid gold;
@@ -210,7 +219,10 @@ body .frame-link.selected {
210
219
  color: white;
211
220
  }
212
221
  body.dark .frame-link.selected {
213
- background: rgba(0,0,0,0.2) !important;
222
+ background: rgba(0,0,0,0.7) !important;
223
+ }
224
+ .frame-link .loader {
225
+ padding: 5px;
214
226
  }
215
227
  .frame-link .tab {
216
228
  flex-grow: 1;
@@ -218,7 +230,9 @@ body.dark .frame-link.selected {
218
230
  width: 100%;
219
231
  */
220
232
  word-break: break-word;
233
+ /*
221
234
  margin-right: 10px;
235
+ */
222
236
  }
223
237
  .frame-link .tab .flexible {
224
238
  min-width: 5px;
@@ -265,22 +279,31 @@ body.dark .grid-btns .btn2 {
265
279
  margin-right: 10px;
266
280
  }
267
281
  .temp-menu {
282
+ /*
268
283
  border-top: 1px solid rgba(0,0,0,0.1);
284
+ */
269
285
  }
270
286
  .temp-menu .del i {
271
287
  margin: 0;
272
288
  }
289
+ #delete {
290
+ color: brown;
291
+ }
273
292
  body .footer {
274
293
  }
275
294
  body.dark nav {
295
+ /*
276
296
  border-bottom: 1px solid rgba(255,255,255,0.04);
297
+ */
277
298
  }
278
299
  nav {
279
300
  background: white;
280
301
  padding: 5px;
281
302
  cursor: grab !important;
282
303
  -webkit-app-region: drag !important;
304
+ /*
283
305
  border-bottom: 1px solid rgba(0,0,0,0.04);
306
+ */
284
307
  box-sizing: border-box;
285
308
  }
286
309
  nav .btn2 {
@@ -293,7 +316,8 @@ nav .logo {
293
316
  }
294
317
  #location {
295
318
  padding: 5px;
296
- font-size: 14px;
319
+ font-size: 12px;
320
+ font-family: verdana;
297
321
  }
298
322
  .bar {
299
323
  -webkit-app-region: no-drag !important;
@@ -333,6 +357,21 @@ body.dark #new-tab {
333
357
  padding-left: 15px;
334
358
  box-sizing: border-box;
335
359
  }
360
+ body.dark .loader-popup {
361
+ background: rgba(0,0,0,0.2);
362
+ color: whitesmoke;
363
+ }
364
+ .loader-popup {
365
+ text-transform: uppercase;
366
+ font-size: 12px;
367
+ letter-spacing: 1px;
368
+ padding: 20px;
369
+ background: rgba(0,0,0,0.2);
370
+ color: white;
371
+ }
372
+ body.dark .loader-container {
373
+ background: rgba(255,255,255,0.3);
374
+ }
336
375
  </style>
337
376
  </head>
338
377
  <body class='<%=theme%>'>
@@ -343,9 +382,12 @@ body.dark #new-tab {
343
382
  <div><%=config.title%></div>
344
383
  </div>
345
384
  </div>
346
- <div class='m system'>
385
+ <div class='m n system' data-type="n">
347
386
  <!--<a data-index="0" target="<%=src%>" href="<%=src%>" class='btn header-item frame-link'>-->
348
- <a target="<%=src%>" href="<%=src%>" class='btn header-item frame-link'>
387
+ <div id='delete' data-name="<%=name%>" class='btn header-item frame-link'>
388
+ <div class='tab'><i class="fa-solid fa-trash-can"></i> Delete</div>
389
+ </div>
390
+ <a target="<%=src%>" href="<%=src%>" class='btn header-item frame-link' data-index="0">
349
391
  <div class='tab'><i class="fa-regular fa-folder-open"></i> Files</div>
350
392
  </a>
351
393
  </div>
@@ -465,7 +507,7 @@ const renderSelection = (e, force) => {
465
507
  let type = id[0]
466
508
  let index = id.slice(1)
467
509
 
468
- console.log({ type, index })
510
+ console.log({ type, index })
469
511
 
470
512
  // select the selected link
471
513
  // document.querySelectorAll(".frame-link").forEach((el) => {
@@ -475,107 +517,153 @@ console.log({ type, index })
475
517
 
476
518
 
477
519
  // const target = document.querySelector(`[target='${id}']`)
520
+
521
+
478
522
  let target
479
523
  if (e) {
524
+ // If the renderSelection is triggered by an event, look for the frame-link that's triggering the event
480
525
  if (e.target.classList.contains("frame-link")) {
481
526
  target = e.target
482
527
  } else {
483
528
  target = e.target.closest(".frame-link")
484
529
  }
530
+ } else {
531
+ // if not triggered by an event, look for the target from the location hash
532
+ target = document.querySelector(`aside .${type} [data-index='${index}']`)
485
533
  }
486
534
 
487
535
 
488
- if (!target) {
489
- // find target by id
490
- //target = document.querySelector("aside [target='" + id + "']")
491
- target = document.querySelector(`aside .${type} [data-index='${index}']`)
492
- }
536
+ // if the target was found either through:
537
+ // 1. looking for the frame-link that triggered the event
538
+ // 2. or by looking at the location hash
539
+ //
540
+ // => select that tab and frame
493
541
 
494
542
  if (target) {
495
543
  console.log("# 3")
496
544
 
497
545
 
546
+ // Instantiate a frame with the selected target's href
498
547
  let url = target.href
548
+ console.log("> url", url)
499
549
  document.querySelector("#open-browser").href = url
500
550
  document.querySelector("#clone-tab").setAttribute("data-href", url)
501
551
  document.querySelector("#location").innerHTML = url
502
552
 
503
- // document.querySelector("#location").innerHTML = location.hash.slice(1)
504
- //
505
- // if (location.hash.slice(1).startsWith("/")) {
506
- // //document.querySelector("#open-browser").classList.add("hidden")
507
- // document.querySelector("#open-browser").classList.remove("hidden")
508
- // document.querySelector("#open-browser").href = location.hash.slice(1)
509
- // } else {
510
- // document.querySelector("#open-browser").classList.remove("hidden")
511
- // //document.querySelector("#open-browser").href = id
512
- // document.querySelector("#open-browser").href = location.hash.slice(1)
513
- // }
514
- // document.querySelector("#clone-tab").setAttribute("data-href", location.hash.slice(1))
515
-
516
-
517
553
 
554
+ // select the selected target element (tab)
518
555
  target.classList.add("selected")
519
556
 
520
- // select the iframe
557
+ // hide all frames
521
558
  document.querySelectorAll("iframe").forEach((el) => {
522
559
  el.classList.add("hidden")
523
560
  })
524
- let targetFrame = document.querySelector(`iframe[name='${target.target}']`)
525
- if (targetFrame) {
526
- targetFrame.classList.remove("hidden")
527
561
 
528
- // if the iframe already exists, do not
529
- if (loaded[target.target]){
530
562
 
531
- let mode = target.getAttribute("data-mode")
532
- if (mode === "refresh") {
533
- targetFrame.src = target.href
534
- return
563
+
564
+ // Look for the frame
565
+ // 1. if it's hard (".h")
566
+ // look for the url that matches
567
+ // 2. if it's soft (".s")
568
+ // find using the name attribute
569
+ let targetFrame;
570
+ if (target.closest(".h")) {
571
+ let hardFrames = document.querySelectorAll(".browserview iframe[name^=h]")
572
+ let port = new URL(target.href).port
573
+ for(let frame of hardFrames) {
574
+ console.log({ src: frame.src, href: target.href, target: target.target })
575
+ // Types of links in the tab
576
+ if (String(port) === "42000") {
577
+ // 1. running from 42000 => find a frame whose base URL matches the tab's base URL
578
+ // Pinokio links
579
+ let targetPath = new URL(target.href).pathname
580
+ let framePath = new URL(frame.src).pathname
581
+ if (targetPath === framePath) {
582
+ let beforeName = frame.name
583
+ frame.name = target.target
584
+ console.log("SET FRAME", { before: beforeName, after: frame.name, target: target.target })
585
+ targetFrame = frame
586
+ break
587
+ }
588
+ } else {
589
+ // 2. rest => find the frame whose src exactly matches the tab's url
590
+ if (target.href === frame.src) {
591
+ frame.name = target.target
592
+ targetFrame = frame
593
+ break
594
+ }
535
595
  }
596
+ // find the frame whose path matches
597
+ }
598
+ } else if (target.closest(".s")) {
599
+ targetFrame = document.querySelector(`iframe[name='${target.target}']`)
600
+ } else if (target.closest(".n")) {
601
+ targetFrame = document.querySelector(`iframe[name='${target.target}']`)
602
+ }
603
+
604
+
605
+ /*
606
+ // Load the link in the frame
607
+
608
+ 1. if the frame was found:
609
+ - if "refresh": true => refresh
610
+ - otherwise,
611
+ - if the target frame has been already loaded, don't do anything
612
+ - frame: start.json?mode=abc, link: start.json?mode=abc => don't touch
613
+ - link === frame
614
+ - frame: start.json?mode=abc, link: start.json?mode=def => should load
615
+ - link !== frame && !frame.includes(link)
616
+ - frame: start.json?mode=abc, link: start.json => don't touch
617
+ - link !== frame && frame.includes(link)
536
618
 
537
- console.log("# 4")
538
619
 
620
+
621
+ if the link is different
622
+
623
+ - if the target frame has not been loaded, refresh
624
+ 2. if the frame was NOT found => create one
625
+
626
+ */
627
+
628
+ if (targetFrame) {
629
+ targetFrame.classList.remove("hidden")
630
+ let mode = target.getAttribute("data-mode")
631
+ if (mode === "refresh") {
632
+ targetFrame.src = target.href
633
+ } else {
539
634
  if (e) {
540
- console.log("# 5", { src: targetFrame.src, href: target.href, target: target.target })
541
- // triggered with a click
542
- // do not reload iframe if the href and the src is the same
543
635
  if (target.closest(".h")) {
544
- // if (targetFrame.src.includes(target.target)) {
545
- if (targetFrame.src.includes(target.href)) {
546
- // if (targetFrame.src === target.href) {
636
+ if (target.href === targetFrame.src) {
637
+ // same url. don't do anything
547
638
  e.preventDefault()
548
639
  e.stopPropagation()
640
+ } else {
641
+ if (targetFrame.src.includes(target.href)) {
642
+ // different url, but the frame's url contains the tab url => don't touch
643
+ e.preventDefault()
644
+ e.stopPropagation()
645
+ } else {
646
+ // different url, and the frame's url does not contain the tab url => change the src of the frame and load
647
+ targetFrame.src = target.href
648
+ e.preventDefault()
649
+ e.stopPropagation()
650
+ }
549
651
  }
550
652
  } else if (target.closest(".s")) {
653
+ // load unconditionally => .s doesn't change
654
+ e.preventDefault()
655
+ e.stopPropagation()
656
+ } else if (target.closest(".n")) {
657
+ // load unconditionally => .n doesn't change
551
658
  e.preventDefault()
552
659
  e.stopPropagation()
553
660
  }
554
661
  } else {
555
- console.log("# 6")
556
662
  if (force) {
557
663
  console.log("# 7")
558
- // if (targetFrame.src !== target.href) {
559
- targetFrame.src = target.href
560
- // }
664
+ targetFrame.src = target.href
561
665
  }
562
666
  }
563
- } else {
564
- console.log("# 8")
565
- //targetFrame.contentWindow.addEventListener("load", () => {
566
- if (e) {
567
- console.log("# 9")
568
- // coming from a click => don't need to set the src
569
- } else {
570
- console.log("# 10")
571
- // load without click
572
- if (targetFrame.src !== target.href) {
573
- console.log("# 11")
574
- targetFrame.src = target.href
575
- }
576
- }
577
- loaded[target.target] = true
578
- //});
579
667
  }
580
668
  } else {
581
669
  console.log("# 12")
@@ -589,6 +677,84 @@ console.log({ type, index })
589
677
  document.querySelector("main").appendChild(frame)
590
678
  loaded[target.target] = true
591
679
  }
680
+
681
+ // if (targetFrame) {
682
+ // targetFrame.classList.remove("hidden")
683
+ //
684
+ // // if the iframe already exists, do not
685
+ // if (loaded[target.target]){
686
+ //
687
+ // // Force refresh option
688
+ // //
689
+ // // menu := [{
690
+ // // text,
691
+ // // icon,
692
+ // // mode: "refresh" => refresh regardless of any condition
693
+ // // }]
694
+ // let mode = target.getAttribute("data-mode")
695
+ // if (mode === "refresh") {
696
+ // targetFrame.src = target.href
697
+ // } else {
698
+ // console.log("# 4")
699
+ // if (e) {
700
+ // // if triggered by a click event,
701
+ // // 1. if it's a hard link (".h")
702
+ // // - ignore if the pathname is the same
703
+ // // - reload if
704
+ // console.log("# 5", { src: targetFrame.src, href: target.href, target: target.target })
705
+ // // triggered with a click
706
+ // // do not reload iframe if the href and the src is the same
707
+ // if (target.closest(".h")) {
708
+ // // if (targetFrame.src.includes(target.target)) {
709
+ // if (targetFrame.src.includes(target.href)) {
710
+ // // if (targetFrame.src === target.href) {
711
+ // e.preventDefault()
712
+ // e.stopPropagation()
713
+ // }
714
+ // } else if (target.closest(".s")) {
715
+ // e.preventDefault()
716
+ // e.stopPropagation()
717
+ // }
718
+ // } else {
719
+ // // if not triggered by event
720
+ // // refresh ONLY if programmatically forced refresh
721
+ // console.log("# 6")
722
+ // if (force) {
723
+ // console.log("# 7")
724
+ // targetFrame.src = target.href
725
+ // }
726
+ // }
727
+ // }
728
+ //
729
+ // } else {
730
+ // console.log("# 8")
731
+ // //targetFrame.contentWindow.addEventListener("load", () => {
732
+ // if (e) {
733
+ // console.log("# 9")
734
+ // // coming from a click => don't need to set the src
735
+ // } else {
736
+ // console.log("# 10")
737
+ // // load without click
738
+ // if (targetFrame.src !== target.href) {
739
+ // console.log("# 11")
740
+ // targetFrame.src = target.href
741
+ // }
742
+ // }
743
+ // loaded[target.target] = true
744
+ // //});
745
+ // }
746
+ // } else {
747
+ // console.log("# 12")
748
+ // let frame = document.createElement("iframe")
749
+ // frame.name = target.target
750
+ // frame.src = target.href
751
+ // frame.setAttribute(
752
+ // "allow",
753
+ // "clipboard-read *; clipboard-write *; accelerometer *; ambient-light-sensor *; autoplay *; battery *; camera *; display-capture *; gamepad *; geolocation *; gyroscope *; hid *; identity-credentials-get *; microphone *; midi *; otp-credentials *; serial *;"
754
+ // )
755
+ // document.querySelector("main").appendChild(frame)
756
+ // loaded[target.target] = true
757
+ // }
592
758
  } else {
593
759
  console.log("# 13")
594
760
  // couldn't find item,
@@ -598,7 +764,7 @@ console.log({ type, index })
598
764
  }
599
765
  } else {
600
766
  console.log("# 14")
601
- document.querySelector(".bar").classList.add("hidden")
767
+ // document.querySelector(".bar").classList.add("hidden")
602
768
  }
603
769
  }
604
770
  console.log("loaded before", loaded)
@@ -673,7 +839,6 @@ const syncTabs = async () => {
673
839
  })
674
840
  }
675
841
  const addTab = async (url) => {
676
- debugger
677
842
  let item = document.createElement("a")
678
843
  //let id = "ts" + Date.now()
679
844
  let index = document.querySelectorAll("aside .s .frame-link").length
@@ -717,6 +882,47 @@ document.querySelector(".app-info").addEventListener("click", async (e) => {
717
882
  renderSelection()
718
883
 
719
884
  })
885
+ document.querySelector("#delete").addEventListener("click", async (e) => {
886
+ e.preventDefault()
887
+ e.stopPropagation()
888
+ const confirmed = confirm("Are you sure you wish to delete the app?")
889
+ if (confirmed) {
890
+
891
+
892
+
893
+ let name = document.querySelector("#delete").getAttribute("data-name")
894
+ console.log("delete", name)
895
+ Swal.fire({
896
+ html: '<i class="fa-solid fa-circle-notch fa-spin"></i> Deleting',
897
+ customClass: {
898
+ container: "loader-container",
899
+ popup: "loader-popup",
900
+ htmlContainer: "loader-dialog",
901
+ footer: "hidden",
902
+ actions: "hidden"
903
+ }
904
+ });
905
+ let res = await fetch("/pinokio/delete", {
906
+ method: "post",
907
+ headers: {
908
+ "Content-Type": "application/json"
909
+ },
910
+ body: JSON.stringify({ name })
911
+ }).then((res) => {
912
+ return res.json()
913
+ })
914
+ console.log("res", res)
915
+ Swal.close()
916
+ if (res) {
917
+ if (res.success) {
918
+ location.href = "/"
919
+ } else if (res.error) {
920
+ alert(res.error)
921
+ }
922
+ }
923
+ } else {
924
+ }
925
+ })
720
926
  document.querySelector("aside").addEventListener("click", async (e) => {
721
927
  let target
722
928
 
@@ -773,6 +979,9 @@ document.querySelector("aside").addEventListener("click", async (e) => {
773
979
  //location.hash = target.getAttribute("href")
774
980
  let index = target.getAttribute("data-index")
775
981
  let type = target.closest(".m").getAttribute("data-type")
982
+
983
+ console.log({ type, index })
984
+
776
985
  location.hash = type + index
777
986
 
778
987
  document.querySelectorAll(".frame-link").forEach((el) => {
@@ -812,6 +1021,27 @@ const refresh = async () => {
812
1021
  console.log("refresh", html)
813
1022
  */
814
1023
  document.querySelector(".menu").innerHTML = html
1024
+
1025
+
1026
+ // update the frames so the name matches the tab links
1027
+
1028
+ // 1. iterate through all the "h" menu items
1029
+ // 2. for each tab that starts with "h" (hard), iterate through all iframes
1030
+ // 3. to find a frame whose src.includes(item.href)
1031
+ // 4. update the frame's name to the target attribute
1032
+
1033
+ // let hardFrames = document.querySelectorAll(".browserview iframe[name^=h]")
1034
+ // for(let frame of hardFrames) {
1035
+ // frame.removeAttribute("name")
1036
+ // location.hash = ""
1037
+ // }
1038
+ location.hash = ""
1039
+
1040
+
1041
+
1042
+
1043
+ //
1044
+
815
1045
  renderSelection()
816
1046
  // cursorIndex = 0
817
1047
  //renderCursor()
@@ -517,7 +517,8 @@ document.addEventListener("DOMContentLoaded", async () => {
517
517
  //theme: xtermTheme.Github,
518
518
 
519
519
  //theme: xtermTheme.Cobalt_Neon, // top legibility
520
- theme: xtermTheme.Duotone_Dark,
520
+ //theme: xtermTheme.Duotone_Dark,
521
+ theme: xtermTheme.FrontEndDelight,
521
522
  //theme: xtermTheme.Seafoam_Pastel,
522
523
  //theme: xtermTheme.IC_Green_PPL,
523
524
  //theme: xtermTheme.FunForrest,
@@ -508,7 +508,10 @@ document.addEventListener("DOMContentLoaded", async () => {
508
508
  //theme: xtermTheme.Github,
509
509
 
510
510
  //theme: xtermTheme.Cobalt_Neon, // top legibility
511
- theme: xtermTheme.Duotone_Dark,
511
+ //theme: xtermTheme.Duotone_Dark,
512
+ //theme: xtermTheme.Batman,
513
+ //theme: xtermTheme.Brogrammer,
514
+ theme: xtermTheme.FrontEndDelight,
512
515
  //theme: xtermTheme.Seafoam_Pastel,
513
516
  //theme: xtermTheme.IC_Green_PPL,
514
517
  //theme: xtermTheme.FunForrest,
@@ -128,7 +128,8 @@ const createTerm = () => {
128
128
  //theme: xtermTheme.Github,
129
129
 
130
130
  //theme: xtermTheme.Cobalt_Neon, // top legibility
131
- theme: xtermTheme.Duotone_Dark,
131
+ //theme: xtermTheme.Duotone_Dark,
132
+ theme: xtermTheme.FrontEndDelight,
132
133
  //theme: xtermTheme.Seafoam_Pastel,
133
134
  //theme: xtermTheme.IC_Green_PPL,
134
135
  //theme: xtermTheme.FunForrest,
@@ -87,9 +87,7 @@ body.dark .item select {
87
87
  padding: 10px;
88
88
  flex-grow: 1;
89
89
  border: none;
90
- /*
91
90
  background: rgba(0,0,0,0.05);
92
- */
93
91
  width: 100%;
94
92
  }
95
93
  .item select {