Improve webhook label in GUI, improve webhook message that gets POSTed, and display webhook errors without verbose mode

This commit is contained in:
Micah Lee 2021-04-12 09:08:47 -07:00
parent 3a0d8bc4d4
commit 2e2e775125
2 changed files with 7 additions and 7 deletions

View file

@ -108,7 +108,11 @@ class ReceiveModeWeb:
and not request.upload_error
and len(files) > 0
):
self.send_webhook_notification(f"{len(files)} files uploaded")
if len(files) == 1:
file_msg = "1 file"
else:
file_msg = f"{len(files)} files"
self.send_webhook_notification(f"{file_msg} uploaded to OnionShare")
if request.upload_error:
self.common.log(
@ -191,11 +195,7 @@ class ReceiveModeWeb:
proxies=self.web.proxies,
)
except Exception as e:
self.common.log(
"ReceiveModeWeb",
"send_webhook_notification",
f"sending failed: {e}",
)
print(f"Webhook notification failed: {e}")
class ReceiveModeWSGIMiddleware(object):