feat(webhooks): verify that url is accessible before saving it

This commit is contained in:
spiral 2021-11-25 16:45:00 -05:00
parent 0a244eb9b5
commit ece17f7470
No known key found for this signature in database
GPG key ID: A6059F0CA0E1BD31
2 changed files with 15 additions and 2 deletions

View file

@ -21,7 +21,7 @@ namespace PluralKit.Core
_provider = provider;
}
private async Task DoPostRequest(SystemId system, string webhookUrl, HttpContent content)
public async Task DoPostRequest(SystemId system, string webhookUrl, HttpContent content, bool isVerify = false)
{
if (!await DispatchExt.ValidateUri(webhookUrl))
{
@ -35,7 +35,10 @@ namespace PluralKit.Core
}
catch (HttpRequestException e)
{
_logger.Error("Could not dispatch webhook request!", e);
if (isVerify)
throw;
else
_logger.Error("Could not dispatch webhook request!", e);
}
}