diff --git a/surfsense_backend/alembic/versions/74_add_obsidian_connector.py b/surfsense_backend/alembic/versions/74_add_obsidian_connector.py deleted file mode 100644 index ea2b0c46e..000000000 --- a/surfsense_backend/alembic/versions/74_add_obsidian_connector.py +++ /dev/null @@ -1,33 +0,0 @@ -"""Add Obsidian connector enums - -Revision ID: 74_add_obsidian_connector -Revises: 73 -Create Date: 2026-01-21 - -""" - -from collections.abc import Sequence - -from alembic import op - -# revision identifiers, used by Alembic. -revision: str = "74_add_obsidian_connector" -down_revision: str | None = "73" -branch_labels: str | Sequence[str] | None = None -depends_on: str | Sequence[str] | None = None - - -def upgrade() -> None: - # Add OBSIDIAN_CONNECTOR to documenttype enum - op.execute("ALTER TYPE documenttype ADD VALUE IF NOT EXISTS 'OBSIDIAN_CONNECTOR'") - - # Add OBSIDIAN_CONNECTOR to searchsourceconnectortype enum - op.execute( - "ALTER TYPE searchsourceconnectortype ADD VALUE IF NOT EXISTS 'OBSIDIAN_CONNECTOR'" - ) - - -def downgrade() -> None: - # Note: PostgreSQL doesn't support removing enum values directly. - # The values will remain in the enum type but won't be used. - pass diff --git a/surfsense_web/components/assistant-ui/connector-popup/tabs/all-connectors-tab.tsx b/surfsense_web/components/assistant-ui/connector-popup/tabs/all-connectors-tab.tsx index 1b36b3b81..8c7e51465 100644 --- a/surfsense_web/components/assistant-ui/connector-popup/tabs/all-connectors-tab.tsx +++ b/surfsense_web/components/assistant-ui/connector-popup/tabs/all-connectors-tab.tsx @@ -3,6 +3,7 @@ import type { FC } from "react"; import { EnumConnectorName } from "@/contracts/enums/connector"; import type { SearchSourceConnector } from "@/contracts/types/connector.types"; +import { isSelfHosted } from "@/lib/env-config"; import { ConnectorCard } from "../components/connector-card"; import { ComposioConnectorCard } from "../components/composio-connector-card"; import { CRAWLERS, OAUTH_CONNECTORS, OTHER_CONNECTORS, COMPOSIO_CONNECTORS } from "../constants/connector-constants"; @@ -53,23 +54,31 @@ export const AllConnectorsTab: FC = ({ onViewAccountsList, onOpenComposio, }) => { - // Filter connectors based on search + // Check if self-hosted mode (for showing self-hosted only connectors) + const selfHosted = isSelfHosted(); + + // Filter connectors based on search and deployment mode const filteredOAuth = OAUTH_CONNECTORS.filter( (c) => - c.title.toLowerCase().includes(searchQuery.toLowerCase()) || - c.description.toLowerCase().includes(searchQuery.toLowerCase()) + // Filter by search query + (c.title.toLowerCase().includes(searchQuery.toLowerCase()) || + c.description.toLowerCase().includes(searchQuery.toLowerCase())) && + // Filter self-hosted only connectors in cloud mode + (!("selfHostedOnly" in c) || !c.selfHostedOnly || selfHosted) ); const filteredCrawlers = CRAWLERS.filter( (c) => - c.title.toLowerCase().includes(searchQuery.toLowerCase()) || - c.description.toLowerCase().includes(searchQuery.toLowerCase()) + (c.title.toLowerCase().includes(searchQuery.toLowerCase()) || + c.description.toLowerCase().includes(searchQuery.toLowerCase())) && + (!("selfHostedOnly" in c) || !c.selfHostedOnly || selfHosted) ); const filteredOther = OTHER_CONNECTORS.filter( (c) => - c.title.toLowerCase().includes(searchQuery.toLowerCase()) || - c.description.toLowerCase().includes(searchQuery.toLowerCase()) + (c.title.toLowerCase().includes(searchQuery.toLowerCase()) || + c.description.toLowerCase().includes(searchQuery.toLowerCase())) && + (!("selfHostedOnly" in c) || !c.selfHostedOnly || selfHosted) ); // Filter Composio connectors diff --git a/surfsense_web/lib/env-config.ts b/surfsense_web/lib/env-config.ts index 6201a0425..2f9e92357 100644 --- a/surfsense_web/lib/env-config.ts +++ b/surfsense_web/lib/env-config.ts @@ -21,8 +21,21 @@ export const BACKEND_URL = process.env.NEXT_PUBLIC_FASTAPI_BACKEND_URL || "http: // Placeholder: __NEXT_PUBLIC_ETL_SERVICE__ export const ETL_SERVICE = process.env.NEXT_PUBLIC_ETL_SERVICE || "DOCLING"; +// Deployment Mode: "self-hosted" or "cloud" +// Matches backend's SURFSENSE_DEPLOYMENT_MODE - defaults to "self-hosted" +// self-hosted: Full access to local file system connectors (Obsidian, etc.) +// cloud: Only cloud-based connectors available +// Placeholder: __NEXT_PUBLIC_DEPLOYMENT_MODE__ +export const DEPLOYMENT_MODE = process.env.NEXT_PUBLIC_DEPLOYMENT_MODE || "self-hosted"; + // Helper to check if local auth is enabled export const isLocalAuth = () => AUTH_TYPE === "LOCAL"; // Helper to check if Google auth is enabled export const isGoogleAuth = () => AUTH_TYPE === "GOOGLE"; + +// Helper to check if running in self-hosted mode +export const isSelfHosted = () => DEPLOYMENT_MODE === "self-hosted"; + +// Helper to check if running in cloud mode +export const isCloud = () => DEPLOYMENT_MODE === "cloud";