Добавил распознавание ссылок на RSS
This commit is contained in:
parent
e67d7d0aa0
commit
454c52916f
1 changed files with 4 additions and 1 deletions
|
|
@ -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) ?? '';
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue