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.

URLProcessor.js 1.6KB

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