diff --git a/tools/BootstrapBlazor.MediaMtx.Cli/BootstrapBlazor.MediaMtx.Cli.csproj b/tools/BootstrapBlazor.MediaMtx.Cli/BootstrapBlazor.MediaMtx.Cli.csproj index 57bfb4f7..0db4ca4b 100644 --- a/tools/BootstrapBlazor.MediaMtx.Cli/BootstrapBlazor.MediaMtx.Cli.csproj +++ b/tools/BootstrapBlazor.MediaMtx.Cli/BootstrapBlazor.MediaMtx.Cli.csproj @@ -1,13 +1,13 @@ - 11.0.3 + 11.0.4 Exe BootstrapBlazor MediaMTX CLI - Downloads and verifies MediaMTX from GitHub or GitCode and copies tools to application build and publish directories. + Downloads and verifies MediaMTX from GitHub, GitCode or Gitee and copies tools to application build and publish directories. true bb-mediamtx BootstrapBlazor MediaMTX CLI diff --git a/tools/BootstrapBlazor.MediaMtx.Cli/MediaMtxInstaller.cs b/tools/BootstrapBlazor.MediaMtx.Cli/MediaMtxInstaller.cs index 0e22c847..8b0bf0bd 100644 --- a/tools/BootstrapBlazor.MediaMtx.Cli/MediaMtxInstaller.cs +++ b/tools/BootstrapBlazor.MediaMtx.Cli/MediaMtxInstaller.cs @@ -21,7 +21,9 @@ static partial class MediaMtxInstaller new Uri("https://github.com/bluenviron/mediamtx/releases/download/")), "gitcode.com" => ("https://api.gitcode.com/api/v5/repos/LongbowEnterprise/mediamtx", new Uri("https://gitcode.com/LongbowEnterprise/mediamtx/releases/download/")), - _ => throw new ArgumentException($"Unsupported source '{source}'. Supported sources: github.com, gitcode.com.") + "gitee.com" => ("https://gitee.com/api/v5/repos/LongbowEnterprise/mediamtx", + new Uri("https://gitee.com/LongbowEnterprise/mediamtx/releases/download/")), + _ => throw new ArgumentException($"Unsupported source '{source}'. Supported sources: github.com, gitcode.com, gitee.com.") }; private static readonly JsonSerializerOptions _jsonOptions = new() diff --git a/tools/BootstrapBlazor.MediaMtx.Cli/Program.cs b/tools/BootstrapBlazor.MediaMtx.Cli/Program.cs index dedca75c..8c4311dc 100644 --- a/tools/BootstrapBlazor.MediaMtx.Cli/Program.cs +++ b/tools/BootstrapBlazor.MediaMtx.Cli/Program.cs @@ -17,7 +17,7 @@ await Console.Out.WriteLineAsync(""" or invalid. Shows the download URL and progress. Does not copy by itself. --copy Copy the executable and license from the verified cache without downloading. Can be combined with --download. - --source Select github.com (default) or gitcode.com for downloads. + --source Select github.com (default), gitcode.com or gitee.com for downloads. Sources share the same cache. Does not force a download or enable downloading. --rid Select win-x64, linux-x64, linux-arm64, linux-arm, osx-x64, or osx-arm64. Omitted or empty selects the current OS and architecture. @@ -40,6 +40,7 @@ cannot be repeated. Examples: bb-mediamtx --download bb-mediamtx --download --source gitcode.com + bb-mediamtx --download --source gitee.com bb-mediamtx --download --rid all bb-mediamtx --download --copy --rid linux-arm64 --output publish bb-mediamtx --copy --rid linux-arm64 --output publish --force @@ -81,12 +82,12 @@ cannot be repeated. if (index + 1 == args.Length || args[index + 1].StartsWith("--", StringComparison.Ordinal) || string.IsNullOrWhiteSpace(args[index + 1])) { - throw new ArgumentException("Option '--source' requires github.com or gitcode.com."); + throw new ArgumentException("Option '--source' requires github.com, gitcode.com or gitee.com."); } source = args[++index].Trim(); - if (source is not ("github.com" or "gitcode.com")) + if (source is not ("github.com" or "gitcode.com" or "gitee.com")) { - throw new ArgumentException($"Unsupported source '{source}'. Supported sources: github.com, gitcode.com."); + throw new ArgumentException($"Unsupported source '{source}'. Supported sources: github.com, gitcode.com, gitee.com."); } break; case "--rid" when !ridSpecified: diff --git a/tools/BootstrapBlazor.MediaMtx.Cli/readme.md b/tools/BootstrapBlazor.MediaMtx.Cli/readme.md index 8969f130..596ee3ef 100644 --- a/tools/BootstrapBlazor.MediaMtx.Cli/readme.md +++ b/tools/BootstrapBlazor.MediaMtx.Cli/readme.md @@ -1,6 +1,6 @@ # BootstrapBlazor.MediaMtx.Cli -独立的 .NET CLI 工具,用于从 [GitHub](https://github.com/bluenviron/mediamtx/releases) 或 [GitCode](https://gitcode.com/LongbowEnterprise/mediamtx/releases) 下载、校验和缓存 MediaMTX,并将可执行文件和许可证复制到应用目录。工具包不包含 MediaMTX 二进制文件;`BootstrapBlazor.MediaMtx` 主包也不会自动安装 CLI 或下载 MediaMTX。 +独立的 .NET CLI 工具,用于从 [GitHub](https://github.com/bluenviron/mediamtx/releases)、[GitCode](https://gitcode.com/LongbowEnterprise/mediamtx/releases) 或 [Gitee](https://gitee.com/LongbowEnterprise/mediamtx/releases) 下载、校验和缓存 MediaMTX,并将可执行文件和许可证复制到应用目录。工具包不包含 MediaMTX 二进制文件;`BootstrapBlazor.MediaMtx` 主包也不会自动安装 CLI 或下载 MediaMTX。 CLI 目标为 .NET 11:安装工具需要 .NET SDK,运行需要 .NET 11 运行时。若只有更高主版本的运行时,需另行启用运行时 roll-forward。 @@ -50,7 +50,7 @@ bb-mediamtx --help | --- | --- | | `--download` | 检查目标 RID 的缓存,缺失或校验失败时从指定源下载并校验;不单独复制到输出目录。下载时显示资源地址和进度。 | | `--copy` | 从已校验的缓存复制工具和许可证,不联网;缓存缺失或损坏时输出警告。可与 `--download` 组合。 | -| `--source ` | 下载源,只接受 `github.com`(默认)或 `gitcode.com`。两者共用缓存;设置此参数不自动下载、不强制刷新缓存,也不在源之间自动回退。 | +| `--source ` | 下载源,只接受 `github.com`(默认)、`gitcode.com` 或 `gitee.com`。三者共用缓存;设置此参数不自动下载、不强制刷新缓存,也不在源之间自动回退。 | | `--rid ` | 指定目标平台。省略或显式传入空字符串时使用当前操作系统和架构。`--download --rid all` 准备全部支持平台;与 `--copy` 组合时只复制本机平台。`all` 不能单独用于复制。 | | `--output ` | 复制的输出基目录。省略时使用命令执行时的当前工作目录;相对路径也以当前工作目录为基准。仅下载时不使用此参数。 | | `--force` | 复制时覆盖输出目录中已有的可执行文件和许可证,不强制重新下载;有效缓存仍会复用。单独 `--download` 不能与 `--force` 组合。 | @@ -71,10 +71,11 @@ bb-mediamtx --download bb-mediamtx --copy --output .\publish ``` -使用 GitCode 下载并复制: +使用 GitCode 或 Gitee 下载并复制: ```powershell bb-mediamtx --download --copy --source gitcode.com --rid win-x64 --output .\publish +bb-mediamtx --download --copy --source gitee.com --rid win-x64 --output .\publish ``` 准备指定平台并复制;也可以合并两个动作: @@ -103,7 +104,7 @@ bb-mediamtx --copy --rid linux-arm64 --output .\publish --force CLI 固定使用 MediaMTX `1.22.0`,缓存位于本机应用数据目录下的 `BootstrapBlazor\mediamtx\v1.22.0\`,不同下载源、构建和发布共用。下载通过所选源的发布 API 获取同名附件及 SHA-256,校验后只提取可执行文件和许可证,不使用压缩包中的 `mediamtx.yml`。有效缓存会校验后复用;下载进度在可获取文件大小时显示百分比,否则显示已下载字节数。 -GitHub 使用 `bluenviron/mediamtx`,GitCode 使用 `LongbowEnterprise/mediamtx`。所选源必须提供目标平台附件和 SHA-256;缺失时输出警告,不自动切换到其他源。`--copy` 即使指定下载源也不会联网。 +GitHub 使用 `bluenviron/mediamtx`,GitCode 和 Gitee 使用 `LongbowEnterprise/mediamtx`。所选源必须提供目标平台附件和 SHA-256;缺失时输出警告,不自动切换到其他源。`--copy` 即使指定下载源也不会联网。 `--download --rid all` 逐个平台处理,某个平台失败会输出警告并继续;其他模式处理指定或本机平台。参数、下载、校验、复制失败或取消时 CLI 输出警告,但仍以成功状态退出,以免阻断宿主构建或发布。因此不能只依据退出码判断是否部署成功,应检查警告及目标文件。