2023-08-08 22:50:52 +03:00
|
|
|
/* eslint-disable import/no-unused-modules */
|
|
|
|
import { MetaTagInjector } from './components/metaTagInjector'
|
|
|
|
|
|
|
|
export const onRequest: PagesFunction = async ({ request, next }) => {
|
|
|
|
const imageUri = new URL(request.url).origin + '/images/1200x630_Rich_Link_Preview_Image.png'
|
|
|
|
const data = {
|
|
|
|
title: 'Uniswap Interface',
|
|
|
|
image: imageUri,
|
|
|
|
url: request.url,
|
2023-08-12 01:53:48 +03:00
|
|
|
description: 'Swap or provide liquidity on the Uniswap Protocol',
|
2023-08-08 22:50:52 +03:00
|
|
|
}
|
|
|
|
const res = next()
|
|
|
|
try {
|
|
|
|
return new HTMLRewriter().on('head', new MetaTagInjector(data)).transform(await res)
|
|
|
|
} catch (e) {
|
|
|
|
return res
|
|
|
|
}
|
|
|
|
}
|