optimize sync & add accept popup
This commit is contained in:
parent
c9f604863a
commit
f0e097fa76
10 changed files with 305 additions and 61 deletions
|
|
@ -23,6 +23,13 @@ let lanSyncProgressCb = null
|
|||
ipcRenderer.on('lansync:progress', (e, data) => {
|
||||
if (lanSyncProgressCb) lanSyncProgressCb(data)
|
||||
})
|
||||
|
||||
// Incoming sync consent: the receiver's Accept/Decline popup. Single slot for
|
||||
// the same reason - one pending request at a time (the server enforces it).
|
||||
let lanSyncIncomingCb = null
|
||||
ipcRenderer.on('lansync:incoming', (e, data) => {
|
||||
if (lanSyncIncomingCb) lanSyncIncomingCb(data)
|
||||
})
|
||||
const fs = require('fs')
|
||||
const path = require('path')
|
||||
|
||||
|
|
@ -91,10 +98,14 @@ contextBridge.exposeInMainWorld('plwl', {
|
|||
lansyncRerollSyncCode: () => ipcRenderer.invoke('lansync:rerollSyncCode'),
|
||||
lansyncForget: id => ipcRenderer.invoke('lansync:forget', id),
|
||||
lansyncSync: payload => ipcRenderer.invoke('lansync:sync', payload),
|
||||
lansyncRespondIncoming: (requestId, accept) => ipcRenderer.invoke('lansync:respondIncoming', requestId, accept),
|
||||
onLanSyncDevices: cb => ipcRenderer.on('lansync:devices', (e, data) => cb(data)),
|
||||
onLanSyncProgress: cb => {
|
||||
lanSyncProgressCb = cb
|
||||
},
|
||||
onLanSyncIncoming: cb => {
|
||||
lanSyncIncomingCb = cb
|
||||
},
|
||||
onLanSyncApplied: cb => ipcRenderer.on('lansync:applied', (e, data) => cb(data)),
|
||||
onLanSyncReceiving: cb => ipcRenderer.on('lansync:receiving', (e, data) => cb(data))
|
||||
})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue