You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

ConferenceUrl.js 2.6KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. const logger = require("jitsi-meet-logger").getLogger(__filename);
  2. import { replace } from '../util/helpers';
  3. /**
  4. * The modules stores information about the URL used to start the conference and
  5. * provides utility methods for dealing with conference URL and reloads.
  6. */
  7. export default class ConferenceUrl {
  8. /**
  9. * Initializes the module.
  10. *
  11. * @param location an object which stores provides the info about conference
  12. * URL(would be 'window.location' for the Web app). The params below are
  13. * described based on the following example URL:
  14. *
  15. * https://example.com:8888/SomeConference1245?opt=1#somehash
  16. *
  17. * @param location.href full URL with all parameters, would be the whole URL
  18. * from the example string above.
  19. *
  20. * @param location.host the host part of the URL, 'example.com' from
  21. * the sample URL above.
  22. *
  23. * @param location.pathname the path part of the URL, would be
  24. * '/SomeConference1245' from the example above.
  25. *
  26. * @param location.protocol the protocol part of the URL, would be 'https:'
  27. * from the sample URL.
  28. */
  29. constructor(location) {
  30. /**
  31. * Stores the original conference room URL with all parameters.
  32. * Example:
  33. * https://example.com:8888/SomeConference1245?jwt=a5sbc2#blablahash
  34. * @type {string}
  35. */
  36. this.originalURL = location.href;
  37. /**
  38. * A simplified version of the conference URL stripped out of
  39. * the parameters which should be used for sending invites.
  40. * Example:
  41. * https://example.com:8888/SomeConference1245
  42. * @type {string}
  43. */
  44. this.inviteURL
  45. = location.protocol + "//" + location.host + location.pathname;
  46. logger.info("Stored original conference URL: " + this.originalURL);
  47. logger.info("Conference URL for invites: " + this.inviteURL);
  48. }
  49. /**
  50. * Obtains the conference invite URL.
  51. * @return {string} the URL pointing o the conference which is mean to be
  52. * used to invite new participants.
  53. */
  54. getInviteUrl() {
  55. return this.inviteURL;
  56. }
  57. /**
  58. * Obtains full conference URL with all original parameters.
  59. * @return {string} the original URL used to open the current conference.
  60. */
  61. getOriginalUrl() {
  62. return this.originalURL;
  63. }
  64. /**
  65. * Reloads the conference using original URL with all of the parameters.
  66. */
  67. reload() {
  68. logger.info("Reloading the conference using URL: " + this.originalURL);
  69. replace(this.originalURL);
  70. }
  71. }