mirror of
https://github.com/MODSetter/SurfSense.git
synced 2026-05-29 19:35:20 +02:00
Merge pull request #1437 from AnishSarkar22/fix/electron-nextjs
feat: improve desktop updates, branding, and local server lifecycle
This commit is contained in:
commit
5f4d62c225
23 changed files with 503 additions and 91 deletions
|
|
@ -12,16 +12,17 @@ import { EnumConnectorName } from "@/contracts/enums/connector";
|
|||
import { getConnectorIcon } from "@/contracts/enums/connectorIcons";
|
||||
import type { SearchSourceConnector } from "@/contracts/types/connector.types";
|
||||
import { authenticatedFetch } from "@/lib/auth-utils";
|
||||
import { getReauthEndpoint } from "@/lib/connector-telemetry";
|
||||
import { BACKEND_URL } from "@/lib/env-config";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { DateRangeSelector } from "../../components/date-range-selector";
|
||||
import { PeriodicSyncConfig } from "../../components/periodic-sync-config";
|
||||
import { SummaryConfig } from "../../components/summary-config";
|
||||
import { VisionLLMConfig } from "../../components/vision-llm-config";
|
||||
import { getReauthEndpoint, LIVE_CONNECTOR_TYPES } from "../../constants/connector-constants";
|
||||
import { LIVE_CONNECTOR_TYPES } from "../../constants/connector-constants";
|
||||
import { getConnectorDisplayName } from "../../tabs/all-connectors-tab";
|
||||
import { MCPServiceConfig } from "../components/mcp-service-config";
|
||||
import { getConnectorConfigComponent } from "../index";
|
||||
import { BACKEND_URL } from "@/lib/env-config";
|
||||
const VISION_LLM_CONNECTOR_TYPES = new Set<SearchSourceConnector["connector_type"]>([
|
||||
EnumConnectorName.GOOGLE_DRIVE_CONNECTOR,
|
||||
EnumConnectorName.COMPOSIO_GOOGLE_DRIVE_CONNECTOR,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import { EnumConnectorName } from "@/contracts/enums/connector";
|
||||
import type { SearchSourceConnector } from "@/contracts/types/connector.types";
|
||||
|
||||
/**
|
||||
* Connectors that operate in real time (no background indexing).
|
||||
|
|
@ -294,25 +293,5 @@ export const AUTO_INDEX_DEFAULTS: Record<string, AutoIndexConfig> = {
|
|||
|
||||
export const AUTO_INDEX_CONNECTOR_TYPES = new Set<string>(Object.keys(AUTO_INDEX_DEFAULTS));
|
||||
|
||||
// ============================================================================
|
||||
// CONNECTOR TELEMETRY REGISTRY
|
||||
// ----------------------------------------------------------------------------
|
||||
// Single source of truth for "what does this connector_type look like in
|
||||
// analytics?". Any connector added to the lists above is automatically
|
||||
// picked up here, so adding a new integration does NOT require touching
|
||||
// `lib/posthog/events.ts` or per-connector tracking code.
|
||||
// ============================================================================
|
||||
|
||||
// Telemetry types & helpers are now defined in `@/lib/connector-telemetry`.
|
||||
// Re-exported here for backward compatibility with existing imports.
|
||||
export type {
|
||||
ConnectorTelemetryGroup,
|
||||
ConnectorTelemetryMeta,
|
||||
} from "@/lib/connector-telemetry";
|
||||
export {
|
||||
getConnectorTelemetryMeta,
|
||||
getReauthEndpoint,
|
||||
} from "@/lib/connector-telemetry";
|
||||
|
||||
// Re-export IndexingConfigState from schemas for backward compatibility
|
||||
export type { IndexingConfigState } from "./connector-popup.schemas";
|
||||
|
|
|
|||
|
|
@ -11,12 +11,13 @@ import { EnumConnectorName } from "@/contracts/enums/connector";
|
|||
import { getConnectorIcon } from "@/contracts/enums/connectorIcons";
|
||||
import type { SearchSourceConnector } from "@/contracts/types/connector.types";
|
||||
import { authenticatedFetch } from "@/lib/auth-utils";
|
||||
import { getReauthEndpoint } from "@/lib/connector-telemetry";
|
||||
import { BACKEND_URL } from "@/lib/env-config";
|
||||
import { formatRelativeDate } from "@/lib/format-date";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { getReauthEndpoint, LIVE_CONNECTOR_TYPES } from "../constants/connector-constants";
|
||||
import { LIVE_CONNECTOR_TYPES } from "../constants/connector-constants";
|
||||
import { useConnectorStatus } from "../hooks/use-connector-status";
|
||||
import { getConnectorDisplayName } from "../tabs/all-connectors-tab";
|
||||
import { BACKEND_URL } from "@/lib/env-config";
|
||||
interface ConnectorAccountsListViewProps {
|
||||
connectorType: string;
|
||||
connectorTitle: string;
|
||||
|
|
|
|||
82
surfsense_web/components/desktop/desktop-update-toast.tsx
Normal file
82
surfsense_web/components/desktop/desktop-update-toast.tsx
Normal file
|
|
@ -0,0 +1,82 @@
|
|||
"use client";
|
||||
|
||||
import { Download, X } from "lucide-react";
|
||||
import { useEffect, useState } from "react";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { cn } from "@/lib/utils";
|
||||
|
||||
type UpdateToastState = {
|
||||
version: string;
|
||||
};
|
||||
|
||||
export function DesktopUpdateToast() {
|
||||
const [update, setUpdate] = useState<UpdateToastState | null>(null);
|
||||
|
||||
useEffect(() => {
|
||||
const api = window.electronAPI;
|
||||
if (!api?.onUpdateDownloaded) return;
|
||||
|
||||
return api.onUpdateDownloaded(({ version }) => {
|
||||
setUpdate({ version });
|
||||
});
|
||||
}, []);
|
||||
|
||||
if (!update) return null;
|
||||
|
||||
const installAndRestart = () => {
|
||||
void window.electronAPI?.installUpdateNow();
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="pointer-events-none fixed bottom-5 right-5 z-[100]">
|
||||
<div
|
||||
className={cn(
|
||||
"pointer-events-auto relative flex w-[360px] max-w-[calc(100vw-2.5rem)] gap-3 rounded-md border border-popover-border",
|
||||
"bg-popover p-4 text-popover-foreground shadow-md"
|
||||
)}
|
||||
aria-live="polite"
|
||||
>
|
||||
<div className="mt-0.5 flex size-7 shrink-0 items-center justify-center rounded-full text-muted-foreground">
|
||||
<Download className="size-5" strokeWidth={1.8} />
|
||||
</div>
|
||||
|
||||
<div className="min-w-0 flex-1">
|
||||
<div className="pr-8 text-sm font-semibold tracking-tight">Update available</div>
|
||||
<p className="mt-1.5 text-sm leading-relaxed text-muted-foreground">
|
||||
A new version of SurfSense ({update.version}) is now available to install.
|
||||
</p>
|
||||
|
||||
<div className="mt-3 flex items-center gap-4">
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
className="h-auto px-0 text-sm font-semibold hover:bg-transparent hover:text-foreground"
|
||||
onClick={installAndRestart}
|
||||
>
|
||||
Install and restart
|
||||
</Button>
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
className="h-auto px-0 text-sm font-semibold text-muted-foreground hover:bg-transparent hover:text-foreground"
|
||||
onClick={() => setUpdate(null)}
|
||||
>
|
||||
Not now
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Button
|
||||
type="button"
|
||||
variant="ghost"
|
||||
size="icon"
|
||||
className="absolute right-2 top-2 size-7 text-muted-foreground hover:bg-transparent hover:text-foreground"
|
||||
aria-label="Dismiss update toast"
|
||||
onClick={() => setUpdate(null)}
|
||||
>
|
||||
<X className="size-4" strokeWidth={1.8} />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue