nano-pow 4.0.1 → 4.0.2

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.
Files changed (2) hide show
  1. package/dist/bin/server.js +13 -11
  2. package/package.json +1 -1
@@ -87,23 +87,25 @@ async function work_validate(res, json) {
87
87
  page.on("console", (msg) => {
88
88
  log(msg.text());
89
89
  });
90
- await fs.writeFile(`${import.meta.dirname}/server.html`, "");
90
+ const path = new URL(import.meta.url).pathname;
91
+ const dir = path.slice(0, path.lastIndexOf("/"));
92
+ await fs.writeFile(`${dir}/server.html`, "");
91
93
  await page.goto(import.meta.resolve("./server.html"));
92
94
  await page.waitForFunction(async () => {
93
95
  return await navigator.gpu.requestAdapter();
94
96
  });
95
- const inject = `${NanoPow};window.NanoPow=NanoPow;`;
97
+ const inject = `${NanoPow}; window.NanoPow = NanoPow; `;
96
98
  const hash = await crypto.subtle.digest("SHA-256", Buffer.from(inject, "utf-8"));
97
- const src = `sha256-${Buffer.from(hash).toString("base64")}`;
99
+ const src = `sha256 - ${Buffer.from(hash).toString("base64")} `;
98
100
  await page.setContent(`
99
- <!DOCTYPE html>
100
- <head>
101
- <meta http-equiv="Content-Security-Policy" content="default-src 'none'; base-uri 'none'; form-action 'none'; script-src '${src}';">
102
- <script type="module">${inject}</script>
103
- </head>
104
- </html>
105
- `);
106
- await fs.unlink(`${import.meta.dirname}/server.html`);
101
+ < !DOCTYPE html >
102
+ <head>
103
+ <meta http - equiv="Content-Security-Policy" content = "default-src 'none'; base-uri 'none'; form-action 'none'; script-src '${src}';" >
104
+ <script type="module" > ${inject} </script>
105
+ </head>
106
+ </html>
107
+ `);
108
+ await fs.unlink(`${dir}/server.html`);
107
109
  log("Puppeteer initialized");
108
110
  const server = http.createServer(async (req, res) => {
109
111
  let data = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "nano-pow",
3
- "version": "4.0.1",
3
+ "version": "4.0.2",
4
4
  "description": "Proof-of-work generation and validation with WebGPU/WebGL for Nano cryptocurrency.",
5
5
  "keywords": [
6
6
  "nemo",