Skip to content

Commit f9a2c48

Browse files
authored
Merge pull request #5 from appwrite/fix-flutter-support
Fix: Flutter support
2 parents b39145f + bedf4b1 commit f9a2c48

File tree

3 files changed

+35
-14
lines changed

3 files changed

+35
-14
lines changed

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"dependencies": {
1919
"h3": "^1.13.0",
2020
"lighthouse": "^12.2.1",
21-
"playwright": "^1.50.1",
21+
"playwright": "^1.52.0",
2222
"playwright-lighthouse": "^4.0.0",
2323
"zod": "^3.23.8"
2424
},

pnpm-lock.yaml

+12-12
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.js

+22-1
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,27 @@ router.post(
4646
const context = await browser.newContext({
4747
...defaultContext,
4848
colorScheme: body.theme,
49-
extraHTTPHeaders: body.headers,
5049
});
50+
51+
// await context.tracing.start({ screenshots: true, snapshots: true });
52+
5153
const page = await context.newPage();
54+
55+
// Override headers
56+
await page.route("**/*", async (route, request) => {
57+
const url = request.url();
58+
if (url.startsWith("http://appwrite/")) {
59+
return await route.continue({
60+
headers: {
61+
...request.headers(),
62+
...body.headers,
63+
},
64+
});
65+
}
66+
67+
return await route.continue({ headers: request.headers() });
68+
});
69+
5270
await page.goto(body.url, {
5371
waitUntil: "domcontentloaded",
5472
});
@@ -58,6 +76,9 @@ router.post(
5876
}
5977

6078
const screen = await page.screenshot();
79+
80+
// await context.tracing.stop({ path: '/tmp/trace' + Date.now() + '.zip' });
81+
6182
await context.close();
6283
return screen;
6384
}),

0 commit comments

Comments
 (0)