We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 719650c commit 33c1019Copy full SHA for 33c1019
src/pages/api/generate.ts
@@ -25,7 +25,11 @@ const serverOptions = {
25
}
26
27
export const GET: APIRoute = async ({ url }) => {
28
- const isDev = url.searchParams.get('dev') === 'true'
+ const { isDev, height, width } = {
29
+ isDev: url.searchParams.get('dev') === 'true',
30
+ height: url.searchParams.get('h'),
31
+ width: url.searchParams.get('w')
32
+ };
33
const options = isDev ? Localoptions : serverOptions
34
35
try {
@@ -46,8 +50,8 @@ export const GET: APIRoute = async ({ url }) => {
46
50
47
51
// set the viewport size
48
52
await page.setViewport({
49
- width: 1920,
- height: 1080,
53
+ width: width ? Math.abs(parseInt(width)) : 1920,
54
+ height: height ? Math.abs(parseInt(height)) : 1080,
55
deviceScaleFactor: 1,
56
})
57
0 commit comments