test supabase plugin
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import 'dotenv/config'
|
||||
import { electronApp, optimizer, is } from '@electron-toolkit/utils'
|
||||
import { app, shell, BrowserWindow, ipcMain } from 'electron'
|
||||
import filesystemPlugin from '@takerofnotes/plugin-filesystem'
|
||||
import supabasePlugin from '@takerofnotes/plugin-supabase'
|
||||
import PluginRegistry from './core/PluginRegistry.js'
|
||||
import PluginConfig from './core/PluginConfig.js'
|
||||
import NotesAPI from './core/NotesAPI.js'
|
||||
@@ -64,18 +66,6 @@ function createNoteWindow(noteId) {
|
||||
}
|
||||
|
||||
app.whenReady().then(async () => {
|
||||
electronApp.setAppUserModelId('com.electron')
|
||||
|
||||
app.on('browser-window-created', (_, window) => {
|
||||
optimizer.watchWindowShortcuts(window)
|
||||
})
|
||||
|
||||
createWindow()
|
||||
|
||||
app.on('activate', function () {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
|
||||
// Open note in new window
|
||||
ipcMain.on('open-note-window', (_, noteId) => {
|
||||
createNoteWindow(noteId)
|
||||
@@ -86,13 +76,19 @@ app.whenReady().then(async () => {
|
||||
|
||||
// Register built-in plugins
|
||||
registry.register(filesystemPlugin)
|
||||
registry.register(supabasePlugin)
|
||||
|
||||
// Pull plugin config
|
||||
const config = await new PluginConfig(filesystemPlugin).load()
|
||||
|
||||
// Create instance of active adapter
|
||||
const plugin = registry.get(config.activeAdapter)
|
||||
const adapter = plugin.createAdapter(config.adapterConfig)
|
||||
// const plugin = registry.get(config.activeAdapter)
|
||||
const plugin = registry.get(supabasePlugin.id)
|
||||
// const adapter = plugin.createAdapter(config.adapterConfig)
|
||||
const adapter = plugin.createAdapter({
|
||||
supabaseKey: process.env.SUPABASE_KEY,
|
||||
supabaseUrl: process.env.SUPABASE_URL,
|
||||
})
|
||||
|
||||
// Init Notes API
|
||||
const notesAPI = new NotesAPI(adapter)
|
||||
@@ -105,6 +101,18 @@ app.whenReady().then(async () => {
|
||||
}
|
||||
return notesAPI[method](...args)
|
||||
})
|
||||
|
||||
electronApp.setAppUserModelId('com.electron')
|
||||
|
||||
app.on('browser-window-created', (_, window) => {
|
||||
optimizer.watchWindowShortcuts(window)
|
||||
})
|
||||
|
||||
createWindow()
|
||||
|
||||
app.on('activate', function () {
|
||||
if (BrowserWindow.getAllWindows().length === 0) createWindow()
|
||||
})
|
||||
})
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
|
||||
Reference in New Issue
Block a user