pinokiod 2.15.29 → 2.15.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pinokiod",
3
- "version": "2.15.29",
3
+ "version": "2.15.31",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/server/index.js CHANGED
@@ -305,14 +305,8 @@ class Server {
305
305
  }
306
306
  const env = await this.kernel.env("api/" + name)
307
307
 
308
- //let d2 = await Util.du(this.kernel.homedir)
309
-
310
- //console.log("d2",d2)
311
-
312
308
  //res.render("browser", {
313
309
  res.render("browser-experimental", {
314
- // d1,
315
- // d2,
316
310
  env,
317
311
  mode,
318
312
  port: this.port,
@@ -2597,10 +2591,7 @@ class Server {
2597
2591
  }))
2598
2592
  this.app.get("/du/:name", ex(async (req, res) => {
2599
2593
  let p = this.kernel.path("api", req.params.name)
2600
- console.time("a")
2601
2594
  let d1 = await Util.du(p)
2602
- console.log("d1", d1)
2603
- console.timeEnd("a")
2604
2595
  res.json({ du: d1 })
2605
2596
  }))
2606
2597
  this.app.get("/edit/*", ex(async (req, res) => {
@@ -1498,15 +1498,16 @@ fetch("/du/<%=name%>").then((res) => {
1498
1498
  return res.json()
1499
1499
  }).then((res) => {
1500
1500
  let val
1501
- if (res.du > 1000 * 1000 * 1000) {
1501
+ let k = 1024
1502
+ if (res.du > k * k * k) {
1502
1503
  // GB
1503
- val = `${Math.floor(res.du/1000/1000/1000 * 100) / 100} GB`
1504
- } else if (res.du > 1000 * 1000) {
1504
+ val = `${Math.floor(res.du/k/k/k * 100) / 100} GB`
1505
+ } else if (res.du > k * k) {
1505
1506
  // MB
1506
- val = `${Math.floor(res.du/1000/1000 * 100) / 100} MB`
1507
+ val = `${Math.floor(res.du/k/k * 100) / 100} MB`
1507
1508
  } else {
1508
1509
  // KB
1509
- val = `${Math.floor(res.du/1000 * 100) / 100} KB`
1510
+ val = `${Math.floor(res.du/k * 100) / 100} KB`
1510
1511
  }
1511
1512
  //document.querySelector(".disk-usage").innerHTML = `<i class="fa-regular fa-hard-drive"></i> ${val}`
1512
1513
  document.querySelector(".disk-usage").innerHTML = val