odant-work 1.0.110 → 1.0.111

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.
@@ -64,7 +64,7 @@ export async function computerAccess(req, rawName, ownerOverride) {
64
64
  throw Object.assign(new Error('чужой компьютер — нужен ADMIN'), { http: 403 });
65
65
  const docker = await getDocker();
66
66
  let found = await findComputer(docker, owner, name);
67
- if (!found && DEV_MODE && !ownerOverride)
67
+ if (!found && DEV_MODE)
68
68
  found = await findComputer(docker, undefined, name);
69
69
  if (!found)
70
70
  throw Object.assign(new Error('компьютера «' + name + '» нет — он создастся при первой команде агента'), { http: 404 });
@@ -176,8 +176,9 @@ export async function handleComputerHttp(req, res, url, readBody) {
176
176
  return true;
177
177
  }
178
178
  // пассивный статус компьютера (не запускает!)
179
- if (/^\/~computer\/([^/]+)\/status$/.test(pathname) && req.method === 'GET') {
180
- const name = pathname.split('/')[3];
179
+ const statusMatch = pathname.match(/^\/~computer\/([^/]+)\/status$/);
180
+ if (statusMatch && req.method === 'GET') {
181
+ const name = statusMatch[1];
181
182
  try {
182
183
  const acc = await computerAccess(req, name, url.searchParams.get('owner') || '');
183
184
  const st = await statusOf(acc.docker, acc.id).catch(() => null);