This commit is contained in:
Eric Bailey
2025-06-16 14:19:16 -05:00
parent 55566dfcae
commit 9fcd10be32
2 changed files with 11 additions and 1 deletions
+4 -1
View File
@@ -89,7 +89,10 @@ export default function (ctx: AppContext, app: Express) {
return res.end(output.asPng())
} catch (err) {
httpLogger.warn({err, uri: uri.toString()}, 'could not fetch post')
httpLogger.warn(
{err, uri: uri.toString()},
`Failed to render post ${uri}`,
)
return res.status(404).end('not found')
}
}),
@@ -4,6 +4,9 @@ import {getWidthWithMat} from './frameMatting.js'
export const DEFAULT_WIDTH = 360
/**
* Options parsed from the query string, passed to the components themselves.
*/
export type DisplayOptions = {
mat: boolean
}
@@ -25,6 +28,10 @@ export function parseDisplayOptionsFromQuery(query: ParsedQs): DisplayOptions {
return opts
}
/**
* Options computed from the parsed query options, passed to the render
* function.
*/
export function getRenderOptions(options: DisplayOptions) {
return {
// must match width + padding of Post.tsx