NightscoutFoundation / xDrip

Nightscout version of xDrip+
https://jamorham.github.io/#xdrip-plus
GNU General Public License v3.0
1.41k stars 1.15k forks source link

Disable Nightscout upload back to data source #3627

Closed Navid200 closed 1 month ago

Navid200 commented 3 months ago

Consider xDrip used as a Nightscout follower. If the user accidentally sets up xDrip to upload to the same Nightscout site, xDrip will accept. The only reason this does not cause a disaster is that Mongo fortunately issues a non-destructive error message.
But, the upload is a waste of bandwidth. This PR disables Nightscout upload in that scenario.

The log that is issued is shown in the following image at the top.
Screenshot_20240814-204811

Navid200 commented 3 months ago

I'm sorry for the auto format. The indentations were so confusing!

I have added a notification so that this cannot happen without the user knowing. This is what the notifiacation looks like: Screenshot_20240815-082334 Screenshot_20240815-082407 Screenshot_20240815-082502

Navid200 commented 3 months ago

This is really all of the change to NightscoutUploader other than the two imports: Screenshot 2024-08-15 084037

Navid200 commented 1 month ago

If someone wants to upload treatments to Nightscout both from the master and follower, this may be the only way.
I have to do some tests on this. So, I may have overlooked that scenario.

Navid200 commented 1 month ago

Even though this is good for not allowing a user to unintentionally upload to a Nightscout host that they are downloading from, it would disable a required feature.

A Nightscout follower cannot upload treatments. The only way to do that is to set up xDrip to also be an uploader.
Since Mongodb tolerates collisions (overwrites), this is not an issue.
I wish there was an easy way to avoid uploading the redundant readings in this case. But, other than adding the ability to upload treatments to Nightscout follower, I don't see how.

So, I am closing this.