-
Notifications
You must be signed in to change notification settings - Fork 400
install flask-cors - enable in www/app.py #1266
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
Conversation
|
I added two more json endpoints for the web service. cgm - the xdripjs cgm pill json record hostname - the hostname of the rig. This is important for ensuring the calling application / script is accessing the correct rig and can display the rig hostname to the user. Since many use multiple rigs per person and multiple family members with rigs, it is important to know which rig the data is coming from. |
www/app.py
Outdated
|
|
||
| @app.route("/cgm") | ||
| def cgm(): | ||
| json_url = os.path.join("/root/myopenaps/monitor/xdripjs/cgm-pill.json") |
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.
This should use myopenaps_dir, not be hardcoded to the default path.
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.
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.
Good suggestions. I updated all hard-coded paths to use myopenaps_dir. Please take another look while I'm testing tonight.
scottleibrand
left a comment
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.
Other than the myopenaps_dir thing this LGTM. Has it received sufficient testing to merge to dev?
|
Tested out good for me. |
|
Yes, it's all working for me in my tests from my browsers on my laptop and from my phone. |
installing flask-cors module and enabling in app.py allows a web-based script (such as IOS shortcut to running javascript) to access the rig's local web server for retrieving JSON information such as BG records, IOB, COB, Temp Basal/Duration, Battery Percentage, etc.