voip.ms Messages: Signal-style desktop SMS client
Electron + React app that imports the full voip.ms SMS history into a local SQLite/FTS5 database, polls for new messages, sends SMS, resolves names/photos from GNOME EDS address books, and supports global and per-chat search with jump-to-message. Data lives in ~/Documents/voipms-desktop-data (covered by Deja Dup) with daily consistent snapshots. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import { contextBridge, ipcRenderer, type IpcRendererEvent } from 'electron'
|
||||
import type { Api } from '@shared/api'
|
||||
|
||||
function on<T extends unknown[]>(channel: string, cb: (...args: T) => void): () => void {
|
||||
const listener = (_e: IpcRendererEvent, ...args: unknown[]): void => cb(...(args as T))
|
||||
ipcRenderer.on(channel, listener)
|
||||
return () => ipcRenderer.removeListener(channel, listener)
|
||||
}
|
||||
|
||||
const api: Api = {
|
||||
getState: () => ipcRenderer.invoke('getState'),
|
||||
testCredentials: (creds) => ipcRenderer.invoke('testCredentials', creds),
|
||||
saveSetup: (creds, settings) => ipcRenderer.invoke('saveSetup', creds, settings),
|
||||
updateSettings: (settings) => ipcRenderer.invoke('updateSettings', settings),
|
||||
signOut: () => ipcRenderer.invoke('signOut'),
|
||||
|
||||
listContacts: () => ipcRenderer.invoke('listContacts'),
|
||||
listConversations: () => ipcRenderer.invoke('listConversations'),
|
||||
getMessages: (did, contact) => ipcRenderer.invoke('getMessages', did, contact),
|
||||
markRead: (did, contact) => ipcRenderer.invoke('markRead', did, contact),
|
||||
search: (query, scope) => ipcRenderer.invoke('search', query, scope),
|
||||
send: (did, contact, text) => ipcRenderer.invoke('send', did, contact, text),
|
||||
deleteFailed: (id) => ipcRenderer.invoke('deleteFailed', id),
|
||||
retryFailed: (id) => ipcRenderer.invoke('retryFailed', id),
|
||||
|
||||
syncStatus: () => ipcRenderer.invoke('syncStatus'),
|
||||
pollNow: () => ipcRenderer.invoke('pollNow'),
|
||||
openDataFolder: () => ipcRenderer.invoke('openDataFolder'),
|
||||
snapshotNow: () => ipcRenderer.invoke('snapshotNow'),
|
||||
chooseDataDir: () => ipcRenderer.invoke('chooseDataDir'),
|
||||
|
||||
onMessages: (cb) => on('messages', cb),
|
||||
onConversationsChanged: (cb) => on('conversationsChanged', cb),
|
||||
onSyncStatus: (cb) => on('syncStatus', cb),
|
||||
onContactsChanged: (cb) => on('contactsChanged', cb)
|
||||
}
|
||||
|
||||
contextBridge.exposeInMainWorld('api', api)
|
||||
Reference in New Issue
Block a user