pinokiod 3.8.95 → 3.8.97

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/peer.js CHANGED
@@ -39,9 +39,9 @@ class PeerDiscovery {
39
39
  console.log("kernel.peer start")
40
40
  this.socket = dgram.createSocket('udp4');
41
41
  this.socket.on('message', (msg, rinfo) => {
42
- console.log("peer message", { msg, rinfo })
42
+ // console.log("peer message", { msg, rinfo })
43
43
  const ip = rinfo.address;
44
- console.log({rinfo})
44
+ // console.log({rinfo})
45
45
  if (msg.toString() === this.message.toString() && this._isLocalLAN(ip)) {
46
46
  if (!this.peers.has(ip)) {
47
47
  console.log(`Discovered peer: ${ip}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "3.8.95",
3
+ "version": "3.8.97",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -3164,8 +3164,13 @@ class Server {
3164
3164
  }))
3165
3165
  this.app.get("/du/:name", ex(async (req, res) => {
3166
3166
  let p = this.kernel.path("api", req.params.name)
3167
- let d1 = await Util.du(p)
3168
- res.json({ du: d1 })
3167
+ try {
3168
+ let d1 = await Util.du(p)
3169
+ res.json({ du: d1 })
3170
+ } catch (e) {
3171
+ console.log("disk usage error", e)
3172
+ res.json({ du: 0 })
3173
+ }
3169
3174
  }))
3170
3175
  this.app.get("/edit/*", ex(async (req, res) => {
3171
3176
  let pathComponents = req.params[0].split("/")
@@ -1595,22 +1595,24 @@ body.dark .loader-container {
1595
1595
  fetch("/du/<%=name%>").then((res) => {
1596
1596
  return res.json()
1597
1597
  }).then((res) => {
1598
- let val
1599
- //let k = 1024
1600
- let k = 1000
1601
- if (res.du > k * k * k) {
1602
- // GB
1603
- val = `${Math.floor(res.du/k/k/k * 100) / 100} GB`
1604
- } else if (res.du > k * k) {
1605
- // MB
1606
- val = `${Math.floor(res.du/k/k * 100) / 100} MB`
1598
+ if (res.du > 0) {
1599
+ let val
1600
+ //let k = 1024
1601
+ let k = 1000
1602
+ if (res.du > k * k * k) {
1603
+ // GB
1604
+ val = `${Math.floor(res.du/k/k/k * 100) / 100} GB`
1605
+ } else if (res.du > k * k) {
1606
+ // MB
1607
+ val = `${Math.floor(res.du/k/k * 100) / 100} MB`
1608
+ } else {
1609
+ // KB
1610
+ val = `${Math.floor(res.du/k * 100) / 100} KB`
1611
+ }
1612
+ console.log("DU VAL", val)
1613
+ document.querySelector(".disk-usage").innerHTML = val
1607
1614
  } else {
1608
- // KB
1609
- val = `${Math.floor(res.du/k * 100) / 100} KB`
1610
1615
  }
1611
- console.log("DU VAL", val)
1612
- //document.querySelector(".disk-usage").innerHTML = `<i class="fa-regular fa-hard-drive"></i> ${val}`
1613
- document.querySelector(".disk-usage").innerHTML = val
1614
1616
  })
1615
1617
  }
1616
1618
  const refresh = async (silent, options) => {