Coder Social home page Coder Social logo

yihong0618 / running_page Goto Github PK

View Code? Open in Web Editor NEW
3.3K 41.0 921.0 67.8 MB

Make your own running home page

Home Page: https://running-page.vercel.app

License: MIT License

JavaScript 0.30% Python 48.42% Dockerfile 0.64% TypeScript 40.77% HTML 0.08% CSS 9.78%
nike strava adidas gpx github-secret vercel garmin-watch garmin mapbox club-nike

running_page's Introduction

Note

  1. clone or Fork before vercel 404 need to pull the latest code
  2. python3(python) in README means python3 python
  3. use v2.0 need change vercel setting from gatsby to vite
  4. 2023.09.26 garmin need secret_string(and in Actions) get
  python run_page/get_garmin_secret.py ${email} ${password}
  # if cn
  python run_page/get_garmin_secret.py ${email} ${password} --is-cn

Github Action Chat on telegram

demo

English | 简体中文 | Wiki

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 Strava
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://zhaohongxuan.github.io/workouts Strava
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://running-fun.eu.org gpx
stevenash0822 https://run.imangry.xyz/ Strava
Vint https://vinton.store/Running/ Keep
Muyids https://muyids.github.io/running Garmin-cn
Gao Hao https://efish2002.github.io/running_page/ Garmin-cn
Jinlei https://jinlei.run/ 咕咚
RealTiny656 https://tiny656.github.io/running_page/ JoyRun
EINDEX https://workouts.eindex.me/ Strava/Nike
Melt https://running.autove.dev/ Strava
deepinwine https://deepin.autove.dev/ Garmin-cn
Echo https://donghao526.github.io/running JoyRun
Jeffggmm https://jeffggmm.github.io/workouts_page/ Garmin
s1smart https://s1smart.github.io/running_page/ Strava
XmchxUp https://xmchxup.github.io/running_page/ Strava
Ryan https://85ryan.github.io/gooorun/ Strava
PPZ https://run.dudubbbbbbbbb.top/ Strava
Yer1k https://running.yer1k.com/ Strava
AlienVision https://run.drink.cafe/ Strava
闻笑忘 https://wenxiaowan.com 苹果健身
Vensent https://vensent.github.io/workouts_page/ Garmin
Zeonsing https://run.jogzeal.com/ Coros
yaoper https://running.yaoper.cn codoon

How it works

image

Features

  1. GitHub Actions automatically synchronizes running data and generates page displays
  2. Support for Vercel (recommended) and GitHub Pages automated deployment
  3. React Hooks
  4. Mapbox for map display
  5. 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 >= 16 python >= 3.8)

pip3 install -r requirements.txt
npm install -g corepack && corepack enable && pnpm install
pnpm develop

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

Docker

# 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 secret_string=""

# Garmin-CN
docker build -t running_page:latest . --build-arg app=Garmin-CN --build-arg secret_string=""

# 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=""

# Keep
docker build -t running_page:latest . --build-arg app=Keep --build-arg keep_phone_number="" --build-arg keep_password=""

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

# visit
Open your browser and visit localhost:80

Local sync data

Modifying Mapbox token

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

const MAPBOX_TOKEN =
  'pk.eyJ1IjoieWlob25nMDYxOCIsImEiOiJja2J3M28xbG4wYzl0MzJxZm0ya2Fua2p2In0.PNKfkeQwYuyGOTT_x9BJ4Q';

Custom your page

  • Find src/static/site-metadata.ts 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.ts
// 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;
// styling: set to `true` if you want to display only the routes without showing the map
// Note: This config only affects the page display; please refer to "privacy protection" below for data protection
const PRIVACY_MODE = false;
// styling: set to `false` if you want to make light off as default, only effect when `PRIVACY_MODE` = false
const LIGHTS_ON = true;
  • To use Google Analytics, you need to modify the configuration in the src/utils/const.ts file.
const USE_GOOGLE_ANALYTICS = false;
const GOOGLE_ANALYTICS_TRACKING_ID = '';

privacy protection,setting flowing env:

# ignore distance for each polyline start and end.
IGNORE_START_END_RANGE = 200

# ignore meters for each point in below polyline.
IGNORE_RANGE = 200

# a polyline include point you want to ignore.
IGNORE_POLYLINE = ktjrFoemeU~IorGq}DeB

