Gate the dashboard on the site's admin login and add a setup page
Like job-tracker, the tracker forwards the visitor's cookies to the site backend's /auth/validate-admin instead of asking for an API key. Signed in, the dashboard shows every device's data. The new /setup page has instructions for each collector and creates and revokes API keys. The userscript is served publicly at /tracker.user.js. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
<!doctype html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<title>Activity Tracker</title>
|
||||
<style>
|
||||
body { margin:0; background:#fafafa; color:#1a1a1a; font:15px/1.45 system-ui, sans-serif; }
|
||||
@media (prefers-color-scheme: dark) { body { background:#151515; color:#e6e6e6; } a { color:#6f9be6; } }
|
||||
main { max-width:760px; margin:0 auto; padding:24px 16px; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<main>
|
||||
<p>Sign in to the site to open the activity tracker. <a id="login" href="/admin/login">Sign in</a></p>
|
||||
</main>
|
||||
<script>
|
||||
// The site's login page sends you back to `redirect` afterwards.
|
||||
const here = location.pathname + location.search;
|
||||
const to = "/admin/login?redirect=" + encodeURIComponent(here);
|
||||
document.getElementById("login").href = to;
|
||||
location.replace(to);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user