mirror of
https://gitlab.com/soapbox-pub/ditto.git
synced 2025-12-06 11:29:46 +00:00
remove premature optimization in serveStaticWithOG
This commit is contained in:
parent
5ee0c1e852
commit
baa6e318f3
1 changed files with 3 additions and 1 deletions
|
|
@ -222,11 +222,13 @@ export const serveStaticWithOG = <E extends Env>(
|
|||
return async function serveStatic(c: Context, next: Next) {
|
||||
let file = '';
|
||||
const getContent = async (path: string) => {
|
||||
console.log('here');
|
||||
try {
|
||||
if (!file) file = await Deno.readTextFile(path);
|
||||
if (!file) throw new Error(`File at ${path} was empty!`);
|
||||
if (c.req.header('accept')?.includes('html') && file.includes(OG_META_PLACEHOLDER)) {
|
||||
if (file.includes(OG_META_PLACEHOLDER)) {
|
||||
const params = getPathParams(c.req.path);
|
||||
console.log(params);
|
||||
if (params) {
|
||||
const meta = await buildMetaTags(params, Conf.local(c.req.path));
|
||||
return file.replace(OG_META_PLACEHOLDER, meta);
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue