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.

2 lines
3.6 KiB

(window.webpackJsonp=window.webpackJsonp||[]).push([[10],{1123:function(e,o,n){"use strict";n.r(o),n.d(o,"loadApp",(function(){return U}));var t=n(43),r=n.n(t),i=n(68),a=n.n(i),s=n(46),c=n(62),l=n(480),d=n(44),f=n(85),u=n(241),g=n(220),w=n(47),h=n(53),p=n(103),m=n(19);window.React=r.a;let _=null;function v(e){const o=Object(m.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://app.element.io/#/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 r=n[t];o+=r+"="+encodeURIComponent(e[r])}return o}function O(){const e=a.a.parse(window.location.href);e.search="";const o=a.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(d.h)(Object(d.b)("Missing indexeddb worker script!"));w.a.setIndexedDbWorkerScript(o),p.a.setConferenceHandler(l),window.addEventListener("hashchange",b);const n=c.a.get(),t=Object(m.a)(window.location),i=window.location.protocol+"//"+window.location.host+window.location.pathname;console.log("Vector starting at "+i),n.startUpdater();const a=await async function(){let e;try{console.log("Verifying homeserver configuration");const o=h.a.get();let n=o.default_server_config;const t=o.default_server_name,r=o.default_hs_url,i=o.default_is_url,a=[n,t,r].filter(e=>!!e);if(a.length>1)throw Object(d.h)(Object(d.b)("Invalid configuration: can only specify one of default_server_config, default_server_name, or default_hs_url."));if(a.length<1)throw Object(d.h)(Object(d.b)("Invalid configuration: no default server specified."));r&&(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:r}},i&&(n["m.identity_server"]={base_url:i}));let s=null;n&&(console.log("Config uses a default_server_config - validating object"),s=await u.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 u.a.findClientConfig(t)),e=f.b.buildValidatedConfigFromDiscovery(t,s,!0)}catch(o){const{hsUrl:n,isUrl:t,userId:r}=g.b();if(!n||!r)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 f.b.validateServerConfigWithStaticUrls(n,t,!0)}return e.isDefault=!0,console.log("Using homeserver config:",e),console.log("Updating SdkConfig with validated discovery information"),h.a.add({validated_server_config:e}),h.a.get()}(),_=s.getComponent("structures.MatrixChat");return r.a.createElement(_,{onNewScreen:C,makeRegistrationUrl:y,ConferenceHandler:l,config:a,realQueryParams:t,startingFragmentQueryParams:e,enableGuest:!a.disable_guests,onTokenLoginCompleted:O,initialScreenAfterLogin:v(window.location),defaultDeviceDisplayName:n.getDefaultDeviceDisplayName()})}}}]);
//# sourceMappingURL=riot-web-app.js.map