clavarium 0.2.402-next.1 → 0.2.404-next.1

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.
@@ -1121,10 +1121,11 @@ case "$AREA $VERB" in
1121
1121
  fi
1122
1122
  exit 0 ;;
1123
1123
  "vm smount")
1124
- # <vm> <conversation> <work|folder|view> <resource> <uid> <gid>: into the conversation's own place in a
1125
- # shared machine (/srv/clavarium/<conversation>/...), where its door (clavarium-enter) finds it -- only for
1126
- # a conversation that lives in that machine.
1127
- [ $# -eq 6 ] || usage; vm_of "$1"; is_name "$2" || refuse "not a conversation name: $2"; is_name "$4" || refuse "not a folder name: $4"; number "$5"; number "$6"
1124
+ # <vm> <conversation> <work|folder|view> <resource> <uid> <gid> <its uid> <its gid>: into the conversation's
1125
+ # own place in a shared machine (/srv/clavarium/<conversation>/...), where its door (clavarium-enter) finds
1126
+ # it, owned there by ITS user (not the machine's admin) -- only for a conversation that lives in that machine.
1127
+ [ $# -eq 8 ] || usage; vm_of "$1"; is_name "$2" || refuse "not a conversation name: $2"; is_name "$4" || refuse "not a folder name: $4"; number "$5"; number "$6"; number "$7"; number "$8"
1128
+ [ "$7" -ge 1001 ] && [ "$8" -ge 1001 ] || refuse "its own user is not the machine's admin"
1128
1129
  [ -f "$DATA/shared/$1" ] && grep -qx "$2" "$DATA/shared/$1" || refuse "$2 does not live in $1"
1129
1130
  case "$3" in
1130
1131
  work) [ "$4" = "$2" ] || refuse "a work folder belongs to its own conversation"
@@ -1137,7 +1138,7 @@ case "$AREA $VERB" in
1137
1138
  target="$1:/srv/clavarium/$2/resources/$4" ;;
1138
1139
  *) refuse "a shared mount is of a work folder, a folder or a view" ;;
1139
1140
  esac
1140
- run "$MULTIPASS" mount -u "$5:$VM_ID" -g "$6:$VM_ID" "$source" "$target" ;;
1141
+ run "$MULTIPASS" mount -u "$5:$7" -g "$6:$8" "$source" "$target" ;;
1141
1142
  "vm sumount")
1142
1143
  # <vm> <conversation> <work|resource name>: taken out of its place in a shared machine.
1143
1144
  [ $# -eq 3 ] || usage; vm_of "$1"; is_name "$2" || refuse "not a conversation name: $2"; is_name "$3" || refuse "not a name: $3"
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.402-next.1",
3
+ "version": "0.2.404-next.1",
4
4
  "lockfileVersion": 3,
5
5
  "requires": true,
6
6
  "packages": {
7
7
  "": {
8
8
  "name": "clavarium",
9
- "version": "0.2.402-next.1",
9
+ "version": "0.2.404-next.1",
10
10
  "license": "MIT",
11
11
  "dependencies": {
12
12
  "@xterm/addon-fit": "^0.11.0",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clavarium",
3
- "version": "0.2.402-next.1",
3
+ "version": "0.2.404-next.1",
4
4
  "license": "MIT",
5
5
  "type": "module",
6
6
  "description": "A conversation is a VM with a terminal in it. Everything else is a folder.",
@@ -445,7 +445,7 @@ export class Conversations {
445
445
  if (me.code !== 0 || !Number.isInteger(uid) || !Number.isInteger(gid)) return fail('Its own user could not be made', me);
446
446
  this.#store.patch(name, { machineUser: { uid, gid } });
447
447
  const kept = await this.#vms.workMake(name);
448
- const shown = kept.code === 0 ? await this.#vms.workMount(name, uid, gid) : kept;
448
+ const shown = kept.code === 0 ? await this.#vms.workMount(name, this.#uid, this.#gid) : kept;
449
449
  if (shown.code !== 0) return fail('The work folder could not be shown in the shared machine', shown);
450
450
  /* Its tool: there already (another conversation installed it), or installed -- a step as root for the
451
451
  machine, any other as its own user (its settings, in its home). */
package/server/vm.mjs CHANGED
@@ -188,7 +188,7 @@ export class Vms {
188
188
  files written in the VM belong, on the host, to this account. */
189
189
  mount(conversation, kind, name, uid, gid) {
190
190
  /* In a shared machine (#221): into its own place there, where its door finds it. */
191
- if (this.shared(conversation)) { const u = this.#userOf(conversation) ?? { uid, gid }; return this.run(['vm', 'smount', this.vmOf(conversation), conversation, kind, name, String(u.uid), String(u.gid)], { timeoutMs: 600_000 }); }
191
+ if (this.shared(conversation)) { const u = this.#userOf(conversation); if (!u) throw new Error('its own user in the shared machine is not known yet'); return this.run(['vm', 'smount', this.vmOf(conversation), conversation, kind, name, String(uid), String(gid), String(u.uid), String(u.gid)], { timeoutMs: 600_000 }); }
192
192
  return this.run(['vm', 'mount', this.vmOf(conversation), kind, name, String(uid), String(gid)], { timeoutMs: 600_000 });
193
193
  }
194
194
 
@@ -196,7 +196,7 @@ export class Vms {
196
196
  machine at /work. Made (or found again) before it is mounted. */
197
197
  workMake(conversation) { this.vmOf(conversation); return this.run(['work', 'make', conversation]); }
198
198
  workMount(conversation, uid, gid) {
199
- if (this.shared(conversation)) { const u = this.#userOf(conversation) ?? { uid, gid }; return this.run(['vm', 'smount', this.vmOf(conversation), conversation, 'work', conversation, String(u.uid), String(u.gid)], { timeoutMs: 600_000 }); }
199
+ if (this.shared(conversation)) { const u = this.#userOf(conversation); if (!u) throw new Error('its own user in the shared machine is not known yet'); return this.run(['vm', 'smount', this.vmOf(conversation), conversation, 'work', conversation, String(uid), String(gid), String(u.uid), String(u.gid)], { timeoutMs: 600_000 }); }
200
200
  return this.run(['vm', 'mount', this.vmOf(conversation), 'work', conversation, String(uid), String(gid)], { timeoutMs: 600_000 });
201
201
  }
202
202
  workUnmount(conversation) {