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 eb628ad093
commit 839b23f87a
No known key found for this signature in database
GPG Key ID: 403C2657CD994F73
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):

View File

@ -174,7 +174,7 @@
"mode_settings_share_autostop_sharing_checkbox": "Stop sharing after files have been sent (uncheck to allow downloading individual files)",
"mode_settings_receive_data_dir_label": "Save files to",
"mode_settings_receive_data_dir_browse_button": "Browse",
"mode_settings_receive_webhook_url_checkbox": "Use webhook URL",
"mode_settings_receive_webhook_url_checkbox": "Use notification webhook",
"mode_settings_website_disable_csp_checkbox": "Don't send Content Security Policy header (allows your website to use third-party resources)",
"gui_all_modes_transfer_finished_range": "Transferred {} - {}",
"gui_all_modes_transfer_finished": "Transferred {}",