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.

1 line
3.6 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{1455:function(e,o,n){"use strict";n.r(o),function(e){n.d(o,"loadApp",(function(){return U}));var t=n(33),i=n.n(t),r=n(36),a=n(50),s=n(392),c=n(34),l=n(65),d=n(187),f=n(181),u=n(55),g=n.n(u),w=n(15),h=n(37),p=n(45),m=n(82);e.React=i.a;let _=null;function v(e){const o=Object(w.b)(e);return{screen:o.location.substring(1),params:o.params}}function b(e){decodeURIComponent(window.location.hash)!==_&&function(e){if(!window.matrixChat)return;console.log("Routing URL ",e.href);const o=v(e);window.matrixChat.showScreen(o.screen,o.params)}(window.location)}function C(e){console.log("newscreen "+e);const o="#/"+e;_=o,window.location.hash=o}function y(e){let o;o="vector:"===window.location.protocol?"https://riot.im/app/#/register":window.location.protocol+"//"+window.location.host+window.location.pathname+"#/register";const n=Object.keys(e);for(let t=0;t<n.length;++t){o+=0===t?"?":"&";const i=n[t];o+=i+"="+encodeURIComponent(e[i])}return o}function O(){const e=g.a.parse(window.location.href);e.search="";const o=g.a.format(e);console.log("Redirecting to "+o+" to drop loginToken from queryparams"),window.location.href=o}async function U(e){const o=document.body.dataset.vectorIndexeddbWorkerScript;if(!o)throw Object(c.h)(Object(c.b)("Missing indexeddb worker script!"));h.a.setIndexedDbWorkerScript(o),m.a.setConferenceHandler(s),window.addEventListener("hashchange",b);const n=a.a.get(),t=Object(w.a)(window.location),u=window.location.protocol+"//"+window.location.host+window.location.pathname;console.log("Vector starting at "+u),n.startUpdater();const g=await async function(){let e;try{console.log("Verifying homeserver configuration");const o=p.a.get();let n=o.default_server_config;const t=o.default_server_name,i=o.default_hs_url,r=o.default_is_url,a=[n,t,i].filter(e=>!!e);if(a.length>1)throw Object(c.h)(Object(c.b)("Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url."));if(a.length<1)throw Object(c.h)(Object(c.b)("Invalid configuration: no default server specified."));i&&(console.log("Config uses a default_hs_url - constructing a default_server_config using this information"),console.warn("DEPRECATED CONFIG OPTION: In the future, default_hs_url will not be accepted. Please use default_server_config instead."),n={"m.homeserver":{base_url:i}},r&&(n["m.identity_server"]={base_url:r}));let s=null;n&&(console.log("Config uses a default_server_config - validating object"),s=await d.a.fromDiscoveryConfig(n)),t&&(console.log("Config uses a default_server_name - doing .well-known lookup"),console.warn("DEPRECATED CONFIG OPTION: In the future, default_server_name will not be accepted. Please use default_server_config instead."),s=await d.a.findClientConfig(t)),e=l.b.buildValidatedConfigFromDiscovery(t,s,!0)}catch(o){const{hsUrl:n,isUrl:t,userId:i}=f.b();if(!n||!i)throw o;console.error(o),console.warn("A session was found - suppressing config error and using the session's homeserver"),console.log("Using pre-existing hsUrl and isUrl: ",{hsUrl:n,isUrl:t}),e=await l.b.validateServerConfigWithStaticUrls(n,t,!0)}return e.isDefault=!0,console.log("Using homeserver config:",e),console.log("Updating SdkConfig with validated discovery information"),p.a.add({validated_server_config:e}),p.a.get()}(),_=r.getComponent("structures.MatrixChat");return i.a.createElement(_,{onNewScreen:C,makeRegistrationUrl:y,ConferenceHandler:s,config:g,realQueryParams:t,startingFragmentQueryParams:e,enableGuest:!g.disable_guests,onTokenLoginCompleted:O,initialScreenAfterLogin:v(window.location),defaultDeviceDisplayName:n.getDefaultDeviceDisplayName()})}}.call(this,n(17))}}]);