Skip to content

Commit

Permalink
feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
fiji-flo committed Oct 25, 2024
1 parent d427d8e commit fa3cdb4
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions server/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -386,18 +386,13 @@ if (contentProxy) {
app.get("/[^/]+/docs/*/metadata.json", async (req, res) => {
const url = decodeURI(req.path.replace(/\/metadata.json$/, ""));
const doc = await buildDocumentFromURL(url);
if (!doc) {
if (!doc?.doc) {
return redirectOr404(res, url, "/metadata.json");
}
const docString = JSON.stringify(doc);

const hash = crypto.createHash("sha256").update(docString).digest("hex");
const {
body: _,
toc: __,
sidebarHTML: ___,
...builtMetadata
} = (doc.doc as any) || {};
const { body: _, toc: __, sidebarHTML: ___, ...builtMetadata } = doc.doc;
builtMetadata.hash = hash;

return res.json(builtMetadata);
Expand Down

0 comments on commit fa3cdb4

Please sign in to comment.