Take control over your live stream video by running it yourself. Streaming + chat out of the box.
HTML activitypubbroadcastingchatdecentralizedfederationfediversegolanghacktoberfesthlslivelivestreamowncastrtmpself-hostedstreaming-videovideo
Only show a plugin update when the registry version is newer
Gabe Kangas0a09b33fa2ff
diff --git a/web/components/admin/plugins/BrowseRegistry.tsx b/web/components/admin/plugins/BrowseRegistry.tsxindex b5704a6d53..e8585738ef 100644--- a/web/components/admin/plugins/BrowseRegistry.tsx+++ b/web/components/admin/plugins/BrowseRegistry.tsx@@ -2,6 +2,7 @@ import React, { useState } from 'react';import { Alert, Button, Card, Empty, Space, Spin, Tag, Tooltip, Typography } from 'antd';import { useTranslation } from 'next-export-i18n';import { Localization } from '../../../types/localization';+import { isPluginUpdateAvailable } from '../../../utils/apis';import { PuzzlePiece } from './PluginIcon';import { permissionDescriptionKey, permissionNameKey } from './permissionDescriptions';import s from './BrowseRegistry.module.scss';@@ -143,8 +144,7 @@ export const BrowseRegistry = ({const installedVersion = installedVersions.get(plugin.slug);const latestVersion = plugin.latest?.version;const isInstalled = installedVersion !== undefined;- const hasUpdate =- isInstalled && latestVersion !== undefined && installedVersion !== latestVersion;+ const hasUpdate = isInstalled && isPluginUpdateAvailable(installedVersion, latestVersion);let actionButton: React.ReactNode;if (!plugin.latest) {diff --git a/web/pages/admin/plugins.tsx b/web/pages/admin/plugins.tsxindex e55839a9fc..04591c977a 100644--- a/web/pages/admin/plugins.tsx+++ b/web/pages/admin/plugins.tsx@@ -7,6 +7,7 @@ import { useTranslation } from 'next-export-i18n';import { AdminLayout } from '../../components/layouts/AdminLayout';import {fetchData,+ isPluginUpdateAvailable,PLUGIN_REGISTRY_INSTALL,PLUGIN_REGISTRY_LIST,PLUGIN_UPLOAD,@@ -117,7 +118,7 @@ const Plugins = () => {plugins.flatMap(p => {const reg = registryPlugins.find(r => r.slug === p.slug);const latest = reg?.latest?.version;- if (p.version && latest && latest !== p.version) {+ if (latest && isPluginUpdateAvailable(p.version, latest)) {return [[p.slug, latest] as [string, string]];}return [];diff --git a/web/utils/apis.ts b/web/utils/apis.tsindex e9145f5db7..6dd7644451 100644--- a/web/utils/apis.ts+++ b/web/utils/apis.ts@@ -227,6 +227,27 @@ function upToDate(local, remote) {return !semverGt(remote, local);}+// isPluginUpdateAvailable reports whether the registry's latest version is+// strictly newer than what's installed. A newer local/dev build (e.g.+// installed 0.3.0 vs a registry 0.2.1) is NOT an update — only an older+// installed version is. Comparing with string inequality would wrongly flag a+// dev build as "needs update" (and prompt a downgrade). Non-semver version+// strings can't be ordered, so we conservatively report "no update" rather+// than nagging about a change we can't reason about.+export function isPluginUpdateAvailable(+ installedVersion?: string,+ latestVersion?: string,+): boolean {+ if (!installedVersion || !latestVersion) {+ return false;+ }+ try {+ return semverGt(latestVersion, installedVersion);+ } catch {+ return false;+ }+}+// Make a request to the server status API and the Github releases API// and return a release if it's newer than the server version.export async function upgradeVersionAvailable(currentVersion) {