Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
thostetler committed Sep 16, 2024
1 parent 76c63ef commit 596c672
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
1 change: 0 additions & 1 deletion src/middleware.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { initSession } from '@/middlewares/initSession';
import { verifyMiddleware } from '@/middlewares/verifyMiddleware';
import { getIronSession } from 'iron-session/edge';
import { edgeLogger } from '@/logger';
// eslint-disable-next-line @next/next/no-server-import-in-page
import { NextRequest, NextResponse } from 'next/server';

const log = edgeLogger.child({}, { msgPrefix: '[middleware] ' });
Expand Down
16 changes: 12 additions & 4 deletions src/middlewares/botCheck.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { sessionConfig } from '@/config';
import { getIronSession } from 'iron-session/edge';
import { edgeLogger } from '@/logger';
// eslint-disable-next-line @next/next/no-server-import-in-page
import { NextRequest, NextResponse, userAgent } from 'next/server';
import { IronSessionData } from 'iron-session';

Expand Down Expand Up @@ -43,13 +42,22 @@ const getBotToken = (result: CRAWLER_RESULT): IronSessionData['token'] => {
switch (result) {
case CRAWLER_RESULT.BOT:
log.debug('Bot detected');
return { access_token: process.env.VERIFIED_BOTS_ACCESS_TOKEN, ...baseToken };
return {
access_token: process.env.VERIFIED_BOTS_ACCESS_TOKEN,
...baseToken,
};
case CRAWLER_RESULT.UNVERIFIABLE:
log.debug('Unverifiable bot detected');
return { access_token: process.env.UNVERIFIABLE_BOTS_ACCESS_TOKEN, ...baseToken };
return {
access_token: process.env.UNVERIFIABLE_BOTS_ACCESS_TOKEN,
...baseToken,
};
case CRAWLER_RESULT.POTENTIAL_MALICIOUS_BOT:
log.debug('Potentially malicious bot detected');
return { access_token: process.env.MALICIOUS_BOTS_ACCESS_TOKEN, ...baseToken };
return {
access_token: process.env.MALICIOUS_BOTS_ACCESS_TOKEN,
...baseToken,
};
case CRAWLER_RESULT.HUMAN:
default:
log.debug('Human detected');
Expand Down
1 change: 0 additions & 1 deletion src/middlewares/decorateHeaders.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { edgeLogger } from '@/logger';
// eslint-disable-next-line @next/next/no-server-import-in-page
import { NextRequest } from 'next/server';

const log = edgeLogger.child({}, { msgPrefix: '[decorateHeaders] ' });
Expand Down
1 change: 0 additions & 1 deletion src/middlewares/verifyMiddleware.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// eslint-disable-next-line @next/next/no-server-import-in-page
import { NextRequest, NextResponse } from 'next/server';
import { getIronSession } from 'iron-session/edge';
import { sessionConfig } from '@/config';
Expand Down
2 changes: 1 addition & 1 deletion src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import '../styles/page-loader.css';
import { logger } from '@/logger';
import { GoogleTagManager, sendGTMEvent } from '@next/third-parties/google';
import Head from 'next/head';
import { APP_DEFAULTS, BRAND_NAME_FULL } from '@/config';
import { BRAND_NAME_FULL } from '@/config';

if (process.env.NEXT_PUBLIC_API_MOCKING === 'enabled' && process.env.NODE_ENV !== 'production') {
require('../mocks');
Expand Down

0 comments on commit 596c672

Please sign in to comment.