Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
feat(admin): show plugin author name in the browse list
Gabe Kangas2ac5c714272b
diff --git a/web/components/admin/plugins/BrowseRegistry.module.scss b/web/components/admin/plugins/BrowseRegistry.module.scssindex 64dbfcb8df..fa42c16f01 100644--- a/web/components/admin/plugins/BrowseRegistry.module.scss+++ b/web/components/admin/plugins/BrowseRegistry.module.scss@@ -55,6 +55,13 @@margin-bottom: 4px;}+// Author display name, shown under the title before the summary.+.author {+ display: block;+ font-size: 12px;+ margin-bottom: 4px;+}+.summary {margin-bottom: 8px !important;}diff --git a/web/components/admin/plugins/BrowseRegistry.stories.tsx b/web/components/admin/plugins/BrowseRegistry.stories.tsxnew file mode 100644index 0000000000..25bc08a02e--- /dev/null+++ b/web/components/admin/plugins/BrowseRegistry.stories.tsx@@ -0,0 +1,108 @@+import React from 'react';+import { Meta, StoryFn } from '@storybook/react';+import { BrowseRegistry, BrowseRegistryProps, RegistryPlugin } from './BrowseRegistry';++export default {+ title: 'owncast/Admin/Plugins/BrowseRegistry',+ component: BrowseRegistry,+ parameters: {+ docs: {+ description: {+ component:+ 'The Browse tab of the admin plugins screen. Lists publicly-available registry plugins as cards, each showing the plugin name, version, size, the author display name, summary, optional preview screenshot, declared permissions, and tags. The action button reflects whether the plugin is not installed (Install), already installed (Installed), or has a newer version available (Update).',+ },+ },+ },+} as Meta<typeof BrowseRegistry>;++const noop = async () => {};++const plugins: RegistryPlugin[] = [+ {+ slug: 'welcome-bot',+ name: 'Welcome Bot',+ authorName: 'Gabe Kangas',+ summary: 'Greets new chat participants with a configurable message when they join.',+ tags: ['chat', 'moderation'],+ latest: {+ version: '1.2.0',+ sizeBytes: 48 * 1024,+ manifest: { permissions: ['chat.send', 'chat.read'] },+ },+ },+ {+ slug: 'now-playing',+ name: 'Now Playing',+ authorName: 'Owncast Community',+ summary: 'Shows the currently playing track pulled from an external music service.',+ tags: ['overlay'],+ latest: {+ version: '0.4.1',+ sizeBytes: 120 * 1024,+ manifest: { permissions: ['network.outbound'] },+ },+ },+ {+ // No authorName: the "by ..." line should be omitted entirely rather+ // than rendering an empty or "by undefined" string.+ slug: 'raid-alerts',+ name: 'Raid Alerts',+ summary: 'Plays an on-screen alert when another stream raids yours.',+ latest: {+ version: '2.0.0',+ sizeBytes: 256 * 1024,+ },+ },+];++const Template: StoryFn<BrowseRegistryProps> = args => <BrowseRegistry {...args} />;++// Primary story: a registry with several plugins, each (where available)+// showing its author display name under the title.+export const WithAuthors = Template.bind({});+WithAuthors.args = {+ installedVersions: new Map(),+ registry: plugins,+ registryLoading: false,+ registryError: null,+ onInstall: noop,+ onRetry: () => {},+};++// Exercises the three action-button states alongside the author line:+// Welcome Bot is up to date, Now Playing has an update available, and+// Raid Alerts (no author) is not installed.+export const MixedInstallStates = Template.bind({});+MixedInstallStates.args = {+ ...WithAuthors.args,+ installedVersions: new Map([+ ['welcome-bot', '1.2.0'],+ ['now-playing', '0.3.0'],+ ]),+};++export const SingleAuthoredPlugin = Template.bind({});+SingleAuthoredPlugin.args = {+ ...WithAuthors.args,+ registry: [plugins[0]],+};++export const Loading = Template.bind({});+Loading.args = {+ ...WithAuthors.args,+ registry: [],+ registryLoading: true,+};++export const Empty = Template.bind({});+Empty.args = {+ ...WithAuthors.args,+ registry: [],+};++export const CatalogUnavailable = Template.bind({});+CatalogUnavailable.args = {+ ...WithAuthors.args,+ registry: [],+ registryError: 'dial tcp: lookup registry.owncast.online: no such host',+};diff --git a/web/components/admin/plugins/BrowseRegistry.tsx b/web/components/admin/plugins/BrowseRegistry.tsxindex 2b0a3084ee..f54e3c0a27 100644--- a/web/components/admin/plugins/BrowseRegistry.tsx+++ b/web/components/admin/plugins/BrowseRegistry.tsx@@ -195,6 +195,11 @@ export const BrowseRegistry = ({<Text type="secondary"> · {readableBytes(plugin.latest.sizeBytes)}</Text>) : null}</div>+ {plugin.authorName && (+ <Text type="secondary" className={s.author}>+ {t(Localization.Admin.Plugins.browseAuthor, { name: plugin.authorName })}+ </Text>+ )}{plugin.summary && <Paragraph className={s.summary}>{plugin.summary}</Paragraph>}{plugin.previewURL && (<imgdiff --git a/web/i18n/en/translation.json b/web/i18n/en/translation.jsonindex ce8d549400..345bd16f3b 100644--- a/web/i18n/en/translation.json+++ b/web/i18n/en/translation.json@@ -206,6 +206,7 @@"browseInstall": "Install","browseInstalled": "Installed","browsePreviewAlt": "{{name}} preview screenshot",+ "browseAuthor": "by {{name}}","browseUnavailableDescription": "Owncast can't reach the plugin catalog right now. You can still upload .ocpkg files directly from the Installed tab.","browseUnavailableRetry": "Retry","browseUnavailableTitle": "The plugin catalog is currently unavailable",diff --git a/web/types/localization.ts b/web/types/localization.tsindex 9176002851..f558c244b6 100644--- a/web/types/localization.ts+++ b/web/types/localization.ts@@ -462,6 +462,7 @@ export const Localization = {browseUnavailableDescription: 'Admin.Plugins.browseUnavailableDescription',browseUnavailableRetry: 'Admin.Plugins.browseUnavailableRetry',browsePreviewAlt: 'Admin.Plugins.browsePreviewAlt',+ browseAuthor: 'Admin.Plugins.browseAuthor',updateAvailable: 'Admin.Plugins.updateAvailable',updateConfirmTitle: 'Admin.Plugins.updateConfirmTitle',updateConfirmOk: 'Admin.Plugins.updateConfirmOk',