From f8c6268c3a832a9ece83de8622abfb5e7f9b3932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elis=C3=A9e=20Maurer?= Date: Thu, 7 Jul 2016 05:06:55 +0200 Subject: [PATCH] Add back a loading page for server builds --- client/src/project/sidebar/header.ts | 4 ++-- client/src/serverBuild/index.jade | 10 ++++++++++ client/src/serverBuild/index.styl | 14 ++++++++++++++ server/commands/start.ts | 6 ++++++ 4 files changed, 32 insertions(+), 2 deletions(-) create mode 100644 client/src/serverBuild/index.jade create mode 100644 client/src/serverBuild/index.styl diff --git a/client/src/project/sidebar/header.ts b/client/src/project/sidebar/header.ts index b49ed532..69a26ea8 100644 --- a/client/src/project/sidebar/header.ts +++ b/client/src/project/sidebar/header.ts @@ -58,7 +58,7 @@ if (runButton.hidden || runButton.disabled) return; if (SupApp != null) { if (runWindow == null) { - runWindow = SupApp.openWindow(`${window.location.origin}/build.html`); + runWindow = SupApp.openWindow(`${window.location.origin}/serverBuild`); runWindow.setMenuBarVisibility(false); runWindow.on("closed", onCloseRunWindow); @@ -68,7 +68,7 @@ if (runButton.hidden || runButton.disabled) return; runWindow.focus(); stopButton.disabled = false; - } else window.open("/build.html", `player_${SupClient.query.project}`); + } else window.open("/serverBuild", `player_${SupClient.query.project}`); socket.emit("build:project", (err: string, buildId: string) => { if (err != null) { new SupClient.Dialogs.InfoDialog(err); return; } diff --git a/client/src/serverBuild/index.jade b/client/src/serverBuild/index.jade new file mode 100644 index 00000000..7db474ea --- /dev/null +++ b/client/src/serverBuild/index.jade @@ -0,0 +1,10 @@ +doctype html +html + head + title Superpowers + meta(charset="utf-8") + link(rel="stylesheet",href="/styles/reset.css") + link(rel="stylesheet",href="/serverBuild/index.css") + + body + header= t("common:states.loading") diff --git a/client/src/serverBuild/index.styl b/client/src/serverBuild/index.styl new file mode 100644 index 00000000..793ef8b1 --- /dev/null +++ b/client/src/serverBuild/index.styl @@ -0,0 +1,14 @@ +body { + display: flex; + flex-flow: column; + align-items: center; + justify-content: center; + padding: 2em; + background: #eee; +} + +header { + text-transform: uppercase; + font-size: 1.5em; + color: #888; +} diff --git a/server/commands/start.ts b/server/commands/start.ts index 19b461c1..4c8b64a7 100644 --- a/server/commands/start.ts +++ b/server/commands/start.ts @@ -93,6 +93,7 @@ export default function start(serverDataPath: string) { mainApp.get("/project", enforceAuth, serveProjectIndex); mainApp.get("/build", enforceAuth, serveBuildIndex); + mainApp.get("/serverBuild", enforceAuth, serveServerBuildIndex); mainApp.use("/projects/:projectId/*", serveProjectWildcard); mainApp.use("/", express.static(`${__dirname}/../../public`)); @@ -227,6 +228,11 @@ function serveBuildIndex(req: express.Request, res: express.Response) { res.sendFile(path.resolve(`${__dirname}/../../public/build/${localizedIndex}`)); } +function serveServerBuildIndex(req: express.Request, res: express.Response) { + const localizedIndex = getLocalizedFilename("index.html", req.cookies["supLanguage"]); + res.sendFile(path.resolve(`${__dirname}/../../public/serverBuild/${localizedIndex}`)); +} + function serveProjectWildcard(req: express.Request, res: express.Response) { const projectPath = hub.serversById[req.params.projectId].projectPath;