- Prevented admin challenge solves from creating score records
- Added operator solves list to the Admin panel profile - Allowed deletion of specific operator solves from the Admin panel - Enhanced operator solves list with alphabetical sorting, difficulty colors, and point values - Added rank medal icons to operator solves in the Admin panel
This commit is contained in:
12
server.js
12
server.js
@@ -429,11 +429,15 @@ apiRouter.post('/challenges/submit', (req, res) => {
|
||||
configRows.forEach(row => { config[row.key] = row.value; });
|
||||
const now = Date.now(), start = parseInt(config.eventStartTime || 0), end = parseInt(config.eventEndTime || Date.now() + 86400000);
|
||||
if (config.isStarted !== 'true' || now < start || now > end) return res.status(403).json({ success: false, message: 'COMPETITION_NOT_ACTIVE' });
|
||||
db.get("SELECT isDisabled FROM teams WHERE id = ?", [teamId], (err, team) => {
|
||||
db.get("SELECT isDisabled, isAdmin FROM teams WHERE id = ?", [teamId], (err, team) => {
|
||||
if (team?.isDisabled) return res.status(403).json({ success: false, message: 'Account disabled' });
|
||||
db.get("SELECT * FROM challenges WHERE id = ?", [challengeId], (err, challenge) => {
|
||||
if (challenge && challenge.flag === flag) {
|
||||
db.run("INSERT OR IGNORE INTO solves (teamId, challengeId, timestamp) VALUES (?, ?, ?)", [teamId, challengeId, Date.now()], () => res.json({ success: true }));
|
||||
if (team?.isAdmin) {
|
||||
res.json({ success: true });
|
||||
} else {
|
||||
db.run("INSERT OR IGNORE INTO solves (teamId, challengeId, timestamp) VALUES (?, ?, ?)", [teamId, challengeId, Date.now()], () => res.json({ success: true }));
|
||||
}
|
||||
} else res.json({ success: false });
|
||||
});
|
||||
});
|
||||
@@ -478,6 +482,10 @@ apiRouter.delete('/admin/teams/:id', (req, res) => {
|
||||
db.run("DELETE FROM teams WHERE id = ?", [req.params.id], () => db.run("DELETE FROM solves WHERE teamId = ?", [req.params.id], () => res.json({ success: true })));
|
||||
});
|
||||
|
||||
apiRouter.delete('/admin/solves/:teamId/:challengeId', (req, res) => {
|
||||
db.run("DELETE FROM solves WHERE teamId = ? AND challengeId = ?", [req.params.teamId, req.params.challengeId], () => res.json({ success: true }));
|
||||
});
|
||||
|
||||
apiRouter.post('/admin/blogs', (req, res) => {
|
||||
const id = 'blog-' + Math.random().toString(36).substr(2, 9);
|
||||
db.run("INSERT INTO blogs (id, title, content, timestamp) VALUES (?, ?, ?, ?)", [id, req.body.title, req.body.content, Date.now()], () => res.json({ success: true, id }));
|
||||
|
||||
Reference in New Issue
Block a user