summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-03-25 17:30:54 +0100
committerJoas Schilling <coding@schilljs.com>2024-03-26 08:36:00 +0100
commit6fd87cb3d411123f789b8b0ec767fe5c7f6583d3 (patch)
tree98d0eb876d1a0473b3b016afada18468018f3380 /src
parentb1c6fc3ebd35242b8e1770219e3d15caa5a81ae8 (diff)
feat(UX): Show a warning when bruteforce protection is throttling
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'src')
-rw-r--r--src/services/participantsService.js17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/services/participantsService.js b/src/services/participantsService.js
index 9ffa14d62..eaf65da3f 100644
--- a/src/services/participantsService.js
+++ b/src/services/participantsService.js
@@ -22,6 +22,9 @@
import axios from '@nextcloud/axios'
import {
+ showWarning
+} from '@nextcloud/dialogs'
+import {
generateOcsUrl,
} from '@nextcloud/router'
@@ -48,6 +51,20 @@ const joinConversation = async ({ token, forceJoin = false }, options) => {
force: forceJoin,
}, options)
+ if (response.headers.get('X-Nextcloud-Bruteforce-Throttled')) {
+ console.error(
+ 'Remote address is bruteforce throttled: '
+ + response.headers.get('X-Nextcloud-Bruteforce-Throttled')
+ + ' (Request ID: ' + response.headers.get('X-Request-ID') + ')'
+ )
+ const throttleMs = parseInt(response.headers.get('X-Nextcloud-Bruteforce-Throttled'), 10)
+ if (throttleMs > 5000) {
+ showWarning(
+ t('spreed', 'Your requests are throttled at the moment due to brute force protection')
+ )
+ }
+ }
+
// FIXME Signaling should not be synchronous
await signalingJoinConversation(token, response.data.ocs.data.sessionId)