# Do filter before saving to database, you will lose some data, but you can protect your privacy, when you using public repo. enable for set 1, disable via unset.
IGNORE_BEFORE_SAVING =

You can using Google map Interactive Polyline Encoder Utility , to making your IGNORE_POLYLINE.

Download your running data

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) run_page/gpx_sync.py

TCX

Make your TCX data

Copy all your tcx files to TCX_OUT or new tcx files

python3(python) run_page/tcx_sync.py

FIT

Make your FIT data

Copy all your tcx files to FIT_OUT or new fit files

python3(python) run_page/fit_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
  • If you only want fit files add args --fit
  • If you are using Garmin as a data source, it is recommended that you pull the code to your local environment to run and obtain the Garmin secret. The Python version must be >=3.8

Get Garmin Secret

Enter the following command in the terminal

# to get secret_string
python3(python) run_page/get_garmin_secret.py ${your email} ${your password}

Execute Garmin Sync Script

Copy the Secret output in the terminal,If you are using Github, please configure GARMIN_SECRET_STRING in Github Action.

# use this secret_string
python3(python) run_page/garmin_sync.py ${secret_string}

example:

python3(python) run_page/get_garmin_secret.py xxxxxxxxxxx

only-run:

python3(python) run_page/garmin_sync.py xxxxxxxxxxxxxx(secret_string) --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
  • If you only want fit files add args --fit
  • If you are using Garmin as a data source, it is recommended that you pull the code to your local environment to run and obtain the Garmin secret. The Python version must be >=3.10

Get Garmin CN Secret

Enter the following command in the terminal

# to get secret_string
python3(python) run_page/get_garmin_secret.py ${your email} ${your password} --is-cn

get_garmin_cn_secret

Execute Garmin CN Sync Script

Copy the Secret output in the terminal,If you are using Github, please configure GARMIN_SECRET_STRING_CN in Github Action. get_garmin_secret

example:

python3(python) run_page/garmin_sync.py xxxxxxxxx(secret_string) --is-cn

only-run:

python3(python) run_page/garmin_sync.py xxxxxxxxxxxxxx(secret_string)  --is-cn --only-run

Garmin-CN to Garmin

Sync your Garmin-CN data to Garmin
  • If you only want to sync type running add args --only-run The Python version must be >=3.10

Get Garmin CN Secret

Enter the following command in the terminal

# to get secret_string
python3(python) run_page/get_garmin_secret.py ${your email} ${your password} --is-cn

Get Garmin Secret

Enter the following command in the terminal

# to get secret_string
python3(python) run_page/get_garmin_secret.py ${your email} ${your password}

Sync Garmin CN to Garmin

Enter the following command in the terminal

# to sync garmin-cn to garmin-global
python3(python) run_page/garmin_sync_cn_global.py ${garmin_cn_secret_string} ${garmin_secret_string}

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

ALL need to do outside GFW

example img

  1. Login from this website, open F12 -> XHR -> get the refresh_token from login api.

  2. copy this refresh_token and use it in GitHub Secrets or in command line

  3. Execute in the root directory:

python3(python) run_page/nike_sync.py ${nike refresh_token}

example:

python3(python) run_page/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

Example:

https://www.strava.com/oauth/authorize?client_id=115321&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. If you only want to sync type running add args --only-run

python3(python) run_page/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) run_page/tcx_to_strava_sync.py ${client_id} ${client_secret}  ${strava_refresh_token}

example:

python3(python) run_page/tcx_to_strava_sync.py xxx xxx xxx
or
python3(python) run_page/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) run_page/gpx_to_strava_sync.py ${client_id} ${client_secret}  ${strava_refresh_token}

example:

python3(python) run_page/gpx_to_strava_sync.py xxx xxx xxx
or
python3(python) run_page/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) run_page/nike_to_strava_sync.py ${nike_refresh_token} ${client_id} ${client_secret} ${strava_refresh_token}

example:

python3(python) run_page/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 setup
  2. Execute in the root directory:
python3(python) run_page/garmin_to_strava_sync.py  ${client_id} ${client_secret} ${strava_refresh_token} ${garmin_secret_string} --is-cn

e.g.

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

Strava_to_Garmin

Get your Strava data and upload to Garmin
  1. finish garmin and strava setup, 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) run_page/strava_to_garmin_sync.py ${{ secrets.STRAVA_CLIENT_ID }} ${{ secrets.STRAVA_CLIENT_SECRET }} ${{ secrets.STRAVA_CLIENT_REFRESH_TOKEN }}  ${{ secrets.GARMIN_SECRET_STRING }} ${{ secrets.STRAVA_EMAIL }} ${{ secrets.STRAVA_PASSWORD }}

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

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

