Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ if (process.env.MANUALLY_START_QUEUE === 'true') {
});
}

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

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

app.get(
'/.well-known/webfinger',
spanWrapper(
createWebFingerHandler(accountRepository, siteService, flagService),
),
spanWrapper(createWebFingerHandler(accountRepository, siteService)),
);

app.get(
Expand Down
6 changes: 0 additions & 6 deletions src/http/handler/webfinger.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import type { Context as HonoContext, Next } from 'hono';

import type { Account } from 'account/account.entity';
import type { KnexAccountRepository } from 'account/account.repository.knex';
import type { FlagService } from 'flag/flag.service';
import type { SiteService } from 'site/site.service';

const ACCOUNT_RESOURCE_PREFIX = 'acct:';
Expand All @@ -11,7 +10,6 @@ const HOST_REGEX = /^([a-zA-Z0-9-]+(\.[a-zA-Z0-9-]+)*\.[a-zA-Z0-9]+)$/;
export function createWebFingerHandler(
accountRepository: KnexAccountRepository,
siteService: SiteService,
flagService: FlagService,
) {
/**
* Custom webfinger implementation to allow resources hosted on the www
Expand All @@ -20,10 +18,6 @@ export function createWebFingerHandler(
* @see https://github.com/fedify-dev/fedify/blob/main/src/webfinger/handler.ts
*/
return async function handleWebFinger(ctx: HonoContext, next: Next) {
if (flagService.isDisabled('custom-webfinger')) {
return next();
}

const resource = ctx.req.query('resource');

// We only support custom handling of `acct:` resources - If the
Expand Down
14 changes: 0 additions & 14 deletions src/http/handler/webfinger.unit.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@ import { beforeEach, describe, expect, it, vi } from 'vitest';

import type { Account } from 'account/account.entity';
import type { KnexAccountRepository } from 'account/account.repository.knex';
import type { FlagService } from 'flag/flag.service';
import type { Context } from 'hono';
import type { Site, SiteService } from 'site/site.service';
import { createWebFingerHandler } from './webfinger';

describe('handleWebFinger', () => {
let siteService: SiteService;
let accountRepository: KnexAccountRepository;
let flagService: FlagService;

function getCtx(queries: Record<string, string>) {
return {
Expand All @@ -29,16 +27,12 @@ describe('handleWebFinger', () => {
accountRepository = {
getBySite: vi.fn(),
} as unknown as KnexAccountRepository;
flagService = {
isDisabled: vi.fn().mockReturnValue(false),
} as unknown as FlagService;
});

it('should fallback to the default webfinger implementation if the resource is falsy', async () => {
const handleWebFinger = createWebFingerHandler(
accountRepository,
siteService,
flagService,
);

const ctx = getCtx({});
Expand All @@ -53,7 +47,6 @@ describe('handleWebFinger', () => {
const handleWebFinger = createWebFingerHandler(
accountRepository,
siteService,
flagService,
);

const ctx = getCtx({ resource: 'https://example.com' });
Expand All @@ -68,7 +61,6 @@ describe('handleWebFinger', () => {
const handleWebFinger = createWebFingerHandler(
accountRepository,
siteService,
flagService,
);

const ctx = getCtx({ resource: 'acct:alice' }); // missing @
Expand All @@ -84,7 +76,6 @@ describe('handleWebFinger', () => {
const handleWebFinger = createWebFingerHandler(
accountRepository,
siteService,
flagService,
);

const ctx = getCtx({ resource: 'acct:alice@example' }); // missing .com
Expand All @@ -100,7 +91,6 @@ describe('handleWebFinger', () => {
const handleWebFinger = createWebFingerHandler(
accountRepository,
siteService,
flagService,
);

const ctx = getCtx({ resource: 'acct:[email protected]' });
Expand All @@ -120,7 +110,6 @@ describe('handleWebFinger', () => {
const handleWebFinger = createWebFingerHandler(
accountRepository,
siteService,
flagService,
);

const ctx = getCtx({ resource: 'acct:[email protected]' });
Expand Down Expand Up @@ -152,7 +141,6 @@ describe('handleWebFinger', () => {
const handleWebFinger = createWebFingerHandler(
accountRepository,
siteService,
flagService,
);

const ctx = getCtx({ resource: 'acct:[email protected]' });
Expand Down Expand Up @@ -201,7 +189,6 @@ describe('handleWebFinger', () => {
const handleWebFinger = createWebFingerHandler(
accountRepository,
siteService,
flagService,
);

const ctx = getCtx({ resource: 'acct:[email protected]' });
Expand Down Expand Up @@ -232,7 +219,6 @@ describe('handleWebFinger', () => {
const handleWebFinger = createWebFingerHandler(
accountRepository,
siteService,
flagService,
);

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