feat: require ingress for egress
Some checks failed
ci-build / lint (push) Has been cancelled
ci-build / build (push) Has been cancelled
ci-build / release (push) Has been cancelled

This commit is contained in:
Rob Watson 2025-04-01 16:39:44 +02:00
parent 036366a875
commit e4438baa65
3 changed files with 19 additions and 3 deletions

View File

@ -140,6 +140,11 @@ func Run(ctx context.Context, params RunParams) error {
continue continue
} }
case terminal.CommandStartDestination: case terminal.CommandStartDestination:
if !state.Source.Live {
ui.ShowSourceNotLiveModal()
continue
}
mp.StartDestination(c.URL) mp.StartDestination(c.URL)
case terminal.CommandStopDestination: case terminal.CommandStopDestination:
mp.StopDestination(c.URL) mp.StopDestination(c.URL)

View File

@ -91,7 +91,7 @@ func TestIntegration(t *testing.T) {
contents := getContents() contents := getContents()
require.True(t, len(contents) > 2, "expected at least 3 lines of output") require.True(t, len(contents) > 2, "expected at least 3 lines of output")
assert.Contains(t, contents[2], "Status ready", "expected mediaserver status to be ready") assert.Contains(t, contents[2], "Status waiting", "expected mediaserver status to be waiting")
}, },
2*time.Minute, 2*time.Minute,
time.Second, time.Second,
@ -281,7 +281,7 @@ func TestIntegrationDestinationValidations(t *testing.T) {
contents := getContents() contents := getContents()
require.True(t, len(contents) > 2, "expected at least 3 lines of output") require.True(t, len(contents) > 2, "expected at least 3 lines of output")
assert.Contains(t, contents[2], "Status ready", "expected mediaserver status to be ready") assert.Contains(t, contents[2], "Status waiting", "expected mediaserver status to be waiting")
}, },
2*time.Minute, 2*time.Minute,
time.Second, time.Second,

View File

@ -297,6 +297,17 @@ func (ui *UI) run(ctx context.Context) {
} }
} }
func (ui *UI) ShowSourceNotLiveModal() {
ui.app.QueueUpdateDraw(func() {
ui.showModal(
pageNameModalStartupCheck,
fmt.Sprintf("Source is not live.\nStart streaming to the source URL then try again:\n\n%s", ui.sourceViews.url.GetText(true)),
[]string{"Ok"},
nil,
)
})
}
// ShowStartupCheckModal shows a modal dialog to the user, asking if they want // ShowStartupCheckModal shows a modal dialog to the user, asking if they want
// to kill a running instance of Octoplex. // to kill a running instance of Octoplex.
// //
@ -571,7 +582,7 @@ func (ui *UI) redrawFromState(state domain.AppState) {
ui.sourceViews.status.SetText("[black:green]receiving" + durStr) ui.sourceViews.status.SetText("[black:green]receiving" + durStr)
} else if state.Source.Container.Status == domain.ContainerStatusRunning && state.Source.Container.HealthState == "healthy" { } else if state.Source.Container.Status == domain.ContainerStatusRunning && state.Source.Container.HealthState == "healthy" {
ui.sourceViews.status.SetText("[black:yellow]ready") ui.sourceViews.status.SetText("[black:yellow]waiting")
} else { } else {
ui.sourceViews.status.SetText("[white:red]not ready") ui.sourceViews.status.SetText("[white:red]not ready")
} }