@siteboon/claude-code-ui 1.19.1 → 1.20.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.
package/dist/index.html CHANGED
@@ -25,7 +25,7 @@
25
25
 
26
26
  <!-- Prevent zoom on iOS -->
27
27
  <meta name="format-detection" content="telephone=no" />
28
- <script type="module" crossorigin src="/assets/index-0DqtvI36.js"></script>
28
+ <script type="module" crossorigin src="/assets/index-C88hdQje.js"></script>
29
29
  <link rel="modulepreload" crossorigin href="/assets/vendor-react-DIN4KjD2.js">
30
30
  <link rel="modulepreload" crossorigin href="/assets/vendor-codemirror-l-lAmaJ1.js">
31
31
  <link rel="modulepreload" crossorigin href="/assets/vendor-xterm-DfaPXD3y.js">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siteboon/claude-code-ui",
3
- "version": "1.19.1",
3
+ "version": "1.20.1",
4
4
  "description": "A web-based UI for Claude Code CLI",
5
5
  "type": "module",
6
6
  "main": "server/index.js",
@@ -40,6 +40,22 @@ if (process.env.DATABASE_PATH) {
40
40
  }
41
41
  }
42
42
 
43
+ // As part of 1.19.2 we are introducing a new location for auth.db. The below handles exisitng moving legacy database from install directory to new location
44
+ const LEGACY_DB_PATH = path.join(__dirname, 'auth.db');
45
+ if (DB_PATH !== LEGACY_DB_PATH && !fs.existsSync(DB_PATH) && fs.existsSync(LEGACY_DB_PATH)) {
46
+ try {
47
+ fs.copyFileSync(LEGACY_DB_PATH, DB_PATH);
48
+ console.log(`[MIGRATION] Copied database from ${LEGACY_DB_PATH} to ${DB_PATH}`);
49
+ for (const suffix of ['-wal', '-shm']) {
50
+ if (fs.existsSync(LEGACY_DB_PATH + suffix)) {
51
+ fs.copyFileSync(LEGACY_DB_PATH + suffix, DB_PATH + suffix);
52
+ }
53
+ }
54
+ } catch (err) {
55
+ console.warn(`[MIGRATION] Could not copy legacy database: ${err.message}`);
56
+ }
57
+ }
58
+
43
59
  // Create database connection
44
60
  const db = new Database(DB_PATH);
45
61
 
@@ -128,12 +144,12 @@ const userDb = {
128
144
  }
129
145
  },
130
146
 
131
- // Update last login time
147
+ // Update last login time (non-fatal — logged but not thrown)
132
148
  updateLastLogin: (userId) => {
133
149
  try {
134
150
  db.prepare('UPDATE users SET last_login = CURRENT_TIMESTAMP WHERE id = ?').run(userId);
135
151
  } catch (err) {
136
- throw err;
152
+ console.warn('Failed to update last login:', err.message);
137
153
  }
138
154
  },
139
155
 
package/server/index.js CHANGED
@@ -9,6 +9,8 @@ import { dirname } from 'path';
9
9
  const __filename = fileURLToPath(import.meta.url);
10
10
  const __dirname = dirname(__filename);
11
11
 
12
+ const installMode = fs.existsSync(path.join(__dirname, '..', '.git')) ? 'git' : 'npm';
13
+
12
14
  // ANSI color codes for terminal output
13
15
  const colors = {
14
16
  reset: '\x1b[0m',
@@ -333,7 +335,8 @@ app.use(express.urlencoded({ limit: '50mb', extended: true }));
333
335
  app.get('/health', (req, res) => {
334
336
  res.json({
335
337
  status: 'ok',
336
- timestamp: new Date().toISOString()
338
+ timestamp: new Date().toISOString(),
339
+ installMode
337
340
  });
338
341
  });
339
342
 
@@ -410,11 +413,13 @@ app.post('/api/system/update', authenticateToken, async (req, res) => {
410
413
 
411
414
  console.log('Starting system update from directory:', projectRoot);
412
415
 
413
- // Run the update command
414
- const updateCommand = 'git checkout main && git pull && npm install';
416
+ // Run the update command based on install mode
417
+ const updateCommand = installMode === 'git'
418
+ ? 'git checkout main && git pull && npm install'
419
+ : 'npm install -g @siteboon/claude-code-ui@latest';
415
420
 
416
421
  const child = spawn('sh', ['-c', updateCommand], {
417
- cwd: projectRoot,
422
+ cwd: installMode === 'git' ? projectRoot : os.homedir(),
418
423
  env: process.env
419
424
  });
420
425
 
@@ -1,5 +1,6 @@
1
1
  // Load environment variables from .env before other imports execute.
2
2
  import fs from 'fs';
3
+ import os from 'os';
3
4
  import path from 'path';
4
5
  import { fileURLToPath } from 'url';
5
6
  import { dirname } from 'path';
@@ -22,3 +23,7 @@ try {
22
23
  } catch (e) {
23
24
  console.log('No .env file found or error reading it:', e.message);
24
25
  }
26
+
27
+ if (!process.env.DATABASE_PATH) {
28
+ process.env.DATABASE_PATH = path.join(os.homedir(), '.cloudcli', 'auth.db');
29
+ }
@@ -53,11 +53,11 @@ router.post('/register', async (req, res) => {
53
53
  // Generate token
54
54
  const token = generateToken(user);
55
55
 
56
- // Update last login
56
+ db.prepare('COMMIT').run();
57
+
58
+ // Update last login (non-fatal, outside transaction)
57
59
  userDb.updateLastLogin(user.id);
58
60
 
59
- db.prepare('COMMIT').run();
60
-
61
61
  res.json({
62
62
  success: true,
63
63
  user: { id: user.id, username: user.username },