From d1e68e94a7f485bee816ea9f82e37b396b52a289 Mon Sep 17 00:00:00 2001 From: Henry Date: Thu, 15 Oct 2020 11:56:19 +0200 Subject: [PATCH] some prefix matching logic lowercase the searches and see if they match the beginning of a name. --- src/models.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/models.js b/src/models.js index 3e7798b..b77c28c 100644 --- a/src/models.js +++ b/src/models.js @@ -160,7 +160,7 @@ module.exports = ({ cooler, isPublic }) => { img: img, rel: rel, }) - all_the_names[name] = feeds_named + all_the_names[name.toLowerCase()] = feeds_named }).catch(console.warn) }).catch(console.warn) }) @@ -188,7 +188,14 @@ module.exports = ({ cooler, isPublic }) => { ); // First 8 chars of public key }, named: (name) => { - return all_the_names[name] || [] + let found = [] + let matched = Object.keys(all_the_names).filter(n => { + return n.startsWith(name.toLowerCase()) + }) + for (const m of matched) { + found = found.concat(all_the_names[m]) + } + return found }, image: async (feedId) => { if (isPublic && (await models.about.publicWebHosting(feedId)) === false) {