feat: bootstrap backend API, schema and forgejo task issues

This commit is contained in:
openclaw 2026-03-04 16:03:04 +00:00
parent 77e837cc25
commit 09ea388190
15 changed files with 1557 additions and 0 deletions

View file

@ -0,0 +1,15 @@
import jwt from 'jsonwebtoken';
export const requireAuth = (req, res, next) => {
const authHeader = req.headers.authorization || '';
const token = authHeader.startsWith('Bearer ') ? authHeader.slice(7) : null;
if (!token) return res.status(401).json({ error: 'Missing token' });
try {
req.user = jwt.verify(token, process.env.JWT_SECRET);
next();
} catch {
res.status(401).json({ error: 'Invalid token' });
}
};