Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[683] initial fix for Garmin upload error #687

Merged
merged 29 commits into from
Dec 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b9eb4c6
[683] initial fix for Garmin upload error
philosowaffle Nov 27, 2024
0f7f063
try fix pr check
philosowaffle Nov 27, 2024
7756fb2
try again
philosowaffle Nov 27, 2024
b51f574
try fix build
philosowaffle Nov 27, 2024
0b2f3b3
try this
philosowaffle Nov 27, 2024
a9dd94d
Update pr-check.yml
philosowaffle Nov 28, 2024
8cad3f9
Update pr-check.yml
philosowaffle Nov 28, 2024
307c9fb
Update pr-check.yml
philosowaffle Nov 28, 2024
6879593
Update pr-check.yml
philosowaffle Nov 28, 2024
9e9d2fa
Update pr-check.yml
philosowaffle Nov 28, 2024
3ac24c0
Update pr-check.yml
philosowaffle Nov 28, 2024
89e5803
Update pr-check.yml
philosowaffle Nov 28, 2024
8d91977
Update pr-check.yml
philosowaffle Nov 28, 2024
85461a1
Update pr-check.yml
philosowaffle Nov 28, 2024
dc4e15b
Update pr-check.yml
philosowaffle Nov 28, 2024
ffae7f6
Update pr-check.yml
philosowaffle Nov 28, 2024
f942bb5
Update pr-check.yml
philosowaffle Nov 28, 2024
4c532d8
Update pr-check.yml
philosowaffle Dec 5, 2024
df4c85e
Update pr-check.yml
philosowaffle Dec 5, 2024
afcdd35
Update pr-check.yml
philosowaffle Dec 5, 2024
6d66164
Update pr-check.yml
philosowaffle Dec 5, 2024
3af3ec6
Update action.yaml
philosowaffle Dec 6, 2024
d6071f2
Update action.yaml
philosowaffle Dec 6, 2024
5d7c977
make more settings tweakable
philosowaffle Dec 6, 2024
49ea0ae
polish ui a bit
philosowaffle Dec 7, 2024
c0b3e8f
pretty sure everything is working now
philosowaffle Dec 7, 2024
13eb350
update workflow
philosowaffle Dec 7, 2024
17ae3b3
more action fixes, maui sucks
philosowaffle Dec 7, 2024
18d9b09
update release notes
philosowaffle Dec 7, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/actions/publish-ui-dist/action.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ runs:
with:
dotnet-version: ${{ inputs.dotnet-version }}

- name: Restore MAUI Workloads
run: dotnet workload restore
shell: pwsh

- name: List MAUI Workloads
run: dotnet workload list
shell: pwsh
Expand Down
16 changes: 14 additions & 2 deletions .github/workflows/pr-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
matrix:
dotnet: ['7.0']
os: [windows-latest]
framework: ['net7.0-windows10.0.19041.0']

runs-on: ${{ matrix.os }}

Expand All @@ -23,6 +24,17 @@ jobs:
with:
dotnet-version: ${{ matrix.dotnet }}

- name: List SDKs
run: dotnet --list-sdks

- name: Restore MAUI Workloads
run: dotnet workload restore
shell: pwsh

- name: List MAUI Workloads
run: dotnet workload list
shell: pwsh

- name: Clean
run: dotnet clean --configuration Debug && dotnet nuget locals all --clear

Expand All @@ -41,7 +53,7 @@ jobs:
needs: build-and-test
strategy:
matrix:
dotnet: [ '7.0.401' ]
dotnet: [ '7.0.410' ]
framework: ['net7.0-windows10.0.19041.0']
os: [ 'win10-x64' ]

Expand Down Expand Up @@ -80,4 +92,4 @@ jobs:
tag: ${{ matrix.tag }}
secret_docker_username: ${{ secrets.DOCKER_USERNAME }}
secret_docker_password: ${{ secrets.DOCKER_PASSWORD }}
secret_github_package: ${{ secrets.GH_PACKAGE_SECRET}}
secret_github_package: ${{ secrets.GH_PACKAGE_SECRET}}
2 changes: 1 addition & 1 deletion .github/workflows/publish-latest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
runs-on: 'windows-latest'
strategy:
matrix:
dotnet: [ '7.0.400' ]
dotnet: [ '7.0.410' ]
framework: ['net7.0-windows10.0.19041.0']
os: [ 'win10-x64' ]

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
artifact_name: ${{ steps.win-ui-create-artifact.outputs.artifact_name }}
strategy:
matrix:
dotnet: [ '7.0.400' ]
dotnet: [ '7.0.410' ]
framework: ['net7.0-windows10.0.19041.0']
os: [ 'win10-x64' ]

