-
-
Notifications
You must be signed in to change notification settings - Fork 148
feat: add MyFitnessPal integration and external provider settings UI #1088
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
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
a5716ed
fix(infra): migrate logging and garmin sync to typescript
serjsv87 9980d65
feat: add MyFitnessPal integration and settings UI
serjsv87 389051a
refactor: remove unused telegramBotService integration from server en…
serjsv87 8dca5f3
fix: remove accidental Telegram export from shared index
serjsv87 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -490,12 +490,66 @@ export const EditProviderForm = ({ | |
| <Clipboard className="h-4 w-4" /> | ||
| </Button> | ||
| </strong> | ||
| and ensuring your local URL is correct if testing locally. Note: | ||
| Strava callback URL on the server is configured to: | ||
| <strong>{`${window.location.origin}/strava/callback`}</strong> | ||
| </p> | ||
| </> | ||
| )} | ||
| {editData.provider_type === 'myfitnesspal' && ( | ||
| <> | ||
| {/* Show connection status for connected MyFitnessPal accounts instead of credential fields */} | ||
| {provider.app_id && provider.app_key ? ( | ||
| <div className="bg-green-50 dark:bg-green-900/20 border border-green-200 dark:border-green-800 rounded-lg p-4"> | ||
| <div className="flex items-center gap-2 text-green-700 dark:text-green-400"> | ||
| <div className="h-2 w-2 bg-green-500 rounded-full"></div> | ||
| <span className="font-medium">Connected to MyFitnessPal</span> | ||
| </div> | ||
| <p className="text-sm text-muted-foreground mt-2"> | ||
| Your MyFitnessPal account is connected. To reconnect with | ||
| different credentials, disconnect first and add a new provider. | ||
| </p> | ||
| </div> | ||
| ) : ( | ||
| <> | ||
| <div> | ||
| <Label>MFP CSRF Token (x-csrf-token)</Label> | ||
| <Input | ||
| type="text" | ||
| value={editData.app_id || ''} | ||
| onChange={(e) => | ||
| setEditData((prev) => ({ | ||
| ...prev, | ||
| app_id: e.target.value, | ||
| })) | ||
| } | ||
| placeholder="Paste x-csrf-token from Network tab" | ||
| autoComplete="off" | ||
| /> | ||
| </div> | ||
| <div> | ||
| <Label>MFP Session Cookies</Label> | ||
| <Input | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| type="text" | ||
| value={editData.app_key || ''} | ||
| onChange={(e) => | ||
| setEditData((prev) => ({ | ||
| ...prev, | ||
| app_key: e.target.value, | ||
| })) | ||
| } | ||
| placeholder="Paste full Cookie string from Network tab" | ||
| autoComplete="off" | ||
| /> | ||
| </div> | ||
| <p className="text-sm text-muted-foreground col-span-2"> | ||
| <strong>How to find:</strong> Open MyFitnessPal in browser, | ||
| press F12 (Network tab), find a request to{' '} | ||
| <code>www.myfitnesspal.com</code>, and copy <code>Cookie</code>{' '} | ||
| and <code>x-csrf-token</code> from Request Headers. | ||
| </p> | ||
| </> | ||
| )} | ||
| </> | ||
| )} | ||
| {editData.provider_type === 'hevy' && ( | ||
| <> | ||
| <div> | ||
|
|
@@ -523,7 +577,8 @@ export const EditProviderForm = ({ | |
| editData.provider_type === 'fitbit' || | ||
| editData.provider_type === 'strava' || | ||
| editData.provider_type === 'polar' || | ||
| editData.provider_type === 'hevy') && ( | ||
| editData.provider_type === 'hevy' || | ||
| editData.provider_type === 'myfitnesspal') && ( | ||
| <div> | ||
| <Label htmlFor="edit_sync_frequency">Sync Frequency</Label> | ||
| <Select | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,4 @@ | ||
| import React from 'react'; | ||
| import { Input } from '@/components/ui/input'; | ||
| import { Label } from '@/components/ui/label'; | ||
| import { Button } from '@/components/ui/button'; | ||
|
|
@@ -28,6 +29,7 @@ export const ProviderSpecificFields = ({ | |
| const needsAppId = [ | ||
| 'nutritionix', | ||
| 'fatsecret', | ||
| 'edamam', | ||
| 'withings', | ||
| 'fitbit', | ||
| 'strava', | ||
|
|
@@ -38,6 +40,7 @@ export const ProviderSpecificFields = ({ | |
| 'tandoor', | ||
| 'nutritionix', | ||
| 'fatsecret', | ||
| 'edamam', | ||
| 'usda', | ||
| 'withings', | ||
| 'fitbit', | ||
|
|
@@ -146,6 +149,43 @@ export const ProviderSpecificFields = ({ | |
| </> | ||
| )} | ||
|
|
||
| {provider.provider_type === 'myfitnesspal' && ( | ||
| <> | ||
| <div> | ||
| <Label htmlFor="add-mfp-csrf">MFP CSRF Token (x-csrf-token)</Label> | ||
| <Input | ||
| id="add-mfp-csrf" | ||
| type="text" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| value={provider.app_id || ''} | ||
| onChange={(e) => | ||
| setProvider((prev) => ({ ...prev, app_id: e.target.value })) | ||
| } | ||
| placeholder="Paste x-csrf-token from Network tab" | ||
| autoComplete="off" | ||
| /> | ||
| </div> | ||
| <div> | ||
| <Label htmlFor="add-mfp-cookies">MFP Session Cookies</Label> | ||
| <Input | ||
| id="add-mfp-cookies" | ||
| type="text" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| value={provider.app_key || ''} | ||
| onChange={(e) => | ||
| setProvider((prev) => ({ ...prev, app_key: e.target.value })) | ||
| } | ||
| placeholder="Paste full Cookie string from Network tab" | ||
| autoComplete="off" | ||
| /> | ||
| </div> | ||
| <p className="text-sm text-muted-foreground col-span-2"> | ||
| <strong>How to find:</strong> Open MyFitnessPal in browser, press | ||
| F12 (Network tab), find a request to{' '} | ||
| <code>www.myfitnesspal.com</code>, and copy <code>Cookie</code> and{' '} | ||
| <code>x-csrf-token</code> from Request Headers. | ||
| </p> | ||
| </> | ||
| )} | ||
|
|
||
| {['withings', 'fitbit', 'strava', 'polar'].includes( | ||
| provider.provider_type || '' | ||
| ) && ( | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The input field for the MyFitnessPal CSRF token is using
type="text", which leaves sensitive session-level credentials visible on the screen. It is recommended to usetype="password"to prevent shoulder surfing and improve security.