Browse Source

fix(connection): Detects tenant hyphen and length problems and show notification.

factor2
damencho 11 months ago
parent
commit
6af4d182d0
2 changed files with 19 additions and 1 deletions
  1. 3
    0
      lang/main.json
  2. 16
    1
      react/features/base/conference/middleware.any.ts

+ 3
- 0
lang/main.json View File

754
         "gifsMenu": "GIPHY",
754
         "gifsMenu": "GIPHY",
755
         "groupTitle": "Notifications",
755
         "groupTitle": "Notifications",
756
         "hostAskedUnmute": "The moderator would like you to speak",
756
         "hostAskedUnmute": "The moderator would like you to speak",
757
+        "invalidTenant": "Invalid tenant",
758
+        "invalidTenantHyphenDescription": "The tenant you are using is invalid (starts or ends with '-').",
759
+        "invalidTenantLengthDescription": "The tenant you are using is too long.",
757
         "invitedOneMember": "{{name}} has been invited",
760
         "invitedOneMember": "{{name}} has been invited",
758
         "invitedThreePlusMembers": "{{name}} and {{count}} others have been invited",
761
         "invitedThreePlusMembers": "{{name}} and {{count}} others have been invited",
759
         "invitedTwoMembers": "{{first}} and {{second}} have been invited",
762
         "invitedTwoMembers": "{{first}} and {{second}} have been invited",

+ 16
- 1
react/features/base/conference/middleware.any.ts View File

38
 import MiddlewareRegistry from '../redux/MiddlewareRegistry';
38
 import MiddlewareRegistry from '../redux/MiddlewareRegistry';
39
 import StateListenerRegistry from '../redux/StateListenerRegistry';
39
 import StateListenerRegistry from '../redux/StateListenerRegistry';
40
 import { TRACK_ADDED, TRACK_REMOVED } from '../tracks/actionTypes';
40
 import { TRACK_ADDED, TRACK_REMOVED } from '../tracks/actionTypes';
41
+import { parseURIString } from '../util/uri';
41
 
42
 
42
 import {
43
 import {
43
     CONFERENCE_FAILED,
44
     CONFERENCE_FAILED,
421
     }
422
     }
422
 
423
 
423
     if (error.name === JitsiConnectionErrors.CONFERENCE_REQUEST_FAILED) {
424
     if (error.name === JitsiConnectionErrors.CONFERENCE_REQUEST_FAILED) {
425
+        let notificationAction: Function = showNotification;
424
         const notificationProps = {
426
         const notificationProps = {
425
             customActionNameKey: [ 'dialog.rejoinNow' ],
427
             customActionNameKey: [ 'dialog.rejoinNow' ],
426
             customActionHandler: [ () => dispatch(reloadNow()) ],
428
             customActionHandler: [ () => dispatch(reloadNow()) ],
427
             descriptionKey: 'notify.connectionFailed'
429
             descriptionKey: 'notify.connectionFailed'
428
         } as INotificationProps;
430
         } as INotificationProps;
429
 
431
 
430
-        dispatch(showNotification(notificationProps, NOTIFICATION_TIMEOUT_TYPE.STICKY));
432
+        const { locationURL = { href: '' } as URL } = getState()['features/base/connection'];
433
+        const { tenant } = parseURIString(locationURL.href) || {};
434
+
435
+        if (tenant.startsWith('-') || tenant.endsWith('-')) {
436
+            notificationProps.descriptionKey = 'notify.invalidTenantHyphenDescription';
437
+            notificationProps.titleKey = 'notify.invalidTenant';
438
+            notificationAction = showErrorNotification;
439
+        } else if (tenant.length > 63) {
440
+            notificationProps.descriptionKey = 'notify.invalidTenantLengthDescription';
441
+            notificationProps.titleKey = 'notify.invalidTenant';
442
+            notificationAction = showErrorNotification;
443
+        }
444
+
445
+        dispatch(notificationAction(notificationProps, NOTIFICATION_TIMEOUT_TYPE.STICKY));
431
     }
446
     }
432
 
447
 
433
     const result = next(action);
448
     const result = next(action);

Loading…
Cancel
Save