From 75309cab9c4f0fcdf9240b27d78c99b5382d202e Mon Sep 17 00:00:00 2001 From: nicwands Date: Tue, 24 Mar 2026 14:14:08 -0400 Subject: [PATCH] add browser plugin --- out/main/index.js | 2 +- package-lock.json | 58 ++++++++++++++++++++------------ package.json | 5 +-- src/core/ConfigManager.js | 2 +- src/core/WebStorage.js | 1 - src/core/index.js | 6 ++-- src/renderer/src/plugins/core.js | 3 +- 7 files changed, 45 insertions(+), 32 deletions(-) diff --git a/out/main/index.js b/out/main/index.js index 22f5608..34787be 100644 --- a/out/main/index.js +++ b/out/main/index.js @@ -74,7 +74,7 @@ class PluginRegistry { } const getDefaultConfig = () => { return { - activeAdapter: "supabase", + activeAdapter: "browser", theme: "dark" }; }; diff --git a/package-lock.json b/package-lock.json index 1675adc..b02453b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -12,8 +12,9 @@ "@electron-toolkit/preload": "^3.0.2", "@electron-toolkit/utils": "^4.0.0", "@fuzzco/font-loader": "^1.0.2", - "@takerofnotes/plugin-filesystem": "^0.2.0", - "@takerofnotes/plugin-supabase": "^0.1.0", + "@takerofnotes/plugin-browser": "^0.2.0", + "@takerofnotes/plugin-filesystem": "^0.3.0", + "@takerofnotes/plugin-supabase": "^0.2.0", "@tiptap/extension-code-block-lowlight": "^3.20.0", "@tiptap/extension-document": "^3.19.0", "@tiptap/extension-highlight": "^3.20.0", @@ -2339,41 +2340,54 @@ "node": ">=10" } }, - "node_modules/@takerofnotes/plugin-filesystem": { + "node_modules/@takerofnotes/plugin-browser": { "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@takerofnotes/plugin-filesystem/-/plugin-filesystem-0.2.0.tgz", - "integrity": "sha512-BP7HBN0SKAqBiv5pDtXpyVmkW9UrOnPXpKeThTwQTIShHyN5aPaD8ZEyv8+vfTSs3qnXWGplNdEPVjbQmc27+Q==", + "resolved": "https://registry.npmjs.org/@takerofnotes/plugin-browser/-/plugin-browser-0.2.0.tgz", + "integrity": "sha512-CexK/RO3EZNKkxx4eptU7CDJJ6EjR0k02DPyUuYsCnjOmjVnP73zNtJbB/hb6MeAEH91aH7UENHqd4r2KxKPeA==", "license": "MIT", "dependencies": { - "@takerofnotes/plugin-sdk": "^0.3.1" + "@takerofnotes/plugin-sdk": "^0.4.0" + } + }, + "node_modules/@takerofnotes/plugin-filesystem": { + "version": "0.3.0", + "resolved": "https://registry.npmjs.org/@takerofnotes/plugin-filesystem/-/plugin-filesystem-0.3.0.tgz", + "integrity": "sha512-c7kXRPfaUpqWGzZJ6Ac9bPUKAKxND6HRRgTpAbBE36254SGS6kwdxmejNtwDOh5+VjK7IQ+25emGVGOyVImq8w==", + "license": "MIT", + "dependencies": { + "@takerofnotes/plugin-sdk": "^0.4.0" } }, "node_modules/@takerofnotes/plugin-sdk": { - "version": "0.3.1", - "resolved": "https://registry.npmjs.org/@takerofnotes/plugin-sdk/-/plugin-sdk-0.3.1.tgz", - "integrity": "sha512-9GfPKyu1n52N00zYlLK32wdmGdc2uSd0jTj6UEixauW0TXn/7hD6SLpLRGSXcfZOJGGoi3iQk4MfjNsthe2ucw==", + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/@takerofnotes/plugin-sdk/-/plugin-sdk-0.4.0.tgz", + "integrity": "sha512-eAutJ1y237VHsqn95tkub37sGtChZzSIXybJKx6+qRS1ymkL9i5pptRq3Gywsi3kDj7uqT8vi7HMDF0rz9yEjg==", "license": "MIT", "dependencies": { + "semver": "^7.7.4", "zod": "^4.3.6" } }, + "node_modules/@takerofnotes/plugin-sdk/node_modules/semver": { + "version": "7.7.4", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.7.4.tgz", + "integrity": "sha512-vFKC2IEtQnVhpT78h1Yp8wzwrf8CM+MzKMHGJZfBtzhZNycRFnXsHk6E5TxIkkMsgNS7mdX3AGB7x2QM2di4lA==", + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@takerofnotes/plugin-supabase": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/@takerofnotes/plugin-supabase/-/plugin-supabase-0.1.0.tgz", - "integrity": "sha512-NXmiyOAjVHXSFyzOPwljngrjwe1KZEzFiQjImI5XbjxtMJiAg6TFSbqLAnZaIZqg2WpAcBdZKy941WmkXJfNXA==", + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/@takerofnotes/plugin-supabase/-/plugin-supabase-0.2.0.tgz", + "integrity": "sha512-QSHj/yeHzFlt3EXQjkKzE1TyWj+T9FjJVejMZjyK4iXgc//48IXe1UEd+lWOJ683WCpinTRZbLYpbjat6cTo3A==", "license": "MIT", "dependencies": { "@supabase/supabase-js": "^2.98.0", - "@takerofnotes/plugin-sdk": "^0.2.0" - } - }, - "node_modules/@takerofnotes/plugin-supabase/node_modules/@takerofnotes/plugin-sdk": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/@takerofnotes/plugin-sdk/-/plugin-sdk-0.2.0.tgz", - "integrity": "sha512-6Ll+EnO/9B51jf3tKXGkByj9lRTodYJogIuCJ1xh7uTxorJ5tcpBXv49dtXNYmGYEtpVt80G26/kQzm3J54DoA==", - "license": "MIT", - "dependencies": { - "zod": "^4.3.6" + "@takerofnotes/plugin-sdk": "^0.4.0" } }, "node_modules/@tiptap/core": { diff --git a/package.json b/package.json index a9a0a51..d4097a0 100644 --- a/package.json +++ b/package.json @@ -28,8 +28,9 @@ "@electron-toolkit/preload": "^3.0.2", "@electron-toolkit/utils": "^4.0.0", "@fuzzco/font-loader": "^1.0.2", - "@takerofnotes/plugin-filesystem": "^0.2.0", - "@takerofnotes/plugin-supabase": "^0.1.0", + "@takerofnotes/plugin-browser": "^0.2.0", + "@takerofnotes/plugin-filesystem": "^0.3.0", + "@takerofnotes/plugin-supabase": "^0.2.0", "@tiptap/extension-code-block-lowlight": "^3.20.0", "@tiptap/extension-document": "^3.19.0", "@tiptap/extension-highlight": "^3.20.0", diff --git a/src/core/ConfigManager.js b/src/core/ConfigManager.js index 8bb5190..9ef1606 100644 --- a/src/core/ConfigManager.js +++ b/src/core/ConfigManager.js @@ -1,6 +1,6 @@ const getDefaultConfig = () => { return { - activeAdapter: 'supabase', + activeAdapter: 'browser', theme: 'dark', } } diff --git a/src/core/WebStorage.js b/src/core/WebStorage.js index f25f2f1..17b4f35 100644 --- a/src/core/WebStorage.js +++ b/src/core/WebStorage.js @@ -1,4 +1,3 @@ -const USER_DATA_STRING = '__DEFAULT_USER_DATA__' const DB_NAME = 'takerofnotes' const DB_VERSION = 1 const STORE_NAME = 'config' diff --git a/src/core/index.js b/src/core/index.js index 1ae2ed2..bb8d9a9 100644 --- a/src/core/index.js +++ b/src/core/index.js @@ -28,10 +28,8 @@ const initPluginManager = (runtime, plugins, config) => { } const manager = createPluginManager(registry) - manager.setActivePlugin( - config.activeAdapter, - config.adapters[config.activeAdapter], - ) + const activeConfig = config.adapters?.[config.activeAdapter] || {} + manager.setActivePlugin(config.activeAdapter, activeConfig) return manager } diff --git a/src/renderer/src/plugins/core.js b/src/renderer/src/plugins/core.js index e1214ac..95c1acf 100644 --- a/src/renderer/src/plugins/core.js +++ b/src/renderer/src/plugins/core.js @@ -1,6 +1,7 @@ import { useEnvironment } from '@/composables/useEnvironment' import { initializeCore } from '@core/index.js' import supabasePlugin from '@takerofnotes/plugin-supabase' +import browserPlugin from '@takerofnotes/plugin-browser' export const initCore = async (app) => { const environment = useEnvironment() @@ -9,7 +10,7 @@ export const initCore = async (app) => { const runtime = environment === 'electron' ? 'electron-renderer' : 'web' // Plugins that are valid for web (electron uses IPC) - const plugins = [supabasePlugin] + const plugins = [supabasePlugin, browserPlugin] const core = await initializeCore(runtime, { plugins,