Skip to content

Commit

Permalink
Fix redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
slmnio committed Aug 13, 2023
1 parent f32ec8d commit 268fa18
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions server/src/meta.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,15 @@ module.exports = ({ app, Cache }) => {
].includes(domain.toLowerCase());
}

async function getAllRedirects() {
return Promise.all((await Cache.get("Redirects"))?.ids?.map(id => Cache.get(id)));
}

async function getRedirect(path = "", subdomain) {
// get all redirects
// see if any match path/subdomain combo
// if it does, send back data for indexer

let redirects = (await Cache.get("Redirects"))?.items;
let redirects = await getAllRedirects();
if (!path.startsWith("/")) path = "/" + path;
path = path.trim().toLowerCase();
if (!redirects?.length) return null;
Expand Down

0 comments on commit 268fa18

Please sign in to comment.