-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathloader.html
67 lines (61 loc) · 2.74 KB
/
loader.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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="expires" content="0">
<meta http-equiv="cache-control" content="no-cache">
<title>SIMRacingApps</title>
</head>
<body style="margin:0; width:100%; height:100%; z-index: -1">
<h1 id="sratitle">SIMRacingApps</h1><br />
<span id="version" class="version"></span><br />
<div id="copyright" class="copyright"></div><br />
<div id="userpath" class="userpath"></div><br />
<div id="storage" class="storage"></div><br />
<div id='main' style='white-space: nowrap'><b>
This window must stay open.<br />
You can resize and move it and it will remember that.<br />
Minimize it to minimize all Apps.<br />
Restore it to restore all Apps.<br />
Go to View -> Reload to reload all Apps.<br />
Close it to close all Apps.<br /><br />
Press Ctrl-R while an App is in the foreground to reload that App.<br />
<h2>Loading Apps...</h2>
</b></div>
<script type="text/javascript">
const ipc = require('electron').ipcRenderer;
var vars = window.location.search.substring(1).split('&');
var hostname = 'localhost';
var port = 80;
for (var i = 0; i < vars.length; i++) {
var pair = vars[i].split('=');
if (decodeURIComponent(pair[0]) == "hostname") {
hostname = decodeURIComponent(pair[1]);
}
else
if (decodeURIComponent(pair[0]) == "port") {
port = pair[1];
}
}
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (xhttp.readyState == 4 && xhttp.status == 200) {
// Action to be performed when the document is read;
var listings = JSON.parse(xhttp.responseText);
document.getElementById("version").innerHTML = 'Version: '+listings.version.major + '.' + listings.version.minor + '-' + listings.version.build;
document.getElementById("copyright").innerHTML = listings.version.copyright;
document.getElementById("userpath").innerHTML = 'UserPath: '+listings.version.userpath;
ipc.send('loadApps',listings);
}
};
xhttp.open("GET", "http://"+hostname + ":" + port+"/SIMRacingApps/listings", true);
xhttp.send();
ipc.on('storage',function(e,value) {
document.getElementById('storage').innerHTML = 'Storage Location: ' + value;
});
ipc.on('loadingApps',function(e,app) {
document.getElementById('main').innerHTML = document.getElementById('main').innerHTML + '<br />' + app;
});
</script>
</body>
</html>