enhance: detect requests of pwa

This commit is contained in:
Julian Krauser 2025-01-11 14:45:37 +01:00
parent 632a8290ac
commit b1e949dce2
3 changed files with 14 additions and 0 deletions

View file

@ -0,0 +1,11 @@
import { Request, Response } from "express";
export default async function detectPWA(req: Request, res: Response, next: Function) {
const userAgent = req.headers["user-agent"] || "";
if ((userAgent.includes("Mobile") && userAgent.includes("Standalone")) || req.headers["x-pwa-client"] === "true") {
req.isPWA = true;
} else {
req.isPWA = false;
}
next();
}