🆙 Cleanup old youtube link in chat, now broadcasting is working

This commit is contained in:
duckietm
2026-04-10 16:32:14 +02:00
parent d61428c7d2
commit bef58bc929
5 changed files with 3 additions and 85 deletions
+3 -14
View File
@@ -1,10 +1,7 @@
import { CreateLinkEvent } from '@nitrots/nitro-renderer';
import { useBetween } from 'use-between';
import { LocalizeText } from '../api';
import { useNotification } from './notification';
const YOUTUBE_REGEX = /(?:http:\/\/|https:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?.*v=|shorts\/)?([a-zA-Z0-9_-]{11})/;
const useOnClickChatState = () =>
{
const { showConfirm = null } = useNotification();
@@ -17,19 +14,11 @@ const useOnClickChatState = () =>
event.preventDefault();
const url = event.target.href;
const youtubeMatch = url.match(YOUTUBE_REGEX);
if(youtubeMatch)
showConfirm(LocalizeText('chat.confirm.openurl', [ 'url' ], [ url ]), () =>
{
CreateLinkEvent('youtube-tv/show/' + youtubeMatch[1]);
}
else
{
showConfirm(LocalizeText('chat.confirm.openurl', [ 'url' ], [ url ]), () =>
{
window.open(url, '_blank');
}, null, null, null, LocalizeText('generic.alert.title'), null, 'link');
}
window.open(url, '_blank');
}, null, null, null, LocalizeText('generic.alert.title'), null, 'link');
};
return { onClickChat };