• Stars
    star
    3,565
  • Rank 12,439 (Top 0.3 %)
  • Language
    Python
  • License
    MIT License
  • Created about 4 years ago
  • Updated about 1 month ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Make your own running home page

注:如果是之前 clone 或 Fork 的朋友 vercel 显示 404 可能需要更新下代码

Create a personal running home page

Github Action Chat on telegram

demo

English | 简体中文 | Wiki

Runner's Page Show

Running page runners
Runner page App
zhubao315 https://zhubao315.github.io/running Strava
shaonianche https://run.duanfei.org Strava
yihong0618 https://yihong.run Nike
superleeyom https://running.leeyom.top Nike
geekplux https://activities.geekplux.com Nike
guanlan https://grun.vercel.app Strava
tuzimoe https://run.tuzi.moe Nike
ben_29 https://running.ben29.xyz Strava
kcllf https://running-tau.vercel.app Garmin-cn
mq https://running-iota.vercel.app Keep
zhaohongxuan https://running-page-psi.vercel.app Keep
yvetterowe https://run.haoluo.io Strava
love-exercise https://run.kai666666.top Keep
zstone12 https://running-page.zstone12.vercel.app Keep
Lax https://lax.github.io/running Keep
lusuzi https://running.lusuzi.vercel.app Nike
wh1994 https://run4life.fun Garmin
liuyihui https://run.foolishfox.cn Keep
sunyunxian https://sunyunxian.github.io/running_page Strava
AhianZhang https://running.ahianzhang.com Nike
L1cardo https://run.licardo.cn Nike
luckylele666 https://0000928.xyz Strava
MFYDev https://mfydev.run Garmin-cn
Eished https://run.iknow.fun Keep
Liuxin https://liuxin.run Nike
loucx https://loucx.github.io/running Nike
winf42 https://winf42.github.io Garmin-cn
sun0225SUN https://run.sunguoqi.com Nike
Zhan https://run.zlog.in Nike
Dennis https://run.domon.cn Garmin-cn
hanpei https://running.nexts.top Garmin-cn
liugezhou https://run.liugezhou.online Strava
Jason Tan https://jason-cqtan.github.io/running_page Nike
Conge https://conge.github.io/running_page Strava
zHElEARN https://workouts.zhelearn.com Strava
Ym9i https://bobrun.vercel.app/ Strava
jianchengwang https://jianchengwang.github.io/running_page Suunto
fxbin https://fxbin.github.io/sport-records/ Keep
shensl4499 https://waner.run codoon
haowei93 https://haowei93.github.io/ gpx
stevenash0822 https://run.imangry.xyz/ Strava
Vint https://vinton.store/Running/ Keep
Muyids https://muyids.github.io/running Garmin-cn

How it works

image

Features

  1. GitHub Actions manages automatic synchronization of runs and generation of new pages.
  2. Gatsby-generated static pages, fast
  3. Support for Vercel (recommended) and GitHub Pages automated deployment
  4. React Hooks
  5. Mapbox for map display
  6. Supports most sports apps such as nike strava...

automatically backup gpx data for easy backup and uploading to other software.
Note: If you don't want to make the data public, you can choose strava's fuzzy processing, or private repositories.

Support

Download

Clone or fork the repo.

git clone https://github.com/yihong0618/running_page.git --depth=1

Installation and testing (node >= 12 and <= 14 python >= 3.7)

pip3 install -r requirements.txt
yarn install
yarn develop

Open your browser and visit http://localhost:8000/

Docker

#build
# NRC
docker build -t running_page:latest . --build-arg app=NRC --build-arg nike_refresh_token=""
# Garmin
docker build -t running_page:latest . --build-arg app=Garmin --build-arg email=""  --build-arg password=""
# Garmin-CN
docker build -t running_page:latest . --build-arg app=Garmin-CN --build-arg email=""  --build-arg password=""
# Strava
docker build -t running_page:latest . --build-arg app=Strava --build-arg client_id=""  --build-arg client_secret=""  --build-arg refresh_token=""
#Nike_to_Strava
docker build -t running_page:latest . --build-arg app=Nike_to_Strava  --build-arg nike_refresh_token="" --build-arg client_id=""  --build-arg client_secret=""  --build-arg refresh_token=""

#run
docker run -itd -p 80:80   running_page:latest

#visit
Open your browser and visit localhost:80

Local sync data

Modifying Mapbox token in src/utils/const.js

If you use English please change IS_CHINESE = false in src/utils/const.js
Suggested changes to your own Mapbox token

const MAPBOX_TOKEN =
  'pk.eyJ1IjoieWlob25nMDYxOCIsImEiOiJja2J3M28xbG4wYzl0MzJxZm0ya2Fua2p2In0.PNKfkeQwYuyGOTT_x9BJ4Q';

