handle xsns.jp as a special suffix

This commit is contained in:
kakkokari-gtyih 2024-12-09 19:02:32 +09:00
parent 3a84635186
commit 3c8829ba10
2 changed files with 8 additions and 0 deletions

View file

@ -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;
}

View file

@ -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');
});
});
});