chore: fixes

This commit is contained in:
Cory Dransfeldt 2024-03-24 12:46:36 -07:00
parent 86ab1d894d
commit ef280f0a1c
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View file

@ -6,8 +6,8 @@ export default async (request, context) => {
const id = crypto.createHash('md5').update(`${context['ip']}${context['geo']['city']}`).digest('hex');
const page = new URL(request['url']).searchParams.get('page')
const num = new URL(request['url']).searchParams.get('num')
const lang = new URL(request['url']).searchParams.get('lang')
const nav = new URL(request['url']).searchParams.get('nav')
const lang = decodeURIComponent(new URL(request['url']).searchParams.get('lang'))
const nav = decodeURIComponent(new URL(request['url']).searchParams.get('nav'))
const i = new URL(request['url']).searchParams.get('i')
const headers = {}
if (lang) headers['Accept-Language'] = lang;

View file

@ -3,7 +3,7 @@ let i;
if (window.sessionStorage && !window.sessionStorage?.getItem('id')) sessionStorage.setItem('id', id)
if (window.localStorage && window.localStorage.getItem('i')) i = localStorage.getItem('i')
if (!window.fathom) {
fetch(`https://coryd.dev/api/event/?page=${encodeURIComponent(window.location.href)}&num=${sessionStorage.getItem('id' || id)}&lang=${navigator.language}&nav=${navigator.userAgent}&i=${i}`)
fetch(`https://coryd.dev/api/event/?page=${encodeURIComponent(window.location.href)}&num=${sessionStorage.getItem('id' || id)}&lang=${encodeURIComponent(navigator.language)}&nav=${encodeURIComponent(navigator.userAgent)}&i=${i}`)
.then((data) => {
console.log(data)
return {}