Expand Down
1 change: 1 addition & 0 deletions PelotonToGarmin.sln
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".solution", ".solution", "{
.gitignore = .gitignore
configuration.example.json = configuration.example.json
deviceInfo.sample.xml = deviceInfo.sample.xml
global.json = global.json
README.md = README.md
vNextReleaseNotes.md = vNextReleaseNotes.md
EndProjectSection
Expand Down
5 changes: 5 additions & 0 deletions global.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"sdk": {
"version": "7.0.410"
}
}
19 changes: 17 additions & 2 deletions mkdocs/docs/configuration/garmin.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,21 @@ This Garmin Settings provide settings related to uploading workouts to Garmin.
"Password": "garmin",
"TwoStepVerificationEnabled": false,
"Upload": false,
"FormatToUpload": "fit"
"FormatToUpload": "fit",
"api": {
"ssoSignInUrl": "https://sso.garmin.com/sso/signin",
"ssoEmbedUrl": "https://sso.garmin.com/sso/embed",
"ssoMfaCodeUrl": "https://sso.garmin.com/sso/verifyMFA/loginEnterMfaCode",
"ssoUserAgent": "GCM-iOS-5.7.2.1",
"oAuth1TokenUrl": "https://connectapi.garmin.com/oauth-service/oauth/preauthorized",
"oAuth1LoginUrlParam": "https://sso.garmin.com/sso/embed&accepts-mfa-tokens=true",
"oAuth2RequestUrl": "https://connectapi.garmin.com/oauth-service/oauth/exchange/user/2.0",
"uploadActivityUrl": "https://connectapi.garmin.com/upload-service/upload",
"uploadActivityUserAgent": "GCM-iOS-5.7.2.1",
"uplaodActivityNkHeader": "NT",
"origin": "https://sso.garmin.com",
"referer": "https://sso.garmin.com/sso/signin"
}
}
```

Expand All @@ -37,4 +51,5 @@ This Garmin Settings provide settings related to uploading workouts to Garmin.
| Password | **yes - if Upload=true** | `null` | `Garmin Tab` | Your Garmin password used to sign in. **Note: Does not support `\` character in password** |
| TwoStepVerificationEnabled | no | `false` | `Garmin Tab` | Whether or not your Garmin account is protected by Two Step Verification |
| Upload | no | `false` | `Garmin Tab` | `true` indicates you wish downloaded Peloton workouts to be uploaded to Garmin Connect. |
| FormatToUpload | no | `fit` | `Garmin Tab > Advanced` | Valid values are `fit` or `tcx`. Ensure the format you specify here is also enabled in your [Format config](format.md) |
| FormatToUpload | no | `fit` | `Garmin Tab > Advanced` | Valid values are `fit` or `tcx`. Ensure the format you specify here is also enabled in your [Format config](format.md) |
| Api | no | See sample above | `Garmin Tab > Advanced > Garmin Api Settings` | Configures how P2G communicates with the Garmin Api. **Do not modify unless told to do so** |
7 changes: 6 additions & 1 deletion src/Api.Contract/SettingsContracts.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,8 @@
TwoStepVerificationEnabled = settings.Garmin.TwoStepVerificationEnabled,
FormatToUpload = settings.Garmin.FormatToUpload,
Upload = settings.Garmin.Upload,
IsPasswordSet = !string.IsNullOrEmpty(settings.Garmin.Password)
IsPasswordSet = !string.IsNullOrEmpty(settings.Garmin.Password),
Api = settings.Garmin.Api ?? new GarminApiSettings()
};
}

Expand All @@ -52,6 +53,7 @@
public bool TwoStepVerificationEnabled { get; set; }
public bool Upload { get; set; }
public FileFormat FormatToUpload { get; set; }
public GarminApiSettings Api { get; set; } = new GarminApiSettings();
}

public class SettingsGarminPostRequest
Expand All @@ -61,6 +63,7 @@
public bool TwoStepVerificationEnabled { get; set; }
public bool Upload { get; set; }
public FileFormat FormatToUpload { get; set; }
public GarminApiSettings Api { get; set; }

Check warning on line 66 in src/Api.Contract/SettingsContracts.cs

View workflow job for this annotation

GitHub Actions / build-and-test (7.0, windows-latest, net7.0-windows10.0.19041.0)

Non-nullable property 'Api' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.

Check warning on line 66 in src/Api.Contract/SettingsContracts.cs

View workflow job for this annotation

GitHub Actions / Publish UI Distribution (7.0.410, net7.0-windows10.0.19041.0, win10-x64)

Non-nullable property 'Api' must contain a non-null value when exiting constructor. Consider declaring the property as nullable.
}

public class SettingsPelotonGetResponse
Expand Down Expand Up @@ -118,6 +121,7 @@
TwoStepVerificationEnabled = response.TwoStepVerificationEnabled,
FormatToUpload = response.FormatToUpload,
Upload = response.Upload,
Api = response.Api,
};
}

Expand All @@ -130,6 +134,7 @@
TwoStepVerificationEnabled = request.TwoStepVerificationEnabled,
FormatToUpload = request.FormatToUpload,
Upload = request.Upload,
Api = request.Api,
};
}
}
9 changes: 9 additions & 0 deletions src/ClientUI/ClientUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
<Product>P2G ClientUI</Product>
</PropertyGroup>

<!--<PropertyGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">
<WindowsSdkPackageVersion>10.0.19041.52</WindowsSdkPackageVersion>
</PropertyGroup>-->

<ItemGroup>
<!-- App Icon -->
<MauiIcon Include="Resources\AppIcon\appicon.svg" ForegroundFile="Resources\AppIcon\appiconfg.svg" Color="#512BD4" />
Expand All @@ -60,6 +64,11 @@
<Content Remove="Resources\Raw\configuration.local.json" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.Web" Version="7.0.20" />
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\SharedUI\SharedUI.csproj" />
<ProjectReference Include="..\Api.Service\Api.Service.csproj" />
Expand Down
2 changes: 1 addition & 1 deletion src/Common/Constants.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,6 @@ public static class Constants
public const string WebUIName = "p2g_webui";
public const string ClientUIName = "p2g_clientui";

public const string AppVersion = "4.3.0";
public const string AppVersion = "4.3.1-rc";
}
}
25 changes: 24 additions & 1 deletion src/Common/Dto/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,30 @@ public class GarminSettings : ICredentials
public string Password { get; set; }
public bool TwoStepVerificationEnabled { get; set; }
public bool Upload { get; set; }
public FileFormat FormatToUpload { get; set; }
public FileFormat FormatToUpload { get; set; }
public GarminApiSettings Api { get; set; } = new GarminApiSettings();
}

public class GarminApiSettings
{
public string SsoSignInUrl { get; set; } = "https://sso.garmin.com/sso/signin";
public string SsoEmbedUrl { get; set; } = "https://sso.garmin.com/sso/embed";
public string SsoMfaCodeUrl { get; set; } = "https://sso.garmin.com/sso/verifyMFA/loginEnterMfaCode";
public string SsoUserAgent { get; set; } = "GCM-iOS-5.7.2.1";

public string OAuth1TokenUrl { get; set; } = "https://connectapi.garmin.com/oauth-service/oauth/preauthorized";
public string OAuth1LoginUrlParam { get; set; } = "https://sso.garmin.com/sso/embed&accepts-mfa-tokens=true";

public string OAuth2RequestUrl { get; set; } = "https://connectapi.garmin.com/oauth-service/oauth/exchange/user/2.0";

public string UploadActivityUrl { get; set; } = "https://connectapi.garmin.com/upload-service/upload";
public string UploadActivityUserAgent { get; set; } = "GCM-iOS-5.7.2.1";
public string UplaodActivityNkHeader { get; set; } = "NT";

public string Origin { get; set; } = "https://sso.garmin.com";
public string Referer { get; set; } = "https://sso.garmin.com/sso/signin";


}

public enum FileFormat : byte
Expand Down
Loading
Loading