LearnSpace: full-stack educational whiteboard platform
Node.js/Express backend + vanilla JS frontend. Features: real-time collaborative whiteboard (SSE), multi-page support, LaTeX formulas, shapes/connectors, coordinate systems, number lines, compass, zoom/pan, Catmull-Rom pencil smoothing, ruler/protractor with rotation & resize controls, minimap navigation overlay, auto-measurements, multi-page thumbnails sidebar, PNG export, page templates. Student/teacher workflows: classes, assignments, library, dashboard. Mobile responsive. SQLite (better-sqlite3). Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
'use strict';
|
||||
const db = require('../db/db');
|
||||
|
||||
const stmt = db.prepare(
|
||||
"INSERT INTO admin_audit_log (admin_id, action, target, detail, ip) VALUES (?, ?, ?, ?, ?)"
|
||||
);
|
||||
|
||||
/**
|
||||
* Log an admin action.
|
||||
* @param {object} req - Express request (must have req.user)
|
||||
* @param {string} action - e.g. 'user.role_change', 'user.delete', 'user.ban'
|
||||
* @param {string} [target] - e.g. 'user:42', 'question:15'
|
||||
* @param {string} [detail] - human-readable detail
|
||||
*/
|
||||
function audit(req, action, target, detail) {
|
||||
try {
|
||||
const ip = req.ip || req.socket?.remoteAddress || '';
|
||||
stmt.run(req.user?.id || 0, action, target || null, detail || null, ip);
|
||||
} catch (e) { console.error('[audit]', e.message); }
|
||||
}
|
||||
|
||||
module.exports = { audit };
|
||||
Reference in New Issue
Block a user