跳转到主内容

Strava

非官方测试版翻译

本页面由 PageTurner AI 翻译(测试版)。未经项目官方认可。 发现错误? 报告问题 →

功能

Strava 是一款流行的运动追踪应用,支持骑行、跑步及其他训练活动。 为保持训练目标,及时获得提醒至关重要。 Oh My Posh 的 Strava 组件会显示您最近的运动记录, 并通过颜色变化提示是否该离开电脑去运动了。

访问 Strava 数据

授权 Oh My Posh 访问 Strava 数据需开启公开活动读取权限。 系统将生成访问令牌和刷新令牌,请将这些令牌粘贴至 Strava 组件配置中。

点击下方链接关联 Strava 账户:

关联 Strava

示例配置

此配置规则为:近两日内有运动时显示绿色背景, 近五日内有运动时显示橙色背景,否则显示红色背景。下方 foreground_templates 示例可设为单色, 只要该颜色在您的背景色下清晰可见即可。

{
"type": "strava",
"style": "powerline",
"powerline_symbol": "",
"foreground": "#ffffff",
"background": "#000000",
"background_templates": [
"{{ if gt .Hours 100 }}#dc3545{{ end }}",
"{{ if and (lt .Hours 100) (gt .Hours 50) }}#ffc107{{ end }}",
"{{ if lt .Hours 50 }}#28a745{{ end }}"
],
"foreground_templates": [
"{{ if gt .Hours 100 }}#FFFFFF{{ end }}",
"{{ if and (lt .Hours 100) (gt .Hours 50) }}#343a40{{ end }}",
"{{ if lt .Hours 50 }}#FFFFFF{{ end }}"
],
"template": "  {{.Name}} {{.Ago}} {{.Icon}} ",
"options": {
"access_token": "11111111111111111",
"refresh_token": "1111111111111111",
"http_timeout": 1500
}
}

选项

NameTypeDefaultDescription
access_tokentemplatetoken from Strava login, see login link in section above.
refresh_tokentemplatetoken from Strava login, see login link in section above.
expires_inint0the default timeout of the token from the Strava login
http_timeoutint20in milliseconds - how long do you want to wait before you want to see your prompt more than your strava data?
ride_iconstring\uf206
run_iconstring\ue213
skiing_iconstring\ue213
workout_iconstring\ue213
unknown_activity_iconstring\ue213

模板 (信息)

默认模板
 {{ if .Error }}{{ .Error }}{{ else }}{{ .Ago }}{{ end }}

属性

NameTypeDescription
.IDtimeThe id of the entry
.DateStringtimeThe timestamp of the entry
.TypestringActivity types as used in strava
.UtcOffsetintThe UTC offset
.HoursintNumber of hours since last activity
.NamestringThe name of the activity
.Durationfloat64Total duration in seconds
.Distancefloat64Total distance in meters
.DeviceWattsboolDevice has watts
.AverageWattsfloat64Average watts
.WeightedAverageWattsfloat64Weighted average watts
.AverageHeartRatefloat64Average heart rate
.MaxHeartRatefloat64Max heart rate
.KudosCountintKudos count
.IconstringActivity based icon

现在,出门享受骑行的乐趣或来场畅快奔跑吧!