From 3acf2c39344af2d20b75a7b37097e93eebf347af Mon Sep 17 00:00:00 2001 From: marpme Date: Sun, 31 May 2020 19:16:18 +0200 Subject: [PATCH 01/14] Set specific locale definitions --- src/assets/locales/ar.ts | 4 +- src/assets/locales/bn.ts | 5 +- src/assets/locales/de.ts | 5 +- src/assets/locales/en.ts | 12 ++- src/assets/locales/es.ts | 5 +- src/assets/locales/fr.ts | 5 +- src/assets/locales/hi.ts | 5 +- src/assets/locales/it.ts | 5 +- src/assets/locales/ja.ts | 5 +- src/assets/locales/nl.ts | 5 +- src/assets/locales/pt.ts | 5 +- src/assets/locales/ru.ts | 5 +- src/assets/locales/standard.local.ts | 149 +++++++++++++++++++++++++++ src/assets/locales/zh.ts | 5 +- 14 files changed, 207 insertions(+), 13 deletions(-) create mode 100644 src/assets/locales/standard.local.ts diff --git a/src/assets/locales/ar.ts b/src/assets/locales/ar.ts index 1054b2d..cce3c9a 100644 --- a/src/assets/locales/ar.ts +++ b/src/assets/locales/ar.ts @@ -1,2 +1,4 @@ -const ar = {} +import { LocaleDefinition } from './standard.local' +// @ts-ignore +const ar: LocaleDefinition = {} export default ar diff --git a/src/assets/locales/bn.ts b/src/assets/locales/bn.ts index e896724..a13e6ec 100644 --- a/src/assets/locales/bn.ts +++ b/src/assets/locales/bn.ts @@ -1,2 +1,5 @@ -const bn = {} +import { LocaleDefinition } from './standard.local' + +// @ts-ignore +const bn: LocaleDefinition = {} export default bn diff --git a/src/assets/locales/de.ts b/src/assets/locales/de.ts index 5b8ce3f..5e89105 100644 --- a/src/assets/locales/de.ts +++ b/src/assets/locales/de.ts @@ -1,2 +1,5 @@ -const de = {} +import { LocaleDefinition } from './standard.local' + +// @ts-ignore +const de: LocaleDefinition = {} export default de diff --git a/src/assets/locales/en.ts b/src/assets/locales/en.ts index 2a2a806..a393923 100644 --- a/src/assets/locales/en.ts +++ b/src/assets/locales/en.ts @@ -1,4 +1,6 @@ -const en = { +import { LocaleDefinition } from './standard.local' + +const en: LocaleDefinition = { main: { menu: { wallets: 'Wallets', @@ -7,6 +9,14 @@ const en = { contacts: 'Contacts' } }, + tor: { + status: { + loading: 'Loading ...', + connected: 'Connected', + disconnected: 'Disconnected' + }, + toggle: 'Tor-Proxy' + }, unlock: { unlockYourWallet: 'Unlock your wallet', password: 'Password', diff --git a/src/assets/locales/es.ts b/src/assets/locales/es.ts index 2b599c0..8c2daad 100644 --- a/src/assets/locales/es.ts +++ b/src/assets/locales/es.ts @@ -1,2 +1,5 @@ -const es = {} +import { LocaleDefinition } from './standard.local' + +// @ts-ignore +const es: LocaleDefinition = {} export default es diff --git a/src/assets/locales/fr.ts b/src/assets/locales/fr.ts index d12c33b..1d1bd08 100644 --- a/src/assets/locales/fr.ts +++ b/src/assets/locales/fr.ts @@ -1,2 +1,5 @@ -const fr = {} +import { LocaleDefinition } from './standard.local' + +// @ts-ignore +const fr: LocaleDefinition = {} export default fr diff --git a/src/assets/locales/hi.ts b/src/assets/locales/hi.ts index b70850d..6324a7e 100644 --- a/src/assets/locales/hi.ts +++ b/src/assets/locales/hi.ts @@ -1,2 +1,5 @@ -const hi = {} +import { LocaleDefinition } from './standard.local' + +// @ts-ignore +const hi: LocaleDefinition = {} export default hi diff --git a/src/assets/locales/it.ts b/src/assets/locales/it.ts index 2c9c3aa..951d8a2 100644 --- a/src/assets/locales/it.ts +++ b/src/assets/locales/it.ts @@ -1,2 +1,5 @@ -const it = {} +import { LocaleDefinition } from './standard.local' + +// @ts-ignore +const it: LocaleDefinition = {} export default it diff --git a/src/assets/locales/ja.ts b/src/assets/locales/ja.ts index 47ddcd2..47c0810 100644 --- a/src/assets/locales/ja.ts +++ b/src/assets/locales/ja.ts @@ -1,2 +1,5 @@ -const ja = {} +import { LocaleDefinition } from './standard.local' + +// @ts-ignore +const ja: LocaleDefinition = {} export default ja diff --git a/src/assets/locales/nl.ts b/src/assets/locales/nl.ts index 36a8c19..c4657f9 100644 --- a/src/assets/locales/nl.ts +++ b/src/assets/locales/nl.ts @@ -1,4 +1,7 @@ -const nl = { +import { LocaleDefinition } from './standard.local' + +// @ts-ignore +const nl: LocaleDefinition = { main: { menu: { wallets: 'Wallets', diff --git a/src/assets/locales/pt.ts b/src/assets/locales/pt.ts index c319433..4e324df 100644 --- a/src/assets/locales/pt.ts +++ b/src/assets/locales/pt.ts @@ -1,2 +1,5 @@ -const pt = {} +import { LocaleDefinition } from './standard.local' + +// @ts-ignore +const pt: LocaleDefinition = {} export default pt diff --git a/src/assets/locales/ru.ts b/src/assets/locales/ru.ts index 0ee2ea0..d2263fa 100644 --- a/src/assets/locales/ru.ts +++ b/src/assets/locales/ru.ts @@ -1,2 +1,5 @@ -const ru = {} +import { LocaleDefinition } from './standard.local' + +// @ts-ignore +const ru: LocaleDefinition = {} export default ru diff --git a/src/assets/locales/standard.local.ts b/src/assets/locales/standard.local.ts new file mode 100644 index 0000000..d11363d --- /dev/null +++ b/src/assets/locales/standard.local.ts @@ -0,0 +1,149 @@ +export interface LocaleDefinition { + main: { + menu: { + wallets: string, + add: string, + explorer: string, + contacts: string + } + }, + tor: { + status: { + loading: string, + connected: string, + disconnected: string + }, + toggle: string + }, + unlock: { + unlockYourWallet: string, + password: string, + forgotPassword: string + }, + wallet: { + send: string, + receive: string + }, + transaction: { + transaction: string, + sent: string, + sending: string, + received: string, + receiving: string, + moved: string, + pending: string, + amount: string, + date: string, + details: string, + address: string, + confirmations: string, + txid: string + }, + send: { + formDescription: string, + confirmDescription: string, + sendingDescription: string, + send: string, + fillForm: string, + confirm: string, + sending: string, + sent: string, + recipient: string, + recipientDetails: string, + amount: string, + amountDetails: string, + internalMemo: string, + internalMemoDetails: string, + sendMax: string, + reset: string, + confirmTransaction: string, + cancel: string, + transactionFee: string, + total: string, + transactionWarning: string, + signing: string, + publishing: string, + broadcasting: string, + transactionSent: string, + transactionSentSubtitle: string, + done: string + }, + createWallet: { + createNewWallet: string, + restoreExistingWallet: string, + addYourFirstWallet: string, + itsReallyEasy: string, + aWalletName: string, + aWalletNameDescription: string, + walletName: string, + enterYourWalletName: string, + walletColor: string, + advanced: string, + singleAddress: string, + serviceURL: string, + writeDownPaperKey: string, + preferences: string, + paperKey: string, + aPaperKey: string, + aPaperKeyDescription: string, + fillInYourPaperKey: string, + fillInYourPaperKeyDesc: string, + confirmPaperKey: string, + invalidPaperkeySelected: string, + passPhrase: string, + passPhraseDescription: string, + setupPassphraseReq1: string, + setupPassphraseReq2: string, + setupPassphraseReq3: string, + setupPassphrasePassPlaceholder: string, + confirmPassphrase: string, + passphraseInvalid: string, + confirm: string, + back: string, + proceed: string, + almostReady: string, + almostReadyDesc: string, + awesomeYouveDoneIt: string, + createTerm1: string, + createTerm2: string, + createTerm3: string, + termsOfUse: string, + openTermsOfUseConfirm: string, + createWallet: string, + creatingWallet: string, + walletCreated: string, + whatToDoNext: string, + exportYourWallet: string, + exportYourWalletDesc: string, + exportWallet: string, + sendXvgToYourWallet: string, + sendXvgToYourWalletDesc: string, + receiveXvg: string, + orGoToWallet: string, + orGoToWalletDesc: string, + goToWallet: string + }, + walletSettings: { + walletSettings: string, + dangerZone: string, + delete: string, + deleteWallet: string, + deleteWalletDesc: string, + deleteWalletConfirm: string, + walletDeleted: string + }, + settings: { + settings: string, + security: string, + language: string, + currency: string, + currencyDetails: string, + password: string, + changePassword: string, + lockAfter: string, + lockAfterDetails: string, + connection: string, + torConnection: string, + manageTorConnection: string + } +} diff --git a/src/assets/locales/zh.ts b/src/assets/locales/zh.ts index deb6098..3bf88bb 100644 --- a/src/assets/locales/zh.ts +++ b/src/assets/locales/zh.ts @@ -1,2 +1,5 @@ -const zh = {} +import { LocaleDefinition } from './standard.local' + +// @ts-ignore +const zh: LocaleDefinition = {} export default zh From 20d405b050d7ae95dc21acb6967a551436febd69 Mon Sep 17 00:00:00 2001 From: marpme Date: Sun, 31 May 2020 19:16:51 +0200 Subject: [PATCH 02/14] Add possibilites to switch proxy on or via IPC --- src/background.ts | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/src/background.ts b/src/background.ts index 0d0d524..d830ae3 100644 --- a/src/background.ts +++ b/src/background.ts @@ -1,6 +1,4 @@ -'use strict' - -import { app, protocol, nativeTheme, BrowserWindow, Menu } from 'electron' +import { app, protocol, nativeTheme, BrowserWindow, Menu, ipcMain } from 'electron' import { autoUpdater } from 'electron-updater' import { createProtocol, installVueDevtools } from 'vue-cli-plugin-electron-builder/lib' import logger from 'electron-log' @@ -20,6 +18,13 @@ const TOR_SOCKS_PORT = 9999 // Scheme must be registered before the app is ready protocol.registerSchemesAsPrivileged([{ scheme: 'app', privileges: { secure: true, standard: true } }]) +const activateTorProxy = (win: BrowserWindow) => win.webContents.session.setProxy({ + proxyRules: `socks5://127.0.0.1:${TOR_SOCKS_PORT}`, + proxyBypassRules: ', 192.168.1.1/16, fefe:13::abc/33' +}) + +const deactivateTorProxy = (win: BrowserWindow) => win.webContents.session.setProxy({ proxyRules: undefined }) + function createWindow () { Menu.setApplicationMenu(Menu.buildFromTemplate(generateMenuTemplate())) @@ -57,10 +62,7 @@ function createWindow () { mainWindowState.manage(win) - win.webContents.session.setProxy({ - proxyRules: `socks5://127.0.0.1:${TOR_SOCKS_PORT}`, - proxyBypassRules: ', 192.168.1.1/16, fefe:13::abc/33' - }).then(() => { + activateTorProxy(win).then(() => { if (process.env.WEBPACK_DEV_SERVER_URL) { // Load the url of the dev server if in development mode win!.loadURL(process.env.WEBPACK_DEV_SERVER_URL as string) @@ -97,6 +99,8 @@ function createWindow () { win.once('ready-to-show', () => { win!.show() }) + + return win } // Quit when all windows are closed. @@ -157,7 +161,17 @@ app.on('ready', async () => { console.error('Vue Devtools failed to install:', e.toString()) } } - createWindow() + const window = createWindow() + ipcMain.on('TOGGLE_TOR', async (event, arg: any) => { + if (arg.activate === true) { + await activateTorProxy(window) + } else { + await deactivateTorProxy(window) + } + + event.returnValue = 'received' + event.reply('TOR_TOGGLED') + }) }) }) From 020d29443c8c2746d36ef1fb45932d2e32008292 Mon Sep 17 00:00:00 2001 From: marpme Date: Sun, 31 May 2020 19:17:14 +0200 Subject: [PATCH 03/14] Add view capabilities to handle tor --- src/assets/tor-icons/onion-connected.vue | 6 ++ src/assets/tor-icons/onion-disconnected.vue | 6 ++ src/assets/tor-icons/onion-error.vue | 6 ++ src/assets/tor-icons/onion-loading.vue | 6 ++ src/utils/constants.ts | 1 + src/views/IconListBar.vue | 46 +++++----- src/views/TorStatus.vue | 96 +++++++++++++++++++++ src/views/Wallet/WalletView.vue | 2 +- 8 files changed, 142 insertions(+), 27 deletions(-) create mode 100644 src/views/TorStatus.vue diff --git a/src/assets/tor-icons/onion-connected.vue b/src/assets/tor-icons/onion-connected.vue index 9398824..67c6eac 100644 --- a/src/assets/tor-icons/onion-connected.vue +++ b/src/assets/tor-icons/onion-connected.vue @@ -15,3 +15,9 @@ /> + + diff --git a/src/assets/tor-icons/onion-disconnected.vue b/src/assets/tor-icons/onion-disconnected.vue index 0c75603..699159a 100644 --- a/src/assets/tor-icons/onion-disconnected.vue +++ b/src/assets/tor-icons/onion-disconnected.vue @@ -15,3 +15,9 @@ /> + + diff --git a/src/assets/tor-icons/onion-error.vue b/src/assets/tor-icons/onion-error.vue index 2bc0df0..ad8aa86 100644 --- a/src/assets/tor-icons/onion-error.vue +++ b/src/assets/tor-icons/onion-error.vue @@ -19,3 +19,9 @@ /> + + diff --git a/src/assets/tor-icons/onion-loading.vue b/src/assets/tor-icons/onion-loading.vue index 8049864..a13ce08 100644 --- a/src/assets/tor-icons/onion-loading.vue +++ b/src/assets/tor-icons/onion-loading.vue @@ -27,6 +27,12 @@ + + diff --git a/src/views/TorStatus.vue b/src/views/TorStatus.vue new file mode 100644 index 0000000..aa4b485 --- /dev/null +++ b/src/views/TorStatus.vue @@ -0,0 +1,96 @@ + + + diff --git a/src/views/Wallet/WalletView.vue b/src/views/Wallet/WalletView.vue index 9efb44e..a6bf81c 100644 --- a/src/views/Wallet/WalletView.vue +++ b/src/views/Wallet/WalletView.vue @@ -63,7 +63,7 @@ import TransactionRow from '@/components/TransactionRow' import Money from '@/components/labels/Money' export default { - name: 'WalletView', + name: 'wallet-view', components: { TransactionRow, Money }, props: { wallet: { From d6c9b9e23ed213220339c6e1b83253e1449c4768 Mon Sep 17 00:00:00 2001 From: Swen van Zanten Date: Sun, 31 May 2020 20:18:35 +0200 Subject: [PATCH 04/14] remove tor status button extra margin --- src/views/TorStatus.vue | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/views/TorStatus.vue b/src/views/TorStatus.vue index aa4b485..891ea7f 100644 --- a/src/views/TorStatus.vue +++ b/src/views/TorStatus.vue @@ -1,5 +1,5 @@