Custom your page

  • Find gatsby-config.js in the repository directory, find the following content, and change it to what you want.
siteMetadata: {
  siteTitle: 'Running Page', #website title
  siteUrl: 'https://yihong.run', #website url
  logo: 'https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcQTtc69JxHNcmN1ETpMUX4dozAgAN6iPjWalQ&usqp=CAU', #logo img
  description: 'Personal site and blog',
  navLinks: [
    {
      name: 'Blog', #navigation name
      url: 'https://yihong.run/running', #navigation url
    },
    {
      name: 'About',
      url: 'https://github.com/yihong0618/running_page/blob/master/README-CN.md',
    },
  ],
},
  • Modifying styling in src/utils/const.js
// styling: set to `false` if you want to disable dash-line route
const USE_DASH_LINE = true;
// styling: route line opacity: [0, 1]
const LINE_OPACITY = 0.4;

Download your running data and do not forget to generate svg in total page

GPX

Make your GPX data

Copy all your gpx files to GPX_OUT or new gpx files

python3(python) scripts/gpx_sync.py

TCX

Make your TCX data

Copy all your tcx files to TCX_OUT or new tcx files

python3(python) scripts/tcx_sync.py

Garmin

Get your Garmin data
If you only want to sync `type running` add args --only-run If you only want `tcx` files add args --tcx
python3(python) scripts/garmin_sync.py ${your email} ${your password}

example:

python3(python) scripts/garmin_sync.py example@gmail.com example

only-run:

python3(python) scripts/garmin_sync.py example@gmail.com example --only-run

Garmin-CN(China)

Get your Garmin-CN data
If you only want to sync `type running` add args --only-run If you only want `tcx` files add args --tcx
python3(python) scripts/garmin_sync.py ${your email} ${your password} --is-cn

example:

python3(python) scripts/garmin_sync.py example@gmail.com example --is-cn

Nike Run Club

Get your Nike Run Club data

Please note: When you choose to deploy running_page on your own server, due to Nike has blocked some IDC's IP band, maybe your server cannot sync Nike Run Club's data correctly and display 403 error, then you have to change another way to host it.

Get Nike's refresh_token

  1. Login Nike website
  2. In Develop -> Application-> Storage -> https:unite.nike.com look for refresh_token

image

  1. Execute in the root directory:
python3(python) scripts/nike_sync.py ${nike refresh_token}

example:

python3(python) scripts/nike_sync.py eyJhbGciThiMTItNGIw******

example img

Strava

Get your Strava data
  1. Sign in/Sign up Strava account

  2. Open after successful Signin Strava Developers -> Create & Manage Your App

  3. Create My API Application: Enter the following information


My API Application

Created successfully:


  1. Use the link below to request all permissions: Replace ${your_id} in the link with My API Application Client ID
https://www.strava.com/oauth/authorize?client_id=${your_id}&response_type=code&redirect_uri=http://localhost/exchange_token&approval_prompt=force&scope=read_all,profile:read_all,activity:read_all,profile:write,activity:write

get_all_permissions

  1. Get the code value in the link

example:

http://localhost/exchange_token?state=&code=1dab37edd9970971fb502c9efdd087f4f3471e6e&scope=read,activity:write,activity:read_all,profile:write,profile:read_all,read_all

code value:

1dab37edd9970971fb502c9efdd087f4f3471e6

get_code

  1. Use Client_idClient_secretCode get refresh_token: Execute in Terminal/iTerm
curl -X POST https://www.strava.com/oauth/token \
-F client_id=${Your Client ID} \
-F client_secret=${Your Client Secret} \
-F code=${Your Code} \
-F grant_type=authorization_code

example:

curl -X POST https://www.strava.com/oauth/token \
-F client_id=12345 \
-F client_secret=b21******d0bfb377998ed1ac3b0 \
-F code=d09******b58abface48003 \
-F grant_type=authorization_code

get_refresh_token

  1. Sync Strava data

The first time you synchronize Strava data you need to change line 12 of the code False to True in strava_sync.py, and then change it to False after it finishes running.

python3(python) scripts/strava_sync.py ${client_id} ${client_secret} ${refresh_token}

References:

TCX_to_Strava

upload all tcx files to strava
  1. follow the strava steps
  2. copy all your tcx files to TCX_OUT
  3. Execute in the root directory:
python3(python) scripts/tcx_to_strava_sync.py ${client_id} ${client_secret}  ${strava_refresh_token}

example:

