mirror of
https://github.com/SchildiChat/element-web.git
synced 2024-10-01 01:26:12 -04:00
fix global.d.ts
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
4b6164d823
commit
b5318b4ebc
3
src/@types/global.d.ts
vendored
3
src/@types/global.d.ts
vendored
@ -14,9 +14,12 @@ See the License for the specific language governing permissions and
|
|||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
type ReactNode = import("react").ReactNode;
|
||||||
|
|
||||||
interface Window {
|
interface Window {
|
||||||
Olm: {
|
Olm: {
|
||||||
init: () => Promise<void>;
|
init: () => Promise<void>;
|
||||||
};
|
};
|
||||||
mxSendRageshake: (text: string, withLogs?: boolean) => void;
|
mxSendRageshake: (text: string, withLogs?: boolean) => void;
|
||||||
|
matrixChat: ReactNode;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,6 @@ import React from 'react';
|
|||||||
// access via the console
|
// access via the console
|
||||||
global.React = React;
|
global.React = React;
|
||||||
|
|
||||||
import ReactDOM from 'react-dom';
|
|
||||||
import * as sdk from 'matrix-react-sdk';
|
import * as sdk from 'matrix-react-sdk';
|
||||||
import PlatformPeg from 'matrix-react-sdk/src/PlatformPeg';
|
import PlatformPeg from 'matrix-react-sdk/src/PlatformPeg';
|
||||||
import * as VectorConferenceHandler from 'matrix-react-sdk/src/VectorConferenceHandler';
|
import * as VectorConferenceHandler from 'matrix-react-sdk/src/VectorConferenceHandler';
|
||||||
@ -235,11 +234,7 @@ export async function loadApp() {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const GenericErrorPage = sdk.getComponent("structures.GenericErrorPage");
|
const GenericErrorPage = sdk.getComponent("structures.GenericErrorPage");
|
||||||
window.matrixChat = ReactDOM.render(
|
return <GenericErrorPage message={errorMessage} title={_t("Your Riot is misconfigured")} />;
|
||||||
<GenericErrorPage message={errorMessage} title={_t("Your Riot is misconfigured")} />,
|
|
||||||
document.getElementById('matrixchat'),
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const validBrowser = checkBrowserFeatures();
|
const validBrowser = checkBrowserFeatures();
|
||||||
@ -249,31 +244,29 @@ export async function loadApp() {
|
|||||||
const urlWithoutQuery = window.location.protocol + '//' + window.location.host + window.location.pathname;
|
const urlWithoutQuery = window.location.protocol + '//' + window.location.host + window.location.pathname;
|
||||||
console.log("Vector starting at " + urlWithoutQuery);
|
console.log("Vector starting at " + urlWithoutQuery);
|
||||||
if (configError) {
|
if (configError) {
|
||||||
window.matrixChat = ReactDOM.render(<div className="error">
|
return <div className="error">
|
||||||
Unable to load config file: please refresh the page to try again.
|
Unable to load config file: please refresh the page to try again.
|
||||||
</div>, document.getElementById('matrixchat'));
|
</div>;
|
||||||
} else if (validBrowser || acceptInvalidBrowser) {
|
} else if (validBrowser || acceptInvalidBrowser) {
|
||||||
platform.startUpdater();
|
platform.startUpdater();
|
||||||
|
|
||||||
// Don't bother loading the app until the config is verified
|
try {
|
||||||
verifyServerConfig().then((newConfig) => {
|
// Don't bother loading the app until the config is verified
|
||||||
|
const config = await verifyServerConfig();
|
||||||
const MatrixChat = sdk.getComponent('structures.MatrixChat');
|
const MatrixChat = sdk.getComponent('structures.MatrixChat');
|
||||||
window.matrixChat = ReactDOM.render(
|
return <MatrixChat
|
||||||
<MatrixChat
|
onNewScreen={onNewScreen}
|
||||||
onNewScreen={onNewScreen}
|
makeRegistrationUrl={makeRegistrationUrl}
|
||||||
makeRegistrationUrl={makeRegistrationUrl}
|
ConferenceHandler={VectorConferenceHandler}
|
||||||
ConferenceHandler={VectorConferenceHandler}
|
config={config}
|
||||||
config={newConfig}
|
realQueryParams={params}
|
||||||
realQueryParams={params}
|
startingFragmentQueryParams={fragparts.params}
|
||||||
startingFragmentQueryParams={fragparts.params}
|
enableGuest={!config.disable_guests}
|
||||||
enableGuest={!SdkConfig.get().disable_guests}
|
onTokenLoginCompleted={onTokenLoginCompleted}
|
||||||
onTokenLoginCompleted={onTokenLoginCompleted}
|
initialScreenAfterLogin={getScreenFromLocation(window.location)}
|
||||||
initialScreenAfterLogin={getScreenFromLocation(window.location)}
|
defaultDeviceDisplayName={platform.getDefaultDeviceDisplayName()}
|
||||||
defaultDeviceDisplayName={platform.getDefaultDeviceDisplayName()}
|
/>;
|
||||||
/>,
|
} catch (err) {
|
||||||
document.getElementById('matrixchat'),
|
|
||||||
);
|
|
||||||
}).catch(err => {
|
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
|
||||||
let errorMessage = err.translatedMessage
|
let errorMessage = err.translatedMessage
|
||||||
@ -282,23 +275,17 @@ export async function loadApp() {
|
|||||||
|
|
||||||
// Like the compatibility page, AWOOOOOGA at the user
|
// Like the compatibility page, AWOOOOOGA at the user
|
||||||
const GenericErrorPage = sdk.getComponent("structures.GenericErrorPage");
|
const GenericErrorPage = sdk.getComponent("structures.GenericErrorPage");
|
||||||
window.matrixChat = ReactDOM.render(
|
return <GenericErrorPage message={errorMessage} title={_t("Your Riot is misconfigured")} />;
|
||||||
<GenericErrorPage message={errorMessage} title={_t("Your Riot is misconfigured")} />,
|
}
|
||||||
document.getElementById('matrixchat'),
|
|
||||||
);
|
|
||||||
});
|
|
||||||
} else {
|
} else {
|
||||||
console.error("Browser is missing required features.");
|
console.error("Browser is missing required features.");
|
||||||
// take to a different landing page to AWOOOOOGA at the user
|
// take to a different landing page to AWOOOOOGA at the user
|
||||||
const CompatibilityPage = sdk.getComponent("structures.CompatibilityPage");
|
const CompatibilityPage = sdk.getComponent("structures.CompatibilityPage");
|
||||||
window.matrixChat = ReactDOM.render(
|
return <CompatibilityPage onAccept={function() {
|
||||||
<CompatibilityPage onAccept={function() {
|
if (window.localStorage) window.localStorage.setItem('mx_accepts_unsupported_browser', true);
|
||||||
if (window.localStorage) window.localStorage.setItem('mx_accepts_unsupported_browser', true);
|
console.log("User accepts the compatibility risks.");
|
||||||
console.log("User accepts the compatibility risks.");
|
loadApp();
|
||||||
loadApp();
|
}} />;
|
||||||
}} />,
|
|
||||||
document.getElementById('matrixchat'),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,7 +371,6 @@ async function verifyServerConfig() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
validatedConfig.isDefault = true;
|
validatedConfig.isDefault = true;
|
||||||
|
|
||||||
// Just in case we ever have to debug this
|
// Just in case we ever have to debug this
|
||||||
|
@ -20,6 +20,7 @@ limitations under the License.
|
|||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
import olmWasmPath from "olm/olm.wasm";
|
import olmWasmPath from "olm/olm.wasm";
|
||||||
import Olm from 'olm';
|
import Olm from 'olm';
|
||||||
|
import * as ReactDOM from "react-dom";
|
||||||
|
|
||||||
import * as languageHandler from "matrix-react-sdk/src/languageHandler";
|
import * as languageHandler from "matrix-react-sdk/src/languageHandler";
|
||||||
import SettingsStore from "matrix-react-sdk/src/settings/SettingsStore";
|
import SettingsStore from "matrix-react-sdk/src/settings/SettingsStore";
|
||||||
@ -142,5 +143,5 @@ export async function loadApp() {
|
|||||||
/* webpackChunkName: "riot-web-app" */
|
/* webpackChunkName: "riot-web-app" */
|
||||||
/* webpackPreload: true */
|
/* webpackPreload: true */
|
||||||
"./app");
|
"./app");
|
||||||
await module.loadApp();
|
window.matrixChat = ReactDOM.render(await module.loadApp(), document.getElementById('matrixchat'));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user