Skip to content

Commit

Permalink
misc: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
antho-bunny committed Sep 18, 2024
1 parent 26d7917 commit 6d311fe
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ BunnySDK.net.http.servePullZone({ url: "https://echo.free.beeceptor.com/" })
.onOriginRequest(
(ctx) => {
ctx.request.headers.set("mobile", "true");
const ua = ctx.request.headers.get("User-Agent");
const ua = ctx.request.headers.get("User-Agent") ?? navigator.userAgent;
const parser = new UA.UAParser(ua);
const device = parser.getDevice();
const device = parser.getDevice().type;
switch (device) {
case "mobile":
ctx.request.headers.set("isMobile", "true");
Expand All @@ -20,6 +20,8 @@ BunnySDK.net.http.servePullZone({ url: "https://echo.free.beeceptor.com/" })
default:
break;
}

return Promise.resolve(ctx.request);
},
).onOriginResponse(async (ctx) => {
const body = await ctx.response.json();
Expand Down

0 comments on commit 6d311fe

Please sign in to comment.