Skip to content

Commit 53de6f6

Browse files
committed
Allow France in free mode country gate
1 parent 3feed48 commit 53de6f6

3 files changed

Lines changed: 11 additions & 8 deletions

File tree

web/src/app/api/v1/freebuff/session/__tests__/session.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -230,15 +230,15 @@ describe('POST /api/v1/freebuff/session', () => {
230230
test('returns country_blocked without joining the queue for disallowed country', async () => {
231231
const sessionDeps = makeSessionDeps()
232232
const resp = await postFreebuffSession(
233-
makeReq('ok', { cfCountry: 'FR' }),
233+
makeReq('ok', { cfCountry: 'ES' }),
234234
makeDeps(sessionDeps, 'u1'),
235235
)
236236
// 403 (not 200) so older CLIs that don't know `country_blocked` fall into
237237
// their error-retry backoff instead of tight-polling.
238238
expect(resp.status).toBe(403)
239239
const body = await resp.json()
240240
expect(body.status).toBe('country_blocked')
241-
expect(body.countryCode).toBe('FR')
241+
expect(body.countryCode).toBe('ES')
242242
expect(body.countryBlockReason).toBe('country_not_allowed')
243243
expect(sessionDeps.rows.size).toBe(0)
244244
})
@@ -326,13 +326,13 @@ describe('GET /api/v1/freebuff/session', () => {
326326
test('returns country_blocked for disallowed country on GET', async () => {
327327
const sessionDeps = makeSessionDeps()
328328
const resp = await getFreebuffSession(
329-
makeReq('ok', { cfCountry: 'FR' }),
329+
makeReq('ok', { cfCountry: 'ES' }),
330330
makeDeps(sessionDeps, 'u1'),
331331
)
332332
expect(resp.status).toBe(403)
333333
const body = await resp.json()
334334
expect(body.status).toBe('country_blocked')
335-
expect(body.countryCode).toBe('FR')
335+
expect(body.countryCode).toBe('ES')
336336
expect(body.countryBlockReason).toBe('country_not_allowed')
337337
})
338338

@@ -358,7 +358,7 @@ describe('GET /api/v1/freebuff/session', () => {
358358
})
359359
let countryChecks = 0
360360
const resp = await getFreebuffSession(
361-
makeReq('ok', { cfCountry: 'FR' }),
361+
makeReq('ok', { cfCountry: 'ES' }),
362362
makeDeps(sessionDeps, 'u1', {
363363
getCountryAccess: async (req) => {
364364
countryChecks++

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ describe('free mode country access', () => {
2929
['SG', 'SG'],
3030
['MT', 'MT'],
3131
['IL', 'IL'],
32+
['FR', 'FR'],
33+
['BE', 'BE'],
3234
])('allows allowlisted Cloudflare country %s', async (header, expected) => {
3335
const access = await getFreeModeCountryAccess(
3436
makeReq({
@@ -44,11 +46,11 @@ describe('free mode country access', () => {
4446

4547
test('blocks countries outside the allowlist', async () => {
4648
const access = await getFreeModeCountryAccess(
47-
makeReq({ 'cf-ipcountry': 'FR' }),
49+
makeReq({ 'cf-ipcountry': 'ES' }),
4850
noAnonymousNetwork,
4951
)
5052
expect(access.allowed).toBe(false)
51-
expect(access.countryCode).toBe('FR')
53+
expect(access.countryCode).toBe('ES')
5254
expect(access.blockReason).toBe('country_not_allowed')
5355
})
5456

@@ -295,7 +297,7 @@ describe('free mode country access', () => {
295297

296298
test('allowLocalhost does not bypass when cf-ipcountry is set', async () => {
297299
const access = await getFreeModeCountryAccess(
298-
makeReq({ 'cf-ipcountry': 'FR' }),
300+
makeReq({ 'cf-ipcountry': 'ES' }),
299301
{
300302
ipinfoToken: 'test-token',
301303
allowLocalhost: true,

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ export const FREE_MODE_ALLOWED_COUNTRIES = new Set([
1919
'NL',
2020
'DK',
2121
'DE',
22+
'FR',
2223
'FI',
2324
'BE',
2425
'LU',

0 commit comments

Comments
 (0)