forked from sgml/lucee-electron
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
39 lines (36 loc) · 1.11 KB
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Your App Name</title>
<script>if (typeof module === 'object') {window.module = module; module = undefined;}</script>
<script>if (window.module) module = window.module;</script>
</head>
<body>
Please wait while the application loads.
</body>
<script>
// Ping the server until it starts, once it does, open it
var commandbox_port = global.location.search;
commandbox_port = commandbox_port.replace("?port=", "");
var pingUrl = `http://localhost:${commandbox_port}`;
var errorCount = 0;
setInterval(ping, 1000);
function ping() {
if (errorCount > 600) {
//shouldnt take longer than 10min, something wrong
document.body.innerText="Unable to start commandbox";
return;
}
fetch(pingUrl).then(function(response) {
if (response.status == 200) {
window.location.href = pingUrl;
} else {
errorCount++;
}
}).catch(function(err) {
errorCount++;
});
}
</script>
</html>