Developers
Contributing
All developer pages · From CONTRIBUTING.md in the release that is running.
Every change reaches pub-runners.com through a pull request. Never push to main: a push to main deploys straight to the live site.
This guide, the timer brief and the API guides are also published at https://pub-runners.com/developers, built from the release that is running.
The timing app (public/timer)
The club timing app at https://pub-runners.com/timer lives in public/timer. It is plain HTML, CSS and JavaScript with no build step: the files are served as they are. What it does, and which API call each screen makes, is in docs/timer.md. The API itself is in docs/partner-api.md, with interactive docs at https://staging.pub-runners.com/api/docs.
Making a change
- Make a branch from
mainin this repository (not a fork: forks get no preview site). - Change files in
public/timer. Anything outside that folder needs a word with Tom first. - Open a pull request. CI checks that the JavaScript parses and runs the site's tests.
- Once CI passes, the pull request gets its own site at
https://pr<number>.demo.pub-runners.com/timer/, with made-up runners and runs. Every push updates it, and closing the pull request removes it. Sign in ashost(oradmin), with the demo password Tom sends you. - Tom reviews and merges. Merging deploys to staging, then to pub-runners.com.
Running it on your own machine
Sign-in cookies only work on the site itself, so the app served from localhost cannot sign in as a host. Use the pull request preview for the real sign-in flow. For quick work on your own machine, point the app at https://staging.pub-runners.com and send the demo API key (Tom sends it with the password) as Authorization: Bearer ... on timer requests. Keep the key out of the repository: an environment variable, or a file named *.local.* (git-ignored in public/timer). Never use pub-runners.com for development.
What the site allows /timer to do
The page is served with a Content Security Policy (App\Http\Controllers\TimerController::CSP):
- Scripts only from files in
public/timer. No inline<script>blocks, noonclick="..."attributes, no CDNs. - Requests only to the site itself. Map tiles only from
tile.openstreetmap.org. - Inline styles are fine.
- Keep
<base href="/timer/">inindex.html.
The app runs on pub-runners.com with the rights of whoever is signed in, admins included. That is why every change is reviewed before it ships.