GET /wake?since=<stamp> is public (the apps hold no token) and rate limited (30 a minute per IP). It holds up to
45 s, re-reading the stamp every 2 s, and answers {stamp, at, added, changed, held_ms} the moment the stored stamp
differs from since, else the unchanged stamp at the deadline. POST /r/<token>/wake {stamp, added} (the relay's
auth, also x-relay-token or x-igneum-key on /wake) records a stamp; one row per stamp in relay_wake, created by the
first POST. maxDuration 60 s for api/wake.mjs in vercel.json. api/relay.mjs is untouched.
The handler lives in lib/wake.mjs with its dependencies injected; relay/test/wake.test.mjs drives it with a fake
database, a fake clock and a fake sleep (the hold, the change, the deadline, the rate limit, the hold cap, auth, a
database error). CI's site job runs it with the other relay tests.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
62 lines
1.2 KiB
JSON
62 lines
1.2 KiB
JSON
{
|
|
"cleanUrls": true,
|
|
"trailingSlash": false,
|
|
"rewrites": [
|
|
{
|
|
"source": "/r/:token",
|
|
"destination": "/ui"
|
|
},
|
|
{
|
|
"source": "/r/:token/c/:fn",
|
|
"destination": "/api/console?token=:token&fn=:fn"
|
|
},
|
|
{
|
|
"source": "/r/:token/api/:fn",
|
|
"destination": "/api/relay?token=:token&fn=:fn"
|
|
},
|
|
{
|
|
"source": "/wake",
|
|
"destination": "/api/wake"
|
|
},
|
|
{
|
|
"source": "/r/:token/wake",
|
|
"destination": "/api/wake?token=:token"
|
|
}
|
|
],
|
|
"functions": {
|
|
"api/wake.mjs": {
|
|
"maxDuration": 60
|
|
}
|
|
},
|
|
"headers": [
|
|
{
|
|
"source": "/(.*)",
|
|
"headers": [
|
|
{
|
|
"key": "X-Content-Type-Options",
|
|
"value": "nosniff"
|
|
},
|
|
{
|
|
"key": "X-Frame-Options",
|
|
"value": "DENY"
|
|
},
|
|
{
|
|
"key": "X-Robots-Tag",
|
|
"value": "noindex, nofollow"
|
|
},
|
|
{
|
|
"key": "Referrer-Policy",
|
|
"value": "no-referrer"
|
|
},
|
|
{
|
|
"key": "Cache-Control",
|
|
"value": "no-store"
|
|
},
|
|
{
|
|
"key": "Strict-Transport-Security",
|
|
"value": "max-age=63072000; includeSubDomains"
|
|
}
|
|
]
|
|
}
|
|
]
|
|
}
|