@decentnetwork/beagle 0.1.83 → 0.1.85

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.
@@ -1,4 +1,4 @@
1
- window.__DK_UI_VERSION="0.1.82";
1
+ window.__DK_UI_VERSION="0.1.84";
2
2
  "use strict";
3
3
  (() => {
4
4
  // packages/beagle-ui/dist/beagle-ui.js
package/dist/server.js CHANGED
@@ -366,7 +366,12 @@ async function globalNpmWritable() {
366
366
  return { ok: true }; // nothing installed there yet
367
367
  const { access } = await import("node:fs/promises");
368
368
  const { constants } = await import("node:fs");
369
+ // BOTH, and both as directories. npm rewrites the package directory and
370
+ // re-links the binaries, and either one being unwritable stops the update.
371
+ // Checking only the scope reported "you can update" on a machine that then
372
+ // failed on the bin links.
369
373
  await access(scope, constants.W_OK);
374
+ await access(join(prefix, "bin"), constants.W_OK);
370
375
  return { ok: true };
371
376
  }
372
377
  catch {
@@ -388,10 +393,17 @@ async function globalNpmOwnershipHint(pkg) {
388
393
  return `no write access to the global npm dir. \`sudo npm i -g ${pkg}@latest\` would work but leaves it root-owned, so the next update fails the same way — fix the ownership once instead.`;
389
394
  }
390
395
  const scope = join(prefix, "lib", "node_modules", "@decentnetwork");
391
- const bins = [join(prefix, "bin", "agentnet"), join(prefix, "bin", "beagle")].join(" ");
396
+ const bin = join(prefix, "bin");
397
+ // Both DIRECTORIES, not the files inside them. Replacing a package directory
398
+ // or a bin symlink is a rename, and rename needs write permission on the
399
+ // CONTAINING directory — naming the symlinks themselves does nothing when
400
+ // their parent is root-owned. An earlier version of this hint listed
401
+ // bin/agentnet and bin/beagle and left people exactly as stuck, one error
402
+ // further along: the scope chown succeeded and npm then failed on the bin
403
+ // links instead.
392
404
  return (`no write access to ${scope}. This is what a first install with sudo leaves behind, and ` +
393
405
  `\`sudo npm i -g\` would rebuild it — run this ONCE and updates never need sudo again: ` +
394
- `sudo chown -R $(id -u):$(id -g) ${scope} ${bins}`);
406
+ `sudo chown -R $(id -u):$(id -g) ${scope} && sudo chgrp -R admin ${bin} && sudo chmod -R g+w ${bin}`);
395
407
  }
396
408
  /** `npm prefix -g`, or undefined if npm cannot be reached. */
397
409
  async function npmGlobalPrefix() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@decentnetwork/beagle",
3
- "version": "0.1.83",
3
+ "version": "0.1.85",
4
4
  "description": "Beagle — P2P chat, file transfer and calls for regular users, on the Decent Network. No admin privilege required.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -27,7 +27,7 @@
27
27
  "dependencies": {
28
28
  "@decentnetwork/chat-components": "^0.1.3",
29
29
  "@decentnetwork/lan": "^0.1.283",
30
- "@decentnetwork/peer": "^0.1.163",
30
+ "@decentnetwork/peer": "^0.1.164",
31
31
  "@decentnetwork/peer-webrtc": "^0.2.16",
32
32
  "js-yaml": "^4.1.0",
33
33
  "ws": "^8.21.1",