Skip to content

Commit

Permalink
[683] fix for Garmin upload error (#687)
Browse files Browse the repository at this point in the history
* [683] initial fix for Garmin upload error

* try fix pr check

* try again

* try fix build

* try this

* Update pr-check.yml

* Update pr-check.yml

* Update pr-check.yml

* Update pr-check.yml

* Update pr-check.yml

* Update pr-check.yml

* Update pr-check.yml

* Update pr-check.yml

* Update pr-check.yml

* Update pr-check.yml

* Update pr-check.yml

* Update pr-check.yml

* Update pr-check.yml

* Update pr-check.yml

* Update pr-check.yml

* Update pr-check.yml

* Update action.yaml

* Update action.yaml

* make more settings tweakable

* polish ui a bit

* pretty sure everything is working now

* update workflow

* more action fixes, maui sucks

* update release notes
  • Loading branch information
philosowaffle authored Dec 7, 2024
1 parent a65ed4d commit 18f6b08
Show file tree
Hide file tree
Showing 18 changed files with 306 additions and 120 deletions.
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 @@ public SettingsGetResponse(Settings settings)
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 class SettingsGarminGetResponse
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 class SettingsGarminPostRequest
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 / 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 @@ public static SettingsGarminPostRequest Map(this SettingsGarminGetResponse respo
TwoStepVerificationEnabled = response.TwoStepVerificationEnabled,
FormatToUpload = response.FormatToUpload,
Upload = response.Upload,
Api = response.Api,
};
}

Expand All @@ -130,6 +134,7 @@ public static GarminSettings Map(this SettingsGarminPostRequest request)
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

0 comments on commit 18f6b08

Please sign in to comment.