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

Commit

Permalink
Merge branch 'dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
domschiener committed Aug 28, 2016
2 parents 2deade9 + 9cc98ab commit ef5141c
Show file tree
Hide file tree
Showing 19 changed files with 335 additions and 565 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

## Prerequisites

1. Download NodeJS:

[NodeJS](https://nodejs.org/en/download/)
1. Download [NodeJS](https://nodejs.org/en/download/)

2. Install [Electron](http://electron.atom.io):

Expand Down Expand Up @@ -35,10 +33,12 @@
3. Clone repositories:

```
https://github.com/iotaledger/wallet
git clone https://github.com/iotaledger/wallet
git clone https://github.com/iotaledger/iri
```

Note: iri project does not exist yet -- make an IRI directory manually and place IRI.jar in it.

4. Install components

```
Expand Down
6 changes: 0 additions & 6 deletions app/alerts/init_error.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,9 @@ <h3>Server Ouput:</h3>
<p>Easy solution: Download 64-bit java.</p>
</div>
</div>
<div id="edit-configuration-content">
<h3>Edit Configuration File:</h3>
<textarea rows="6" class="form-control" id="server_config"></textarea>
<p style="margin-top:5px;color: #777;">Make sure IP addresses are in the form of <strong>+udp://ip:14265</strong></p>
</div>
</div>
</div>
<div id="footer">
<button class="btn btn-danger btn-pull-right" id="edit-configuration-file" style="display:none">Edit Config File</button>
<button class="btn btn-danger btn-pull-right" id="download-java" style="display:none">Download 64-bit Java</button>
<button class="btn btn-primary btn-pull-right" id="restart-btn">Restart</button>
<button class="btn btn-default btn-pull-right" id="quit-btn">Quit</button>
Expand Down
35 changes: 1 addition & 34 deletions app/alerts/js/init_error.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,16 @@ var UI = (function(UI, undefined) {
UI.initialize = function() {
document.getElementById("quit-btn").addEventListener("click", function(e) {
document.getElementById("quit-btn").disabled = true;
if (document.getElementById("edit-configuration-content").style.display == "block") {
UI.saveServerConfig(document.getElementById("server_config").value);
}
electron.ipcRenderer.send("quit");
});
document.getElementById("restart-btn").addEventListener("click", function(e) {
document.getElementById("restart-btn").disabled = true;
if (document.getElementById("edit-configuration-content").style.display == "block") {
UI.saveServerConfig(document.getElementById("server_config").value);
UI.relaunchApplication();
} else {
UI.relaunchApplication(String(document.getElementById("java_parameters").value).trim());
}
UI.relaunchApplication(String(document.getElementById("java_parameters").value).trim());
});
document.getElementById("download-java").addEventListener("click", function(e) {
document.getElementById("download-java").disabled = true;
UI.showNoJavaInstalledWindow();
});
document.getElementById("edit-configuration-file").addEventListener("click", function(e) {
document.getElementById("edit-configuration-file").style.display = "none";
document.getElementById("edit-configuration-content").style.display = "block";
document.getElementById("default-content").style.display = "none";
document.getElementById("quit-btn").innerHTML = "Save and Quit";
document.getElementById("restart-btn").innerHTML = "Save and Restart";

electron.remote.getCurrentWindow().setContentSize(600, parseInt(document.documentElement.scrollHeight, 10) + parseInt(document.getElementById("footer").scrollHeight, 10), false);
});
}

UI.showContextMenu = function(e) {
Expand Down Expand Up @@ -78,18 +61,10 @@ var UI = (function(UI, undefined) {
log = "No server output.";
}

if (log.match(/Illegal character in authority|hostname|UnresolvedAddressException|illegalargument|URISyntaxException|NumberFormatException|SocketException/i)) {
document.getElementById("edit-configuration-file").style.display = "block";
}

document.getElementById("server_output").value = log;
//document.getElementById("server_output").scrollTop = document.getElementById("server_output").scrollHeight;
}

if (params.serverConfig) {
document.getElementById("server_config").value = params.serverConfig;
}

if (params.javaArgs) {
document.getElementById("java_parameters").value = params.javaArgs;
}
Expand All @@ -109,10 +84,6 @@ var UI = (function(UI, undefined) {
}, 20);
}

UI.saveServerConfig = function(serverConfig) {
electron.ipcRenderer.send("updateServerConfiguration", serverConfig);
}

UI.relaunchApplication = function(javaArgs) {
electron.ipcRenderer.send("relaunchApplication", (javaArgs ? javaArgs : -1));
}
Expand All @@ -121,10 +92,6 @@ var UI = (function(UI, undefined) {
electron.ipcRenderer.send("showNoJavaInstalledWindow", {"downloadImmediatelyIfWindows": true});
}

UI.showConfigurationFile = function() {
electron.ipcRenderer.send("openServerFolder", "IRI.cfg");
}

return UI;
}(UI || {}));

Expand Down
2 changes: 1 addition & 1 deletion app/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,7 @@ body.new-user-active #new-user {
color: #696969;
}

.neighbors-activity-modal .contents {
.peers-modal .contents {
max-height: 450px;
overflow: none;
overflow-y: auto;
Expand Down
123 changes: 14 additions & 109 deletions app/js/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,12 @@ var UI = (function(UI, undefined) {
return false;
},false);

webview.addEventListener('drop',function(e) {
webview.addEventListener('drop',function(e, b) {
if (e.dataTransfer && e.dataTransfer.files && e.dataTransfer.files[0] && e.dataTransfer.files[0].path) {
if (String(e.dataTransfer.files[0].path).match(/IRI.*\.jar$/i)) {
electron.ipcRenderer.send("upgradeIRI", e.dataTransfer.files[0].path);
}
}
e.preventDefault();
return false;
},false);
Expand Down Expand Up @@ -232,8 +237,8 @@ var UI = (function(UI, undefined) {

UI.updateStatusBar = function(data) {
/*
if (data.hasOwnProperty("activeNeighbors")) {
document.getElementById("status-bar-neighbors").innerHTML = data.activeNeighbors + " active neighbors";
if (data.hasOwnProperty("activePeers")) {
document.getElementById("status-bar-peers").innerHTML = data.activePeers + " active peers";
}
*/

Expand Down Expand Up @@ -387,85 +392,6 @@ var UI = (function(UI, undefined) {
modal.open();
}

UI.addNeighborNode = function(node) {
if (showQuitAlert) {
return;
}

UI.hideAlerts();

var modal = new tingle.modal({
footer: true,
onOpen: function() {
var close = document.querySelector(".tingle-modal__close");
var modalContent = document.querySelector(".tingle-modal-box__content");
modalContent.appendChild(close);
}
});

modal.setContent("<h1>Add Neighbor Node</h1>" +
"<p>Are you sure you want to add this node to your server configuration?</p>" +
"<p style='font-weight:bold'>" + String(node).escapeHTML() + "</p>");

modal.addFooterBtn("Yes, Add This Node", "tingle-btn tingle-btn--primary", function() {
modal.close();
electron.ipcRenderer.send("addNeighborNode", node);
});

modal.addFooterBtn("No, Cancel", "tingle-btn tingle-btn--default", function() {
modal.close();
});

modal.open();
}

UI.editServerConfiguration = function(configuration) {
if (showQuitAlert) {
return;
}

UI.hideAlerts();

var modal = new tingle.modal({
footer: true,
onOpen: function() {
var close = document.querySelector(".tingle-modal__close");
var modalContent = document.querySelector(".tingle-modal-box__content");
modalContent.appendChild(close);

var el = document.getElementById("server_config_tx_fetch_intensity_gap");

var temp = el.value;
el.value = "";
el.value = temp;
el.focus();
}
});

modal.setContent("<h1>Server Config</h1>" +
"<div class='input-group'><label>Transactions to Fetch Gap (ms):</label>" +
"<input type='number' min='0' step='1' name='tx_fetch_intensity_gap' id='server_config_tx_fetch_intensity_gap' placeholder='' value='" + (configuration.txFetchIntensityGap ? String(configuration.txFetchIntensityGap).escapeHTML() : "1000") + "' /></div>" +
"<div class='input-group'><label># Cores (POW):</label>" +
"<input type='number' min='1' step='1' name='nr_of_cores' id='server_config_nr_of_cores' placeholder='' value='" + (configuration.nrOfCores ? String(configuration.nrOfCores).escapeHTML() : "1") + "' /></div>" +
"<div class='input-group input-group'><label>Neighboring Nodes:</label>" +
"<textarea name='neighboring_nodes' id='server_config_neighboring_nodes' style='width:100%;height:150px;'>" + String(configuration.nodes).escapeHTML() + "</textarea></div>" +
"<div class='input-group input-group-last'><label class='label--checkbox'><input type='checkbox' name='babysit' id='server_config_babysit' class='checkbox' value='1'" + (configuration.babysit ? " checked='checked'" : "") + " />Babysit the network</label></div>");

modal.addFooterBtn("Save", "tingle-btn tingle-btn--primary", function() {
var config = {};
config.txFetchIntensityGap = parseInt(document.getElementById("server_config_tx_fetch_intensity_gap").value, 10);
config.nrOfCores = parseInt(document.getElementById("server_config_nr_of_cores").value, 10);
config.nodes = document.getElementById("server_config_neighboring_nodes").value;
config.babysit = document.getElementById("server_config_babysit").checked;

modal.close();

electron.ipcRenderer.send("updateServerConfiguration", config);
});

modal.open();
}

UI.showUpdateAvailable = function() {
UI.showAlert("<h1>Update Available</h1><p>An update is available and is being downloaded.</p>");
}
Expand Down Expand Up @@ -648,36 +574,23 @@ var UI = (function(UI, undefined) {
}
}

UI.setConfig = function(lines) {
if (webviewIsLoaded && webview) {
webview.send("setConfig", lines);
}
}

UI.handleURL = function(url) {
UI.hideAlerts();

url = decodeURI(url.replace("iota://", "").toLowerCase().replace(/\/$/, ""));

if (url == "config" || url == "configuration" || url == "setup") {
electron.ipcRenderer.send("editServerConfiguration");
} else if (url == "log") {
if (url == "log") {
electron.ipcRenderer.send("showServerLog");
} else if (url == "nodeinfo" || url == "node") {
UI.sendToWebview("showNodeInfo");
} else if (url == "neighbors" || url == "neighbours" || url == "nodes") {
UI.sendToWebview("showNeighborsActivity");
} else if (url == "peers") {
UI.sendToWebview("showPeers");
} else if (url == "spam" || url == "spammer") {
UI.sendToWebview("showNetworkSpammer");
} else if (url == "generateseed" || url == "seed") {
UI.sendToWebview("generateSeed");
} else {
var match = url.match(/(?:addnode|addneighbou?r)\/(.*)/i);
if (match && match[1] && match[1].charAt(0) != "-") {
UI.addNeighborNode(match[1]);
} else {
UI.sendToWebview("handleURL", url);
}
UI.sendToWebview("handleURL", url);
}
}

Expand Down Expand Up @@ -785,9 +698,9 @@ electron.ipcRenderer.on("handleURL", function(event, url) {
UI.handleURL(url);
});

electron.ipcRenderer.on("showNeighborsActivity", function() {
electron.ipcRenderer.on("showPeers", function() {
UI.hideAlerts();
UI.sendToWebview("showNeighborsActivity");
UI.sendToWebview("showPeers");
});

electron.ipcRenderer.on("showNetworkSpammer", function() {
Expand All @@ -800,10 +713,6 @@ electron.ipcRenderer.on("generateSeed", function() {
UI.sendToWebview("generateSeed");
});

electron.ipcRenderer.on("editServerConfiguration", function(event, serverConfiguration) {
UI.editServerConfiguration(serverConfiguration);
});

electron.ipcRenderer.on("toggleDeveloperTools", UI.toggleDeveloperTools);

electron.ipcRenderer.on("setFocus", function(event, focus) {
Expand Down Expand Up @@ -834,10 +743,6 @@ electron.ipcRenderer.on("notify", function(event, type, msg) {
UI.notify(type, msg);
});

electron.ipcRenderer.on("setConfig", function(event, lines) {
UI.setConfig(lines);
});

electron.ipcRenderer.on("relaunch", UI.relaunch);

electron.ipcRenderer.on("shutdown", UI.shutdown);

0 comments on commit ef5141c

Please sign in to comment.