Skip to content

Commit

Permalink
feat(UX): Show a warning when bruteforce protection is throttling
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Mar 26, 2024
1 parent b1c6fc3 commit 6fd87cb
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/services/participantsService.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@
*/

import axios from '@nextcloud/axios'
import {
showWarning
} from '@nextcloud/dialogs'
import {
generateOcsUrl,
} from '@nextcloud/router'
Expand Down Expand Up @@ -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)

Expand Down

0 comments on commit 6fd87cb

Please sign in to comment.