cctether 0.6.0 → 0.6.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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/evalfile.js +7 -9
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cctether",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Let Claude Code use your browser over your own connection — no third-party relay.",
5
5
  "keywords": [
6
6
  "claude-code",
package/src/evalfile.js CHANGED
@@ -3,10 +3,10 @@
3
3
  // scripts Claude wrote there for the browser, so `file` can't be used to push other files on this
4
4
  // computer (keys, configs, files Claude Code's own permissions keep it from reading) into a page.
5
5
 
6
- import { mkdirSync, chmodSync, lstatSync, constants } from 'node:fs';
6
+ import { mkdirSync, constants } from 'node:fs';
7
7
  import { open, realpath, lstat } from 'node:fs/promises';
8
8
  import { homedir } from 'node:os';
9
- import { isAbsolute, join, relative, resolve, sep } from 'node:path';
9
+ import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
10
10
 
11
11
  export const FILE_MAX_BYTES = 200 * 1024;
12
12
  export const FILE_MAX_CHARS = 200_000; // the same limit as `expression`
@@ -24,13 +24,11 @@ export const scriptsDir = (configDir) => join(configDir, 'scripts');
24
24
  */
25
25
  export function ensureScriptsDir(dir) {
26
26
  try {
27
- lstatSync(dir);
28
- return;
29
- } catch { /* not there */ }
30
- try {
31
- mkdirSync(dir, { recursive: true, mode: 0o700 });
32
- chmodSync(dir, 0o700); // whatever the umask
33
- } catch { /* reported when a file is read from it */ }
27
+ mkdirSync(dirname(dir), { recursive: true, mode: 0o700 });
28
+ // Not recursive: if anything (a link put there meanwhile) is in the way, EEXIST, and it is
29
+ // left alone. No chmod by path, which would follow such a link; the umask only takes bits away.
30
+ mkdirSync(dir, { mode: 0o700 });
31
+ } catch { /* there already, or reported when a file is read from it */ }
34
32
  }
35
33
 
36
34
  /** Is dir itself (not a link to one) a directory of this user that nobody else can use? */