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
type PluginTrustStorage = Pick<Storage, "getItem" | "setItem">;
export const PLUGIN_TRUST_WARNING_COPY = {
version: 1,
titleKey: "plugins.trustWarning.title",
descriptionKey: "plugins.trustWarning.description",
confirmLabelKey: "plugins.trustWarning.confirm",
} as const;
export const PLUGIN_TRUST_ACKNOWLEDGEMENT_STORAGE_KEY =
`edgeever:plugins:trusted-code:${PLUGIN_TRUST_WARNING_COPY.version}`;
const getDefaultStorage = (): PluginTrustStorage | null => {
if (typeof window === "undefined") return null;
try {
return window.localStorage;
} catch {
return null;
}
};
export const hasAcknowledgedPluginTrustWarning = (storage?: PluginTrustStorage | null) => {
const resolvedStorage = storage === undefined ? getDefaultStorage() : storage;
try {
return resolvedStorage?.getItem(PLUGIN_TRUST_ACKNOWLEDGEMENT_STORAGE_KEY) === "acknowledged";
} catch {
return false;
}
};
export const acknowledgePluginTrustWarning = (storage?: PluginTrustStorage | null) => {
const resolvedStorage = storage === undefined ? getDefaultStorage() : storage;
try {
resolvedStorage?.setItem(PLUGIN_TRUST_ACKNOWLEDGEMENT_STORAGE_KEY, "acknowledged");
} catch {
// The current enable action may proceed; browsers that block storage will ask again next time.
}
};
export const shouldRequestPluginTrustAcknowledgement = ({
acknowledged,
enabled,
extensionType,
isOfficial,
}: {
acknowledged: boolean;
enabled: boolean;
extensionType: "plugin" | "theme";
isOfficial: boolean;
}) => enabled && extensionType === "plugin" && !acknowledged && !isOfficial;