TeaWeb/loader/app/bootstrap.ts

99 lines
3.0 KiB
TypeScript
Raw Normal View History

2021-03-18 17:59:06 +00:00
import "core-js/stable";
import "./polifill";
import "./css";
import { ApplicationLoader } from "./loader/loader";
import { getUrlParameter } from "./loader/Utils";
2021-03-18 17:59:06 +00:00
/* let the loader register himself at the window first */
const target = getUrlParameter("loader-target") || "app";
console.info("Loading app with loader \"%s\"", target);
let appLoader: ApplicationLoader;
if (target === "empty") {
2021-03-18 17:59:06 +00:00
appLoader = new (require("./targets/empty").default);
} else if (target === "manifest") {
2021-03-18 17:59:06 +00:00
appLoader = new (require("./targets/maifest-target").default);
} else {
appLoader = new (require("./targets/app").default);
}
setTimeout(() => appLoader.execute(), 0);
export { };
2021-03-18 17:59:06 +00:00
if (__build.target === "client") {
2021-03-18 17:59:06 +00:00
/* do this so we don't get a react dev tools warning within the client */
if (!('__REACT_DEVTOOLS_GLOBAL_HOOK__' in window)) {
(window as Window).__REACT_DEVTOOLS_GLOBAL_HOOK__ = {};
2021-03-18 17:59:06 +00:00
}
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.inject = function () { };
2021-03-18 17:59:06 +00:00
}
/* Hello World message */
{
const clog = console.log;
const print_security = () => {
{
const css = [
"display: block",
"text-align: center",
"font-size: 42px",
"font-weight: bold",
"-webkit-text-stroke: 2px black",
"color: red"
].join(";");
clog("%c ", "font-size: 100px;");
clog("%cSecurity warning:", css);
}
{
const css = [
"display: block",
"text-align: center",
"font-size: 18px",
"font-weight: bold"
].join(";");
clog("%cPasting anything in here could give attackers access to your data.", css);
clog("%cUnless you understand exactly what you are doing, close this window and stay safe.", css);
clog("%c ", "font-size: 100px;");
}
};
/* print the hello world */
{
const css = [
"display: block",
"text-align: center",
"font-size: 72px",
"font-weight: bold",
"-webkit-text-stroke: 2px black",
"color: #18BC9C"
].join(";");
clog("%cHey, hold on!", css);
}
{
const css = [
"display: block",
"text-align: center",
"font-size: 26px",
"font-weight: bold"
].join(";");
const css_2 = [
"display: block",
"text-align: center",
"font-size: 26px",
"font-weight: bold",
"color: blue"
].join(";");
const display_detect = /./;
display_detect.toString = function () { print_security(); return ""; };
2021-03-18 17:59:06 +00:00
clog("%cLovely to see you using and debugging the TeaSpeak-Web client.", css);
clog("%cIf you have some good ideas or already done some incredible changes,", css);
clog("%cyou'll be may interested to share them here: %chttps://github.com/TeaSpeak/TeaWeb", css, css_2);
clog("%c ", display_detect);
}
}