mirror of
https://github.com/movie-web/simple-proxy.git
synced 2025-09-13 18:13:26 +00:00
Finish ip fetching
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
import { EventHandlerRequest, H3Event } from 'h3';
|
||||
|
||||
export function getIp(_event: H3Event<EventHandlerRequest>) {
|
||||
return 'not-a-real-ip'; // TODO cross platform IP
|
||||
export function getIp(event: H3Event<EventHandlerRequest>) {
|
||||
const value = getHeader(event, 'CF-Connecting-IP');
|
||||
if (!value)
|
||||
throw new Error(
|
||||
'Ip header not found, turnstile only works on cloudflare workers',
|
||||
);
|
||||
return value;
|
||||
}
|
||||
|
Reference in New Issue
Block a user