@@ -297,6 +297,40 @@ function Wait-ServiceHealthy {
297297 return $false
298298}
299299
300+ function Show-RustDeskInfo {
301+ param ([string ]$ServiceName , [string ]$DataPath )
302+ if ($ServiceName -in @ (' rustdesk-hbbs' , ' rustdesk-hbbr' )) {
303+ $rustdeskPath = Join-Path $DataPath " rustdesk"
304+ $pubKeyFile = Join-Path $rustdeskPath " id_ed25519.pub"
305+
306+ Write-Host " `n === RustDesk 配置说明 ===" - ForegroundColor Cyan
307+ Write-Host " 1. ID 服务器 (ID Server): <你的服务器IP>"
308+ Write-Host " 2. 中继服务器 (Relay Server): <你的服务器IP>"
309+
310+ $pubKey = $null
311+ for ($i = 0 ; $i -lt 5 ; $i ++ ) {
312+ if (Test-Path $pubKeyFile ) {
313+ try {
314+ $pubKey = Get-Content - LiteralPath $pubKeyFile - Raw
315+ if (-not [string ]::IsNullOrWhiteSpace($pubKey )) { break }
316+ }
317+ catch {}
318+ }
319+ Start-Sleep - Seconds 1
320+ }
321+
322+ if (-not [string ]::IsNullOrWhiteSpace($pubKey )) {
323+ Write-Host " 3. Key: $ ( $pubKey.Trim ()) " - ForegroundColor Green
324+ Write-Host " 注意:请将上述 Key 填入 RustDesk 客户端的 Key 选项中,以启用加密连接。" - ForegroundColor Yellow
325+ }
326+ else {
327+ Write-Host " 3. Key: 未找到公钥文件或文件为空 ($pubKeyFile )" - ForegroundColor Yellow
328+ Write-Host " 如果这是首次启动,可能需要几秒钟生成密钥。请手动查看该文件。"
329+ }
330+ Write-Host " ==========================`n " - ForegroundColor Cyan
331+ }
332+ }
333+
300334
301335function Get-ComposeServiceNames {
302336 param (
@@ -385,19 +419,28 @@ try {
385419 if ($Update ) {
386420 Invoke-DockerCompose - File $composePath - Project $projectName - Profiles @ ($ServiceName ) - Action ' pull' - DryRun:$DryRun
387421 Invoke-DockerCompose - File $composePath - Project $projectName - Profiles @ ($ServiceName ) - Action ' up -d' - DryRun:$DryRun
388- if (-not $DryRun -and $ServiceName ) { [void ](Wait-ServiceHealthy - Service $ServiceName - Project $projectName ) }
422+ if (-not $DryRun -and $ServiceName ) {
423+ [void ](Wait-ServiceHealthy - Service $ServiceName - Project $projectName )
424+ Show-RustDeskInfo - ServiceName $ServiceName - DataPath $DataPath
425+ }
389426 return
390427 }
391428 if ($PullAlways ) {
392429 $modeForUp = Test-DockerAvailable
393430 if ($modeForUp -eq ' sub' ) {
394431 Invoke-DockerCompose - File $composePath - Project $projectName - Profiles @ ($ServiceName ) - Action ' up -d' - ExtraArgs @ (' --pull' , ' always' ) - DryRun:$DryRun
395- if (-not $DryRun -and $ServiceName ) { [void ](Wait-ServiceHealthy - Service $ServiceName - Project $projectName ) }
432+ if (-not $DryRun -and $ServiceName ) {
433+ [void ](Wait-ServiceHealthy - Service $ServiceName - Project $projectName )
434+ Show-RustDeskInfo - ServiceName $ServiceName - DataPath $DataPath
435+ }
396436 }
397437 else {
398438 Invoke-DockerCompose - File $composePath - Project $projectName - Profiles @ ($ServiceName ) - Action ' pull' - DryRun:$DryRun
399439 Invoke-DockerCompose - File $composePath - Project $projectName - Profiles @ ($ServiceName ) - Action ' up -d' - DryRun:$DryRun
400- if (-not $DryRun -and $ServiceName ) { [void ](Wait-ServiceHealthy - Service $ServiceName - Project $projectName ) }
440+ if (-not $DryRun -and $ServiceName ) {
441+ [void ](Wait-ServiceHealthy - Service $ServiceName - Project $projectName )
442+ Show-RustDeskInfo - ServiceName $ServiceName - DataPath $DataPath
443+ }
401444 }
402445 return
403446 }
@@ -421,7 +464,10 @@ try {
421464 }
422465 if ($available -contains $ServiceName ) {
423466 Invoke-DockerCompose - File $composePath - Project $projectName - Profiles @ ($ServiceName ) - Action ' up -d' - DryRun:$DryRun
424- if (-not $DryRun ) { [void ](Wait-ServiceHealthy - Service $ServiceName - Project $projectName ) }
467+ if (-not $DryRun ) {
468+ [void ](Wait-ServiceHealthy - Service $ServiceName - Project $projectName )
469+ Show-RustDeskInfo - ServiceName $ServiceName - DataPath $DataPath
470+ }
425471 return
426472 }
427473 else {
0 commit comments