mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 16:22:20 +00:00
Show news from the window the server serves
A host may serve fewer hours than the day. The hotspots answer may name its window (`windowHours`, a whole number from 1 to 24); the layer keeps reports, the feed, In view and the chosen event inside it, and the panel says "Last 12 h" or "Last 24 h" accordingly. Without a window named, or with one out of range, the layer keeps the full day as before.
This commit is contained in:
1 parent
f3e206bf37
commit
60fad38c3f
18 files changed
+178
-73
No files matched your search
@@ -96,7 +96,8 @@ function normalizeDeveloping(items) {
|
||||
}
|
||||
|
||||
/**
|
||||
* `/api/news/hotspots` → `{hotspots, categories, lastRunAt}`, or null when the
|
||||
* `/api/news/hotspots` → `{hotspots, categories, lastRunAt, windowHours}`
|
||||
* (`windowHours` null when the server names none), or null when the
|
||||
* payload has no hotspot list.
|
||||
*/
|
||||
export function normalizeHotspotsPayload(payload) {
|
||||
@@ -135,6 +136,12 @@ export function normalizeHotspotsPayload(payload) {
|
||||
)
|
||||
: [],
|
||||
lastRunAt: iso(payload.ingest?.lastRunAt),
|
||||
windowHours:
|
||||
Number.isInteger(payload.windowHours) &&
|
||||
payload.windowHours >= 1 &&
|
||||
payload.windowHours <= 24
|
||||
? payload.windowHours
|
||||
: null,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user