Skip to content

A free and open source instant messaging and VoIP chat app built for friends, groups, and communities.

TypeScript fluxerfluxerapp
387 B
Raw Blame
// SPDX-License-Identifier: AGPL-3.0-or-later

import {lookupGeoip} from '@app/api/utils/IpUtils';

const KLIPY_DEFAULT_COUNTRY = 'US';

export async function resolveGifRequestCountry(req: Request): Promise<string> {
	try {
		const geoip = await lookupGeoip(req);
		return geoip.countryCode?.trim().toUpperCase() || KLIPY_DEFAULT_COUNTRY;
	} catch {
		return KLIPY_DEFAULT_COUNTRY;
	}
}