Skip to content

Commit 74fa2b2

Browse files
mike182ukallouis
authored andcommitted
Removed custom-webfinger flag
ref https://linear.app/ghost/issue/AP-963 Removed `custom-webfinger` flag that was being used to validate custom webfinger solution in prod for `www` based hosts
1 parent e6698c7 commit 74fa2b2

File tree

3 files changed

+2
-24
lines changed

3 files changed

+2
-24
lines changed

src/app.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ if (process.env.MANUALLY_START_QUEUE === 'true') {
248248
});
249249
}
250250

251-
const flagService = new FlagService(['custom-webfinger']);
251+
const flagService = new FlagService([]);
252252

253253
const events = new AsyncEvents();
254254
const fedifyContextFactory = new FedifyContextFactory();
@@ -905,9 +905,7 @@ function requireRole(...roles: GhostRole[]) {
905905

906906
app.get(
907907
'/.well-known/webfinger',
908-
spanWrapper(
909-
createWebFingerHandler(accountRepository, siteService, flagService),
910-
),
908+
spanWrapper(createWebFingerHandler(accountRepository, siteService)),
911909
);
912910

913911
app.get(

src/http/handler/webfinger.ts

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type { Context as HonoContext, Next } from 'hono';
22

33
import type { Account } from 'account/account.entity';
44
import type { KnexAccountRepository } from 'account/account.repository.knex';
5-
import type { FlagService } from 'flag/flag.service';
65
import type { SiteService } from 'site/site.service';
76

87
const ACCOUNT_RESOURCE_PREFIX = 'acct:';
@@ -11,7 +10,6 @@ const HOST_REGEX = /^([a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]+)$/;
1110
export function createWebFingerHandler(
1211
accountRepository: KnexAccountRepository,
1312
siteService: SiteService,
14-
flagService: FlagService,
1513
) {
1614
/**
1715
* Custom webfinger implementation to allow resources hosted on the www
@@ -20,10 +18,6 @@ export function createWebFingerHandler(
2018
* @see https://github.com/fedify-dev/fedify/blob/main/src/webfinger/handler.ts
2119
*/
2220
return async function handleWebFinger(ctx: HonoContext, next: Next) {
23-
if (flagService.isDisabled('custom-webfinger')) {
24-
return next();
25-
}
26-
2721
const resource = ctx.req.query('resource');
2822

2923
// We only support custom handling of `acct:` resources - If the

src/http/handler/webfinger.unit.test.ts

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,13 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';
22

33
import type { Account } from 'account/account.entity';
44
import type { KnexAccountRepository } from 'account/account.repository.knex';
5-
import type { FlagService } from 'flag/flag.service';
65
import type { Context } from 'hono';
76
import type { Site, SiteService } from 'site/site.service';
87
import { createWebFingerHandler } from './webfinger';
98

109
describe('handleWebFinger', () => {
1110
let siteService: SiteService;
1211
let accountRepository: KnexAccountRepository;
13-
let flagService: FlagService;
1412

1513
function getCtx(queries: Record<string, string>) {
1614
return {
@@ -29,16 +27,12 @@ describe('handleWebFinger', () => {
2927
accountRepository = {
3028
getBySite: vi.fn(),
3129
} as unknown as KnexAccountRepository;
32-
flagService = {
33-
isDisabled: vi.fn().mockReturnValue(false),
34-
} as unknown as FlagService;
3530
});
3631

3732
it('should fallback to the default webfinger implementation if the resource is falsy', async () => {
3833
const handleWebFinger = createWebFingerHandler(
3934
accountRepository,
4035
siteService,
41-
flagService,
4236
);
4337

4438
const ctx = getCtx({});
@@ -53,7 +47,6 @@ describe('handleWebFinger', () => {
5347
const handleWebFinger = createWebFingerHandler(
5448
accountRepository,
5549
siteService,
56-
flagService,
5750
);
5851

5952
const ctx = getCtx({ resource: 'https://example.com' });
@@ -68,7 +61,6 @@ describe('handleWebFinger', () => {
6861
const handleWebFinger = createWebFingerHandler(
6962
accountRepository,
7063
siteService,
71-
flagService,
7264
);
7365

7466
const ctx = getCtx({ resource: 'acct:alice' }); // missing @
@@ -84,7 +76,6 @@ describe('handleWebFinger', () => {
8476
const handleWebFinger = createWebFingerHandler(
8577
accountRepository,
8678
siteService,
87-
flagService,
8879
);
8980

9081
const ctx = getCtx({ resource: 'acct:alice@example' }); // missing .com
@@ -100,7 +91,6 @@ describe('handleWebFinger', () => {
10091
const handleWebFinger = createWebFingerHandler(
10192
accountRepository,
10293
siteService,
103-
flagService,
10494
);
10595

10696
const ctx = getCtx({ resource: 'acct:[email protected]' });
@@ -120,7 +110,6 @@ describe('handleWebFinger', () => {
120110
const handleWebFinger = createWebFingerHandler(
121111
accountRepository,
122112
siteService,
123-
flagService,
124113
);
125114

126115
const ctx = getCtx({ resource: 'acct:[email protected]' });
@@ -152,7 +141,6 @@ describe('handleWebFinger', () => {
152141
const handleWebFinger = createWebFingerHandler(
153142
accountRepository,
154143
siteService,
155-
flagService,
156144
);
157145

158146
const ctx = getCtx({ resource: 'acct:[email protected]' });
@@ -201,7 +189,6 @@ describe('handleWebFinger', () => {
201189
const handleWebFinger = createWebFingerHandler(
202190
accountRepository,
203191
siteService,
204-
flagService,
205192
);
206193

207194
const ctx = getCtx({ resource: 'acct:[email protected]' });
@@ -232,7 +219,6 @@ describe('handleWebFinger', () => {
232219
const handleWebFinger = createWebFingerHandler(
233220
accountRepository,
234221
siteService,
235-
flagService,
236222
);
237223

238224
const ctx = getCtx({ resource: 'acct:[email protected]' });

0 commit comments

Comments
 (0)