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
Coach admin: the Runtime line names the endpoint's real scheme, HTTP for a plain http:// endpoint
Duarte Santos82e6165dc977
diff --git a/api/coach/core/adapters/http.js b/api/coach/core/adapters/http.jsindex 2900e8c63..76c84d0fe 100644--- a/api/coach/core/adapters/http.js+++ b/api/coach/core/adapters/http.js@@ -35,6 +35,10 @@ const sleep = (ms, signal) => new Promise(resolve => {});const hostOf = url => { try { return new URL(url).host; } catch { return url; } };+// What the admin card's Runtime line names: the scheme the endpoint is actually called with. An+// OpenAI-compatible model on the LAN is usually plain http://, and calling that "HTTPS" told the+// owner the traffic was encrypted when it was not.+const schemeOf = url => { try { return new URL(url).protocol === 'http:' ? 'HTTP' : 'HTTPS'; } catch { return 'HTTPS'; } };const trim = (s, n = 300) => String(s == null ? '' : s).slice(0, n);/** A fetch, bounded by AbortController. Never throws for HTTP status; throws for transport. */@@ -83,10 +87,10 @@ export function httpAdapter(spec) {async check(cfg, env, opts = {}) {const base = adapter.baseUrl(cfg);if (!base) return { ok: false, error: 'no endpoint configured' };- if (!keyOf(env) && !meta.keyOptional) return { ok: true, version: `HTTPS · ${hostOf(base)}`, needsKey: true };+ if (!keyOf(env) && !meta.keyOptional) return { ok: true, version: `${schemeOf(base)} · ${hostOf(base)}`, needsKey: true };const r = await adapter.models(cfg, env, opts);if (!r.ok) return { ok: false, error: r.error };- return { ok: true, version: `HTTPS · ${hostOf(base)} · ${r.models.length} models`, models: r.models };+ return { ok: true, version: `${schemeOf(base)} · ${hostOf(base)} · ${r.models.length} models`, models: r.models };},/** The models this endpoint serves, so a UI can offer a list instead of a text field. */diff --git a/api/test/adapters-http.test.js b/api/test/adapters-http.test.jsindex 583f6c52b..05261579e 100644--- a/api/test/adapters-http.test.js+++ b/api/test/adapters-http.test.js@@ -269,6 +269,18 @@ test('check(): without a key the runtime is ready and the key is what is missingassert.equal(noBase.ok, false);});+test('check(): the Runtime line names the scheme the endpoint is really called with', async () => {+ const lan = await compatible.check(cfgCompat, env, { fetch: fakeFetch([ok({ data: [{ id: 'llama' }] })]) });+ assert.equal(lan.ok, true);+ assert.match(lan.version, /^HTTP · ollama\.lan:11434 · 1 models$/);+ const lanNoKey = await compatible.check(cfgCompat, {}, { fetch: fakeFetch([ok({ data: [] })]) });+ assert.match(lanNoKey.version, /^HTTP · /);+ const cloud = await anthropic.check({}, env, { fetch: fakeFetch([ok({ data: [{ id: 'claude-a' }] })]) });+ assert.match(cloud.version, /^HTTPS · api\.anthropic\.com/);+ const cloudNoKey = await openai.check({}, {}, { fetch: fakeFetch([]) });+ assert.match(cloudNoKey.version, /^HTTPS · api\.openai\.com$/);+});+test('validateBaseUrl: http(s) only, no credentials, no query, trailing slash dropped', () => {assert.deepEqual(validateBaseUrl('http://ollama.lan:11434/'), { ok: true, value: 'http://ollama.lan:11434' });assert.deepEqual(validateBaseUrl(' '), { ok: true, value: null });