From 7b3947ce9d1fa57682b224fb2a42466fbaffbe7c Mon Sep 17 00:00:00 2001 From: Jack Holloway Date: Thu, 12 May 2022 20:58:26 +0100 Subject: [PATCH] v0.0.17 --- CHANGELOG.md | 4 ++++ index.js | 9 +++++++++ package.json | 2 +- 3 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 61bc705..0c8723b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 0.0.17 + +* Exclude legacy monsters option. + # 0.0.16 * Add missing config URL. diff --git a/index.js b/index.js index 1d3c347..bf5823b 100644 --- a/index.js +++ b/index.js @@ -234,6 +234,7 @@ app.post(getMonsterProxyRoutes, cors(), express.json(), (req, res) => { const homebrew = req.body.homebrew ? req.body.homebrew : false; const homebrewOnly = req.body.homebrewOnly ? req.body.homebrewOnly : false; + const excludeLegacy = req.body.excludeLegacy ? req.body.excludeLegacy : false; const exactNameMatch = req.body.exactMatch || false; const performExactMatch = exactNameMatch && searchTerm && searchTerm !== ""; @@ -249,6 +250,14 @@ app.post(getMonsterProxyRoutes, cors(), express.json(), (req, res) => { monsters .extractMonsters(cacheId, searchTerm, homebrew, homebrewOnly, sources) + .then((data) => { + if (excludeLegacy) { + const filteredMonsters = data.filter((monster) => !monster.isHomebrew && !monster.isLegacy); + return filteredMonsters; + } else { + return data; + } + }) .then((data) => { if (performExactMatch) { const filteredMonsters = data.filter((monster) => monster.name.toLowerCase() === search.toLowerCase()); diff --git a/package.json b/package.json index 1b451f8..0aa35a9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ddb-proxy", - "version": "0.0.16", + "version": "0.0.17", "main": "index.js", "license": "MIT", "scripts": {