add cookie. add city database

This commit is contained in:
Sergei Meza 2022-10-18 16:37:05 +09:00
parent 5a8464e4e0
commit 63531f8753
3 changed files with 9 additions and 4 deletions

View file

@ -1,3 +1,4 @@
/* eslint-disable no-console */
import { parseToken } from 'next-basics';
import { validate } from 'uuid';
import { uuid } from 'lib/crypto';
@ -45,8 +46,10 @@ export async function getSession(req) {
throw new Error(`Website not found: ${website_uuid}`);
}
const ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
const { userAgent, browser, os, country, device } = await getClientInfo(req, payload);
// const ip = req.headers['x-forwarded-for'] || req.connection.remoteAddress;
const { userAgent, browser, os, ip, country, device } = await getClientInfo(req, payload);
console.log('ip:', ip);
let session_uuid = uuid(websiteId, hostname, ip, userAgent);
if (process.env.CROSSDOMAIN_TRACKING) {