GithubHelp home page GithubHelp logo

yihong0618 / running_page Goto Github PK

View Code? Open in Web Editor NEW
3.4K 40.0 976.0 69.07 MB

Make your own running home page

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

License: MIT License

JavaScript 0.28% Python 51.98% Dockerfile 0.59% TypeScript 37.96% HTML 0.08% CSS 9.10%
nike strava adidas gpx github-secret vercel garmin-watch garmin mapbox club-nike

running_page's Issues

i18n

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

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?

隐私性考虑

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

[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

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.

时间识别问题

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

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.

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?

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.

同步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://?
...

跑步机上的没有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>

Deployment Tutorial

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

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

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.

[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)

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.

[NEED FIX] GPX 中文报错问题

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

#81

等宽字体

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

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

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!

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;

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?

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.

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? 😳

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}”这个命令。目前卡在这一步,希望有人能帮忙解答。谢谢!

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

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

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.