Back

Version 181

9/9/2024
import { initAnalytics, getAnalytics, trackPageView } from 'https://esm.town/v/iamseeley/counterTownDb';

export const counterTownConfig = {
firstName: 'thomas',
lastName: 'seeley',
allowedOrigins: ['https://iamseeley-htmlenergy.web.val.run', 'https://tseeley.com', "https://wando-ui.tseeley.com", "https://falbulous-minimovie.vercel.app", "https://iamseeley-dailysilverlion.web.val.run/"],
ogImage: 'https://res.cloudinary.com/dcwnusepx/image/upload/v1721484366/tseeley/flying_ww6ynv.jpg',
};

const possessiveFirstName = counterTownConfig.firstName.endsWith('s')
? `${counterTownConfig.firstName}'`
: `${counterTownConfig.firstName}'s`;

let isInitialized = false;

export default async function handler(req: Request): Promise<Response> {
if (!isInitialized) {
try {
await initAnalytics();
console.log('Analytics initialized successfully');
isInitialized = true;
} catch (error) {
console.error('Failed to initialize analytics:', error);
}
}

const url = new URL(req.url);
const path = url.pathname;

if (path === '/') {
return serveHtml(req);
} else if (path === '/stream') {
return handleStream(req);
} else if (path === '/trackPageView') {
return handleAnalytics(req);
} else if (path === '/trackingScript') {
iamseeley-countertown.web.val.run
Updated: September 10, 2024