From fccc2b06b62cc97882269c96c7813ed33751f294 Mon Sep 17 00:00:00 2001 From: kakkokari-gtyih <67428053+kakkokari-gtyih@users.noreply.github.com> Date: Tue, 10 Dec 2024 10:29:52 +0900 Subject: [PATCH] Revert "handle `.masto.host` specially" This reverts commit 3a8463518673492655d4ff971b6ec62b521ed435. --- packages/backend/src/core/UtilityService.ts | 14 +------------- packages/backend/test/unit/UtilityService.ts | 4 ---- 2 files changed, 1 insertion(+), 17 deletions(-) diff --git a/packages/backend/src/core/UtilityService.ts b/packages/backend/src/core/UtilityService.ts index 24ded0677d..09545b152f 100644 --- a/packages/backend/src/core/UtilityService.ts +++ b/packages/backend/src/core/UtilityService.ts @@ -123,22 +123,10 @@ export class UtilityService { return host; } - private specialSuffix(hostname: string): string | null { - // masto.host provides domain names for its clients, we have to - // treat it as if it were a public suffix - const mastoHost = hostname.match(/\.?([a-zA-Z0-9-]+\.masto\.host)$/i); - if (mastoHost) { - return mastoHost[1]; - } - - return null; - } - @bindThis public punyHostPSLDomain(url: string): string { const urlObj = new URL(url); - const hostname = urlObj.hostname; - const domain = this.specialSuffix(hostname) ?? psl.get(hostname) ?? hostname; + const domain = psl.get(urlObj.hostname) ?? urlObj.hostname; const host = `${this.toPuny(domain)}${urlObj.port.length > 0 ? ':' + urlObj.port : ''}`; return host; } diff --git a/packages/backend/test/unit/UtilityService.ts b/packages/backend/test/unit/UtilityService.ts index d86e794f2f..837b55206e 100644 --- a/packages/backend/test/unit/UtilityService.ts +++ b/packages/backend/test/unit/UtilityService.ts @@ -35,9 +35,5 @@ describe('UtilityService', () => { assert.equal(utilityService.punyHostPSLDomain('http://foo.github.io'), 'foo.github.io'); assert.equal(utilityService.punyHostPSLDomain('http://foo.bar.github.io'), 'bar.github.io'); }); - test('special', () => { - assert.equal(utilityService.punyHostPSLDomain('http://foo.masto.host'), 'foo.masto.host'); - assert.equal(utilityService.punyHostPSLDomain('http://foo.bar.masto.host'), 'bar.masto.host'); - }); }); });