From 18aef9570fe6c918673afea84483e54366317f6e Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 22 Aug 2016 14:07:02 -0700 Subject: [PATCH 1/3] Add spanish locales. --- app/_locales/es/messages.json | 10 ++++++++++ app/_locales/es_419/messages.json | 10 ++++++++++ 2 files changed, 20 insertions(+) create mode 100644 app/_locales/es/messages.json create mode 100644 app/_locales/es_419/messages.json diff --git a/app/_locales/es/messages.json b/app/_locales/es/messages.json new file mode 100644 index 000000000..78fc64dbf --- /dev/null +++ b/app/_locales/es/messages.json @@ -0,0 +1,10 @@ +{ + "appName": { + "message": "MetaMask", + "description": "The name of the application" + }, + "appDescription": { + "message": "Administración de identidad en Ethereum", + "description": "The description of the application" + } +} diff --git a/app/_locales/es_419/messages.json b/app/_locales/es_419/messages.json new file mode 100644 index 000000000..78fc64dbf --- /dev/null +++ b/app/_locales/es_419/messages.json @@ -0,0 +1,10 @@ +{ + "appName": { + "message": "MetaMask", + "description": "The name of the application" + }, + "appDescription": { + "message": "Administración de identidad en Ethereum", + "description": "The description of the application" + } +} From bc2abd0a78a1ac43d230290dbb62c63c68c012ea Mon Sep 17 00:00:00 2001 From: Kevin Serrano Date: Mon, 22 Aug 2016 14:11:32 -0700 Subject: [PATCH 2/3] First part of chinese translation. --- app/_locales/zh_CN/messages.json | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 app/_locales/zh_CN/messages.json diff --git a/app/_locales/zh_CN/messages.json b/app/_locales/zh_CN/messages.json new file mode 100644 index 000000000..fc87384e5 --- /dev/null +++ b/app/_locales/zh_CN/messages.json @@ -0,0 +1,10 @@ +{ + "appName": { + "message": "MetaMask", + "description": "The name of the application" + }, + "appDescription": { + "message": "以太坊身份管理", + "description": "The description of the application" + } +} From b8077983d6ecfeab8998006f188207b8b3f4d6d1 Mon Sep 17 00:00:00 2001 From: kumavis Date: Mon, 22 Aug 2016 18:59:15 -0700 Subject: [PATCH 3/3] inpage provider - reassign incomming ids --- app/scripts/lib/inpage-provider.js | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/app/scripts/lib/inpage-provider.js b/app/scripts/lib/inpage-provider.js index b3ed3d9e2..65354cd3d 100644 --- a/app/scripts/lib/inpage-provider.js +++ b/app/scripts/lib/inpage-provider.js @@ -33,8 +33,16 @@ function MetamaskInpageProvider (connectionStream) { }) asyncProvider.on('error', console.error.bind(console)) self.asyncProvider = asyncProvider - // overwrite own sendAsync method - self.sendAsync = asyncProvider.sendAsync.bind(asyncProvider) + // handle sendAsync requests via asyncProvider + self.sendAsync = function(payload, cb){ + // rewrite request ids + var request = jsonrpcMessageTransform(payload, (message) => { + message.id = createRandomId() + return message + }) + // forward to asyncProvider + asyncProvider.sendAsync(request, cb) + } } MetamaskInpageProvider.prototype.send = function (payload) { @@ -92,3 +100,21 @@ function remoteStoreWithLocalStorageCache (storageKey) { return store } + +function createRandomId(){ + const extraDigits = 3 + // 13 time digits + const datePart = new Date().getTime() * Math.pow(10, extraDigits) + // 3 random digits + const extraPart = Math.floor(Math.random() * Math.pow(10, extraDigits)) + // 16 digits + return datePart + extraPart +} + +function jsonrpcMessageTransform(payload, transformFn){ + if (Array.isArray(payload)) { + return payload.map(transformFn) + } else { + return transformFn(payload) + } +} \ No newline at end of file