(jobs: { type: string; url: string }[], message?: string)
| 55 | } |
| 56 | |
| 57 | function renderHtml(jobs: { type: string; url: string }[], message?: string) { |
| 58 | const links = jobs |
| 59 | .map((job) => `<li><a href="${job.url}">${escapeHtml(job.type)}</a></li>`) |
| 60 | .join(''); |
| 61 | const note = message |
| 62 | ? `<pre>${escapeHtml(message)}</pre>` |
| 63 | : '<p>Click a job to run it now.</p>'; |
| 64 | return `<!doctype html> |
| 65 | <html lang="en"> |
| 66 | <head><meta charset="utf-8"><title>Debug cron</title></head> |
| 67 | <body style="font-family: ui-monospace, monospace; max-width: 40rem; margin: 2rem auto;"> |
| 68 | <h1>Trigger a cron job</h1> |
| 69 | ${note} |
| 70 | <ul>${links}</ul> |
| 71 | </body> |
| 72 | </html>`; |
| 73 | } |
| 74 | |
| 75 | // Local-only debug routes to run a cron job on demand instead of waiting for |
| 76 | // its schedule. Runs the job in this process through the same dispatcher the |
no test coverage detected