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

Make iri.jar downloadable on demand #1058

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 4 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,20 @@ If you wish to compile the app, install the following also:
```
cd wallet
```

3. Clone iri:

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

Note: make sure compiled iri.jar is in the `iri` folder.

4. Install components
3. Install components

```
npm install
```

5. Run the app:
4. Run the app:

```
npm start
```

6. If you wish to compile the app:
5. If you wish to compile the app:

```
npm run compile
Expand All @@ -86,4 +78,4 @@ If you wish to compile the app, install the following also:

#### Testnet

To build testnet binaries, rename `package.testnet.json` to `package.json` and follow instructions as above. Make sure the jar is named `iri-testnet.jar`.
To build testnet binaries, rename `package.testnet.json` to `package.json` and follow instructions as above.
35 changes: 24 additions & 11 deletions app/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ var __entityMap = {
"/": '/'
};

var IRI_VERSION = '1.4.2.1'
var IRI_DIRECTORY = 'iri'

String.prototype.escapeHTML = function() {
return String(this).replace(/[&<>"'\/]/g, function(s) {
return __entityMap[s];
Expand All @@ -43,9 +46,9 @@ var App = (function(App, undefined) {
var isStarted = false;
var appDirectory = "";
var appDataDirectory = "";
var tempDirectory = "";
var resourcesDirectory = "";
var databaseDirectory = "";
var jarDirectory = "";
var javaLocations = [];
var selectedJavaLocation;
var currentLocationTest = 0;
Expand Down Expand Up @@ -908,12 +911,12 @@ var App = (function(App, undefined) {
appDataDirectory = path.join(electron.app.getPath("appData"), "IOTA Wallet" + (isTestNet ? " Testnet" : ""));
}

tempDirectory = electron.app.getPath('temp')

App.loadSettings();

databaseDirectory = (settings.dbLocation ? settings.dbLocation : path.join(appDataDirectory, "iri"));

jarDirectory = path.join(resourcesDirectory, "iri");

if (!fs.existsSync(appDataDirectory)) {
fs.mkdirSync(appDataDirectory);
}
Expand Down Expand Up @@ -1010,11 +1013,11 @@ var App = (function(App, undefined) {

App.start = function() {
if (settings.lightWallet == 1 && (!settings.lightWalletHost || !settings.lightWalletPort)) {
App.showSetupWindow({"section": "light-node"});
App.showSetupWindow({"section": "light-node", appDataDirectory, tempDirectory});
} else if (settings.lightWallet == 0 && settings.nodes.length == 0) {
App.showSetupWindow({"section": "full-node"});
App.showSetupWindow({"section": "full-node", appDataDirectory, tempDirectory});
} else if (settings.lightWallet == -1) {
App.showSetupWindow();
App.showSetupWindow({appDataDirectory, tempDirectory});
} else if (settings.lightWallet == 1) {
global.lightWallet = true;
App.startLightNode();
Expand Down Expand Up @@ -1228,7 +1231,7 @@ var App = (function(App, undefined) {

params.push("-jar");

params.push(path.join(jarDirectory, "iri" + (isTestNet ? "-testnet" : "") + ".jar"));
params.push(path.join(appDataDirectory, IRI_DIRECTORY, 'iri' + (isTestNet ? '-testnet' : '') + '-' + IRI_VERSION + '.jar'));

// temporary !
// Only rescan once
Expand Down Expand Up @@ -1802,7 +1805,10 @@ var App = (function(App, undefined) {
"lightWalletPort" : settings.lightWalletPort,
"port" : settings.port,
"nodes" : settings.nodes,
"section" : params && params.section ? params.section : null});
"section" : params && params.section ? params.section : null,
"appDataDirectory": params && params.appDataDirectory ? params.appDataDirectory : null,
"tempDirectory" : params && params.tempDirectory ? params.tempDirectory : null
});
}

App.showInitializationAlertWindow = function(title, msg) {
Expand Down Expand Up @@ -1851,14 +1857,19 @@ var App = (function(App, undefined) {
"java64BitsOK" : java64BitsOK,
"is64BitOS" : is64BitOS,
"port" : settings.port,
"nodes" : settings.nodes});
"nodes" : settings.nodes,
"appDataDirectory" : appDataDirectory,
"tempDirectory" : tempDirectory});
});
} else {
App.showWindow("init_error.html", {"title" : title,
"message" : msg,
"serverOutput" : serverOutput,
"port" : settings.port,
"nodes" : settings.nodes});
"nodes" : settings.nodes,
"appDataDirectory" : appDataDirectory,
"tempDirectory" : tempDirectory
});
}

selectedJavaLocation = "";
Expand Down Expand Up @@ -1971,7 +1982,9 @@ var App = (function(App, undefined) {
//ready-to-show event not working..
otherWin.webContents.once("did-finish-load", function() {
App.updateTitle();
//win.webContents.toggleDevTools({"mode": "undocked"});
if (isDebug) {
otherWin.webContents.openDevTools({"mode": "undocked"});
}
otherWin.webContents.send("show", params);
});

Expand Down
38 changes: 36 additions & 2 deletions app/windows/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ body {
#footer {
position: absolute;
bottom: 0;
left: 0;
left: 0;
right: 0;
padding: 20px;
background-color: #f1f1f1;
Expand Down Expand Up @@ -162,4 +162,38 @@ p.note {
.error {
display: none;
color: red;
}
}


#download-iri-success {
display: none;
}

#download-iri-progress {
display: none;
padding-bottom: 20px;
}

#download-iri-progress-bar {
width: 100%;
height: 10px;
margin: 10px 0px;
background: #f0f0f0;
box-shadow: inset 3px 0px 10px rgba(0,0,0,0.14);
border-radius: 5px;
overflow: hidden;
position: relative;
}

#download-iri-progress-bar-content {
transform: scaleX(0);
transform-origin: left;
width: 100%;
height: 10px;
border-radius: 10px;
box-shadow: 4px 1px 20px rgba(0,0,0,0.3);
background: linear-gradient(90deg, #4CAF50, #00E676);
position: absolute;
top: 0px;
left: 0px;
}
8 changes: 6 additions & 2 deletions app/windows/js/init_error.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ String.prototype.escapeHTML = function() {

var UI = (function(UI, undefined) {
var isLightWallet = false;
var _tempDirectory
var _appDataDirectory

UI.initialize = function() {
document.getElementById("quit-btn").addEventListener("click", function(e) {
Expand Down Expand Up @@ -82,6 +84,8 @@ var UI = (function(UI, undefined) {

UI.show = function(params) {
if (params) {
_appDataDirectory = params.appDataDirectory
_tempDirectory = params.tempDirectory
isLightWallet = params.lightWallet == 1;
if (params.title) {
document.getElementById("title").innerHTML = UI.format(params.title);
Expand Down Expand Up @@ -130,7 +134,7 @@ var UI = (function(UI, undefined) {
}

UI.showSetupWindow = function(section) {
electron.ipcRenderer.send("showSetupWindow", {"section": section});
electron.ipcRenderer.send("showSetupWindow", {"section": section, appDataDirectory: _appDataDirectory, tempDirectory: _tempDirectory});
}

UI.updateContentSize = function() {
Expand Down Expand Up @@ -203,4 +207,4 @@ electron.ipcRenderer.on("changeLanguage", function(event, language) {
UI.changeLanguage(language, function() {
UI.updateContentSize();
});
});
});
Loading