AI-native knowledge base & Evernote/Obsidian alternative with instant sync & native MCP. Free on Cloudflare or self-hosted via Docker.
HTML ai-agentcloudflarecloudflare-d1cloudflare-r2cloudflare-workersdockerelectronevernoteevernote-alternativeknowledge-basemcpnote-takingobsidian-alternativeoffline-firstpersonal-knowledge-basepwaself-hostedsqlitetiptapweb-clipper
import { useEffect, useMemo, useRef } from "react";
import { getConfiguredDesktopApiBaseUrl } from "../api";
import { NoteImportController } from "./controller";
export const useNoteImport = (accountId: string | null, accountLabel: string, refresh: () => Promise<void>) => {
const refreshRef = useRef(refresh);
refreshRef.current = refresh;
const labelRef = useRef(accountLabel);
labelRef.current = accountLabel;
const target = getConfiguredDesktopApiBaseUrl() || window.location.origin;
const controller = useMemo(() => new NoteImportController(accountId, target, () => labelRef.current, () => refreshRef.current()), [accountId, target]);
useEffect(() => { controller.activate(); return () => controller.dispose(); }, [controller]);
return controller;
};