If you want to add Garmin Device during sync, you should add --use_fake_garmin_device argument, this will add a Garmin Device (Garmin Forerunner 245 by default, and you can change device in garmin_device_adaptor.py) in synced Garmin workout record, this is essential when you want to sync the workout record to other APP like Keep, JoyRun etc.

image

the final command will be:

python3(python) run_page/strava_to_garmin_sync.py ${{ secrets.STRAVA_CLIENT_ID }} ${{ secrets.STRAVA_CLIENT_SECRET }} ${{ secrets.STRAVA_CLIENT_REFRESH_TOKEN }}  ${{ secrets.GARMIN_SECRET_STRING_CN }} ${{ secrets.STRAVA_EMAIL }} ${{ secrets.STRAVA_PASSWORD }} --use_fake_garmin_device

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.

Coros

Get your Coros data

Enter the following command in the terminal

python run_page/coros_sync.py 'your coros account' 'your coros password'

Modify run_data_sync.yml env.RUN_TYPE: coros

Set the Coros account information in github action

  • configure the COROS_ACCOUNT , COROS_PASSWORD

    github-action

Total Data Analysis

Running data display
python run_page/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 run_page/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) run_page/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. Login to Cloudflare dashboard.

  2. Click Workers & Pages on the left side.

  3. Click Create application and select Pages tab, connect your GitHub account and select running_page Repo, then click Begin setup.

  4. Scroll down to Build settings, choose Create React App from Framework preset, and set Build output directory to dist.

  5. Scroll down, click Environment variables (advanced), then add a variable like the below:

    Variable name = PYTHON_VERSION, Value = 3.7

  6. Click Save and Deploy

Deploy to GitHub Pages
  1. Go to repository's Settings -> GitHub Pages -> Source, choose GitHub Actions

  2. Go to the repository's Actions -> Workflows -> All Workflows, choose Run Data Sync from the left panel, and click Run workflow.

  • The Run Data Sync will update data and then trigger the Publish GitHub Pages workflow
  • Make sure the workflow runs without errors.
  1. Open your website to check on the results
  • note if the website doesn't reflect the latest data, please refresh it by F5.
  • Some browsers (e.g. Chrome) won't refresh if there is a cache, you then need to use Ctrl+F5 (Windows) or Shift+Cmd+r (Mac) to force clearing the cache and reload the page.
  1. make sure you have write permissions in Workflow permissions settings.

  2. If you want to deploy your running_page to xxx.github.io instead of xxx.github.io/running_page or redirect your GitHub Pages to a custom domain, you need to do three things:

  • Rename your forked running_page repository to xxx.github.io, where xxx is your GitHub username
  • Modify the Build module in gh-pages.yml, remove ${{ github.event.repository.name }} and change to run: PATH_PREFIX=/ pnpm build
  • In src/static/site-metadata.ts, set siteUrl: '' or your custom domain URL

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.

Shortcuts

Automate with iOS Shortcuts

Take the keep app as an example. Close the app after running, and then automatically trigger Actions to update the data.

  1. Get actions id (need to apply token)
curl https://api.github.com/repos/yihong0618/running_page/actions/workflows -H "Authorization: token d8xxxxxxxxxx" # change to your config
get-action-id
  1. Binding shortcut instruction

    1. Get it via icloud running-page-shortcuts-template

    2. Modify the dictionary parameters in the following figure

  2. Automation

Storing Data Files in GitHub Cache

Storing Data Files in GitHub Cache

When SAVE_DATA_IN_GITHUB_CACHE is set to true in the run_data_sync.yml file, the script can store fetched and intermediate data files in the GitHub Action Cache. This helps keep your GitHub commit history and directory clean.

If you are deploying using GitHub Pages, it is recommended to set this value to true, and set BUILD_GH_PAGES to true.

Fit file

supported manufacturer:

  • Garmin
  • magene

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

running_page's People

Contributors

