diff --git a/packages/backend/src/core/UtilityService.ts b/packages/backend/src/core/UtilityService.ts index 24ded0677d..7e0321f797 100644 --- a/packages/backend/src/core/UtilityService.ts +++ b/packages/backend/src/core/UtilityService.ts @@ -131,6 +131,12 @@ export class UtilityService { return mastoHost[1]; } + // XServer SNS + const xserverSns = hostname.match(/\.?([a-zA-Z0-9-]+\.xsns\.jp)$/i); + if (xserverSns) { + return xserverSns[1]; + } + return null; } diff --git a/packages/backend/test/unit/UtilityService.ts b/packages/backend/test/unit/UtilityService.ts index d86e794f2f..27f22de917 100644 --- a/packages/backend/test/unit/UtilityService.ts +++ b/packages/backend/test/unit/UtilityService.ts @@ -38,6 +38,8 @@ describe('UtilityService', () => { 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'); + assert.equal(utilityService.punyHostPSLDomain('http://foo.xsns.jp'), 'foo.xsns.jp'); + assert.equal(utilityService.punyHostPSLDomain('http://foo.bar.xsns.jp'), 'bar.xsns.jp'); }); }); });