pstreams-providers/src/utils/proxy.ts
2024-06-30 16:28:02 +05:30

16 lines
450 B
TypeScript

import { flags } from '@/entrypoint/utils/targets';
import { Stream } from '@/providers/streams';
export function requiresProxy(stream: Stream): boolean {
if (!stream.flags.includes('cors-allowed') && !!(stream.headers && Object.keys(stream.headers).length > 0))
return true;
return false;
}
export function setupProxy(stream: Stream): Stream {
// todo
// stream.headers = {};
stream.flags = [flags.CORS_ALLOWED];
return stream;
}