abinnz avatar atempcode1 avatar ben-29 avatar conge avatar cvvz avatar eindex avatar geekplux avatar haoxianhan avatar lax avatar lbp0 avatar lingdeyiyicifang avatar loucx avatar mayandev avatar mfydev avatar naturezzz avatar orionna319 avatar rdshoep avatar shaonianche avatar shuxiao9058 avatar sunyunxian avatar superleeyom avatar tiny656 avatar vlin avatar xmchxup avatar yihong0618 avatar yuansu228 avatar zhaohongxuan avatar zhubao315 avatar zlog-in avatar zstone12 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

running_page's Issues

[NEED FIX] GPX 中文报错问题

刚发现是由于Garmin的语言设置问题。我手机之前是中文的系统语言,Garmin给跑步起名字时候是用的中文“跑步”,好像是这个引起哪里不对。然后我把所有的记录名字都改成英文后就好了。

#81

Error on generate svg file

When sync my nike data, there some warning:

...
...
...
The activity 1b611a53-e448-4ddb-a9a5-fd6264cfb3ea doesn't contain metrics information
The activity b0be4df9-b9e4-47d9-a439-f1a4d6f75de3 doesn't contain metrics information
The activity 310f5826-a6d9-4995-9e93-b3449aa4b35d doesn't contain metrics information
...
...
...

and gets an error when generate svg file

Run python scripts/gen_svg.py --from-db --title "Gary's Running" --type github --athlete "Gary" --special-distance 10 --special-distance2 20 --special-color yellow --special-color2 red --output assets/github.svg --use-localtime --min-distance 0.5
179
179
Creating poster of type github with 165 tracks and storing it in file assets/github.svg...
179
179
Creating poster of type grid with 17 tracks and storing it in file assets/grid.svg...
Traceback (most recent call last):
  File "scripts/gen_svg.py", line 259, in <module>
    main()
  File "scripts/gen_svg.py", line 253, in main
    p.draw(drawers[args.type], args.output)
  File "/home/runner/work/running_page/running_page/scripts/gpxtrackposter/poster.py", line 111, in draw
    self.__draw_tracks(d, XY(self.width - 20, self.height - 30 - 30), XY(10, 30))
  File "/home/runner/work/running_page/running_page/scripts/gpxtrackposter/poster.py", line 131, in __draw_tracks
    self.tracks_drawer.draw(d, size, offset)
  File "/home/runner/work/running_page/running_page/scripts/gpxtrackposter/grid_drawer.py", line 50, in draw
    offset + 0.05 * XY(cell_size, cell_size) + p,
  File "/home/runner/work/running_page/running_page/scripts/gpxtrackposter/grid_drawer.py", line 64, in _draw_track
    color = self.color(self.poster.length_range_by_date, tr.length, has_special)
  File "/home/runner/work/running_page/running_page/scripts/gpxtrackposter/tracks_drawer.py", line 34, in color
    assert length_range.contains(length)
AssertionError
Error: Process completed with exit code 1.

I'm a total python newbie and don't know what's wrong.

One thought, share your running page

One thought.
If you want to share your own running homepage, you can generate it and write the URL in the readme, then submit pr and I'll merge it.

[BUG] json parser

