From c1d5c8e0422c6a466048769c441f6edc47556c11 Mon Sep 17 00:00:00 2001 From: agix Date: Mon, 6 Nov 2017 16:24:13 +0100 Subject: [PATCH] Accept big payload for metadata_cache --- src/index.js | 2 +- src/routes/GetUser.js | 1 + src/routes/UpdateUser.js | 6 +++++- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/index.js b/src/index.js index f5042b8..a3e65dc 100644 --- a/src/index.js +++ b/src/index.js @@ -32,7 +32,7 @@ const app = express(); app.server = http.createServer(app); app.use(cors()); -app.use(bodyParser.json()); +app.use(bodyParser.json({limit: '100mb'})); initializeDb(config, (couchdb, redis) => { if (process.env.TEST_SERVER) { diff --git a/src/routes/GetUser.js b/src/routes/GetUser.js index 5d8ae79..25e7d0a 100644 --- a/src/routes/GetUser.js +++ b/src/routes/GetUser.js @@ -103,6 +103,7 @@ export default ({ redis, couchdb }) => { } delete submitUser.options; + delete submitUser.metadataCache; delete submitUser.keys; delete submitUser.seed; delete submitUser.rescueCodes; diff --git a/src/routes/UpdateUser.js b/src/routes/UpdateUser.js index 4e0f808..f00f58b 100644 --- a/src/routes/UpdateUser.js +++ b/src/routes/UpdateUser.js @@ -28,7 +28,11 @@ export default ({ couchdb, redis }) => { typeof jsonBody.pass === 'undefined' || typeof jsonBody.privateKey === 'undefined' ) { - doc.user[req.params.name].options = jsonBody; + if (typeof jsonBody.options === 'undefined') { + doc.user[req.params.name].metadataCache = jsonBody; + } else { + doc.user[req.params.name].options = jsonBody; + } } else { const md = forge.md.sha256.create(); md.update(jsonBody.pass.hash);