From c46bc230471e4c22bd926b70a63732bbd1a0bc77 Mon Sep 17 00:00:00 2001 From: "Evgeny @ SimpleX Chat" <259188159+evgeny-simplex@users.noreply.github.com> Date: Mon, 1 Jun 2026 21:32:33 +0000 Subject: [PATCH] update embed code --- .../Chat/Group/ChannelWebAccessView.swift | 6 ++-- .../views/chat/group/ChannelWebPageView.kt | 6 ++-- website/channel_sample.html | 8 ++--- website/src/js/channel-preview.jsc | 30 +++++++++---------- 4 files changed, 25 insertions(+), 25 deletions(-) diff --git a/apps/ios/Shared/Views/Chat/Group/ChannelWebAccessView.swift b/apps/ios/Shared/Views/Chat/Group/ChannelWebAccessView.swift index 21b82342dd..25d8090735 100644 --- a/apps/ios/Shared/Views/Chat/Group/ChannelWebAccessView.swift +++ b/apps/ios/Shared/Views/Chat/Group/ChannelWebAccessView.swift @@ -124,10 +124,10 @@ struct ChannelWebAccessView: View { if let pg = groupInfo.groupProfile.publicGroup, !relayDomains.isEmpty { """ -
+ data-channel-id="\(pg.publicGroupId)" + data-channel-link="\(pg.groupLink)"> """ } else { diff --git a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/ChannelWebPageView.kt b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/ChannelWebPageView.kt index 5afc241017..eaf5386d66 100644 --- a/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/ChannelWebPageView.kt +++ b/apps/multiplatform/common/src/commonMain/kotlin/chat/simplex/common/views/chat/group/ChannelWebPageView.kt @@ -175,9 +175,9 @@ private fun embedCode(groupRelays: List, groupInfo: GroupInfo): Stri val relayDomains = groupRelays.mapNotNull { it.relayCap.webDomain } if (relayDomains.isEmpty()) return null val domains = relayDomains.joinToString(",") - return """
+ data-channel-id="${pg.publicGroupId}" + data-channel-link="${pg.groupLink}"> """ } diff --git a/website/channel_sample.html b/website/channel_sample.html index cd347311bf..93824c08d9 100644 --- a/website/channel_sample.html +++ b/website/channel_sample.html @@ -11,10 +11,10 @@
diff --git a/website/src/js/channel-preview.jsc b/website/src/js/channel-preview.jsc index b6dab697a5..8283fa1c9a 100644 --- a/website/src/js/channel-preview.jsc +++ b/website/src/js/channel-preview.jsc @@ -433,11 +433,11 @@ const FORWARD_ICON_SVG = ` u.trim()).filter(Boolean); - const groupId = container.dataset.publicGroupId || ''; - const groupLink = container.dataset.groupLink || ''; + const channelId = container.dataset.channelId || ''; + const channelLink = container.dataset.channelLink || ''; - if (!relayDomains.length || !groupId) { - container.innerHTML = '

Missing configuration: data-relay-domains and data-public-group-id required.

'; + if (!relayDomains.length || !channelId) { + container.innerHTML = '

Missing configuration: data-relay-domains and data-channel-id required.

'; return; } @@ -445,12 +445,12 @@ function initChannelPreview(container) { container.classList.add('simplex-preview-container'); container.innerHTML = '

Loading channel...

'; - fetchPreview(relayDomains, groupId).then(data => { + fetchPreview(relayDomains, channelId).then(data => { if (!data) { container.innerHTML = '

Failed to load channel preview.

'; return; } - render(container, data, groupLink); + render(container, data, channelLink); }); } @@ -463,10 +463,10 @@ function injectStyles() { document.head.appendChild(style); } -async function fetchPreview(relayDomains, groupId) { +async function fetchPreview(relayDomains, channelId) { for (const domain of relayDomains) { try { - const url = `https://${domain}/channel/${groupId}.json`; + const url = `https://${domain}/channel/${channelId}.json`; const resp = await fetch(url); if (!resp.ok) continue; return await resp.json(); @@ -477,7 +477,7 @@ async function fetchPreview(relayDomains, groupId) { return null; } -function render(container, data, groupLink) { +function render(container, data, channelLink) { const { channel, members, messages } = data; const membersMap = {}; for (const m of members) { @@ -485,7 +485,7 @@ function render(container, data, groupLink) { } container.innerHTML = ''; - const header = renderHeader(channel, groupLink, members.length); + const header = renderHeader(channel, channelLink, members.length); container.appendChild(header); const messagesDiv = document.createElement('div'); @@ -497,7 +497,7 @@ function render(container, data, groupLink) { setupSecretToggles(container); } -function renderHeader(channel, groupLink, subscriberCount) { +function renderHeader(channel, channelLink, subscriberCount) { const header = document.createElement('div'); header.className = 'simplex-preview-header'; @@ -525,14 +525,14 @@ function renderHeader(channel, groupLink, subscriberCount) { header.appendChild(info); - if (groupLink) { + if (channelLink) { const btn = document.createElement('a'); btn.className = 'simplex-preview-join-btn'; btn.textContent = 'Join'; try { - btn.href = platformSimplexUri(groupLink); + btn.href = platformSimplexUri(channelLink); } catch(e) { - btn.href = groupLink; + btn.href = channelLink; } btn.target = '_blank'; header.appendChild(btn); @@ -942,6 +942,6 @@ function formatFileSize(bytes) { return (bytes / (1024 * 1024)).toFixed(1) + ' MB'; } -document.querySelectorAll('[data-simplex-group-preview]').forEach(initChannelPreview); +document.querySelectorAll('[data-simplex-channel-preview]').forEach(initChannelPreview); })();