10:42:20.331 error "gatsby-transformer-json" threw an error while running the onCreateNode lifecycle:
10:42:20.331 Unable to parse JSON: file /vercel/workpath0/src/static/activities.json
10:42:20.331 75 | } catch {
10:42:20.331 76 | const hint = node.absolutePath ? file ${node.absolutePath} : in node ${node.id};
10:42:20.331 > 77 | throw new Error(Unable to parse JSON: ${hint});
10:42:20.331 | ^
10:42:20.331 78 | }
10:42:20.331 79 |
10:42:20.331 80 | if (_.isArray(parsedContent)) {
10:42:20.343
10:42:20.343 Error: Unable to parse JSON: file /vercel/workpath0/src/static/activities.json
10:42:20.343 - gatsby-node.js:77 Object.onCreateNode
10:42:20.343 [workpath0]/[gatsby-transformer-json]/gatsby-node.js:77:11
10:42:20.343
10:42:20.343 - api-runner-node.js:460 runAPI
10:42:20.343 [workpath0]/[gatsby]/src/utils/api-runner-node.js:460:16
10:42:20.343
10:42:20.343
10:42:20.344 not finished source and transform nodes - 0.124s
10:42:21.351 error Command failed with exit code 1.
10:42:21.351 info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
10:42:21.363 Error: Command "yarn run build" exited with 1

Garmin: Something went wrong when loading GPX.

请问有没有哪位在运行garmin_sync.py时,出现“Something went wrong when loading GPX. for file 6171184463.gpx”这种错误的情况?因为人在国外,用的是“python3(python) scripts/garmin_sync.py ${your email} ${your password}”这个命令。目前卡在这一步,希望有人能帮忙解答。谢谢!

Drop extra files

If you want to focus on building a page:

  • just keep some example data files of GPX and activity JSON.
  • is it necessary to keep the post pages?

同步Keep数据出错

python scripts/keep_sync.py ${your mobile} ${your password} --with-gpx
pares keep ids data since 2019-11-17 16:00:00
pares keep ids data since 2019-06-13 16:00:00
pares keep ids data since 1970-01-01 00:00:00
99 new keep runs to generate
parsing keep id 56828b36ea2dc96356beab40_9223370433569637071_rn
Something wrong paring keep id 56828b36ea2dc96356beab40_9223370433569637071_rn'verticalAccuracy'
parsing keep id 56828b36ea2dc96356beab40_9223370434000576882_rn
Something wrong paring keep id 56828b36ea2dc96356beab40_9223370434000576882_rn'verticalAccuracy'
parsing keep id 56828b36ea2dc96356beab40_9223370434604614053_rn
Something wrong paring keep id 56828b36ea2dc96356beab40_9223370434604614053_rnInvalid URL '': No schema supplied. Perhaps you meant http://?
parsing keep id 56828b36ea2dc96356beab40_9223370436073682176_rn
Something wrong paring keep id 56828b36ea2dc96356beab40_9223370436073682176_rn'verticalAccuracy'
parsing keep id 56828b36ea2dc96356beab40_9223370437283499964_rn
parsing keep id 56828b36ea2dc96356beab40_9223370437715020591_rn
Something wrong paring keep id 56828b36ea2dc96356beab40_9223370437715020591_rnInvalid URL '': No schema supplied. Perhaps you meant http://?
...

About running stats

I found the stats code in the scripts folder is from GpxTrackPoster, is it possible to set it as a git submodule?

And the SVG produced by this module may set it as a page. There will be 2 or 3 links in navbar, and embed the SVG into the corresponding page. The best way, of course, is to visualize the stats data by front-end directly so that we could add some interaction, and SVG download would be just a feature then.

时间识别问题

「午后」和「傍晚」是如何区分的呢,没有确定的时间界限。
image

可以提供一个部署的步骤吗

  1. 我将代码拉倒服务器,执行了yarn build ,执行了同步佳明数据,使用nginx做了代理,但是访问到的还是作者的数据

Feat: more stats charts

In fact, we now have a lot of exercise data for self-tracking and analysis. If you are able to provide some simple statistical charts on the page, it would be more intuitive.

The only problem is the layout may have to be redesigned, a bit.

[Keep Sync] missing gpx data due to genre != KeepApp

Seems we depend on this check run_data.get("vendor", {}).get("genre", "") == "KeepApp" to generate running points (summary_polyline in activities.js). This works for records generated directly from Keep iPhone App, but not for those generated from Apple Watch app (genre = AppleWatch in this case). But for both cases, source == Keep. Maybe update run_data.get("vendor", {}).get("genre", "") == "KeepApp" to be run_data.get("vendor", {}).get("source", "") == "Keep"?

(Happy to open a PR if it makes sense! :D)

Garmin GPX has no track inside

I used garmin_sync to download all my activities and some of them are unable to load. Open the file which has error and I found that the track is empty (as below). Then I went to Garmin Connect website to download the TCX file of the same activity. The TCX file has all the data.

<?xml version="1.0" encoding="UTF-8"?>
<gpx creator="Garmin Connect" version="1.1"
  xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/11.xsd"
  xmlns:ns3="http://www.garmin.com/xmlschemas/TrackPointExtension/v1"
  xmlns="http://www.topografix.com/GPX/1/1"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://www.garmin.com/xmlschemas/GpxExtensions/v3">
  <metadata>
    <link href="connect.garmin.com">
      <text>Garmin Connect</text>
    </link>
    <time>2014-01-01T09:16:06.000Z</time>
  </metadata>
  <trk>
    <name>Run</name>
    <type>running</type>
    <trkseg/>
  </trk>
</gpx>

It must be the fault of Garmin. Perhaps the tool has to import data from TCX. I will investigate it further and let you know if I have more finding.

跑步机上的没有GPS轨迹的记录有办法同步吗?

<?xml version="1.0" encoding="UTF-8"?> <gpx creator="Garmin Connect" version="1.1" xsi:schemaLocation="http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/11.xsd" xmlns:ns3="http://www.garmin.com/xmlschemas/TrackPointExtension/v1" xmlns="http://www.topografix.com/GPX/1/1" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ns2="http://www.garmin.com/xmlschemas/GpxExtensions/v3"> <metadata> <link href="connect.garmin.com"> <text>Garmin Connect</text> </link> <time>2020-09-02T12:09:40.000Z</time> </metadata> <trk> <name>跑步机上跑步</name> <type>treadmill_running</type> <trkseg/> </trk> </gpx>

License

I saw you have LICENSE file in the project which is MIT license. But in the package.json the license is different:

"license": "UNLICENSED",

Would you please update the license so that people know how they are permitted to use it?

Deployment Tutorial

The deployment part is not friendly, especially a novice using the Github Action.

Data fetched from Nike seems incorrect

First of all, thanks for your lovely project. It really encourages me to run. But I find the data fetched from Nike seems incorrect.

Data Lost

The data from my Vercel-build website is as below, which presents that I have total run only 14 times and 24.4KM.
蜂蜜浏览器_Snipaste_2020-11-04_15-54-09

When I launch my Nike Running Club, however, it presents that I have total run 34 times and 41.72KM.
蜂蜜浏览器_6fc6a509e54ea9fb701527fd83dd6ad

After checking my data, I find 20 of them are lost. It has nothing to do with running time and distance.

Remained data's problem

As for those remained data, the distance and pace are also different from Nike's. Is the distance recalculated by Mapbox?

Cannot read property 'match' of undefined

debug发现keep的数据有些偏差,run.location_country可能为"None"值的情况,导致出现下述错误:

TypeError: Cannot read property 'match' of undefined
locationForRun
D:/github/running_page/src/utils/utils.js:49
  46 | }
  47 | const l = location.split(',');
  48 | // or to handle keep location format
