From 72e6c04644f861493a02d46ae01f1361b0a42d9e Mon Sep 17 00:00:00 2001 From: feederbox826 Date: Tue, 14 Apr 2026 04:06:43 -0400 Subject: [PATCH 1/2] add backend for CDP validation --- graphql/schema/schema.graphql | 3 +++ graphql/schema/types/config.graphql | 5 +++++ internal/api/resolver_query_configuration.go | 15 +++++++++++++++ pkg/scraper/url.go | 16 ++++++++++++++++ ui/v2.5/graphql/queries/settings/config.graphql | 7 +++++++ 5 files changed, 46 insertions(+) diff --git a/graphql/schema/schema.graphql b/graphql/schema/schema.graphql index 7f07e4579..eb7a8e236 100644 --- a/graphql/schema/schema.graphql +++ b/graphql/schema/schema.graphql @@ -247,6 +247,9 @@ type Query { ): Directory! validateStashBoxCredentials(input: StashBoxInput!): StashBoxValidationResult! + # Validate remote CDP path + ValidateCDPPath: CDPValidationResult! + # System status systemStatus: SystemStatus! diff --git a/graphql/schema/types/config.graphql b/graphql/schema/types/config.graphql index 5ab7fdfea..0935565ee 100644 --- a/graphql/schema/types/config.graphql +++ b/graphql/schema/types/config.graphql @@ -626,3 +626,8 @@ type StashBoxValidationResult { valid: Boolean! status: String! } + +type CDPValidationResult { + valid: Boolean! + status: String! +} diff --git a/internal/api/resolver_query_configuration.go b/internal/api/resolver_query_configuration.go index cf2c0e3cc..044743705 100644 --- a/internal/api/resolver_query_configuration.go +++ b/internal/api/resolver_query_configuration.go @@ -9,6 +9,7 @@ import ( "github.com/stashapp/stash/internal/manager/config" "github.com/stashapp/stash/pkg/fsutil" "github.com/stashapp/stash/pkg/models" + "github.com/stashapp/stash/pkg/scraper" "golang.org/x/text/collate" ) @@ -285,3 +286,17 @@ func (r *queryResolver) ValidateStashBoxCredentials(ctx context.Context, input c return &result, nil } + +func (r *queryResolver) ValidateCDPPath(ctx context.Context) (*CDPValidationResult, error) { + err := scraper.TestRemoteCDP(config.GetInstance()) + if err == nil { + return &CDPValidationResult{ + Valid: true, + Status: "Successfully validated CDP path", + }, nil + } + return &CDPValidationResult{ + Valid: false, + Status: err.Error(), + }, nil +} diff --git a/pkg/scraper/url.go b/pkg/scraper/url.go index d036ae68e..0f8141f27 100644 --- a/pkg/scraper/url.go +++ b/pkg/scraper/url.go @@ -329,3 +329,19 @@ func splitProxyAuth(proxyUrl string) (string, string, string) { return proxyUrl, "", "" } + +func TestRemoteCDP(globalConfig GlobalConfig) error { + cdpPath := globalConfig.GetScraperCDPPath() + if cdpPath == "" { + return fmt.Errorf("CDP path is empty") + } + if !isCDPPathHTTP(globalConfig) { + // unable to test non-http CDP + return fmt.Errorf("Unable to test non-http CDP paths") + } + _, err := getRemoteCDPWSAddress(context.Background(), cdpPath) + if err != nil { + return fmt.Errorf("Failed to get remote CDP websocket address: %v", err) + } + return nil +} diff --git a/ui/v2.5/graphql/queries/settings/config.graphql b/ui/v2.5/graphql/queries/settings/config.graphql index bfe883fab..064254447 100644 --- a/ui/v2.5/graphql/queries/settings/config.graphql +++ b/ui/v2.5/graphql/queries/settings/config.graphql @@ -18,3 +18,10 @@ query ValidateStashBox($input: StashBoxInput!) { status } } + +query ValidateCDP { + ValidateCDPPath { + valid + status + } +} \ No newline at end of file From d18a9fcbe2d574beb36ea1f52b8f11eb4d833037 Mon Sep 17 00:00:00 2001 From: feederbox826 Date: Tue, 14 Apr 2026 15:18:59 -0400 Subject: [PATCH 2/2] fmt ui --- ui/v2.5/graphql/queries/settings/config.graphql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ui/v2.5/graphql/queries/settings/config.graphql b/ui/v2.5/graphql/queries/settings/config.graphql index 064254447..2de37c3fb 100644 --- a/ui/v2.5/graphql/queries/settings/config.graphql +++ b/ui/v2.5/graphql/queries/settings/config.graphql @@ -24,4 +24,4 @@ query ValidateCDP { valid status } -} \ No newline at end of file +}