Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions dashboard/terminal-server/src/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ class TerminalServer {
this.baseFolder = process.cwd();
const ttlHours = Number(process.env.TERMINAL_SESSION_TTL_HOURS);
const gcMinutes = Number(process.env.TERMINAL_SESSION_GC_INTERVAL_MINUTES);
// Default TTL bumped to 90 days; override via env TERMINAL_SESSION_TTL_HOURS if needed.
this.sessionTtlMs = options.sessionTtlMs ?? (
Number.isFinite(ttlHours) && ttlHours > 0 ? ttlHours * 60 * 60 * 1000 : (24 * 60 * 60 * 1000)
Number.isFinite(ttlHours) && ttlHours > 0 ? ttlHours * 60 * 60 * 1000 : (90 * 24 * 60 * 60 * 1000)
);
this.sessionGcIntervalMs = options.sessionGcIntervalMs ?? (
Number.isFinite(gcMinutes) && gcMinutes >= 0 ? gcMinutes * 60 * 1000 : (15 * 60 * 1000)
Expand Down Expand Up @@ -535,7 +536,7 @@ class TerminalServer {
this.wss.on('connection', (ws, req) => this.handleWebSocketConnection(ws, req));

return new Promise((resolve, reject) => {
server.listen(this.port, '0.0.0.0', (err) => {
server.listen(this.port, '::', (err) => {

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: Binding to '::' may drop IPv4-only accessibility depending on OS and Node configuration.

This change depends on IPv4-mapped IPv6 support, which varies by OS and configuration. On some platforms it will serve only IPv6 and break IPv4-only clients. If you want dual-stack behavior, consider omitting the host argument or explicitly listening on both IPv4 and IPv6 instead of relying on v4-mapped v6.

if (err) return reject(err);
this.server = server;
resolve(server);
Expand Down
5 changes: 3 additions & 2 deletions dashboard/terminal-server/src/utils/session-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ class SessionStore {
// Store sessions in user's home directory
this.storageDir = options.storageDir || path.join(os.homedir(), '.claude-code-web');
this.sessionsFile = path.join(this.storageDir, 'sessions.json');
this.sessionTtlMs = options.sessionTtlMs ?? (24 * 60 * 60 * 1000);
this.maxFileAgeDays = options.maxFileAgeDays ?? 7;
// Default TTL bumped to 90 days to preserve long-running sessions.
this.sessionTtlMs = options.sessionTtlMs ?? (90 * 24 * 60 * 60 * 1000);
this.maxFileAgeDays = options.maxFileAgeDays ?? 90;
fsSync.mkdirSync(this.storageDir, { recursive: true });
this.initializeStorage();
}
Expand Down