mirror of
https://github.com/skidoodle/albert.lol.git
synced 2025-02-15 06:09:15 +01:00
add simple geolocation
This commit is contained in:
parent
a6a33bc434
commit
abf1137b3e
2 changed files with 13 additions and 2 deletions
|
@ -2,5 +2,13 @@ import { NextApiRequest, NextApiResponse } from 'next';
|
|||
|
||||
export default async function ip(req: NextApiRequest, res: NextApiResponse){
|
||||
let ip = req.headers['cf-connecting-ip'];
|
||||
res.status(200).json({ ip: ip });
|
||||
let continent = req.headers['cf-ipcontinent'];
|
||||
let country = req.headers['cf-ipcountry'];
|
||||
let city = req.headers['cf-ipcity'];
|
||||
res.status(200).json({
|
||||
ip: ip,
|
||||
continent: continent,
|
||||
country: country,
|
||||
city: city
|
||||
});
|
||||
}
|
|
@ -42,5 +42,8 @@ export default async function Storage(req: NextApiRequest, res: NextApiResponse)
|
|||
'Cache-Control',
|
||||
'public, s-maxage=10, stale-while-revalidate=59'
|
||||
);
|
||||
res.json({ object: objects, size: Number(size.toFixed(2)) });
|
||||
res.json({
|
||||
object: objects,
|
||||
size: Number(size.toFixed(2))
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue