Type the updater API and the Tauri global. [skip build]
This commit is contained in:
@@ -15,7 +15,7 @@ interface PluginLoaderProps {
|
||||
* Reads and evaluates a plugin's JS module from the Electron filesystem.
|
||||
* Supports both CommonJS and ESM-style exports.
|
||||
*/
|
||||
async function loadPluginModule(pluginId: string): Promise<any> {
|
||||
async function loadPluginModule(pluginId: string): Promise<Record<string, unknown>> {
|
||||
if (!window.electron?.plugins) {
|
||||
throw new Error('Plugins are only supported in the desktop app');
|
||||
}
|
||||
@@ -25,7 +25,7 @@ async function loadPluginModule(pluginId: string): Promise<any> {
|
||||
throw new Error(response.error ?? 'Failed to read plugin code');
|
||||
}
|
||||
|
||||
const pluginExports: any = {};
|
||||
const pluginExports: Record<string, unknown> = {};
|
||||
const mod = { exports: pluginExports };
|
||||
|
||||
try {
|
||||
@@ -134,7 +134,7 @@ export function PluginLoader({ matrixClient, children }: PluginLoaderProps) {
|
||||
const context = createPluginContext(
|
||||
{
|
||||
pluginId: installedPlugin.id,
|
||||
eventClient: matrixClient as any,
|
||||
eventClient: matrixClient,
|
||||
onNotify: async (opts) => {
|
||||
await sendNotification({
|
||||
title: opts.title,
|
||||
@@ -146,13 +146,13 @@ export function PluginLoader({ matrixClient, children }: PluginLoaderProps) {
|
||||
pluginRegistry,
|
||||
);
|
||||
|
||||
const compatContext = Object.assign(context as Record<string, unknown>, {
|
||||
const compatContext = Object.assign(context, {
|
||||
matrixClient,
|
||||
matrix: {
|
||||
on: (eventType: string, handler: (...args: unknown[]) => void) =>
|
||||
matrixClient.on(eventType as any, handler as any),
|
||||
matrixClient.on(eventType as any, handler),
|
||||
off: (eventType: string, handler: (...args: unknown[]) => void) =>
|
||||
matrixClient.off(eventType as any, handler as any),
|
||||
matrixClient.off(eventType as any, handler),
|
||||
},
|
||||
React,
|
||||
lucide,
|
||||
@@ -163,7 +163,7 @@ export function PluginLoader({ matrixClient, children }: PluginLoaderProps) {
|
||||
console.log('[PluginLoader] About to register plugin and call onLoad...');
|
||||
|
||||
pluginRegistry.registerPlugin(installedPlugin.id, plugin, context);
|
||||
await plugin.onLoad(compatContext as any);
|
||||
await plugin.onLoad(compatContext);
|
||||
console.log(`[PluginLoader] Successfully loaded plugin: ${installedPlugin.id}`);
|
||||
dispatchPluginButtonsChanged();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user