diff --git a/CHANGELOG.md b/CHANGELOG.md index a13befa..31be467 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,20 @@ Versions correspond to git tags and to the published image set (the line was reset to 0.2.x at 0.2.14 — Superbrain is pre-beta). Dates are tag dates. +## 0.3.12 — 2026-11-30 + +### Fixed +- **CardDAV: no duplicate Nextcloud suggestion after connecting.** Once a + Nextcloud contacts connection exists (the unified Nextcloud connect creates + one under the server's address-books root), Settings → CardDAV no longer + shows the "Nextcloud contacts detected on this server" card. Detection is by + connection URL, so a renamed connection still counts. +- **Standalone compose forwards `NEXTCLOUD_URL`.** The local/standalone + `docker-compose.yml` now passes the deployment's Nextcloud discovery hint to + the app container (federated cores were unaffected — they use `env_file`); + without it, Nextcloud suggestions never appeared on source/standalone + deployments. + ## 0.3.11 — 2026-11-25 ### Added diff --git a/deploy/federated/lib-superbrain.sh b/deploy/federated/lib-superbrain.sh index 6e7ab0c..1a8b2c3 100644 --- a/deploy/federated/lib-superbrain.sh +++ b/deploy/federated/lib-superbrain.sh @@ -48,7 +48,7 @@ SUPERBRAIN_APP_IP="192.168.0.94" SUPERBRAIN_MIGRATE_IP="192.168.0.95" # Release to install; the generic `upgrade` flow keeps .env in step with the # service file's VERSION afterwards. -SUPERBRAIN_IMAGE_VERSION="0.3.11" +SUPERBRAIN_IMAGE_VERSION="0.3.12" # render_superbrain_compose writes the app-dir compose file. Called by # config_superbrain (install) and by deploy/federated/update.sh after a lib diff --git a/deploy/federated/service b/deploy/federated/service index 452497c..ee34c9f 100644 --- a/deploy/federated/service +++ b/deploy/federated/service @@ -2,7 +2,7 @@ NAME=superbrain DESCRIPTION="Bookmark & Knowledge Base" DOCS=https://github.com/andrew/superbrain CONTAINER=federatedcomputer/superbrain-app -VERSION=0.3.11 +VERSION=0.3.12 INTERNAL_IP=192.168.0.93 DEPENDS="postgresql" PORTS=3000 diff --git a/internal/handlers/carddav.go b/internal/handlers/carddav.go index 6755519..783be8c 100644 --- a/internal/handlers/carddav.go +++ b/internal/handlers/carddav.go @@ -179,10 +179,23 @@ func HandleCardDavConnectionsList(w http.ResponseWriter, r *http.Request) { } suggestions := []object{} if nc := config.NextcloudSuggestion(); nc != "" { - suggestions = append(suggestions, object{ - "kind": "nextcloud", "name": "Nextcloud contacts", - "url": nc + "/remote.php/dav/addressbooks/users/", - }) + // If the caller already connected this Nextcloud's contacts (the + // unified Nextcloud connect creates a CardDAV row under this exact + // root), don't offer the "detected on this server" suggestion again. + root := nc + "/remote.php/dav/addressbooks/users/" + alreadyConnected := false + for _, row := range rows { + if u, _ := row["url"].(string); strings.HasPrefix(u, root) { + alreadyConnected = true + break + } + } + if !alreadyConnected { + suggestions = append(suggestions, object{ + "kind": "nextcloud", "name": "Nextcloud contacts", + "url": root, + }) + } } respond(w, 200, object{"connections": out, "allowed": allowed, "suggestions": suggestions}, nil) } diff --git a/internal/http/carddav_test.go b/internal/http/carddav_test.go index 3402b24..d7b7b71 100644 --- a/internal/http/carddav_test.go +++ b/internal/http/carddav_test.go @@ -1,6 +1,7 @@ package http import ( + "context" "fmt" "io" "net/http" @@ -8,6 +9,8 @@ import ( "strings" "sync" "testing" + + "gitea.federated.computer/Federated_Computer/superbrain/internal/db" ) // fakeCarddav is a mutable CardDAV server for integration tests: a home at @@ -214,8 +217,8 @@ func TestCardDavLifecycle(t *testing.T) { // harness, so this asserts the rule is wired, not the failure itself). func TestCardDavSuggestion(t *testing.T) { t.Setenv("NEXTCLOUD_URL", "https://cloud.example") - srv := testServer(t) - c, _ := accountClient(t, srv.URL, "ksg@superbrain.test") + srv, d := testServerDB(t) + c, uid := accountClient(t, srv.URL, "ksg@superbrain.test") sugg := c.request("GET", "/api/carddav/connections", nil, 200)["suggestions"].([]any) if len(sugg) != 1 { t.Fatalf("want one suggestion, got %v", sugg) @@ -224,4 +227,19 @@ func TestCardDavSuggestion(t *testing.T) { if m["kind"] != "nextcloud" || m["url"] != "https://cloud.example/remote.php/dav/addressbooks/users/" { t.Fatalf("unexpected suggestion: %v", m) } + + // Once the Nextcloud contacts are connected (the unified Nextcloud connect + // creates a CardDAV row under this root), the suggestion is suppressed. + _, e := db.Insert(context.Background(), d, "CardDavConnection", map[string]any{ + "id": "nc-carddav", "ownerId": uid, "name": "Nextcloud contacts", + "url": "https://cloud.example/remote.php/dav/addressbooks/users/erwin/", + "username": "erwin", "secret": "x", + }) + if e != nil { + t.Fatal(e) + } + sugg = c.request("GET", "/api/carddav/connections", nil, 200)["suggestions"].([]any) + if len(sugg) != 0 { + t.Fatalf("suggestion not suppressed after Nextcloud connect: %v", sugg) + } } diff --git a/internal/mcpclient/client.go b/internal/mcpclient/client.go index 6fb4c0d..aee9929 100644 --- a/internal/mcpclient/client.go +++ b/internal/mcpclient/client.go @@ -91,7 +91,7 @@ func httpClient(conn Conn) *http.Client { // ListTools connects, initializes and lists the server's tools, then closes // the session. The context bounds the whole exchange. func ListTools(ctx context.Context, conn Conn) ([]Tool, error) { - client := mcpsdk.NewClient(&mcpsdk.Implementation{Name: "superbrain", Version: "0.3.11"}, nil) + client := mcpsdk.NewClient(&mcpsdk.Implementation{Name: "superbrain", Version: "0.3.12"}, nil) var transport mcpsdk.Transport hc := httpClient(conn) switch conn.Transport { diff --git a/mcp/pyproject.toml b/mcp/pyproject.toml index 5d5a7d5..5e0b09c 100644 --- a/mcp/pyproject.toml +++ b/mcp/pyproject.toml @@ -7,7 +7,7 @@ name = "superbrain-mcp" # Versioned in lockstep with the Superbrain release it speaks to (house # tooling tracks one version per app); the federated mcpserver gateway # installs this package and spawns `superbrain-mcp` per linked instance. -version = "0.3.11" +version = "0.3.12" description = "MCP server for Superbrain — bookmarks, tags and pages over the Superbrain REST API" readme = "README.md" requires-python = ">=3.10" diff --git a/mcp/superbrain_mcp/__init__.py b/mcp/superbrain_mcp/__init__.py index c1dcc69..581a816 100644 --- a/mcp/superbrain_mcp/__init__.py +++ b/mcp/superbrain_mcp/__init__.py @@ -1,3 +1,3 @@ """Superbrain MCP server — bookmarks, tags and pages for AI tooling.""" -__version__ = "0.3.11" +__version__ = "0.3.12"