> 49 | const countryMatch = l[l.length - 1].match(/[\u4e00-\u9fa5].*[\u4e00-\u9fa5]/) || l[2].match(/[\u4e00-\u9fa5].*[\u4e00-\u9fa5]/);
  50 | if (countryMatch) {
  51 |   [country] = countryMatch;
  52 | }
  
 D:/github/running_page/src/pages/index.jsx:29
  26 | const locationsList = [];
  27 | runs.forEach(
  28 |   (run) => {
> 29 |     const location = locationForRun(run);
  30 |     const periodName = titleForRun(run);
  31 |     if (periodName) {
  32 |       runPeriod[periodName] = runPeriod[periodName] === undefined ? 1 : runPeriod[periodName] + 1;

等宽字体

这些数据能不能弄成等宽字体,这看起来好难受呀
image

可以~ 我之后弄一下^_^

Show only running activities in garmin CN sync

    async def get_activities(self, start, limit):
        """
        Fetch available activities
        """
        url = f"{self.modern_url}/proxy/activitylist-service/activities/search/activities?start={start}&limit={limit}&activityType=running"
        return await self.fetch_data(url)

Just add activityType in garmin_sync.py

Text customize

There is some text on the page, but it is hard coding in your index.js.
The better way is to make it customizable by parsing markdown or reading from the config file.

But, I think Gatsby is not as convenient as next.js in terms of reading data.... so do you consider changing the page framework? 😳

Feat: multiple activities type

of course, running is the main activity for users, but it would be better to support more sports types.
As you can see, I've tried to get all my activities including the hike, ride, etc. displayed on the page, and I assign them different colors by the type.

This is not a necessary function, more discussion is needed.

Screen Shot 2020-12-03 at 11 57 06 AM

Feat: Color customization

You know, currently, we just have a main yellow color, I think there may be some requests for color customization from other users. It's easy to extract the color value to the config file, which is also convenient for us to expand in the future.

Keep sync for North American users?

Super cool project!

I was trying syncing my Keep data with the script but my mobile number is based in North American (area code +1), the LOGIN_API keeps returning 400 for my account...any chance you know if there's a different endpoint for North American accounts? Thanks!

隐私性考虑

这种数据如果放在网上可以公开访问的话 很大可能会被别人摸清个人的地理位置和活动轨迹,不太安全

i18n

As this project support globalized running app (Nike, Adidas and Strava), you should consider about involving i18n into this project

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.