Skip to content
This repository has been archived by the owner on Mar 5, 2021. It is now read-only.

Commit

Permalink
Add back a loading page for server builds
Browse files Browse the repository at this point in the history
  • Loading branch information
elisee committed Jul 7, 2016
1 parent e69662b commit f8c6268
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 2 deletions.
4 changes: 2 additions & 2 deletions client/src/project/sidebar/header.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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; }
Expand Down
10 changes: 10 additions & 0 deletions client/src/serverBuild/index.jade
Original file line number Diff line number Diff line change
@@ -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")
14 changes: 14 additions & 0 deletions client/src/serverBuild/index.styl
Original file line number Diff line number Diff line change
@@ -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;
}
6 changes: 6 additions & 0 deletions server/commands/start.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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`));
Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit f8c6268

Please sign in to comment.