From 9aa1b9fe501384f00c74dc80361f432d6a8aead0 Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Fri, 7 Mar 2025 04:27:23 +0300 Subject: [PATCH] Create Channel model --- src/components/BlockedBadge.svelte | 2 +- src/components/ChannelItem.svelte | 17 ++-- src/components/ChannelPopup.svelte | 2 +- src/components/EditButton.svelte | 2 +- src/components/HTMLPreview.svelte | 10 +-- src/components/SearchSyntaxPopup.svelte | 8 +- src/models/channel.js | 44 +++++++++++ src/models/index.js | 1 + src/pages/+page.svelte | 2 +- .../channels/[country]/[name]/+page.svelte | 13 ++-- src/store.js | 78 ++++++++++++------- 11 files changed, 123 insertions(+), 56 deletions(-) create mode 100644 src/models/channel.js create mode 100644 src/models/index.js diff --git a/src/components/BlockedBadge.svelte b/src/components/BlockedBadge.svelte index aa858964f..9348a4934 100644 --- a/src/components/BlockedBadge.svelte +++ b/src/components/BlockedBadge.svelte @@ -9,7 +9,7 @@ nsfw: 'The channel has been added to our blocklist due to NSFW content' } - const blocklistRefs = channel.blocklist_records + const blocklistRefs = channel._blocklistRecords .map(record => { let refName diff --git a/src/components/ChannelItem.svelte b/src/components/ChannelItem.svelte index dd7efe823..7a282e40e 100644 --- a/src/components/ChannelItem.svelte +++ b/src/components/ChannelItem.svelte @@ -13,6 +13,7 @@ const guides = channel._guides const streams = channel._streams + const displayName = channel._displayName const [name, country] = channel.id.split('.') @@ -20,11 +21,7 @@ let prevUrl = '/' const onOpened = () => { prevUrl = window.location.href - window.history.pushState( - {}, - `${channel.displayName} • iptv-org`, - `/channels/${country}/${name}` - ) + window.history.pushState({}, `${displayName} • iptv-org`, `/channels/${country}/${name}`) } const onClose = () => { window.history.pushState({}, `iptv-org`, prevUrl) @@ -32,13 +29,13 @@ const showGuides = () => open( GuidesPopup, - { guides, title: channel.displayName }, + { guides, title: displayName }, { transitionBgProps: { duration: 0 }, transitionWindowProps: { duration: 0 } } ) const showStreams = () => open( StreamsPopup, - { streams, title: channel.displayName }, + { streams, title: displayName }, { transitionBgProps: { duration: 0 }, transitionWindowProps: { duration: 0 } } ) const showChannelData = () => { @@ -89,7 +86,7 @@ loading="lazy" referrerpolicy="no-referrer" src={channel.logo} - alt={channel.displayName} + alt={displayName} /> {/if} @@ -103,9 +100,9 @@ href="/channels/{country}/{name}" tabindex="0" class="font-normal text-gray-600 dark:text-white hover:underline hover:text-blue-500 truncate whitespace-nowrap" - title={channel.displayName} + title={displayName} > - {channel.displayName} + {displayName}