Skip to content

About

Export your own OnelapFit / Geoid (Magene) rides as raw .FIT files — zero-dependency, for Strava-API-free data portability

Resources

Stars

4 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

onelap-fit-export

Export your own rides from OnelapFit / Geoid (the international app for Magene bike computers) as raw .FIT files — no Strava, no cloud middleman.

Strava restricted its API to paid subscribers in 2026. If your head unit (Magene / Geoid) syncs to onelap.com, this tool pulls the original .FIT files directly from OnelapFit's fitness backend so you can own, back up, or re-import them anywhere:

Not the Chinese edition. This targets the international backend api-fitness.rfsvr.com behind your onelap.com account. onelap.cn is a separate service and is not supported.

Features

  • Zero dependencies — Python 3.8+ standard library only. One file.
  • Incremental — remembers what it already fetched (state file); only new rides download.
  • Integrity-checked — validates the .FIT signature and the header-declared length, so a truncated/expired download never lands in your folder.
  • Resilient — retries transient network / 5xx / 429 errors with backoff.
  • Config-driven — nothing is hard-coded to any user; point it at any output folder.
  • Optional post-hook — run any command after new files arrive (notify, trigger an import, ...).

Install

git clone https://github.com/<you>/onelap-fit-export.git
cd onelap-fit-export
cp config.example.ini config.ini
$EDITOR config.ini          # fill in your onelap.com account + password

No pip install needed.

Usage

# one-off / incremental sync
python3 onelap_fit_export.py --config config.ini

# re-download everything in range, ignoring saved state
python3 onelap_fit_export.py --config config.ini --all

# override the output folder on the fly
python3 onelap_fit_export.py --config config.ini --out /path/to/watch

# safe for cron (prevents overlapping runs)
python3 onelap_fit_export.py --config config.ini --lock /tmp/onelap.lock

Run it hourly from cron:

0 * * * * /usr/bin/python3 /opt/onelap-fit-export/onelap_fit_export.py \
          --config /opt/onelap-fit-export/config.ini \
          --lock /tmp/onelap-fit-export.lock >> /var/log/onelap.log 2>&1

The first run is a baseline: it records what exists without firing the post-hook, so you don't get spammed for your whole history. After that, only genuinely new rides are downloaded (and the hook runs).

Configuration

See config.example.ini. Fields:

Key Meaning
account / password Your onelap.com login (the international app).
output_dir Where .FIT files are written.
state_file Tracks already-downloaded rides for incremental sync. Leave empty to always fetch.
start_date YYYY-MM-DD (UTC) or a unix timestamp — ignore rides before this. Empty = all.
post_hook Shell command run after new files arrive. $ONELAP_NEW_COUNT = number of new files.

config.ini holds your password, so it is git-ignored by default. Keep it chmod 600.

Feeding statistics-for-strava

Set output_dir to SFS's watched folder and SFS imports automatically in file-import mode:

output_dir = /opt/stacks/statistics-for-strava/watch

Heads-up (upstream SFS bug): SFS's route/country tagging shells out to geosop and passes the ride's geometry as a single command-line argument. Long rides (~>6000 track points) produce a WKT string larger than Linux's 128 KB per-argument limit (MAX_ARG_STRLEN), so geosop fails to launch and the import errors out. The fix belongs upstream (downsample the route before the intersects call, or pass geometry via stdin/a file). This exporter does not trigger the bug itself — it only writes .FIT files — but if your SFS imports fail on long rides, that's the cause.

How it works (reverse-engineered protocol)

Documented so the tool is auditable and maintainable, not to encourage abuse.

  • Two backends. The account lives on www.onelap.com, but ride data lives on api-fitness.rfsvr.com — a token minted by www.onelap.com/api/login is rejected by rfsvr, so we log in against rfsvr directly.
  • Login. POST /api/v1/app/login with JSON {account, password: md5hex(pw)} → data.token (bearer) + data.userinfo.uid.
  • Request signing (every call). URL-based. nonce = base64(6 random bytes), timestamp = unix seconds. signStr = "{path}?" + join(sorted "k=v&" over {nonce, timestamp, non-empty query params}) + "key={APIKEY}", sign = md5hex(signStr). The body is not signed. APIKEY is the app's BuildConfig.ApiKey.
  • Required headers. authorization, userid, platform (43 iOS / 44 Android), app-name=onelapfit, app-version, nonce, timestamp, sign, onelap-region=1. deviceid/sessionid are not validated server-side.
  • List rides. GET /api/v1/app/record/riding/list?data_type=all&source=all&start_time=&end_time=&p=. Response data.days.{ts}.info[] carries fileKey, fileAddr (a presigned OSS URL, no auth, time-limited), plus distance/etc. Paginate via page_count.
  • Download. GET fileAddr directly — no auth headers needed. File name looks like GEOID_CC600_{start}_{uid}_{end}.fit; bytes 8–12 are .FIT.

The signing key was recovered from the app's BuildConfig; endpoint/header shapes were confirmed by inspecting the app's own HTTPS traffic.

Disclaimer

This is an interoperability / personal-data-portability tool. It accesses your own account and your own ride data using your own credentials. It is not affiliated with, endorsed by, or supported by OnelapFit / Magene / Geoid. The API is undocumented and may change or break at any time. Respect OnelapFit's Terms of Service. Use at your own risk.

License

MIT

About

Export your own OnelapFit / Geoid (Magene) rides as raw .FIT files — zero-dependency, for Strava-API-free data portability

Resources

Stars

4 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages