Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
s1smart committed Feb 5, 2024
2 parents 37bd6e3 + c30a060 commit 9829ac5
Show file tree
Hide file tree
Showing 68 changed files with 935 additions and 241 deletions.
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ module.exports = {
extends: [
'eslint:recommended',
'plugin:react/recommended',
'plugin:react/jsx-runtime',
'plugin:prettier/recommended',
],
overrides: [],
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ jobs:
matrix:
python-version: ['3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
id: setup_python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
Expand Down
15 changes: 8 additions & 7 deletions .github/workflows/gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,14 @@ jobs:
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# if your default branches is not master, please change it here
ref: master

- name: Cache Data Files
if: inputs.save_data_in_github_cache
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
activities
Expand All @@ -71,9 +71,9 @@ jobs:
${{ inputs.data_cache_prefix }}-
- name: Setup Node.js environment
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: '18'
node-version: '20'

- uses: pnpm/action-setup@v2
name: Install pnpm
Expand All @@ -87,7 +87,7 @@ jobs:
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
- uses: actions/cache@v4
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
Expand All @@ -101,10 +101,11 @@ jobs:
run: PATH_PREFIX=/${{ github.event.repository.name }} pnpm build

- name: Upload artifact
uses: actions/upload-pages-artifact@v1
uses: actions/upload-pages-artifact@v2
with:
# Upload dist repository
path: './dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1
uses: actions/deploy-pages@v3

16 changes: 13 additions & 3 deletions .github/workflows/run_data_sync.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ on:

env:
# please change to your own config.

RUN_TYPE: strava # support strava/nike/garmin/garmin_cn/keep/only_gpx/only_fit/nike_to_strava/strava_to_garmin/strava_to_garmin_cn/garmin_to_strava/garmin_to_strava_cn/codoon, Please change the 'pass' it to your own
ATHLETE: 太空战士
TITLE: 太空战士
Expand Down Expand Up @@ -49,11 +50,11 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Python
id: setup_python
uses: actions/setup-python@v4
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: pip
Expand All @@ -65,7 +66,7 @@ jobs:
- name: Cache Data Files
if: env.SAVE_DATA_IN_GITHUB_CACHE == 'true'
uses: actions/cache@v3
uses: actions/cache@v4
with:
path: |
activities
Expand Down Expand Up @@ -125,6 +126,15 @@ jobs:
# If you only want to sync `type running` add args --only-run, default script is to sync all data (rides and runs).
# python run_page/garmin_sync.py ${{ secrets.GARMIN_SECRET_STRING_CN }} --only-run --is-cn

- name: Run sync Garmin CN to Garmin script
if: env.RUN_TYPE == 'garmin_sync_cn_global'
run: |
# make garimin secret string `python run_page/garmin_sync_cn_global.py ${email} ${password} --is-cn
python run_page/garmin_sync_cn_global.py ${{ secrets.GARMIN_SECRET_STRING_CN }} ${{ secrets.GARMIN_SECRET_STRING }}
# If you only want to sync `type running` add args --only-run, default script is to sync all data (rides and runs).
# python run_page/garmin_sync_cn_global.py ${{ secrets.GARMIN_SECRET_STRING_CN }} ${{ secrets.GARMIN_SECRET_STRING }} --only-run


- name: Run sync Only GPX script
if: env.RUN_TYPE == 'only_gpx'
run: |
Expand Down
9 changes: 4 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@ RUN npm config set registry https://registry.npm.taobao.org \
FROM develop-py AS data
ARG app
ARG nike_refresh_token
ARG email
ARG password
ARG secret_string
ARG client_id
ARG client_secret
ARG refresh_token
Expand All @@ -39,9 +38,9 @@ RUN DUMMY=${DUMMY}; \
if [ "$app" = "NRC" ] ; then \
python3 run_page/nike_sync.py ${nike_refresh_token}; \
elif [ "$app" = "Garmin" ] ; then \
python3 run_page/garmin_sync.py ${email} ${password}; \
python3 run_page/garmin_sync.py ${secret_string} ; \
elif [ "$app" = "Garmin-CN" ] ; then \
python3 run_page/garmin_sync.py ${email} ${password} --is-cn ; \
python3 run_page/garmin_sync.py ${secret_string} --is-cn ; \
elif [ "$app" = "Strava" ] ; then \
python3 run_page/strava_sync.py ${client_id} ${client_secret} ${refresh_token};\
elif [ "$app" = "Nike_to_Strava" ] ; then \
Expand All @@ -60,5 +59,5 @@ COPY --from=data /root/running_page /root/running_page
RUN pnpm run build

FROM nginx:alpine AS web
COPY --from=frontend-build /root/running_page/public /usr/share/nginx/html/
COPY --from=frontend-build /root/running_page/dist /usr/share/nginx/html/
COPY --from=frontend-build /root/running_page/assets /usr/share/nginx/html/assets
51 changes: 48 additions & 3 deletions README-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,9 @@ R.I.P. 希望大家都能健康顺利的跑过终点,逝者安息。
| [deepinwine](https://github.com/deepinwine) | <https://deepin.autove.dev/> | Garmin-cn |
| [Jeffggmm](https://github.com/Jeffggmm) | <https://jeffggmm.github.io/workouts_page/> | Garmin |
| [s1smart](https://github.com/s1smart) | <https://s1smart.github.io/running_page/> | Strava |

| [Ryan](https://github.com/85Ryan) | <https://85ryan.github.io/gooorun/> | Strava |
| [PPZ](https://github.com/8824PPZ) | <https://run.dudubbbbbbbbb.top/> | Strava |
| [Yer1k](https://github.com/Yer1k) | <https://running.yer1k.com/> | Strava |
</details>

## 它是怎么工作的
Expand Down Expand Up @@ -136,6 +138,7 @@ R.I.P. 希望大家都能健康顺利的跑过终点,逝者安息。
- **[GPX](#gpx)**
- **[TCX](#tcx)**
- **[FIT](#fit)**
- **[佳明国内同步国际](#Garmin-CN-to-Garmin)**
- **[Tcx+Strava(upload all tcx data to strava)](#tcx_to_strava)**
- **[Gpx+Strava(upload all tcx data to strava)](#gpx_to_strava)**
- **[Nike+Strava(Using NRC Run, Strava backup data)](#nikestrava)**
Expand Down Expand Up @@ -230,6 +233,11 @@ siteMetadata: {
const USE_DASH_LINE = true;
// styling: 透明度:[0, 1]
const LINE_OPACITY = 0.4;
// styling: 开启隐私模式(不显示地图仅显示轨迹): 设置为 `true`
// 注意:此配置仅影响页面显示,数据保护请参考下方的 "隐私保护"
const PRIVACY_MODE = false;
// styling: 默认关灯: 设置为 `false`, 仅在隐私模式关闭时生效(`PRIVACY_MODE` = false)
const LIGHTS_ON = true;
```

> 隐私保护:设置下面环境变量:
Expand Down Expand Up @@ -569,6 +577,43 @@ python3(python) run_page/garmin_sync.py xxxxxxxxxx --is-cn --only-run

</details>

### Garmin-CN to Garmin

<details>
<summary> 同步佳明 CN 数据到 佳明国际区</summary>

<br>

- 如果你只想同步 `type running` 使用参数 --only-run
**The Python version must be >=3.10**

#### 获取佳明 CN 的密钥

在终端中输入以下命令

```bash
python3(python) run_page/get_garmin_secret.py ${your email} ${your password} --is-cn
```

#### 获取佳明全球的密钥

在终端中输入以下命令

```bash
python3(python) run_page/get_garmin_secret.py ${your email} ${your password}
```

#### 同步 佳明 CN 到 佳明全球

在终端中输入以下命令

```bash
python3(python) run_page/garmin_sync_cn_global.py ${garmin_cn_secret_string} ${garmin_secret_string}
```

</details>


### Nike Run Club

<details>
Expand Down Expand Up @@ -912,11 +957,11 @@ python3(python) run_page/gen_svg.py --from-db --type circular --use-localtime
4. 为 GitHub Actions 添加代码提交权限,访问仓库的 `Settings > Actions > General`页面,找到 `Workflow permissions` 的设置项,将选项配置为 `Read and write permissions`,支持 CI 将运动数据更新后提交到仓库中。


5. 如果想把你的 running_page 部署在 xxx.github.io 而不是 xxx.github.io/run_page,需要做三点
5. 如果想把你的 running_page 部署在 xxx.github.io 而不是 xxx.github.io/run_page 亦或是想要添加自定义域名于 GitHub Pages,需要做三点

- 修改你的 fork 的 running_page 仓库改名为 xxx.github.io, xxx 是你 github 的 username
- 修改 gh-pages.yml 中的 Build 模块,删除 `${{ github.event.repository.name }}` 改为`run: PATH_PREFIX=/ pnpm build` 即可
- src/static/site-metadata.ts 中 `siteUrl: ''` 即可
- 修改 src/static/site-metadata.ts 中 `siteUrl: ''` 或是添加你的自定义域名,`siteUrl: '[your_own_domain]'` 即可

</details>

Expand Down
63 changes: 58 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,10 @@ English | [简体中文](https://github.com/yihong0618/running_page/blob/master/
| [Echo](https://github.com/donghao526) | <https://donghao526.github.io/running> | JoyRun |
| [Jeffggmm](https://github.com/Jeffggmm) | <https://jeffggmm.github.io/workouts_page/> | Garmin |
| [s1smart](https://github.com/s1smart) | <https://s1smart.github.io/running_page/> | Strava |

| [XmchxUp](https://github.com/XmchxUp) | <https://xmchxup.github.io/running_page/> | Strava |
| [Ryan](https://github.com/85Ryan) | <https://85ryan.github.io/gooorun/> | Strava |
| [PPZ](https://github.com/8824PPZ) | <https://run.dudubbbbbbbbb.top/> | Strava |
| [Yer1k](https://github.com/Yer1k) | <https://running.yer1k.com/> | Strava |
</details>

## How it works
Expand Down Expand Up @@ -120,6 +123,7 @@ English | [简体中文](https://github.com/yihong0618/running_page/blob/master/
- **[GPX](#gpx)**
- **[TCX](#tcx)**
- **[FIT](#fit)**
- **[Garmin-CN_to_Garmin(Sync Garmin-CN activities to Garmin Global)](#garmin-cn-to-garmin)**
- **[Nike_to_Strava(Using NRC Run, Strava backup data)](#nike_to_strava)**
- **[Tcx_to_Strava(upload all tcx data to strava)](#tcx_to_strava)**
- **[Gpx_to_Strava(upload all gpx data to strava)](#gpx_to_strava)**
Expand Down Expand Up @@ -213,6 +217,18 @@ siteMetadata: {
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.

```typescript
const USE_GOOGLE_ANALYTICS = false;
const GOOGLE_ANALYTICS_TRACKING_ID = '';
```

> privacy protection,setting flowing env:
Expand Down Expand Up @@ -371,6 +387,45 @@ python3(python) run_page/garmin_sync.py xxxxxxxxxxxxxx(secret_string) --is-cn -

</details>

### Garmin-CN to Garmin

<details>
<summary> Sync your <code>Garmin-CN</code> data to <code>Garmin</code></summary>

<br>

- 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

```bash
# 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

```bash
# 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

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

</details>

### Nike Run Club

<details>
Expand Down Expand Up @@ -722,13 +777,11 @@ For more display effects, see:

4. make sure you have write permissions in Workflow permissions settings.



5. If you want to deploy your running_page to xxx.github.io instead of xxx.github.io/running_page, you need to do three things:
5. 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: ''
- In `src/static/site-metadata.ts`, set siteUrl: '' or your custom domain URL

</details>

Expand Down
2 changes: 1 addition & 1 deletion assets/github.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/github_2023.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions assets/github_2024.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion assets/grid.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions assets/index.tsx
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export const yearStats = import.meta.glob('./year_*.svg', { import: 'ReactComponent' })
export const totalStat = import.meta.glob(['./github.svg', './grid.svg'], { import: 'ReactComponent' })
2 changes: 1 addition & 1 deletion assets/year_2023.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 9829ac5

Please sign in to comment.