Commit Graph
9 Commits
Author SHA1 Message Date
Isaac Connor 40129a5564 refactor: replace the auth_hash/auth_relay globals with one ZMAuth credential
The page kept two copies of the same secret: auth_relay, the query fragment
every AJAX call is authenticated with, and auth_hash, the bare hash stamped
into stream <img> URLs. Different responses updated different copies, so
they could drift, and a drifted auth_hash produced stream URLs that zms
rejects.

ZMAuth stores only the relay and derives the hash from it, so the two cannot
disagree. Its helpers cover the four shapes the call sites used:

  zmAuth.hash          derived, '' under the plain/none relay forms
  zmAuth.update(data)  absorb the auth fields of any response
  zmAuth.appendTo(url) authenticate a url, no-op when auth is off
  zmAuth.applyTo(src)  point a stream url at the current credential

appendTo also removes the `x ? '&'+x : ''` guard repeated at every call
site, some of which had omitted it and emitted a dangling '?'.

Migrates all call sites across web/js and the classic skin, and drops both
globals from skin.js.php.

Tests: tests/js/auth-helpers.test.js, 44 passing.
2026-08-09 10:29:46 -04:00
Isaac Connor 72330a5234 Fix api url getting monitors for map 2024-12-18 13:44:20 -05:00
Isaac Connor 506cdc5e66 Only show non-deleted monitors 2024-09-30 09:32:35 -04:00
Isaac Connor ada974ef51 Fix eslint 2024-03-06 14:21:18 -05:00
Isaac Connor fcac8ec2f2 Rename zmMap to ZMMap because eslint thinks constructors should always be capitalized. 2024-02-07 10:58:39 -05:00
Isaac Connor 05d605fe55 change Map to zmMap to prevent name collision with luxor. Add a haversine function to get distance between two lat&long. Start to rough in grouping locations into 1 pin. 2024-01-30 19:57:18 -05:00
Isaac Connor 8a6f0cbe1b Add ServerStats to api 2023-02-26 17:04:05 -05:00
Isaac Connor 1cdd1325bf Fix eslint 2023-02-25 16:26:19 -05:00
iconnor@connortechnology.com afcf55608e Move map generation into an Object so it can be reused. 2023-02-25 13:04:49 -05:00