Добавил распознавание ссылок на RSS

This commit is contained in:
Иван Кузьменко 2025-07-19 03:48:03 +03:00 committed by Иван Кузьменко
parent e67d7d0aa0
commit 454c52916f

View file

@ -16,7 +16,8 @@ const icons: Record<string, string> = {
'hl.teasanctuary.ru': '/icons/half-life.svg',
'git.teasanctuary.ru': 'devicon-plain:git',
localhost: '/icons/tea-sanctuary-white.svg',
email: 'material-symbols:alternate-email'
email: 'material-symbols:alternate-email',
rss: 'material-symbols:rss-feed'
};
// Особые случаи, когда одним доменом второго уровня не ограничишься (например, randomtrash.itch.io)
@ -44,6 +45,8 @@ function getIconFromUrl(url: URL): string | undefined {
const href = url.href;
if (href.startsWith('mailto:'))
return 'email';
if (href.endsWith('/rss.xml'))
return 'rss';
const hostname = url.hostname;
const secondLevel = hostname.match(/(([A-Za-z0-9\-])+\.([A-Za-z0-9\-])+)$/)?.at(0) ?? '';