Repository navigation
feat(MediaMTX.Cli): allow selecting MediaMTX versions #1412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,13 +8,16 @@ | |
| if (args.Contains("--help") || args.Contains("-h")) | ||
| { | ||
| await Console.Out.WriteLineAsync(""" | ||
| Usage: bb-mediamtx [--download] [--copy] [--source <source>] [--rid <rid>] [--output <directory>] [--force] | ||
| Usage: bb-mediamtx [--download [version]] [--copy] [--source <source>] [--rid <rid>] [--output <directory>] [--force] | ||
| bb-mediamtx --help | ||
| bb-mediamtx -h | ||
|
|
||
| Without --download or --copy, copy missing files from the cache. | ||
| --download Verify the cache for the selected RID; download from the selected source if missing | ||
| --download [version] | ||
| Verify the cache for the selected RID; download from the selected source if missing | ||
| or invalid. Shows the download URL and progress. Does not copy by itself. | ||
| Omitted or empty uses v1.22.0; the leading 'v' may be omitted. Each version | ||
| has its own cache directory. | ||
| --copy Copy the executable and license from the verified cache without downloading. | ||
| Can be combined with --download. | ||
| --source <source> Select github.com (default), gitcode.com or gitee.com for downloads. | ||
|
|
@@ -39,6 +42,7 @@ cannot be repeated. | |
|
|
||
| Examples: | ||
| bb-mediamtx --download | ||
| bb-mediamtx --download v1.22.0 | ||
| bb-mediamtx --download --source gitcode.com | ||
| bb-mediamtx --download --source gitee.com | ||
| bb-mediamtx --download --rid all | ||
|
|
@@ -65,6 +69,7 @@ cannot be repeated. | |
| var force = false; | ||
| var download = false; | ||
| var copy = false; | ||
| var version = MediaMtxInstaller.DefaultVersion; | ||
| for (var index = 0; index < args.Length; index++) | ||
| { | ||
| switch (args[index]) | ||
|
|
@@ -74,6 +79,14 @@ cannot be repeated. | |
| break; | ||
| case "--download" when !download: | ||
| download = true; | ||
| if (index + 1 < args.Length && !args[index + 1].StartsWith("--", StringComparison.Ordinal)) | ||
| { | ||
| var versionArgument = args[++index].Trim(); | ||
| if (versionArgument.Length > 0) | ||
| { | ||
| version = MediaMtxInstaller.NormalizeVersion(versionArgument); | ||
|
Comment on lines
+82
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟠 High · Version selection cannot be published When the CLI is packaged or published without overriding its project version, the CLI project still declares package version Increment the CLI package version and update the pinned version in |
||
| } | ||
| } | ||
| break; | ||
| case "--copy" when !copy: | ||
| copy = true; | ||
|
|
@@ -108,7 +121,7 @@ cannot be repeated. | |
| output = args[++index]; | ||
| break; | ||
| default: | ||
| throw new ArgumentException("Usage: bb-mediamtx [--download] [--copy] [--source <source>] [--rid <rid>] [--output <directory>] [--force]."); | ||
| throw new ArgumentException("Usage: bb-mediamtx [--download [version]] [--copy] [--source <source>] [--rid <rid>] [--output <directory>] [--force]."); | ||
| } | ||
| } | ||
| if (download && !copy && force) | ||
|
|
@@ -120,11 +133,11 @@ cannot be repeated. | |
| if (download && rid == "all") | ||
| { | ||
| cancellation.CancelAfter(TimeSpan.FromMinutes(30)); | ||
| await MediaMtxInstaller.DownloadAllAsync(source, output, copy, force, cancellation.Token); | ||
| await MediaMtxInstaller.DownloadAllAsync(source, version, output, copy, force, cancellation.Token); | ||
| } | ||
| else | ||
| { | ||
| await MediaMtxInstaller.DeployAsync(source, rid, output, download, copy || defaultAction, force, | ||
| await MediaMtxInstaller.DeployAsync(source, version, rid, output, download, copy || defaultAction, force, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🟡 Medium · Deployment files come from different versions When two CLI processes copy different selected versions to the same output directory, or a copy stops after replacing only one file, Protect both file replacements with a shared output-level lock and commit them as a pair. Also at |
||
| skipExistingOutput: !download, cancellationToken: cancellation.Token); | ||
| } | ||
| } | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🟡 Medium · Malformed tags reach release lookup
When the supplied version has an invalid prerelease suffix, such as a trailing hyphen,
NormalizeVersionaccepts malformed prerelease tags such asv1.22.0-because the optional suffix permits a lone hyphen;DeployAsyncthen queries the release API and reports a download failure instead of rejecting the version during validation.Validate prerelease identifiers so the suffix cannot be empty or contain empty dot-separated identifiers.