From bef58bc929ffcbee72c5530aa79f3a84b3285fc6 Mon Sep 17 00:00:00 2001 From: duckietm Date: Fri, 10 Apr 2026 16:32:14 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=86=99=20Cleanup=20old=20youtube=20link?= =?UTF-8?q?=20in=20chat,=20now=20broadcasting=20is=20working?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/utils/RoomChatFormatter.ts | 11 ---- src/components/MainView.tsx | 2 - src/components/youtube-tv/YoutubeTvView.tsx | 57 --------------------- src/components/youtube-tv/index.ts | 1 - src/hooks/useOnClickChat.ts | 17 ++---- 5 files changed, 3 insertions(+), 85 deletions(-) delete mode 100644 src/components/youtube-tv/YoutubeTvView.tsx delete mode 100644 src/components/youtube-tv/index.ts diff --git a/src/api/utils/RoomChatFormatter.ts b/src/api/utils/RoomChatFormatter.ts index 6ca8964..1ce8a77 100644 --- a/src/api/utils/RoomChatFormatter.ts +++ b/src/api/utils/RoomChatFormatter.ts @@ -1,4 +1,3 @@ -import { GetConfigurationValue } from '../nitro/GetConfigurationValue'; import { LocalizeText } from './LocalizeText'; const allowedColours: Map = new Map(); @@ -47,16 +46,6 @@ export const RoomChatFormatter = (content: string) => content = encodeHTML(content); //content = (joypixels.shortnameToUnicode(content) as string) - if(!GetConfigurationValue('youtube.publish.disabled', false)) - { - const labelShared = LocalizeText('widget.room.youtube.shared'); - const labelOpen = LocalizeText('widget.room.youtube.open_video'); - content = content.replace( - /(?:http:\/\/|https:\/\/)?(?:www\.)?(?:youtube\.com|youtu\.be)\/(?:watch\?.*v=|shorts\/)?([a-zA-Z0-9_-]{11})/g, - `
📺 ${ labelShared }
▶ ${ labelOpen }
` - ); - } - if(content.startsWith('@') && content.indexOf('@', 1) > -1) { let match = null; diff --git a/src/components/MainView.tsx b/src/components/MainView.tsx index 799654f..f757aa7 100644 --- a/src/components/MainView.tsx +++ b/src/components/MainView.tsx @@ -31,7 +31,6 @@ import { UserProfileView } from './user-profile/UserProfileView'; import { UserSettingsView } from './user-settings/UserSettingsView'; import { WiredView } from './wired/WiredView'; import { WiredCreatorToolsView } from './wired-tools/WiredCreatorToolsView'; -import { YoutubeTvView } from './youtube-tv/YoutubeTvView'; export const MainView: FC<{}> = props => { @@ -124,7 +123,6 @@ export const MainView: FC<{}> = props => - ); diff --git a/src/components/youtube-tv/YoutubeTvView.tsx b/src/components/youtube-tv/YoutubeTvView.tsx deleted file mode 100644 index 166bcc3..0000000 --- a/src/components/youtube-tv/YoutubeTvView.tsx +++ /dev/null @@ -1,57 +0,0 @@ -import { AddLinkEventTracker, RemoveLinkEventTracker } from '@nitrots/nitro-renderer'; -import { FC, useEffect, useMemo, useState } from 'react'; -import { GetConfigurationValue } from '../../api'; -import { NitroCardContentView, NitroCardHeaderView, NitroCardView } from '../../common'; - -export const YoutubeTvView: FC<{}> = props => -{ - const [ videoId, setVideoId ] = useState(''); - const [ isVisible, setIsVisible ] = useState(false); - - const close = () => setIsVisible(false); - - useEffect(() => - { - const linkTracker: ILinkEventTracker = { - linkReceived: (url: string) => - { - const parts = url.split('/'); - - if(parts.length < 3) return; - - switch(parts[1]) - { - case 'show': - setVideoId(parts[2]); - setIsVisible(true); - return; - } - }, - eventUrlPrefix: 'youtube-tv/' - }; - - AddLinkEventTracker(linkTracker); - - return () => RemoveLinkEventTracker(linkTracker); - }, []); - - const originUrl = useMemo(() => GetConfigurationValue('url.prefix', ''), []); - - if(!isVisible) return null; - - return ( - - - - { (videoId.length > 0) && -