chore: eventing + refactoring
This commit is contained in:
parent
20184d767e
commit
4b7e3f7ee5
2 changed files with 9 additions and 4 deletions
11
api/event.js
11
api/event.js
|
@ -8,11 +8,16 @@ export default async (request, context) => {
|
|||
const num = params.get('num') || 'unknown'
|
||||
const lang = decodeURIComponent(params.get('lang'))
|
||||
const nav = decodeURIComponent(params.get('nav'))
|
||||
const notLang = !lang || lang === 'null' || lang === 'undefined'
|
||||
const notNav = !nav || nav === 'null' || nav === 'undefined'
|
||||
const ig = params.get('ig')
|
||||
const setUrl = (id, event) => `https://cdn.usefathom.com/?h=${encodeURIComponent(page)}&sid=CWSVCDJC&cid=${id}&name=${encodeURIComponent(event)}`
|
||||
const headers = {}
|
||||
if (lang) headers['Accept-Language'] = lang
|
||||
if (nav) headers['User-Agent'] = nav
|
||||
const acceptLanguage = notLang ? request['headers'].get('accept-language') : lang
|
||||
const userAgent = notNav ? request['headers'].get('user-agent') : nav
|
||||
const headers = {
|
||||
'Accept-Language': acceptLanguage,
|
||||
'User-Agent': userAgent
|
||||
}
|
||||
let url
|
||||
|
||||
if (ig) return
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "coryd.dev",
|
||||
"version": "8.7.2",
|
||||
"version": "8.7.3",
|
||||
"description": "The source for my personal site. Built using 11ty.",
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
|
|
Reference in a new issue