mirror of
https://github.com/waynesutton/markdown-site.git
synced 2026-01-12 04:09:14 +00:00
docs: add visitor map configuration to README and update docs.md
- Added visitor map section to README.md after GitHub Contributions Graph - Updated visitor map description in content/pages/docs.md with privacy details - Documents configuration options in src/config/siteConfig.ts - Explains Netlify geo detection and theme-aware colors
This commit is contained in:
32
netlify/edge-functions/geo.ts
Normal file
32
netlify/edge-functions/geo.ts
Normal file
@@ -0,0 +1,32 @@
|
||||
import type { Context } from "@netlify/edge-functions";
|
||||
|
||||
// Returns the user's geo location from Netlify's automatic geo headers
|
||||
// Privacy friendly: only returns city/country/coordinates, no IP address stored
|
||||
export default async function handler(
|
||||
_request: Request,
|
||||
context: Context,
|
||||
): Promise<Response> {
|
||||
// Netlify provides geo data automatically via context.geo
|
||||
const geo = context.geo;
|
||||
|
||||
const data = {
|
||||
city: geo?.city || null,
|
||||
country: geo?.country?.code || null,
|
||||
countryName: geo?.country?.name || null,
|
||||
latitude: geo?.latitude || null,
|
||||
longitude: geo?.longitude || null,
|
||||
};
|
||||
|
||||
return new Response(JSON.stringify(data), {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
"Cache-Control": "private, max-age=3600",
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
export const config = {
|
||||
path: "/api/geo",
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user