Merge /conditions into the app as a Station tab
- New Station tab (top tabs, bottom nav, swipe order) carrying the old /conditions look: radar-ring hero, condition pill, wind compass, atmosphere/precip/solar cards, indoor - Scoped sl-* styles and station-live.js; units follow the app's metric/imperial setting - Empty/error states when no station is connected - /conditions now 301-redirects to /?tab=station; removed conditions.html, /api/conditions/public and the old My Station drawer - /api/ambient-config also returns the station name - Dashboard and settings links updated; SW cache v8; manifest shortcut for Station - Drops an indoor-temp block in applyStationOverlay that referenced an out-of-scope helper Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
7dea2734ea
commit
1830fb2e2b
11 files changed
+361
-917
No files matched your search
+3
-12
@@ -1038,7 +1038,7 @@ app.post('/api/ambient-config', requireDashboardAuth, requireAdmin, (req, res) =
|
||||
// Return whether server-side keys exist (never expose the actual keys)
|
||||
app.get('/api/ambient-config', (_req, res) => {
|
||||
const hasKeys = !!(ambientServerConfig.apiKey && ambientServerConfig.appKey);
|
||||
res.json({ configured: hasKeys });
|
||||
res.json({ configured: hasKeys, stationName: dashAuth?.stationName || null });
|
||||
});
|
||||
|
||||
app.get('/api/ambient', async (req, res) => {
|
||||
@@ -1714,17 +1714,8 @@ app.get('/api/station/anomaly', requireDashboardAuth, (_req, res) => {
|
||||
res.json({ available: true, hourStats, anomaly: z > 2 ? 'above' : z < -2 ? 'below' : 'normal', currentTemp: last.tempf, currentHour: h, mean: stat?.mean, stddev: stat?.stddev });
|
||||
});
|
||||
|
||||
// Public conditions page + API (no auth required)
|
||||
app.get('/conditions', (_req, res) => {
|
||||
res.sendFile(path.join(__dirname, 'public', 'conditions.html'));
|
||||
});
|
||||
app.get('/api/conditions/public', (_req, res) => {
|
||||
if (!ambientServerConfig.apiKey) return res.status(503).json({ error: 'Not configured' });
|
||||
const cached = ambientCaches.get(ambientServerConfig.apiKey);
|
||||
const data = cached?.data?.[0]?.lastData || null;
|
||||
if (!data) return res.json(null);
|
||||
res.json({ ...data, stationName: dashAuth?.stationName || 'Genesis 8:22' });
|
||||
});
|
||||
// The old standalone /conditions page now lives in the app as the Station tab
|
||||
app.get('/conditions', (_req, res) => res.redirect(301, '/?tab=station'));
|
||||
|
||||
// ── Dashboard management APIs ─────────────────────────────────────────────────
|
||||
|
||||
|
||||
Reference in new issue
Block a user