diff --git a/.gitignore b/.gitignore index 5abf7e5..de878e5 100644 --- a/.gitignore +++ b/.gitignore @@ -10,3 +10,5 @@ thumbs.db !.gitkeep .idea wowlight +package-lock.json +*.log diff --git a/src/main/config.js b/src/main/config.js index d691ecc..584956d 100644 --- a/src/main/config.js +++ b/src/main/config.js @@ -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(); } } diff --git a/src/renderer/assets/messages.js b/src/renderer/assets/messages.js index 46bbf69..1f993e4 100644 --- a/src/renderer/assets/messages.js +++ b/src/renderer/assets/messages.js @@ -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!' +]; diff --git a/src/renderer/components/Landing/LandingPage.vue b/src/renderer/components/Landing/LandingPage.vue index 21e3868..4f539fd 100644 --- a/src/renderer/components/Landing/LandingPage.vue +++ b/src/renderer/components/Landing/LandingPage.vue @@ -22,7 +22,7 @@ @@ -31,6 +31,10 @@ Settings + +
@@ -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); } } } diff --git a/src/renderer/components/Pages/components/Send.vue b/src/renderer/components/Pages/components/Send.vue index fdd40f6..ad2a660 100644 --- a/src/renderer/components/Pages/components/Send.vue +++ b/src/renderer/components/Pages/components/Send.vue @@ -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(''); + }); } } diff --git a/src/renderer/components/Wizards/CreateWalletOptions.vue b/src/renderer/components/Wizards/CreateWalletOptions.vue index 7a34d78..3448b0b 100644 --- a/src/renderer/components/Wizards/CreateWalletOptions.vue +++ b/src/renderer/components/Wizards/CreateWalletOptions.vue @@ -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; } } } diff --git a/src/renderer/store/index.js b/src/renderer/store/index.js index 41b17ac..64ca8fb 100644 --- a/src/renderer/store/index.js +++ b/src/renderer/store/index.js @@ -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;