clay-server 2.33.0 → 2.33.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.
@@ -25,6 +25,7 @@ function attachSettings(ctx) {
25
25
  profile.username = mu.username;
26
26
  profile.userId = mu.id;
27
27
  profile.role = mu.role;
28
+ profile.pinEnabled = !!mu.pinHash;
28
29
  profile.autoContinueOnRateLimit = !!mu.autoContinueOnRateLimit;
29
30
  profile.chatLayout = mu.chatLayout || "channel";
30
31
  profile.mateOnboardingShown = !!mu.mateOnboardingShown;
@@ -329,6 +330,18 @@ function attachSettings(ctx) {
329
330
  res.end('{"error":"PIN must be exactly 6 digits"}');
330
331
  return;
331
332
  }
333
+ if (mu.pinHash) {
334
+ if (!data.currentPin || typeof data.currentPin !== "string" || !/^\d{6}$/.test(data.currentPin)) {
335
+ res.writeHead(400, { "Content-Type": "application/json" });
336
+ res.end('{"error":"Current PIN is required"}');
337
+ return;
338
+ }
339
+ if (mu.pinHash !== users.hashPin(data.currentPin)) {
340
+ res.writeHead(400, { "Content-Type": "application/json" });
341
+ res.end('{"error":"Current PIN is incorrect"}');
342
+ return;
343
+ }
344
+ }
332
345
  var result = users.updateUserPin(mu.id, data.newPin);
333
346
  if (result.error) {
334
347
  res.writeHead(400, { "Content-Type": "application/json" });
@@ -15,8 +15,8 @@ var { createRequire } = require("module");
15
15
  var PLATFORM_PACKAGE_BY_TARGET = {
16
16
  "aarch64-apple-darwin": "@openai/codex-darwin-arm64",
17
17
  "x86_64-apple-darwin": "@openai/codex-darwin-x64",
18
- "aarch64-unknown-linux-gnu": "@openai/codex-linux-arm64",
19
- "x86_64-unknown-linux-gnu": "@openai/codex-linux-x64",
18
+ "aarch64-unknown-linux-musl": "@openai/codex-linux-arm64",
19
+ "x86_64-unknown-linux-musl": "@openai/codex-linux-x64",
20
20
  "x86_64-pc-windows-msvc": "@openai/codex-win32-x64",
21
21
  };
22
22
 
@@ -27,7 +27,7 @@ function getTargetTriple() {
27
27
  return arch === "arm64" ? "aarch64-apple-darwin" : "x86_64-apple-darwin";
28
28
  }
29
29
  if (platform === "linux") {
30
- return arch === "arm64" ? "aarch64-unknown-linux-gnu" : "x86_64-unknown-linux-gnu";
30
+ return arch === "arm64" ? "aarch64-unknown-linux-musl" : "x86_64-unknown-linux-musl";
31
31
  }
32
32
  if (platform === "win32") {
33
33
  return "x86_64-pc-windows-msvc";
package/lib/yoke/index.js CHANGED
@@ -66,27 +66,88 @@ function createAdapter(opts) {
66
66
  * Call invalidateAuthCache() to force re-check (e.g. after login).
67
67
  */
68
68
  var _authCache = null;
69
+ var _lastAuthLogKey = null;
70
+ var _lastAuthLogAt = 0;
71
+
72
+ function logAuthCheck(auth) {
73
+ var key = JSON.stringify(auth || {});
74
+ var now = Date.now();
75
+ if (_lastAuthLogKey === key && now - _lastAuthLogAt < 30000) return;
76
+ _lastAuthLogKey = key;
77
+ _lastAuthLogAt = now;
78
+ console.log("[yoke] Auth check: claude=" + auth.claude + " codex=" + auth.codex);
79
+ }
69
80
 
70
81
  function checkAuth() {
71
82
  if (_authCache) return _authCache;
72
83
 
73
84
  var execSync = require("child_process").execSync;
74
85
 
86
+ function parseClaudeAuthStatusJson(out) {
87
+ if (!out) return null;
88
+ try {
89
+ return JSON.parse(out);
90
+ } catch (e) {
91
+ return null;
92
+ }
93
+ }
94
+
95
+ function isClaudeLoggedInText(out) {
96
+ if (!out) return false;
97
+ var text = String(out).toLowerCase();
98
+ if (text.indexOf("not logged in") !== -1) return false;
99
+ if (text.indexOf("login method:") !== -1) return true;
100
+ if (text.indexOf("logged in") !== -1) return true;
101
+ return false;
102
+ }
103
+
75
104
  function checkClaude() {
76
105
  try {
77
- var out = execSync("claude auth status", { timeout: 5000, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] });
78
- var parsed = JSON.parse(out);
79
- return !!(parsed && parsed.loggedIn);
106
+ var out = execSync("claude auth status --json", { timeout: 5000, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] });
107
+ var parsed = parseClaudeAuthStatusJson(out);
108
+ if (parsed) return !!parsed.loggedIn;
109
+ console.warn("[yoke] Claude auth status JSON parse failed; falling back to text output");
110
+ } catch (e) {
111
+ var stdout = e && e.stdout ? String(e.stdout) : "";
112
+ if (stdout) {
113
+ var parsedFallback = parseClaudeAuthStatusJson(stdout);
114
+ if (parsedFallback) return !!parsedFallback.loggedIn;
115
+ }
116
+ console.warn("[yoke] Claude auth status JSON check failed; falling back to text output:", e.message);
117
+ }
118
+
119
+ try {
120
+ var textOut = execSync("claude auth status --text", { timeout: 5000, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] });
121
+ return isClaudeLoggedInText(textOut);
80
122
  } catch (e) {
81
123
  return false;
82
124
  }
83
125
  }
84
126
 
85
- function checkCodex() {
127
+ function resolveCodexBinary() {
128
+ var fs = require("fs");
129
+ var findCodexPath = require("./codex-app-server").findCodexPath;
130
+ var pathProbeCmd = process.platform === "win32" ? "where codex" : "which codex";
131
+
86
132
  try {
87
- var findCodexPath = require("./codex-app-server").findCodexPath;
88
133
  var codexBin = findCodexPath();
89
- execSync(codexBin + " login status", { timeout: 5000, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] });
134
+ if (codexBin && fs.existsSync(codexBin)) return codexBin;
135
+ } catch (e) {}
136
+
137
+ try {
138
+ var whichOut = execSync(pathProbeCmd, { timeout: 3000, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] });
139
+ var codexPath = whichOut.trim().split(/\r?\n/)[0];
140
+ if (codexPath) return codexPath;
141
+ } catch (e) {}
142
+
143
+ return null;
144
+ }
145
+
146
+ function checkCodex() {
147
+ try {
148
+ var codexBin = resolveCodexBinary();
149
+ if (!codexBin) return false;
150
+ execSync('"' + codexBin + '" login status', { timeout: 5000, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] });
90
151
  return true;
91
152
  } catch (e) {
92
153
  return false;
@@ -94,7 +155,7 @@ function checkAuth() {
94
155
  }
95
156
 
96
157
  _authCache = { claude: checkClaude(), codex: checkCodex(), gemini: false };
97
- console.log("[yoke] Auth check: claude=" + _authCache.claude + " codex=" + _authCache.codex);
158
+ logAuthCheck(_authCache);
98
159
  return _authCache;
99
160
  }
100
161
 
@@ -103,7 +164,6 @@ function checkAuth() {
103
164
  */
104
165
  function checkInstalled() {
105
166
  var fs = require("fs");
106
- var path = require("path");
107
167
  var execSync = require("child_process").execSync;
108
168
  var result = { claude: false, codex: false };
109
169
  try {
@@ -111,9 +171,19 @@ function checkInstalled() {
111
171
  result.claude = true;
112
172
  } catch (e) {}
113
173
  try {
114
- var findCodexPath = require("./codex-app-server").findCodexPath;
115
- var codexBin = findCodexPath();
116
- if (fs.existsSync(codexBin)) result.codex = true;
174
+ var codexBin = null;
175
+ try {
176
+ var findCodexPath = require("./codex-app-server").findCodexPath;
177
+ codexBin = findCodexPath();
178
+ if (codexBin && fs.existsSync(codexBin)) {
179
+ result.codex = true;
180
+ return result;
181
+ }
182
+ } catch (e) {}
183
+
184
+ var pathProbeCmd = process.platform === "win32" ? "where codex" : "which codex";
185
+ var whichOut = execSync(pathProbeCmd, { timeout: 3000, encoding: "utf8", stdio: ["pipe", "pipe", "pipe"] });
186
+ if (whichOut.trim()) result.codex = true;
117
187
  } catch (e) {}
118
188
  return result;
119
189
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "clay-server",
3
- "version": "2.33.0",
3
+ "version": "2.33.1",
4
4
  "description": "Self-hosted Claude Code in your browser. Multi-session, multi-user, push notifications.",
5
5
  "bin": {
6
6
  "clay-server": "./bin/cli.js",