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