diff --git a/www/css/index.css b/www/css/index.css
index b9603c5..280afc5 100644
--- a/www/css/index.css
+++ b/www/css/index.css
@@ -1,3 +1,7 @@
.navbar-brand {
font-size: 150%;
+}
+
+.mainbox {
+ margin-top: 1rem;
}
\ No newline at end of file
diff --git a/www/index.html b/www/index.html
index 9143f71..d8d2db0 100644
--- a/www/index.html
+++ b/www/index.html
@@ -8,7 +8,29 @@
+
\ No newline at end of file
+
+
+
+
+
+
Setup
+
+
+
+
+
+
+
+
+
Finish Setup
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/www/js/index.js b/www/js/index.js
new file mode 100644
index 0000000..4559ffe
--- /dev/null
+++ b/www/js/index.js
@@ -0,0 +1,79 @@
+var inCordova = false;
+var inNwjs = false;
+var setupMode = false;
+var serverUrl = "";
+var apiKey = "";
+
+
+function loadSetupMode() {
+ $("#setupbtn").click(function () {
+ var url = $("#serverurl").val();
+ if (url == "") {
+ url = "https://pcinfo.netsyms.com/api";
+ }
+ var key = $("#apikey").val();
+ if (key == "") {
+ alert("Please enter a valid API key.");
+ return;
+ }
+
+ $.getJSON(url, {
+ key: key,
+ action: 'ping'
+ }, function (resp) {
+ if (typeof resp['status'] != 'undefined') {
+ if (resp['status'] == 'ERROR') {
+ alert("Error: " + resp['message']);
+ return;
+ } else if (resp['status'] == 'OK') {
+ localStorage.setItem('server', url);
+ localStorage.setItem('apikey', key);
+ alert("Setup complete.");
+ document.location.href = "index.html";
+ } else {
+ alert("Invalid reply from server.");
+ }
+ } else {
+ alert("Invalid reply from server.");
+ }
+ }).fail(function (xhr) {
+ try {
+ var resp = JSON.parse(xhr.responseText);
+ if (typeof resp['status'] != 'undefined' && resp['status'] == 'ERROR') {
+ alert("Error: " + resp['message']);
+ } else {
+ alert("Error connecting to server.");
+ }
+ } catch (ex) {
+ alert("Error connecting to server.");
+ }
+ });
+ });
+
+ $("#setupmode").removeClass("d-none");
+}
+
+function loadUserMode() {
+ $("#usermode").removeClass("d-none");
+}
+
+
+document.addEventListener("deviceready", function () {
+ inCordova = true;
+});
+
+$(document).ready(function () {
+ if (typeof nw !== 'undefined') {
+ inNwjs = true;
+ }
+
+ if (localStorage.getItem('server') === null || localStorage.getItem('apikey') === null) {
+ setupMode = true;
+ }
+
+ if (setupMode) {
+ loadSetupMode();
+ } else {
+ loadUserMode();
+ }
+});
\ No newline at end of file