mirror of
https://github.com/cpvalente/ontime.git
synced 2026-08-11 10:23:54 +00:00
ed39f86a81
Adoption is low, and the app must not be put at risk fixing that. A measured look at the diff showed the risk was concentrated in exactly two places: the timer's hot path and a new file-writing route. Everything that actually makes automations discoverable — recipes, a panel that explains itself, one-step creation, Test buttons that report — is client-only settings-panel code with zero server churn. This cuts the two pieces that weren't, and simplifies two more that only existed to serve them. Removed entirely: templates. Newest, riskiest, and the least connected to the adoption problem — it helps someone who already uses automations share them, not someone who has never tried the feature. It was also the source of two of the bugs found in review. Removed: the websocket broadcast behind "last fired". reportFired ran inside triggerAutomations, called from onClock every second and from onUpdate. A new protocol message pushed to every connected client, including stage displays, up to once a second per automation, is real new traffic on the busiest code path in the app for a feature still trying to prove it's worth using. The log line stays: it's additive, throttled, nowhere near the hot path once written, and answers the same question — did this run — without a new message. Trimmed: the demo goes from two automations tied together by necessity — a danger-time message and a second automation whose only job was undoing the first on finish — to one, attached by an event-level trigger instead of a global one. Same two discovery wins, an automation visibly fires on Play and per-event triggers are found by opening an event, with no message mutation and nothing to keep in sync. That pairing was also the first thing review found broken. Trimmed: the delete dialog no longer deletes blocking triggers and restores them if the automation still won't delete. That rollback was the other multi-request destructive sequence review found a bug in. It now confirms, names what's blocking, and says to remove global triggers from the Global Triggers list first — a single always-safe request the user already has. What stays: one-step creation (lifecycles picked on the automation form), the recipe library, and the panel legibility work — none of it touches the server or the runtime. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LpbLJVVT26tzWkduck1M9H
44 lines
1.4 KiB
TypeScript
44 lines
1.4 KiB
TypeScript
import express, { Router } from 'express';
|
|
|
|
import {
|
|
createProjectFile,
|
|
currentProjectDownload,
|
|
deleteProjectFile,
|
|
duplicateProjectFile,
|
|
listProjects,
|
|
loadDemo,
|
|
loadProject,
|
|
patchPartialProjectFile,
|
|
postProjectFile,
|
|
projectDownload,
|
|
quickProjectFile,
|
|
renameProjectFile,
|
|
} from './db.controller.js';
|
|
import { uploadProjectFile } from './db.middleware.js';
|
|
import {
|
|
validateFilenameBody,
|
|
validateFilenameParam,
|
|
validateNewFilenameBody,
|
|
validateNewProject,
|
|
validatePatchProject,
|
|
validateQuickProject,
|
|
} from './db.validation.js';
|
|
|
|
export const router: Router = express.Router();
|
|
|
|
router.get('/', currentProjectDownload);
|
|
router.post('/download', validateFilenameBody, projectDownload);
|
|
router.post('/upload', uploadProjectFile, postProjectFile);
|
|
|
|
router.patch('/', validatePatchProject, patchPartialProjectFile);
|
|
router.post('/new', validateFilenameBody, validateNewProject, createProjectFile);
|
|
router.post('/quick', validateQuickProject, quickProjectFile);
|
|
|
|
router.get('/all', listProjects);
|
|
|
|
router.post('/load', validateFilenameBody, loadProject);
|
|
router.post('/demo', loadDemo);
|
|
router.post('/:filename/duplicate', validateFilenameParam, validateNewFilenameBody, duplicateProjectFile);
|
|
router.put('/:filename/rename', validateFilenameParam, validateNewFilenameBody, renameProjectFile);
|
|
router.delete('/:filename', validateFilenameParam, deleteProjectFile);
|