chore: fixes

This commit is contained in:
Cory Dransfeldt 2024-03-24 13:03:46 -07:00
parent 86a6b02e5f
commit 48e83d95f5
No known key found for this signature in database
2 changed files with 6 additions and 6 deletions

View file

@ -8,13 +8,13 @@ export default async (request, context) => {
const num = new URL(request['url']).searchParams.get('num') const num = new URL(request['url']).searchParams.get('num')
const lang = decodeURIComponent(new URL(request['url']).searchParams.get('lang')) const lang = decodeURIComponent(new URL(request['url']).searchParams.get('lang'))
const nav = decodeURIComponent(new URL(request['url']).searchParams.get('nav')) const nav = decodeURIComponent(new URL(request['url']).searchParams.get('nav'))
const i = new URL(request['url']).searchParams.get('i') const ig = new URL(request['url']).searchParams.get('ig')
const headers = {} const headers = {}
if (lang) headers['Accept-Language'] = lang; if (lang) headers['Accept-Language'] = lang;
if (nav) headers['User-Agent'] = nav; if (nav) headers['User-Agent'] = nav;
let url; let url;
if (i) return; if (ig) return;
if (ns) { if (ns) {
const ids = getStore('ids') const ids = getStore('ids')
if (!ids.get(id)) ids.set(id, '') if (!ids.get(id)) ids.set(id, '')

View file

@ -2,8 +2,8 @@ const id = Math.floor(Math.random() * Date.now())
let i; let i;
let url = `https://coryd.dev/api/event/?page=${encodeURIComponent(window.location.href)}&num=${sessionStorage.getItem('id' || id)}&lang=${encodeURIComponent(navigator.language)}&nav=${encodeURIComponent(navigator.userAgent)}` let url = `https://coryd.dev/api/event/?page=${encodeURIComponent(window.location.href)}&num=${sessionStorage.getItem('id' || id)}&lang=${encodeURIComponent(navigator.language)}&nav=${encodeURIComponent(navigator.userAgent)}`
if (window.sessionStorage && !window.sessionStorage?.getItem('id')) sessionStorage.setItem('id', id) if (window.sessionStorage && !window.sessionStorage?.getItem('id')) sessionStorage.setItem('id', id)
if (window.localStorage && window.localStorage.getItem('i')) { if (window.localStorage && window.localStorage.getItem('ig')) {
i = localStorage.getItem('i') ig = localStorage.getItem('ig')
url = `${url}&i=${i}` url = `${url}&ig=${ig}`
} }
if (!window.fathom) fetch(url).then((data) => {}).catch(err => {}); if (!window.fathom) fetch(url).then(() => {}).catch(() => {});