Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

feat(admin): show plugin preview screenshots when browsing plugins

Gabe Kangas4c57747fd128
diff --git a/web/components/admin/plugins/BrowseRegistry.module.scss b/web/components/admin/plugins/BrowseRegistry.module.scss
index 18cb2993dd..64dbfcb8df 100644
--- a/web/components/admin/plugins/BrowseRegistry.module.scss
+++ b/web/components/admin/plugins/BrowseRegistry.module.scss
@@ -59,6 +59,20 @@
margin-bottom: 8px !important;
}
+// Author-supplied screenshot/preview for the listing. Constrained so a
+// large upload can't blow out the card; object-fit:contain keeps the
+// whole image visible without cropping. Sits between the summary and
+// the permissions row.
+.preview {
+ display: block;
+ max-width: 100%;
+ max-height: 180px;
+ margin-bottom: 8px;
+ border-radius: 6px;
+ object-fit: contain;
+ background: rgb(128 128 128 / 8%);
+}
+
// Row of permission tags between the summary and the optional tag
// row. Small bottom margin so the tag row underneath doesn't visually
// merge into the permissions when both are present.
diff --git a/web/components/admin/plugins/BrowseRegistry.tsx b/web/components/admin/plugins/BrowseRegistry.tsx
index a53aadee2a..2b0a3084ee 100644
--- a/web/components/admin/plugins/BrowseRegistry.tsx
+++ b/web/components/admin/plugins/BrowseRegistry.tsx
@@ -30,6 +30,9 @@ export type RegistryPlugin = {
homepage?: string;
tags?: string[];
iconURL?: string;
+ // Author-supplied screenshot/preview image for the listing. Wider
+ // than the square icon; rendered below the summary when present.
+ previewURL?: string;
authorName?: string;
latest?: {
version: string;
@@ -193,6 +196,14 @@ export const BrowseRegistry = ({
) : null}
</div>
{plugin.summary && <Paragraph className={s.summary}>{plugin.summary}</Paragraph>}
+ {plugin.previewURL && (
+ <img
+ className={s.preview}
+ src={plugin.previewURL}
+ alt={t(Localization.Admin.Plugins.browsePreviewAlt, { name: plugin.name })}
+ loading="lazy"
+ />
+ )}
{plugin.latest?.manifest?.permissions &&
plugin.latest.manifest.permissions.length > 0 && (
// Permissions the plugin's manifest declares, so the
diff --git a/web/i18n/en/translation.json b/web/i18n/en/translation.json
index 6fc7ac3c09..12fade7e59 100644
--- a/web/i18n/en/translation.json
+++ b/web/i18n/en/translation.json
@@ -278,6 +278,7 @@
"browseUnavailableTitle": "The plugin catalog is currently unavailable",
"browseUnavailableDescription": "Owncast can't reach the plugin catalog right now. You can still upload .ocpkg files directly from the Installed tab.",
"browseUnavailableRetry": "Retry",
+ "browsePreviewAlt": "{{name}} preview screenshot",
"updateAvailable": "Update available: v{{version}}",
"updateConfirmTitle": "Update {{name}} to v{{version}}?",
"updateConfirmOk": "Update",
diff --git a/web/i18n/fr/translation.json b/web/i18n/fr/translation.json
index c97ff13ee4..eef3441808 100644
--- a/web/i18n/fr/translation.json
+++ b/web/i18n/fr/translation.json
@@ -234,6 +234,7 @@
"browseUnavailableTitle": "Le catalogue de plugins est actuellement indisponible",
"browseUnavailableDescription": "Owncast ne peut pas accéder au catalogue des plugins pour le moment. Vous pouvez toujours télécharger des fichiers .ocpkg directement depuis l'onglet Installé.",
"browseUnavailableRetry": "Réessayer",
+ "browsePreviewAlt": "Capture d'écran de {{name}}",
"updateAvailable": "Mise à jour disponible: v{{version}}",
"updateConfirmTitle": "Mettre à jour {{name}} vers{{version}}?",
"updateConfirmOk": "Mise à jour",
diff --git a/web/i18n/it/translation.json b/web/i18n/it/translation.json
index 7cc9ed24aa..09ac12c64c 100644
--- a/web/i18n/it/translation.json
+++ b/web/i18n/it/translation.json
@@ -234,6 +234,7 @@
"browseUnavailableTitle": "Il catalogo dei plugin non è attualmente disponibile",
"browseUnavailableDescription": "Owncast non può raggiungere il catalogo dei plugin in questo momento. Puoi ancora caricare i file .ocpkg direttamente dalla scheda Installata.",
"browseUnavailableRetry": "Riprova",
+ "browsePreviewAlt": "Schermata di anteprima di {{name}}",
"updateAvailable": "Aggiornamento disponibile: v{{version}}",
"updateConfirmTitle": "Aggiornare {{name}} a v{{version}}?",
"updateConfirmOk": "Aggiorna",
diff --git a/web/types/localization.ts b/web/types/localization.ts
index 179dcc38a5..191500fded 100644
--- a/web/types/localization.ts
+++ b/web/types/localization.ts
@@ -429,6 +429,7 @@ export const Localization = {
browseUnavailableTitle: 'Admin.Plugins.browseUnavailableTitle',
browseUnavailableDescription: 'Admin.Plugins.browseUnavailableDescription',
browseUnavailableRetry: 'Admin.Plugins.browseUnavailableRetry',
+ browsePreviewAlt: 'Admin.Plugins.browsePreviewAlt',
updateAvailable: 'Admin.Plugins.updateAvailable',
updateConfirmTitle: 'Admin.Plugins.updateConfirmTitle',
updateConfirmOk: 'Admin.Plugins.updateConfirmOk',