Skip to content

Commit 1896959

Browse files
committed
feat(UX): Show a warning when bruteforce protection is throttling
Signed-off-by: Joas Schilling <[email protected]>
1 parent b1c6fc3 commit 1896959

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/services/participantsService.js

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import axios from '@nextcloud/axios'
2424
import {
2525
generateOcsUrl,
2626
} from '@nextcloud/router'
27+
import { showWarning } from '@nextcloud/dialogs'
2728

2829
import { PARTICIPANT } from '../constants.js'
2930
import {
@@ -48,6 +49,16 @@ const joinConversation = async ({ token, forceJoin = false }, options) => {
4849
force: forceJoin,
4950
}, options)
5051

52+
if (response.headers.get('X-Nextcloud-Bruteforce-Throttled')) {
53+
console.error('Remote address is bruteforce throttled: ' + response.headers.get('X-Nextcloud-Bruteforce-Throttled'))
54+
const throttleMs = parseInt(response.headers.get('X-Nextcloud-Bruteforce-Throttled'), 10)
55+
if (throttleMs > 5000) {
56+
showWarning(
57+
t('spreed', 'Your requests are throttled at the moment due to brute force protection')
58+
)
59+
}
60+
}
61+
5162
// FIXME Signaling should not be synchronous
5263
await signalingJoinConversation(token, response.data.ocs.data.sessionId)
5364

0 commit comments

Comments
 (0)