File tree 2 files changed +5
-7
lines changed
2 files changed +5
-7
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ import { NextRequest, NextResponse } from "next/server";
2
2
import parseURL from "@/helpers/parser" ;
3
3
import { DocumentInfo } from "@/types" ;
4
4
import axios from "axios" ;
5
- import { metadata } from "@/app/page" ;
5
+ import { metadata } from "@/app/page" ;
6
6
7
7
export async function GET ( request : NextRequest ) {
8
8
const Base64searchParams = request . nextUrl . searchParams . get ( 'base64' ) ;
@@ -32,7 +32,7 @@ export async function GET(request: NextRequest) {
32
32
33
33
if ( ! info ) {
34
34
const ogImage = "https://raw.githubusercontent.com/asyncapi/studio/master/apps/studio-next/public/img/meta-studio-og-image.jpeg" ;
35
-
35
+
36
36
const crawlerInfo = `
37
37
<!DOCTYPE html>
38
38
<html lang="en">
Original file line number Diff line number Diff line change @@ -5,10 +5,11 @@ export async function middleware(request: NextRequest) {
5
5
const userAgents = crawlers . map ( crawler => crawler . pattern ) ;
6
6
const requestInfo = userAgent ( request ) ;
7
7
const res = NextResponse . next ( ) ;
8
- const documentURL = request . nextUrl . searchParams . get ( "url" ) ;
9
-
8
+
10
9
for ( const ua of userAgents ) {
11
10
if ( requestInfo . ua . toLowerCase ( ) . includes ( ua . toLowerCase ( ) ) ) {
11
+
12
+ const documentURL = request . nextUrl . searchParams . get ( "url" ) ;
12
13
const encodedDocument = request . nextUrl . searchParams . get ( "base64" ) ;
13
14
14
15
if ( ! encodedDocument && ! documentURL ) {
@@ -25,6 +26,3 @@ export async function middleware(request: NextRequest) {
25
26
return res ;
26
27
}
27
28
28
- export const config = {
29
- matcher : [ '/:base64' , '/:url' ] ,
30
- }
You can’t perform that action at this time.
0 commit comments