mirror of
https://github.com/abraunegg/onedrive
synced 2024-06-08 08:52:15 +02:00
Catch errors from OneDrive when initialising subscriptions (#1846)
* Catch errors from OneDrive when initialising subscriptions
This commit is contained in:
parent
7ff077efd8
commit
76bd6e26a5
|
@ -745,22 +745,22 @@ webhook_enabled = "true"
|
|||
webhook_public_url = "<public-facing url to reach your webhook>"
|
||||
```
|
||||
|
||||
Setting `webhook_enabled` to `true` enables the webhook in 'monitor' mode. The onedrive process will listen for incoming updates at a configurable endpoint, which defaults to `0.0.0.0:8888`. The `webhook_public_url` must be set to an public-facing url for Microsoft to send updates to your webhook. If your host is directly exposed to the Internet, the `webhook_public_url` can be set to `http://<your_host>:8888/` to match the default endpoint. However, the recommended approach is to configure a reverse proxy like nginx.
|
||||
Setting `webhook_enabled` to `true` enables the webhook in 'monitor' mode. The onedrive process will listen for incoming updates at a configurable endpoint, which defaults to `0.0.0.0:8888`. The `webhook_public_url` must be set to an public-facing url for Microsoft to send updates to your webhook. If your host is directly exposed to the Internet, the `webhook_public_url` can be set to `http://<your_host_ip>:8888/` to match the default endpoint. However, the recommended approach is to configure a reverse proxy like nginx.
|
||||
|
||||
**Note:** A valid HTTPS certificate is required for your public-facing URL if using nginx.
|
||||
|
||||
For example, below is a nginx config snippet to proxy traffic into the webhook:
|
||||
|
||||
```
|
||||
http {
|
||||
server {
|
||||
listen 80;
|
||||
location /webhooks/onedrive {
|
||||
proxy_pass http://127.0.0.1:8888;
|
||||
}
|
||||
}
|
||||
server {
|
||||
listen 80;
|
||||
location /webhooks/onedrive {
|
||||
proxy_pass http://127.0.0.1:8888;
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
With nginx running, you can configure `webhook_public_url` to `http://<your_host>/webhooks/onedrive`.
|
||||
With nginx running, you can configure `webhook_public_url` to `https://<your_host>/webhooks/onedrive`.
|
||||
|
||||
### More webhook configuration options
|
||||
|
||||
|
|
|
@ -1004,7 +1004,17 @@ final class OneDriveApi
|
|||
"clientState": randomUUID().toString()
|
||||
];
|
||||
http.addRequestHeader("Content-Type", "application/json");
|
||||
JSONValue response = post(url, request.toString());
|
||||
JSONValue response;
|
||||
|
||||
try {
|
||||
response = post(url, request.toString());
|
||||
} catch (OneDriveException e) {
|
||||
displayOneDriveErrorMessage(e.msg, getFunctionName!({}));
|
||||
|
||||
// We need to exit here, user needs to fix issue
|
||||
log.error("ERROR: Unable to initialize subscriptions for updates. Please fix this issue.");
|
||||
exit(-1);
|
||||
}
|
||||
|
||||
// Save important subscription metadata including id and expiration
|
||||
subscriptionId = response["id"].str;
|
||||
|
|
Loading…
Reference in a new issue