From 225cc07e0d044b62191cbfd2ccb9c5a517fe7fd9 Mon Sep 17 00:00:00 2001 From: James Grugett Date: Sun, 3 May 2026 17:42:53 -0700 Subject: [PATCH] Add Freebuff approved countries --- freebuff/web/src/app/home-client.tsx | 2 +- .../server/__tests__/free-mode-country.test.ts | 15 ++++++++++++--- web/src/server/free-mode-country.ts | 5 +++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/freebuff/web/src/app/home-client.tsx b/freebuff/web/src/app/home-client.tsx index 3487f3a65..3ccd90fa3 100644 --- a/freebuff/web/src/app/home-client.tsx +++ b/freebuff/web/src/app/home-client.tsx @@ -31,7 +31,7 @@ const faqs = [ { question: 'Which countries is Freebuff available in?', answer: - 'Freebuff is currently available in:\n\nUnited States, Canada, United Kingdom, Australia, New Zealand, Norway, Sweden, Netherlands, Denmark, Germany, Finland, Belgium, Luxembourg, Switzerland, Ireland, and Iceland.', + 'Freebuff is currently available in:\n\nUnited States, Canada, United Kingdom, Australia, New Zealand, Norway, Sweden, Netherlands, Denmark, Germany, Finland, Belgium, Luxembourg, Liechtenstein, Switzerland, Austria, Singapore, Malta, Israel, Ireland, and Iceland.', }, { question: 'Are you training on my data?', diff --git a/web/src/server/__tests__/free-mode-country.test.ts b/web/src/server/__tests__/free-mode-country.test.ts index 3523b1e77..2166f49c9 100644 --- a/web/src/server/__tests__/free-mode-country.test.ts +++ b/web/src/server/__tests__/free-mode-country.test.ts @@ -20,16 +20,25 @@ const noAnonymousNetwork = { const IPINFO_PRIVACY_TEST_IP = '198.51.100.42' describe('free mode country access', () => { - test('allows allowlisted Cloudflare countries', async () => { + test.each([ + ['us', 'US'], + ['LU', 'LU'], + ['LI', 'LI'], + ['CH', 'CH'], + ['AT', 'AT'], + ['SG', 'SG'], + ['MT', 'MT'], + ['IL', 'IL'], + ])('allows allowlisted Cloudflare country %s', async (header, expected) => { const access = await getFreeModeCountryAccess( makeReq({ - 'cf-ipcountry': 'us', + 'cf-ipcountry': header, 'cf-connecting-ip': '203.0.113.10', }), noAnonymousNetwork, ) expect(access.allowed).toBe(true) - expect(access.countryCode).toBe('US') + expect(access.countryCode).toBe(expected) expect(access.blockReason).toBe(null) }) diff --git a/web/src/server/free-mode-country.ts b/web/src/server/free-mode-country.ts index c5454cf13..4e5457dd4 100644 --- a/web/src/server/free-mode-country.ts +++ b/web/src/server/free-mode-country.ts @@ -22,7 +22,12 @@ export const FREE_MODE_ALLOWED_COUNTRIES = new Set([ 'FI', 'BE', 'LU', + 'LI', 'CH', + 'AT', + 'SG', + 'MT', + 'IL', 'IE', 'IS', ])