python3(python) scripts/tcx_to_strava_sync.py xxx xxx xxx
or
python3(python) scripts/tcx_to_strava_sync.py xxx xxx xxx --all
  1. if you want to all files add args --all

GPX_to_Strava

upload all gpx files to strava
  1. follow the strava steps
  2. copy all your gpx files to GPX_OUT
  3. Execute in the root directory:
python3(python) scripts/gpx_to_strava_sync.py ${client_id} ${client_secret}  ${strava_refresh_token}

example:

python3(python) scripts/gpx_to_strava_sync.py xxx xxx xxx
or
python3(python) scripts/tcx_to_strava_sync.py xxx xxx xxx --all
  1. if you want to all files add args --all

Nike_to_Strava

Get your Nike Run Club data and upload to strava
  1. follow the nike and strava steps
  2. Execute in the root directory:
python3(python) scripts/nike_to_strava_sync.py ${nike_refresh_token} ${client_id} ${client_secret} ${strava_refresh_token}

example:

python3(python) scripts/nike_to_strava_sync.py eyJhbGciThiMTItNGIw******  xxx xxx xxx

Garmin_to_Strava

Get your Garmin data and upload to strava
  1. finish garmin and strava setps
  2. Execute in the root directory:
python3(python) scripts/garmin_to_strava_sync.py  ${client_id} ${client_secret} ${strava_refresh_token} ${garmin_email} ${garmin_password} --is-cn

e.g.

python3(python) scripts/garmin_to_strava_sync.py  xxx xxx xxx xx xxx

Strava_to_Garmin

Get your Strava data and upload to Garmin
  1. finish garmin and strava setps, at the same time, you need to add additional strava config in Github Actions secret: secrets.STRAVA_EMAIL,secrets.STRAVA_PASSWORD
  2. Execute in the root directory:
python3(python) scripts/strava_to_garmin_sync.py ${{ secrets.STRAVA_CLIENT_ID }} ${{ secrets.STRAVA_CLIENT_SECRET }} ${{ secrets.STRAVA_CLIENT_REFRESH_TOKEN }}  ${{ secrets.GARMIN_EMAIL }} ${{ secrets.GARMIN_PASSWORD }} ${{ secrets.STRAVA_EMAIL }} ${{ secrets.STRAVA_PASSWORD }}

if your garmin account region is China, you need to execute the command:

python3(python) scripts/strava_to_garmin_sync.py ${{ secrets.STRAVA_CLIENT_ID }} ${{ secrets.STRAVA_CLIENT_SECRET }} ${{ secrets.STRAVA_CLIENT_REFRESH_TOKEN }}  ${{ secrets.GARMIN_CN_EMAIL }} ${{ secrets.GARMIN_CN_PASSWORD }} ${{ secrets.STRAVA_EMAIL }} ${{ secrets.STRAVA_PASSWORD }} --is-cn

ps: when initializing for the first time, if you have a large amount of strava data, some data may fail to upload, just retry several times.

Total Data Analysis

Running data display
python scripts/gen_svg.py --from-db --title "${{ env.TITLE }}" --type github --athlete "${{ env.ATHLETE }}" --special-distance 10 --special-distance2 20 --special-color yellow --special-color2 red --output assets/github.svg --use-localtime --min-distance 0.5
python scripts/gen_svg.py --from-db --title "${{ env.TITLE_GRID }}" --type grid --athlete "${{ env.ATHLETE }}"  --output assets/grid.svg --min-distance 10.0 --special-color yellow --special-color2 red --special-distance 20 --special-distance2 40 --use-localtime

Generate year circular svg show

python3(python) scripts/gen_svg.py --from-db --type circular --use-localtime

For more display effects, see: https://github.com/flopp/GpxTrackPoster

server(recommendation vercel)

Use Vercel to deploy
  1. vercel connects to your GitHub repo.

image

  1. import repo

image

  1. Awaiting completion of deployment
  2. Visits
Use Cloudflare to deploy
  1. Click Create a project in Pages to connect to your Repo.

  2. After clicking Begin setup, modify Project's Build settings.

  3. Select Framework preset to Gatsby

  4. Scroll down, click Environment variables, then variable below:

    Variable name = PYTHON_VERSION, Value = 3.7

  5. Click Save and Deploy

