Add webhook support#1626
Conversation
| You will be asked to open a specific URL by using your web browser where you will have to login into your Microsoft Account and give the application the permission to access your files. After giving permission to the application, you will be redirected to a blank page. Copy the URI of the blank page into the application. | ||
| ```text | ||
| [user@hostname ~]$ onedrive | ||
| [user@hostname ~]$ onedrive |
There was a problem hiding this comment.
My editor also removed a bunch of extra whitespaces. It is better to review this PR with the Hide whitespace changes option turned on (or by adding ?w=1 to the PR url)
|
@Lyncredible One question I do have, and it is not immediately visible, is the license for cgi.d. If you can format your readme.md in the new arsd folder as per https://github.com/abraunegg/onedrive/tree/master/src/notifications so that it can be easilly seen that cgi.d is Regarding the '*' -> '-' changes, if you can put those back please given that is the standard I have been using. Re the whitespace removal at the end of various lines - leave that one - that is on the whiteboard at the moment post #1494 being implemented, as there is a lot of extra whitespace that has crept in over the years. I would also add, under the main readme.md (given the removal of 'While local changes are uploaded right away ... ' text), add under 'Features' Supports webhooks to subscribe to remote change notifications - or whatever else is suitably valid. In terms of when this PR will be merged into 'master', most likely after #1494 is merged - so potentially you will need to think about a few updates based on those changes coming down the pipeline. I would PR merge this before that change, however, I am too far along the journey to stop, merge, backtrack then revisit all the language change code. This will give also folk the opportunity to test this PR to really bake / shake this out in it's current format as well. |
b73b853 to
156eb0e
Compare
That is a great suggestion. I have updated the readme file accordingly.
Alright, I have changed it back.
Cool. I will wait and see what to do after #1494 is merged.
I have already added a line
Sounds good to me! |
e323928 to
a2554eb
Compare
|
@Lyncredible Please Fix |
|
@Lyncredible |
|
@abraunegg Thanks for spotting the issue. I have created PR #1718 to address the deprecation warning. The fix can be seen in commit 5b89455. In short, we need The problem is deemed a bug and should be fixed in the compilers eventually. The singleton stuff could be undone when it is fixed. The root cause is described in the links below. |
|
This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Summary
This change adds webhook support to enable real-time syncing of remote updates. It takes advantage of the webhooks functionality provided by Microsoft. This fixes #1620.
How does it work
POST /subscriptionsendpoint.Code changes
onedrive.dcontains the bulk of logic to manage the local web server and to register/renew subscriptions with Microsoft. It is also responsible for processing incoming notification requests. When such requests are received, it sends signals to the main sync loop.main.dcontains the logic to process incoming signals and execute delta sync to fetch updates.cgi.dfrom adamdruppe/arsdconfig.dand also documented.Testing
Unfortunately I could only test this manually with a very straightforward setup: personal OneDrive account with no shared folders. More testing is welcome!
What is next
Currently the public-facing url has to be statically configured. This should work well for most users either with static public IP or with dynamic DNS services. We could consider adding UPnP support to allow dynamic configuration via automatic port forwarding.