Merge pull request #11 from bomb-on/master

More good update!
This commit is contained in:
xmrdsc
2018-12-17 17:22:01 +01:00
committed by GitHub
7 changed files with 54 additions and 25 deletions
+2
View File
@@ -10,3 +10,5 @@ thumbs.db
!.gitkeep
.idea
wowlight
package-lock.json
*.log
+3 -2
View File
@@ -31,7 +31,7 @@ export class Config {
{"address": "node.wownero.com:34568", "location": "Montreal, Canada", "region": "US"},
{"address": "localhost:34568", 'location': "", "region": "*"}
],
"wallet_path": ""
"wallets": []
});
fs.writeFileSync(this._path_cfg, JSON.stringify(data));
@@ -69,7 +69,8 @@ export class Config {
return;
}
this.data.wallet_path = path;
const name = path.split('/').pop();
this.data.wallets.push({ name, path });
this.save();
}
}
+5 -3
View File
@@ -83,6 +83,8 @@ export const messages = [
'Sending all funds to wownero.win',
'Shaving away klubus and grumbo',
'Contacting Stealy for more plumbus',
'Rebuilding WinoBot!'
]
'Rebuilding WinoBot!',
'He who runs, doesn\'t walk!',
'Downloading Shaggy_Complete_Collection.zip [148 GB left]',
'Arrays start at 1!'
];
+16 -13
View File
@@ -22,7 +22,7 @@
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
<a v-on:click="openWallet" class="dropdown-item" href="#">Browse</a>
<a v-on:click="openLastWallet" v-if="cfg_wallet_path !== ''" class="dropdown-item" href="#">{{cfg_wallet_path_name}}</a>
<a v-on:click="openLastWallet" v-for="item in cfg_wallet_names" class="dropdown-item" href="#">{{item}}</a>
</div>
</div>
@@ -31,6 +31,10 @@
<i class="fa fa-cog" aria-hidden="true"></i>
Settings
</button>
<button type="button" class="btn btn-success btn-sm">
Does nothing
</button>
</div>
<div class="col-sm-5">
@@ -118,16 +122,16 @@
}
});
},
openLastWallet(){
if(!this.cfg_wallet_path || this.cfg_wallet_path === ''){
alert('Invalid wallet path?!');
return;
}
this.$store.commit('addWalletPath', this.cfg_wallet_path);
openLastWallet(event){
const selectedWallet = this.cfg_wallets.find(i => i.name === event.currentTarget.text);
this.$store.commit('addWalletPath', selectedWallet.path);
this.$store.commit('showPassword', {
'message': 'Enter wallet password'
});
setTimeout(() => {
jQuery('#password').focus();
}, 50);
}
},
mounted() {
@@ -188,12 +192,11 @@
selected_node(){
return this.$store.getters.cfg.node;
},
cfg_wallet_path(){
return this.$store.getters.cfg.wallet_path;
cfg_wallets(){
return this.$store.getters.cfg.wallets;
},
cfg_wallet_path_name(){
let path = require("path");
return path.basename(this.cfg_wallet_path);
cfg_wallet_names(){
return this.$store.getters.cfg.wallets.map(i => i.name);
}
}
}
@@ -123,7 +123,7 @@
validate(){
this.error = '';
let form = jQuery('#sendForm');
let regexp_address = /(W[o|W][a-zA-Z0-9]{95})/g;
let regexp_address = /(W[o|W][a-zA-Z0-9]{95})|(So[a-zA-Z0-9]{106})/g;
let address = form.find('textarea.address').val().trim();
let amount = form.find('input.amount').val().trim();
let usd = jQuery('form#sendForm .amount label small');
@@ -144,7 +144,7 @@
return invalid();
}
if((amount == 0)){
if((amount === 0)){
//this.error = 'Invalid WOW amount';
usd.html('');
return invalid();
@@ -179,6 +179,12 @@
this.$electron.ipcRenderer.on('rpc_monies_sent_error', (event, data) => {
this.error = data.message;
});
this.$electron.ipcRenderer.on('rpc_monies_sent', () => {
const form = jQuery('#sendForm');
form.find('textarea.address').val('');
form.find('input.amount').val('');
});
}
}
</script>
@@ -67,12 +67,20 @@
this.create_wallet(wallet_name, wallet_pass);
}
},
wallet_exists (name) {
return !!this.wallets.find(i => i.name === name);
},
create_wallet (name, password) {
this.clearMatrixMsg();
this.showMatrixMsg('GENERATING NEW WALLET')
if (this.wallet_exists(name)) {
console.log('Wallet exists!')
// @TODO check if wallet with same name exists no matter the path
} else {
this.clearMatrixMsg();
this.showMatrixMsg('GENERATING NEW WALLET');
this.$store.commit('appState', "create_wallet");
ipcRenderer.send('rpc_create_wallet', {name: name, password: password})
this.$store.commit('appState', "create_wallet");
ipcRenderer.send('rpc_create_wallet', {name: name, password: password})
}
},
showMatrixMsg(msg){
let obj = jQuery('.teh_matrix span.centered');
@@ -179,6 +187,9 @@
},
walletCreating(){
return this.$store.state.wallet_creating;
},
wallets() {
return this.$store.getters.cfg.wallets;
}
}
}
+5 -1
View File
@@ -11,7 +11,7 @@ export default new Vuex.Store({
cfg: {
"node": "",
"nodes": [],
"wallet_path": ""
"wallets": []
},
created_wallet: {}, // only used when creating wallets
appState: "", // not really used
@@ -69,6 +69,10 @@ export default new Vuex.Store({
if(data.hasOwnProperty('wallet_path')){
cfg.wallet_path = data.wallet_path;
}
if(data.hasOwnProperty('wallets')){
cfg.wallets = data.wallets;
}
},
appState(state, data){
state.appState = data;