Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

URLProcessor.js 1.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /* global config, interfaceConfig, getConfigParamsFromUrl */
  2. const logger = require("jitsi-meet-logger").getLogger(__filename);
  3. var configUtils = require('./Util');
  4. var params = {};
  5. params = getConfigParamsFromUrl();
  6. var URLProcessor = {
  7. setConfigParametersFromUrl: function () {
  8. // Convert 'params' to JSON object
  9. // We have:
  10. // {
  11. // "config.disableAudioLevels": false,
  12. // "config.channelLastN": -1,
  13. // "interfaceConfig.APP_NAME": "Jitsi Meet"
  14. // }
  15. // We want to have:
  16. // {
  17. // "config": {
  18. // "disableAudioLevels": false,
  19. // "channelLastN": -1
  20. // },
  21. // interfaceConfig: {
  22. // APP_NAME: "Jitsi Meet"
  23. // }
  24. // }
  25. var configJSON = {
  26. config: {},
  27. interfaceConfig: {}
  28. };
  29. for (var key in params) {
  30. if (typeof key !== "string") {
  31. logger.warn("Invalid config key: ", key);
  32. continue;
  33. }
  34. var confObj = null, confKey;
  35. if (key.indexOf("config.") === 0) {
  36. confObj = configJSON.config;
  37. confKey = key.substr("config.".length);
  38. // prevent passing some parameters which can inject scripts
  39. if (confKey === 'analyticsScriptUrls'
  40. || confKey === 'callStatsCustomScriptUrl')
  41. continue;
  42. } else if (key.indexOf("interfaceConfig.") === 0) {
  43. confObj = configJSON.interfaceConfig;
  44. confKey = key.substr("interfaceConfig.".length);
  45. }
  46. if (!confObj)
  47. continue;
  48. confObj[confKey] = params[key];
  49. }
  50. configUtils.overrideConfigJSON(config, interfaceConfig, configJSON);
  51. }
  52. };
  53. module.exports = URLProcessor;