您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

getRoomName.js 858B

1234567891011121314151617181920212223242526272829
  1. /* @flow */
  2. import { getBackendSafeRoomName } from '../util';
  3. declare var config: Object;
  4. /**
  5. * Builds and returns the room name.
  6. *
  7. * @returns {string}
  8. */
  9. export default function getRoomName(): ?string {
  10. const { getroomnode } = config;
  11. const path = window.location.pathname;
  12. let roomName;
  13. // Determine the room node from the URL.
  14. if (getroomnode && typeof getroomnode === 'function') {
  15. roomName = getroomnode.call(config, path);
  16. } else {
  17. // Fall back to the default strategy of making assumptions about how the
  18. // URL maps to the room (name). It currently assumes a deployment in
  19. // which the last non-directory component of the path (name) is the
  20. // room.
  21. roomName = path.substring(path.lastIndexOf('/') + 1) || undefined;
  22. }
  23. return getBackendSafeRoomName(roomName);
  24. }