Files
BetterDesk/web-nodejs/test-db.js
T
UNITRONIX 32e29723e4 Add Node.js web console and update to v2.2.0
Introduce a new Node.js-based web console (Express + EJS + better-sqlite3) under web-nodejs/ and add installer support to choose between Node.js and the legacy Flask console. Update interactive ALL-IN-ONE installers (betterdesk.sh, betterdesk.ps1) with flags/options for --nodejs/--flask, automatic Node.js installation, migration logic, enhanced service handling and diagnostics. Bump VERSION to 2.2.0 and update README and project docs (.github/copilot-instructions.md) to reflect the new console, usage examples, and Docker/docs changes. Many new web-nodejs files and supporting middleware/services/routes/views/static assets were added to support the new console.
2026-02-17 10:59:46 +01:00

28 lines
879 B
JavaScript

const config = require('./config/config');
const db = require('./services/database');
console.log('Config:');
console.log(' DB_PATH:', config.dbPath);
console.log(' DATA_DIR:', config.dataDir);
console.log(' KEYS_PATH:', config.keysPath);
console.log('');
try {
const devices = db.getAllDevices({});
console.log('Total devices:', devices.length);
console.log('Type:', typeof devices);
console.log('Is array:', Array.isArray(devices));
if (devices.length > 0) {
console.log('First device:', JSON.stringify(devices[0], null, 2));
}
const stats = db.getStats();
console.log('Stats:', JSON.stringify(stats, null, 2));
const auditLogs = db.getAuditLogs(5);
console.log('Audit logs:', JSON.stringify(auditLogs, null, 2));
} catch (err) {
console.error('Error:', err.message);
console.error('Stack:', err.stack);
}