Skip to content

Commit 22f8cb2

Browse files
committed
feat: enhance obsidian connector doc and add notes for migration from legacy obsidian connector
1 parent 99623a8 commit 22f8cb2

3 files changed

Lines changed: 69 additions & 18 deletions

File tree

surfsense_web/components/assistant-ui/connector-popup/connector-configs/components/obsidian-config.tsx

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
"use client";
22

3-
import { Info } from "lucide-react";
3+
import { AlertTriangle, Info } from "lucide-react";
44
import { type FC, useEffect, useMemo, useState } from "react";
55
import { Alert, AlertDescription, AlertTitle } from "@/components/ui/alert";
66
import { connectorsApiService, type ObsidianStats } from "@/lib/apis/connectors-api.service";
77
import type { ConnectorConfigProps } from "../index";
88

9+
const OBSIDIAN_SETUP_DOCS_URL = "/docs/connectors/obsidian";
10+
911
function formatTimestamp(value: unknown): string {
1012
if (typeof value !== "string" || !value) return "—";
1113
const d = new Date(value);
@@ -22,17 +24,61 @@ function formatTimestamp(value: unknown): string {
2224
* web UI doesn't expose a Name input or a Save button for Obsidian (the
2325
* latter is suppressed in `connector-edit-view.tsx`).
2426
*
25-
* Renders plugin stats when connector metadata comes from the plugin.
26-
* If metadata is missing or malformed, we show a recovery hint.
27+
* Renders one of three modes depending on the connector's `config`:
28+
*
29+
* 1. **Plugin connector** (`config.source === "plugin"`) — read-only stats
30+
* panel showing what the plugin most recently reported.
31+
* 2. **Legacy server-path connector** (`config.legacy === true`, set by the
32+
* migration) — migration warning + docs link + explicit disconnect data-loss
33+
* warning so users move to the plugin flow safely.
34+
* 3. **Unknown** — fallback for rows that escaped migration; suggests a
35+
* clean re-install.
2736
*/
2837
export const ObsidianConfig: FC<ConnectorConfigProps> = ({ connector }) => {
2938
const config = (connector.config ?? {}) as Record<string, unknown>;
39+
const isLegacy = config.legacy === true;
3040
const isPlugin = config.source === "plugin";
3141

42+
if (isLegacy) return <LegacyBanner />;
3243
if (isPlugin) return <PluginStats config={config} />;
3344
return <UnknownConnectorState />;
3445
};
3546

47+
const LegacyBanner: FC = () => {
48+
return (
49+
<div className="space-y-6">
50+
<Alert className="border-amber-500/40 bg-amber-500/10">
51+
<AlertTriangle className="size-4 shrink-0 text-amber-500" />
52+
<AlertTitle className="text-xs sm:text-sm">
53+
Sync stopped, install the plugin to migrate
54+
</AlertTitle>
55+
<AlertDescription className="text-[11px] sm:text-xs leading-relaxed">
56+
This Obsidian connector used the legacy server-path scanner, which has been removed. The
57+
notes already indexed remain searchable, but they no longer reflect changes made in your
58+
vault.
59+
</AlertDescription>
60+
</Alert>
61+
62+
<div className="rounded-xl border border-border bg-slate-400/5 p-3 sm:p-6 dark:bg-white/5">
63+
<h3 className="mb-3 text-sm font-medium sm:text-base">Migration required</h3>
64+
<p className="mb-3 text-[11px] leading-relaxed text-muted-foreground sm:text-xs">
65+
Follow the{" "}
66+
<a
67+
href={OBSIDIAN_SETUP_DOCS_URL}
68+
className="font-medium text-primary underline underline-offset-4 hover:text-primary/80"
69+
>
70+
Obsidian setup guide
71+
</a>{" "}
72+
to reconnect this vault through the plugin.
73+
</p>
74+
<p className="text-[11px] leading-relaxed text-amber-600 dark:text-amber-400 sm:text-xs">
75+
Heads up: Disconnect also deletes every document this connector previously indexed.
76+
</p>
77+
</div>
78+
</div>
79+
);
80+
};
81+
3682
const PluginStats: FC<{ config: Record<string, unknown> }> = ({ config }) => {
3783
const vaultId = typeof config.vault_id === "string" ? config.vault_id : null;
3884
const [stats, setStats] = useState<ObsidianStats | null>(null);
@@ -114,8 +160,8 @@ const UnknownConnectorState: FC = () => (
114160
<Info className="size-4 shrink-0" />
115161
<AlertTitle className="text-xs sm:text-sm">Unrecognized config</AlertTitle>
116162
<AlertDescription className="text-[11px] sm:text-xs">
117-
This connector is missing plugin metadata. Delete it, then reconnect your vault from the
118-
SurfSense Obsidian plugin so sync can resume.
163+
This connector has neither plugin metadata nor a legacy marker. It may predate migration —
164+
you can safely delete it and re-install the SurfSense Obsidian plugin to resume syncing.
119165
</AlertDescription>
120166
</Alert>
121167
);

surfsense_web/content/docs/connectors/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ Connect SurfSense to your favorite tools and services. Browse the available inte
105105
/>
106106
<Card
107107
title="Obsidian"
108-
description="Connect your Obsidian vault to SurfSense"
108+
description="Sync your Obsidian vault using the SurfSense plugin"
109109
href="/docs/connectors/obsidian"
110110
/>
111111
<Card

surfsense_web/content/docs/connectors/obsidian.mdx

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ description: Sync your Obsidian vault with the SurfSense plugin
66
# Obsidian Plugin Setup Guide
77

88
SurfSense integrates with Obsidian through the SurfSense Obsidian plugin.
9-
The old server-side vault path scanner is no longer supported.
109

1110
## How it works
1211

@@ -28,20 +27,22 @@ This works for cloud and self-hosted deployments, including desktop and mobile c
2827
1. Open **Connectors** in SurfSense and choose **Obsidian**.
2928
2. Click **Open plugin releases** and install the latest SurfSense Obsidian plugin.
3029
3. In Obsidian, open **Settings → SurfSense**.
31-
4. Paste your SurfSense API token from the connector setup panel.
32-
5. Paste your SurfSense backend URL in the plugin's **Server URL** setting.
33-
6. Choose the Search Space in the plugin, then run the first sync.
34-
7. Confirm the connector appears as **Obsidian — <vault>** in SurfSense.
30+
4. Paste your SurfSense API token from the user settings section.
31+
5. Paste your Server URL in the plugin setting: either your SurfSense main domain (if `/api/v1` rewrites are enabled) or your direct backend URL.
32+
6. Choose the Search Space in the plugin, then the first sync should run automatically.
33+
7. Confirm the connector appears as **Obsidian — &lt;vault&gt;** in SurfSense.
3534

36-
<Callout type="info">
37-
You do not create or configure a vault path in the web UI. The connector row is created automatically when the plugin calls `/api/v1/obsidian/connect`.
38-
</Callout>
35+
## Migrating from the legacy connector
3936

40-
## Self-hosted notes
37+
If you previously used the legacy Obsidian connector architecture, migrate to the plugin flow:
4138

42-
- Use your public or LAN backend URL that your Obsidian device can reach.
43-
- No Docker bind mount for the vault is required.
44-
- If your instance is behind TLS, ensure the URL/certificate is valid for the device running Obsidian.
39+
1. Delete the old legacy Obsidian connector from SurfSense.
40+
2. Install and configure the SurfSense Obsidian plugin using the quick start above.
41+
3. Run the first plugin sync and verify the new **Obsidian — &lt;vault&gt;** connector is active.
42+
43+
<Callout type="warn">
44+
Deleting the legacy connector also deletes all documents that were indexed by that connector. Always finish and verify plugin sync before deleting the old connector.
45+
</Callout>
4546

4647
## Troubleshooting
4748

@@ -50,6 +51,10 @@ This works for cloud and self-hosted deployments, including desktop and mobile c
5051
- Trigger a manual sync from the plugin settings.
5152
- Confirm your API token is valid and not expired.
5253

54+
**Self-hosted URL issues**
55+
- Use a public or LAN backend URL that your Obsidian device can reach.
56+
- If your instance is behind TLS, ensure the URL/certificate is valid for the device running Obsidian.
57+
5358
**Unauthorized / 401 errors**
5459
- Regenerate and paste a fresh API token from SurfSense.
5560
- Ensure the token belongs to the same account and workspace you are syncing into.

0 commit comments

Comments
 (0)