Open-source gym & body-weight tracker, now in the App Store (iPhone + Apple Watch) and as an Android APK. Plan routines, log workouts, see which muscles are trained, import from Strong/Hevy/FitNotes. Self-host it or use it on the phone alone.
JavaScript apple-watchbodyweightdockerfitnessfitness-trackergymhealthiosmcpnodejspasskeysprogressive-web-applicationspwareactself-hostedself-hostingvitewebauthnweightliftingworkout-tracker
Add ALLOWED_PRIVATE_IPS to let push endpoints resolve to chosen private ranges
Claude6f5d3d32b429
diff --git a/README.md b/README.mdindex ce3394baf..54b74926a 100644--- a/README.md+++ b/README.md@@ -167,6 +167,7 @@ Traefik and nginx, and there are separate guides for| `AUDIT_MAX` | Events kept in the activity log; `0` for no limit | `5000` || `AUDIT_DAYS` | Days kept in the activity log; `0` keeps until `AUDIT_MAX` | `90` || `AUDIT_IP` | Record the caller's address: `off`, `net` (network only) or `full` | `off` |+| `ALLOWED_PRIVATE_IPS` | Private addresses push endpoints may resolve to (FakeDNS, split-horizon DNS): comma-separated IPs, `a-b` ranges or CIDR blocks | *(none)* || `VAPID_SUBJECT` | Contact URL sent with push notifications | your `ORIGIN` || `API_TARGET` | API image to build: `default`, or `coach` with the Claude Agent SDK and Codex CLI | `default` || `COACH_DISABLED` | `1` forces the AI coach off instance-wide | *(unset)* |diff --git a/api/server.js b/api/server.jsindex 8dcb6028d..d84e01584 100644--- a/api/server.js+++ b/api/server.js@@ -235,8 +235,33 @@ const PUSH_TIMEOUT_MS = 10000;const PUSH_CONCURRENCY = 6;const MAX_SUBS_PER_USER = 20;+function parseAllowedPrivateIps(raw) {+ const list = new net.BlockList();+ for (const entry of String(raw || '').split(/[\s,]+/).filter(Boolean)) {+ const [from, to] = entry.split('-');+ const [addr, prefix] = entry.split('/');+ const family = net.isIPv6(addr) || net.isIPv6(from) ? 'ipv6' : 'ipv4';+ try {+ if (to !== undefined) list.addRange(from, to, family);+ else if (prefix !== undefined && /^\d{1,3}$/.test(prefix)) list.addSubnet(addr, +prefix, family);+ else if (net.isIP(entry)) list.addAddress(entry, family);+ else throw new Error('not an address, range or CIDR block');+ } catch {+ console.warn(`ALLOWED_PRIVATE_IPS entry "${entry.slice(0, 60)}" is not a valid address, range or CIDR block — ignored`);+ }+ }+ return list;+}+const ALLOWED_PRIVATE_IPS = parseAllowedPrivateIps(process.env.ALLOWED_PRIVATE_IPS);++function isAllowedPrivateAddr(v) {+ const family = net.isIPv6(v) ? 'ipv6' : net.isIPv4(v) ? 'ipv4' : null;+ return family !== null && ALLOWED_PRIVATE_IPS.check(v.replace(/%.*$/, ''), family);+}+function isPrivateAddr(ip) {const v = String(ip).toLowerCase();+ if (isAllowedPrivateAddr(v)) return false;const m4 = /^(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/.exec(v);if (m4) {const a = +m4[1], b = +m4[2];