Skip to content

Commit 59e3450

Browse files
committed
fix: og support
1 parent a11f3e7 commit 59e3450

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/waku/internal/middleware/md-router.ts

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ export const aiUserAgents = [
1818
'Applebot-Extended',
1919
'FacebookBot',
2020
'meta-externalagent',
21-
'LinkedInBot',
2221
'Bytespider',
2322
'DuckAssistBot',
2423
'cohere-ai',
@@ -34,6 +33,21 @@ export const aiUserAgents = [
3433

3534
export const terminalUserAgents = ['curl/', 'Wget/', 'HTTPie/', 'httpie-go/', 'xh/']
3635

36+
export const ogBotUserAgents = [
37+
'Discordbot',
38+
'Embedly',
39+
'Facebot',
40+
'Iframely',
41+
'LinkedInBot',
42+
'Pinterestbot',
43+
'Slackbot',
44+
'Slurp',
45+
'TelegramBot',
46+
'Twitterbot',
47+
'WhatsApp',
48+
'facebookexternalhit',
49+
]
50+
3751
const isDev = process.env['NODE_ENV'] !== 'production'
3852

3953
async function resolveContent() {
@@ -67,6 +81,9 @@ export function middleware(): MiddlewareHandler {
6781
const url = new URL(context.req.url)
6882

6983
const userAgent = context.req.header('user-agent') ?? ''
84+
const isOgBot = ogBotUserAgents.some((agent) => userAgent.includes(agent))
85+
if (isOgBot) return next()
86+
7087
const isAiAgent = aiUserAgents.some((agent) => userAgent.includes(agent))
7188
const isTerminal = terminalUserAgents.some((agent) => userAgent.includes(agent))
7289
const acceptHeader = context.req.header('accept') ?? ''

0 commit comments

Comments
 (0)