fix: Simplify audit to catch ALL non-Trinity schedules
Removed power task filter — Pterodactyl doesn't include task relationships by default. Now catches any schedule not prefixed with [Trinity]. Signed-off-by: Claude (Chronicler #61) <claude@firefrostgaming.com>
This commit is contained in:
@@ -100,19 +100,23 @@ async function auditServerSchedules(serverId, serverName) {
|
||||
const res = await axios.get(pteroUrl, { headers: getHeaders() });
|
||||
const schedules = res.data.data || [];
|
||||
|
||||
// Find ANY schedule not created by Trinity
|
||||
const rogueSchedules = schedules
|
||||
.filter(s => !s.attributes.name.startsWith('[Trinity]'))
|
||||
.filter(s => {
|
||||
// Check if it looks like a restart schedule
|
||||
const tasks = s.attributes.relationships?.tasks?.data || [];
|
||||
return tasks.some(t => t.attributes?.action === 'power');
|
||||
})
|
||||
.map(s => ({
|
||||
id: s.attributes.id,
|
||||
name: s.attributes.name,
|
||||
cron: `${s.attributes.minute} ${s.attributes.hour} * * *`
|
||||
cron: `${s.attributes.minute} ${s.attributes.hour} * * *`,
|
||||
isActive: s.attributes.is_active
|
||||
}));
|
||||
|
||||
return { serverId, serverName, rogueSchedules };
|
||||
} catch (err) {
|
||||
console.error(`Audit failed for ${serverName}:`, err.message);
|
||||
return { serverId, serverName, rogueSchedules: [], error: err.message };
|
||||
}
|
||||
}
|
||||
|
||||
return { serverId, serverName, rogueSchedules };
|
||||
} catch (err) {
|
||||
return { serverId, serverName, rogueSchedules: [], error: err.message };
|
||||
|
||||
Reference in New Issue
Block a user