mirror of
https://github.com/plebbit/seedit.git
synced 2026-06-12 01:56:10 -04:00
On desktop or android, the user can drop or select a media file in the upload box, which automatically uploads it to catbox.moe in the background, and pastes the direct link to the media in the url field.
15 lines
609 B
TypeScript
15 lines
609 B
TypeScript
import { contextBridge, ipcRenderer } from 'electron';
|
|
|
|
// Expose protected methods that allow the renderer process to use
|
|
// the ipcRenderer without exposing the entire object
|
|
contextBridge.exposeInMainWorld('electron', {
|
|
invoke: (channel: string, ...args: any[]) => {
|
|
// whitelist channels
|
|
const validChannels = ['plugin:file-uploader:pickAndUploadMedia', 'plugin:file-uploader:uploadMedia', 'plugin:file-uploader:pickMedia'];
|
|
if (validChannels.includes(channel)) {
|
|
return ipcRenderer.invoke(channel, ...args);
|
|
}
|
|
throw new Error(`Unauthorized IPC channel: ${channel}`);
|
|
},
|
|
});
|