Deploy to GitHub Pages
  1. If you are using a custom domain for GitHub Pages, open .github/workflows/gh-pages.yml, change fqdn value to the domain name of your site.

  2. (Skip this step if you're NOT using a custom domain) Modify gatsby-config.js, change pathPrefix value to the root path. If the repository name is running_page, the value will be /running_page.

  3. Go to repository's Actions -> Workflows -> All Workflows, choose Publish GitHub Pages from the left panel, click Run workflow. Make sure the workflow runs without errors, and gh-pages branch is created.

  4. Go to repository's Settings -> GitHub Pages -> Source, choose Branch: gh-pages, click Save.

GitHub Actions

Modifying information in GitHub Actions

Actions source code The following steps need to be taken

  1. change to your app type and info

image

  1. Add your secret in repo Settings > Secrets (add only the ones you need).

image

  1. My secret is as follows

image

  1. Go to repository's Settings -> Code and automation -> Actions ->General, Scroll to the bottom, find Workflow permissions, choose the first option Read and write permissions, click Save.

TODO

  • Complete this document.
  • Support Garmin, Garmin China
  • support for nike+strava
  • Support English
  • Refine the code
  • add new features
  • tests
  • support the world map
  • support multiple types, like hiking, biking~
  • support for Zeep life

Contribution

  • Any Issues PR welcome.
  • You can PR share your Running page in README I will merge it.

Before submitting PR:

  • Format Python code with black (black .)

Special thanks

Recommended Forks

Support

Just enjoy it~

FAQ

Strava Api limit

https://www.strava.com/settings/api https://developers.strava.com/docs/#rate-limiting

Strava API Rate Limit Exceeded. Retry after 100 seconds
Strava API Rate Limit Timeout. Retry in 799.491622 seconds

More Repositories

1

bilingual_book_maker

Make bilingual epub books Using AI translate
Python
7,286
star
2

xiaogpt

Play ChatGPT and other LLM with Xiaomi AI Speaker
Python
6,039
star
3

Kindle_download_helper

Download all your kindle books script.
Python
2,612
star
4

GitHubPoster

Make everything a GitHub svg poster and Skyline!
Python
1,774
star
5

gitblog

People Die, but Long Live GitHub
Python
1,386
star
6

tg_bot_collections

collections of yihong0618's telegram bot
Python
557
star
7

epubhv

Make your epub books vertical or horizontal.
Python
454
star
8

tg_bing_dalle

Telegram bing bot DALL-E 3
Python
418
star
9

blue

新的 PR(Issue) 来了来了来了!
Python
305
star
10

iBeats

Apple Watch 心率数据采集 - Your Soul, Your Beats!
Python
279
star
11

SunoSongsCreator

About High quality songs generation by https://www.suno.ai/. Reverse engineered API.
Python
276
star
12

2021

关于我的 2021 的一些记录。
Python
274
star
13

2022

2022 gogogo
Python
270
star
14

2023

Another year
Python
204
star
15

iWhat

What is it? Using AI Inspired by pyWhat
Python
190
star
16

shanbay_remember

扇贝自动发送今日新词到 telegram
JavaScript
189
star
17

duolingo_remember

Automatically send new words from duolingo to telegram
Python
166
star
18

2020

2020计划,喜欢的文章,博客,以及其它
C
137
star
19

github-readme-stats

generate my_github status using GitHub Actions
Go
134
star
20

vscode-gcores

VSCode 玩转机核
TypeScript
127
star
21

dalian-IT

『大连互联网』大连基本没啥互联网
114
star
22

gaycore

use command-line to listen gadio
Python
113
star
23

klingCreator

About High quality video and image generation by https://klingai.kuaishou.com and https://klingai.com/ Reverse engineered API.
Python
77
star
24

IdeoImageCreator

About High quality image generation by ideogram. Reverse engineered API.
Python
60
star
25

2024

Change
Python
42
star
26

yihong0618

41
star
27

kai_xin_ci_chang

开心词场帮助程序
Python
33
star
28

nbnhhsh-cli

「能不能好好说话?」 cli 版本
Python
31
star
29

gcores_calendar

gcores audios calendar
JavaScript
30
star
30

pengdu_helper

网易云歌词自动生成《捧读》用的 epub, 帮助学习。(GitHub Actions + shortcuts + telegram)
Go
29
star
31

my_kindle_stats

Show my read on kindle this year
Python
24
star
32

Runtastic

Download all your Runtastic (Adidas Running) activities save to gpx
Python
21
star
33

running_skyline

Generate a 3D Skyline in STL format from your running App
Python
20
star
34

blog

blog
JavaScript
14
star
35

github-readme-stats-server

Server for github-readme-stats
HTML
14
star
36

Python365

Python365天精进计划
Python
11
star
37

run

Python
10
star
38

resume

resume
HTML
4
star
39

remote_mp3_duration

Estimate the duration in seconds of the remote MP3 file without full download(python version)
Python
3
star
40

github_upstream_script

Using script to fetch upstream and sync
Python
2
star
41

500

learn 500 lines from 500lines-rewrite
1
star
42

edocteel001

100days leetcode
JavaScript
1
star