Remove fontWeight parameter, favor markdown
This commit is contained in:
parent
5d2ecce371
commit
ee64fa3a18
|
@ -4,10 +4,7 @@ import { parse } from 'url';
|
|||
export function parseRequest(req: IncomingMessage) {
|
||||
console.log('HTTP ' + req.url);
|
||||
const { pathname = '/', query = {} } = parse(req.url || '', true);
|
||||
const { fontWeight, fontSize, images, md } = query;
|
||||
if (Array.isArray(fontWeight)) {
|
||||
throw new Error('Expected a single fontWeight');
|
||||
}
|
||||
const { fontSize, images, md } = query;
|
||||
if (Array.isArray(fontSize)) {
|
||||
throw new Error('Expected a single fontSize');
|
||||
}
|
||||
|
@ -27,7 +24,6 @@ export function parseRequest(req: IncomingMessage) {
|
|||
type: extension === 'jpeg' ? extension : 'png',
|
||||
text: decodeURIComponent(text),
|
||||
md: md === '1' || md === 'true',
|
||||
fontWeight: fontWeight as FontWeight || 'bold',
|
||||
fontSize: fontSize || '75px',
|
||||
images: Array.isArray(images) && images.length > 0
|
||||
? images
|
||||
|
|
|
@ -59,6 +59,7 @@
|
|||
<li><a href="/hello world.png">/hello world.png</a></li>
|
||||
<li><a href="/hello world.jpeg">/hello world.jpeg</a></li>
|
||||
<li><a href="/small world.png?fontSize=50px">/small world.png?fontSize=50px</a></li>
|
||||
<li><a href="/**bold** world.png?md=1">/**bold** world.png?md=1</a></li>
|
||||
<li><a href="/TypeScript on Now.png?images=https://assets.zeit.co/image/upload/front/assets/design/now-black.svg&images=https://cdn.jsdelivr.net/gh/remojansen/logo.ts@master/ts.svg">TypeScript on Now</a></li>
|
||||
<li><a href="/ZEIT and Hyper.png?images=https://assets.zeit.co/image/upload/front/assets/design/zeit-black-triangle.svg&images=https://assets.zeit.co/image/upload/front/assets/design/hyper-color-logo.svg">ZEIT and Hyper</a></li>
|
||||
</ul>
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
type FontWeight = 'normal' | 'bold';
|
||||
type ScreenshotType = 'png' | 'jpeg';
|
||||
|
||||
interface ParsedRequest {
|
||||
type: ScreenshotType;
|
||||
text: string;
|
||||
md: boolean,
|
||||
fontWeight: FontWeight;
|
||||
md: boolean;
|
||||
fontSize: string;
|
||||
images: string[];
|
||||
}
|
Loading…
Reference in New Issue