pinokiod 3.109.0 → 3.111.0

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.
@@ -51,7 +51,6 @@ class Caddy {
51
51
  console.log("kill existing caddy before restarting")
52
52
  await new Promise((resolve, reject) => {
53
53
  let interval = setInterval(() => {
54
- console.log("CADDY_PID", this.kernel.processes.caddy_pid)
55
54
  if (this.kernel.processes.caddy_pid) {
56
55
  try {
57
56
  console.log("kill caddy", this.kernel.processes.caddy_pid)
@@ -60,12 +59,10 @@ class Caddy {
60
59
  clearInterval(interval)
61
60
  resolve()
62
61
  } catch (error) {
63
- console.log("ERROR", error)
64
62
  clearInterval(interval)
65
63
  reject(error)
66
64
  }
67
65
  } else {
68
- //clearInterval(interval)
69
66
  console.log("try killing existing caddy again in 1 sec")
70
67
  }
71
68
  }, 1000)
@@ -99,7 +96,6 @@ class Caddy {
99
96
  this.kernel.peer.announce()
100
97
  console.log("announced to peers")
101
98
  // this.kernel.refresh(true)
102
- } else {
103
99
  }
104
100
  }
105
101
  async install(req, ondata, kernel, id) {
package/kernel/peer.js CHANGED
@@ -249,7 +249,7 @@ class PeerDiscovery {
249
249
  async router_info() {
250
250
  try {
251
251
  let processes = []
252
- if (this.info[this.host]) {
252
+ if (this.info && this.info[this.host]) {
253
253
  let procs = this.info[this.host].proc
254
254
  let router = this.info[this.host].router
255
255
  let port_mapping = this.info[this.host].port_mapping
@@ -406,6 +406,7 @@ class PeerDiscovery {
406
406
  }
407
407
  return {
408
408
  active: this.active,
409
+ https_active: this.https_active,
409
410
  version: this.kernel.version,
410
411
  home: this.kernel.homedir,
411
412
  arch: this.kernel.arch,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.109.0",
3
+ "version": "3.111.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -890,6 +890,33 @@ body.dark .tab-link-popover .tab-link-popover-item .value {
890
890
  body.dark .tab-link-popover .tab-link-popover-item .value .muted {
891
891
  color: rgba(226, 232, 240, 0.65);
892
892
  }
893
+ .tab-link-popover .tab-link-popover-footer {
894
+ border-top: 1px solid rgba(15, 23, 42, 0.08);
895
+ margin-top: 4px;
896
+ padding-top: 12px;
897
+ background: rgba(59, 130, 246, 0.12);
898
+ color: #1d4ed8;
899
+ }
900
+ .tab-link-popover .tab-link-popover-footer .label,
901
+ .tab-link-popover .tab-link-popover-footer .value {
902
+ color: inherit;
903
+ }
904
+ .tab-link-popover .tab-link-popover-footer .value {
905
+ font-weight: 600;
906
+ }
907
+ .tab-link-popover .tab-link-popover-footer:hover,
908
+ .tab-link-popover .tab-link-popover-footer:focus-visible {
909
+ background: rgba(37, 99, 235, 0.2);
910
+ }
911
+ body.dark .tab-link-popover .tab-link-popover-footer {
912
+ border-top-color: rgba(148, 163, 184, 0.2);
913
+ background: rgba(96, 165, 250, 0.22);
914
+ color: #bfdbfe;
915
+ }
916
+ body.dark .tab-link-popover .tab-link-popover-footer:hover,
917
+ body.dark .tab-link-popover .tab-link-popover-footer:focus-visible {
918
+ background: rgba(147, 197, 253, 0.35);
919
+ }
893
920
  .tab.has-preview .tab-preview {
894
921
  color: rgba(0, 0, 0, 0.6);
895
922
  min-width: 0;
@@ -3088,6 +3115,7 @@ body.dark {
3088
3115
  let tabLinkLocalInfoExpiry = 0
3089
3116
  let tabLinkRouterInfoPromise = null
3090
3117
  let tabLinkRouterInfoExpiry = 0
3118
+ let tabLinkRouterHttpsActive = null
3091
3119
 
3092
3120
  const ensureTabLinkPopoverEl = () => {
3093
3121
  if (!tabLinkPopoverEl) {
@@ -3112,7 +3140,12 @@ body.dark {
3112
3140
  event.stopPropagation()
3113
3141
  const url = item.getAttribute("data-url")
3114
3142
  if (url) {
3115
- window.open(url, "_blank", "noopener")
3143
+ const targetMode = (item.getAttribute("data-target") || "_blank").toLowerCase()
3144
+ if (targetMode === "_self") {
3145
+ window.location.assign(url)
3146
+ } else {
3147
+ window.open(url, "_blank", "noopener")
3148
+ }
3116
3149
  }
3117
3150
  hideTabLinkPopover({ immediate: true })
3118
3151
  })
@@ -3429,6 +3462,9 @@ body.dark {
3429
3462
  return response.json()
3430
3463
  })
3431
3464
  .then((data) => {
3465
+ if (typeof data?.https_active === "boolean") {
3466
+ tabLinkRouterHttpsActive = data.https_active
3467
+ }
3432
3468
  const processes = Array.isArray(data?.router_info) ? data.router_info : []
3433
3469
  const rewriteMapping = data?.rewrite_mapping && typeof data.rewrite_mapping === "object"
3434
3470
  ? Object.values(data.rewrite_mapping)
@@ -3662,10 +3698,13 @@ body.dark {
3662
3698
  hostPortMap
3663
3699
  }
3664
3700
  })
3665
- .catch(() => ({
3666
- portMap: new Map(),
3667
- hostPortMap: new Map()
3668
- }))
3701
+ .catch(() => {
3702
+ tabLinkRouterHttpsActive = null
3703
+ return {
3704
+ portMap: new Map(),
3705
+ hostPortMap: new Map()
3706
+ }
3707
+ })
3669
3708
  tabLinkRouterInfoExpiry = now + 3000
3670
3709
  }
3671
3710
  return tabLinkRouterInfoPromise
@@ -4025,6 +4064,8 @@ body.dark {
4025
4064
  header.innerHTML = `<i class="fa-solid fa-arrow-up-right-from-square"></i><span>Open in browser</span>`
4026
4065
  popover.appendChild(header)
4027
4066
 
4067
+ const hasHttpsEntry = entries.some((entry) => entry && entry.type === "https")
4068
+
4028
4069
  entries.forEach((entry) => {
4029
4070
  const item = document.createElement("button")
4030
4071
  item.type = "button"
@@ -4040,6 +4081,26 @@ body.dark {
4040
4081
  popover.appendChild(item)
4041
4082
  })
4042
4083
 
4084
+ if (tabLinkRouterHttpsActive === false && !hasHttpsEntry) {
4085
+ const footerButton = document.createElement("button")
4086
+ footerButton.type = "button"
4087
+ footerButton.className = "tab-link-popover-item tab-link-popover-footer"
4088
+ footerButton.setAttribute("data-url", "/network")
4089
+ footerButton.setAttribute("data-target", "_self")
4090
+ footerButton.setAttribute("aria-label", "Open network settings to configure local HTTPS")
4091
+
4092
+ const footerLabel = document.createElement("span")
4093
+ footerLabel.className = "label"
4094
+ footerLabel.textContent = "Custom domain not active"
4095
+
4096
+ const footerValue = document.createElement("span")
4097
+ footerValue.className = "value"
4098
+ footerValue.textContent = "Click to activate"
4099
+
4100
+ footerButton.append(footerLabel, footerValue)
4101
+ popover.appendChild(footerButton)
4102
+ }
4103
+
4043
4104
  tabLinkActiveLink = link
4044
4105
  tabLinkPendingLink = null
4045
4106
  positionTabLinkPopover(popover, link)
@@ -4951,6 +5012,13 @@ body.dark {
4951
5012
 
4952
5013
  let target = explicitTarget
4953
5014
  let preselected = null
5015
+ let defaultSelectionNode = null
5016
+ const getDefaultSelection = () => {
5017
+ if (defaultSelectionNode === null) {
5018
+ defaultSelectionNode = document.querySelector('[data-default]')
5019
+ }
5020
+ return defaultSelectionNode
5021
+ }
4954
5022
 
4955
5023
  if (!target && eventParam) {
4956
5024
  target = eventParam.target?.closest(".frame-link") || null
@@ -4992,13 +5060,18 @@ body.dark {
4992
5060
 
4993
5061
  const devTab = document.querySelector('#devtab.frame-link')
4994
5062
  if (!triggeredByUser && !resolvedByGlobalSelector && !target && devRouteActive && devTab) {
4995
- target = devTab
4996
- } else if (!target && preselected) {
5063
+ const defaultCandidate = getDefaultSelection()
5064
+ if (!(pluginLaunchActive && defaultCandidate)) {
5065
+ target = devTab
5066
+ }
5067
+ }
5068
+
5069
+ if (!target && preselected) {
4997
5070
  target = preselected
4998
5071
  }
4999
5072
 
5000
5073
  if (!target) {
5001
- const defaultSelection = document.querySelector("[data-default]")
5074
+ const defaultSelection = getDefaultSelection()
5002
5075
  if (defaultSelection) {
5003
5076
  target = defaultSelection
5004
5077
  } else if (skipPersistedSelection) {
@@ -5009,7 +5082,7 @@ body.dark {
5009
5082
 
5010
5083
  <% if (type === "run" && env.PINOKIO_SCRIPT_DEFAULT && env.PINOKIO_SCRIPT_DEFAULT.toString().toLowerCase() === "true") { %>
5011
5084
  if (!target && !hasPersistedSelection) {
5012
- const defaultSelection = document.querySelector("[data-default]")
5085
+ const defaultSelection = getDefaultSelection()
5013
5086
  if (defaultSelection && defaultSelection.href) {
5014
5087
  const selectionProtocol = new URL(defaultSelection.href).protocol
5015
5088
  const pageProtocol = new URL(location.href).protocol