diff --git a/src/constants.ts b/src/constants.ts index 7d7f32c..2843a68 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,6 +1,7 @@ const fakeChromeVersion = '103'; export const Constants = { + BRANDING_NAME: `pxTwitter`, REDIRECT_URL: 'https://twitter.com/dangeredwolf', TWITTER_ROOT: 'https://twitter.com', TWITTER_API_ROOT: 'https://api.twitter.com', diff --git a/src/server.ts b/src/server.ts index 639e0b0..32acf8f 100644 --- a/src/server.ts +++ b/src/server.ts @@ -29,7 +29,7 @@ const statusRequest = async (request: any) => { const userAgent = request.headers.get('User-Agent'); if (userAgent.match(/bot/ig) !== null) { - return new Response(await handleStatus(handle, id, mediaNumber), { + return new Response(await handleStatus(handle, id, parseInt(mediaNumber || 1)), { headers: { 'content-type': 'text/html;charset=UTF-8', }, @@ -56,13 +56,13 @@ router.get('/owoembed', async (request: any) => { let status = searchParams.get('status') || '1547514042146865153'; const test = { - "author_name":decodeURIComponent(text), - "author_url":`https://twitter.com/${encodeURIComponent(author)}/status/${encodeURIComponent(status)}`, - "provider_name":"pxTwitter", - "provider_url":"https://github.com/dangeredwolf/pxtwitter", - "title":"Twitter", - "type":"link", - "version":"1.0" + "author_name": decodeURIComponent(text), + "author_url": `https://twitter.com/${encodeURIComponent(author)}/status/${encodeURIComponent(status)}`, + "provider_name": Constants.BRANDING_NAME, + "provider_url": Constants.REDIRECT_URL, + "title": "Twitter", + "type": "link", + "version": "1.0" } return new Response(JSON.stringify(test), { headers: {