All changes
This commit is contained in:
parent
593f380581
commit
49f7ec2f5a
60 changed files with 1783 additions and 679 deletions
|
|
@ -50,6 +50,10 @@ export class ScreenshotCache {
|
|||
normalized.tab = params.get('tab')!;
|
||||
}
|
||||
|
||||
if (params.get('path')) {
|
||||
normalized.path = params.get('path')!;
|
||||
}
|
||||
|
||||
const input = JSON.stringify(normalized);
|
||||
const hash = createHash('sha256').update(input).digest('hex').substring(0, 16);
|
||||
return hash;
|
||||
|
|
|
|||
|
|
@ -53,7 +53,12 @@ app.get('/screenshot', async (req, res) => {
|
|||
}
|
||||
}
|
||||
|
||||
// Extract path param (used for non-root pages like /invite/CODE)
|
||||
const pagePath = typeof req.query.path === 'string' && req.query.path ? req.query.path : '/';
|
||||
if (pagePath !== '/') qs.set('path', pagePath);
|
||||
|
||||
const cacheKey = cache.buildKey(qs);
|
||||
qs.delete('path');
|
||||
|
||||
// Check cache first
|
||||
const cached = cache.get(cacheKey);
|
||||
|
|
@ -67,7 +72,7 @@ app.get('/screenshot', async (req, res) => {
|
|||
|
||||
// Build the URL for the frontend in screenshot mode
|
||||
qs.set('screenshot', '1');
|
||||
const url = `${APP_URL}/?${qs}`;
|
||||
const url = `${APP_URL}${pagePath}?${qs}`;
|
||||
|
||||
console.log(`Taking screenshot: ${url}`);
|
||||
const png = await takeScreenshot(url);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue