openGym

应用程序

DuarteSantos8/openGym

自托管健身与体重追踪应用,支持通行密钥登录。

项目简介

openGym 是一款自托管的健身与体重追踪应用,数据完全保存在自己的服务器上。提供包含 1300 多个动作的训练计划、带休息计时与 PR 检测的引导式训练、肌肉恢复热力图,并支持从 FitNotes、Strong、Hevy 导入数据。以 PWA 形式安装,支持通行密钥登录、离线使用与多设备同步。

README 预览

\n\n\n\n**A self-hosted gym and body-weight tracker you actually own.**\n\nPlan your week, run guided workouts, log every set and your body weight —\non your phone, synced across your devices, behind your own passkey login.\n\n[](https://discord.gg/e62jY6fwVb)\n[](https://discord.gg/e62jY6fwVb)\n[](https://github.com/DuarteSantos8/openGym/stargazers)\n\n[](https://github.com/DuarteSantos8/openGym/releases)\n[](https://github.com/DuarteSantos8/openGym/actions/workflows/test.yml)\n[](https://gitlab.com/DuarteSantos8/opengym/-/pipelines)\n[](https://gitlab.com/DuarteSantos8/opengym/-/pipelines?ref=main)\n[](LICENSE)\n\n[Website](https://opengym.duarte-santos.ch) ·\n[Live demo](https://opengym.duarte-santos.ch/demo/) ·\n[Android APK](https://github.com/DuarteSantos8/openGym/releases/latest) ·\n[Self-hosting guide](docs/SELF_HOSTING.md) ·\n[Roadmap](ROADMAP.md) ·\n[Changelog](CHANGELOG.md)\n\n\n\n\n\nHome · today's workout and weight\nGuided workout · demos and sets\nStats · heatmap, charts and PRs\n\n\n\n## Why openGym\n\nMost workout apps keep your data on their servers, push you towards a subscription, or vanish\nwhen the company does. openGym runs on your own box, keeps your data in a folder you control, and\nis yours to fork. It still behaves like a modern app: installable on the home screen, passkey\nsign-in, works offline, syncs between your phone and your laptop.\n\nNo account on someone else's server, no subscription, no ads, no telemetry. One\n`docker compose up` and it's running.\n\nThe [in-browser demo](https://opengym.duarte-santos.ch/demo/) is the real app with example data,\nif you want to try it before installing anything.\n\n## Features\n\n**Planning**\n\n- A routine per weekday over a library of **1,324 exercises** with animated demos, searchable and\n  browsable by muscle on a body map. Filter by the equipment you own.\n- Four starter plans (Push/Pull/Legs, Upper/Lower, Full Body, 5×5) that load as ordinary,\n  editable routines.\n- Move a session to a

常见问题 (4)

故障排除
为什么 openGym Android 应用无法使用私有 CA 证书连接到自托管服务器?

根本原因:自 Android API 24 起,未配置 networkSecurityConfig 的应用仅信任系统 CA —— 用户安装的 CA 会被忽略。WebView 继承了此策略,因此与您的私有 CA 服务器的 TLS 握手会静默失败,请求(例如 POST /api/pair/redeem)永远不会到达服务器。Chrome 可以正常工作是因为它信任用户 CA。修复方法(需要重新构建 APK):创建 frontend/android/app/src/main/res/xml/network_security_config.xml,内容为 <network-security-config><base-config cleartextTrafficPermitted="false"><trust-anchors><certificates src="system" /><certificates src="user" /></trust-anchors></base-config></network-security-config>,然后在 AndroidManifest.xml 的 <application> 标签中添加 android:networkSecurityConfig="@xml/network_security_config"。无需重新构建的变通方法:在手机上通过 Chrome 安装 PWA 而不是使用原生应用 —— Chrome 信任您的用户 CA,因此 passkey 登录和同步可以正常工作。注意:通过局域网 IP 的纯 HTTP 同样会失败,因为 WebView 的源是 https://localhost 且 allowMixedContent 为 false。

来源 Issue #213
故障排除
为什么 AI Coach 在连接不带 /v1 前缀的 OpenAI 兼容端点(例如 Open WebUI 的 /openai 挂载)时返回 404?

在 openGym v1.4.0 中,Coach 总是会在基础 URL 后面追加 /v1,因此会调用 {base}/v1/chat/completions,而当服务器挂载在不包含版本号段的路径下时(例如 Open WebUI 置于 llama.cpp/llama-swap 之前的 /openai 代理、经过反向代理的 Ollama 等),该调用会返回 404。修复方法:升级到 openGym v1.4.1。在该版本中,当 {base}/v1 返回 404 时,Coach 会自动改为直接重试 {base} 并记住可用的形式,因此按照提供商文档中给出的格式原样粘贴端点(例如 http://127.0.0.1:8099/openai),List models 和 Test the Coach 都能正常工作。

来源 Issue #508
故障排除
为什么从 Strong 或 Hevy 导入时,同一天的两次训练会被合并为一次?

这是 openGym v1.4.0 中的一个 bug:CSV 导入和 Hevy API 导入仅按日历日期对训练进行分组(参见 frontend/src/lib/import-csv.js 中的 byDate 和 frontend/src/lib/import-hevy.js 中的 parseHevyWorkouts),因此同一天的上午和晚上两次训练会被合并为一次训练。修复方法:升级到 openGym v1.4.1 或更高版本。自 v1.4.1 起,来自 Strong、Hevy CSV 和 Hevy API 的导入会按日期加训练开始时间进行分组,因此同一天的两次训练会保留为两次独立的训练。FitNotes 导入不受影响,因为 FitNotes 的导出仅包含日期(无开始时间),所以仍按天分组。

来源 Issue #505
故障排除
为什么在 openGym 中锻炼过程中添加练习时,缺少"Type"(练习类型)这一行?

这是一个已在 openGym v1.4.1 中修复的 UI bug。在较早版本中,训练过程中的 "Add exercise" 视图仅显示 "Muscle" 和 "Equipment" 两行,缺少了 Exercise browser 中显示的 "Type" 行。将 openGym 更新至 v1.4.1 或更高版本后,添加训练动作时 "Type" 行将正常显示。

来源 Issue #521