Skip to content

Commit 225cc07

Browse files
committed
Add Freebuff approved countries
1 parent 13c8b0f commit 225cc07

3 files changed

Lines changed: 18 additions & 4 deletions

File tree

freebuff/web/src/app/home-client.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ const faqs = [
3131
{
3232
question: 'Which countries is Freebuff available in?',
3333
answer:
34-
'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.',
34+
'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.',
3535
},
3636
{
3737
question: 'Are you training on my data?',

web/src/server/__tests__/free-mode-country.test.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,25 @@ const noAnonymousNetwork = {
2020
const IPINFO_PRIVACY_TEST_IP = '198.51.100.42'
2121

2222
describe('free mode country access', () => {
23-
test('allows allowlisted Cloudflare countries', async () => {
23+
test.each([
24+
['us', 'US'],
25+
['LU', 'LU'],
26+
['LI', 'LI'],
27+
['CH', 'CH'],
28+
['AT', 'AT'],
29+
['SG', 'SG'],
30+
['MT', 'MT'],
31+
['IL', 'IL'],
32+
])('allows allowlisted Cloudflare country %s', async (header, expected) => {
2433
const access = await getFreeModeCountryAccess(
2534
makeReq({
26-
'cf-ipcountry': 'us',
35+
'cf-ipcountry': header,
2736
'cf-connecting-ip': '203.0.113.10',
2837
}),
2938
noAnonymousNetwork,
3039
)
3140
expect(access.allowed).toBe(true)
32-
expect(access.countryCode).toBe('US')
41+
expect(access.countryCode).toBe(expected)
3342
expect(access.blockReason).toBe(null)
3443
})
3544

web/src/server/free-mode-country.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,12 @@ export const FREE_MODE_ALLOWED_COUNTRIES = new Set([
2222
'FI',
2323
'BE',
2424
'LU',
25+
'LI',
2526
'CH',
27+
'AT',
28+
'SG',
29+
'MT',
30+
'IL',
2631
'IE',
2732
'IS',
2833
])

0 commit comments

Comments
 (0)