vyyhti

· LSX Lokit

Screenshotting a staff-only tool without leaking real data

How I got a real screenshot of a staff-only log viewer full of player data: run the real front end in Playwright and answer every API call with fake data.

LSX Lokit is a log viewer for game server staff. Its whole purpose is to show sensitive things: player names, character IDs, money transfers, admin actions. That makes it a bad thing to screenshot for a portfolio. Blurring a real screenshot is fragile (one missed row and a name is public), and a mock-up drawn by hand is not the real interface.

What I wanted was the real front end, with every number and name fake.

The idea: own the network

The front end is static HTML, CSS and JavaScript that gets all its data from a few JSON endpoints: who is logged in, which log sources exist, and the log rows themselves. If a browser loads those same files but the API answers come from me, the page renders exactly as it does in production, with whatever data I give it.

Playwright can do this with request interception. Every request the page makes goes through one handler:

await context.route('**/*', (route) => {
  const url = new URL(route.request().url());
  if (url.hostname !== 'demo.local') return route.abort();
  if (url.pathname.startsWith('/api/')) {
    return route.fulfill({ json: demoApi[url.pathname] ?? { rows: [], next: null } });
  }
  return route.fulfill({ body: fs.readFileSync(path.join(PUBLIC, url.pathname)) });
});
await page.goto('http://demo.local/#lsx');
  • The page is loaded from a made-up host, demo.local, that does not exist on the network.
  • Static files (index.html, app.js, style.css) are served straight from the app's public/ folder on disk.
  • Anything under /api/ gets a canned JSON answer.
  • Every other request is aborted. The page cannot reach the real server, the real database or anything else, even by accident. That rule is what makes the approach safe: the only data that can appear is data I wrote.

Writing believable fake data

The demo answers are small: a signed-in staff member, a list of nine log categories with plausible counts, and about two dozen log rows. The rows use invented names like "Jake Morrison" and "Rosa Delgado", invented IDs like DEMO1001, and ordinary events: a shop purchase, a bank transfer, a mechanic's paycheck, a store robbery starting. Timestamps are generated relative to "now", so the screenshot always looks recent.

The front end did not need a single change. It cannot tell the difference, which is the point: the screenshot shows the actual sidebar, filters, severity badges and table layout.

From screenshot to WebP without image tools

The server had no image tooling installed (no ImageMagick, no cwebp, no Python imaging library), and I did not want to add one for three images. The browser is already an image encoder, so the same script converts the PNG screenshot to WebP inside the page:

const b64 = await page.evaluate(async ({ data, w }) => {
  const img = new Image();
  img.src = `data:image/png;base64,${data}`;
  await img.decode();
  const c = document.createElement('canvas');
  c.width = w;
  c.height = Math.round(img.naturalHeight * (w / img.naturalWidth));
  c.getContext('2d').drawImage(img, 0, 0, c.width, c.height);
  return c.toDataURL('image/webp', 0.84).split(',')[1];
}, { data: png.toString('base64'), w: 1600 });

Each screenshot is saved at two widths (800 and 1600 pixels) for srcset. The large log viewer image came out at 66 kB.

Say that it is fake

The portfolio caption under the image says the screenshot uses made-up demo data. That is partly honesty and partly protection: if someone recognizes a name that happens to match a real player, the caption already answers the question.

Why this is worth it

  • The screenshot is of the real interface, and it can be re-taken with one command whenever the interface changes.
  • No real data is involved at any step, so there is nothing to blur, crop or forget.
  • The same trick works for any front end that talks to an API: dashboards, admin panels, anything behind a login.

Contact

Questions about one of these projects, or something else? Message me on Discord or send an email.