Add sync reset key bridge
This commit is contained in:
@@ -311,6 +311,12 @@ export function createPluginAPI(pluginId) {
|
||||
return App.PluginSyncSetInterval(pluginId, Number(minutes) || 0);
|
||||
});
|
||||
},
|
||||
resetKey: function() {
|
||||
assertActive('sync.resetKey');
|
||||
return callBackendErrorString(pluginId, 'sync.resetKey', function() {
|
||||
return App.PluginSyncResetKey(pluginId);
|
||||
});
|
||||
},
|
||||
now: function() {
|
||||
assertActive('sync.now');
|
||||
return callBackend(pluginId, 'sync.now', function() {
|
||||
|
||||
@@ -1116,6 +1116,22 @@
|
||||
syncState.syncInterval = Number(minutes) || 0;
|
||||
return Promise.resolve('');
|
||||
},
|
||||
PluginSyncResetKey: function (pluginId) {
|
||||
var err = requirePluginSyncPermission(pluginId, false);
|
||||
if (err) return Promise.resolve(err);
|
||||
syncState.configured = false;
|
||||
syncState.deviceId = '';
|
||||
syncState.deviceName = '';
|
||||
syncState.connected = false;
|
||||
syncState.revoked = false;
|
||||
syncState.tokenStored = false;
|
||||
syncState.lastError = '';
|
||||
syncState.statusLabel = 'disconnected';
|
||||
pluginSettings[pluginId] = Object.assign({}, pluginSettings[pluginId] || {}, {
|
||||
syncStatus: syncState.statusLabel
|
||||
});
|
||||
return Promise.resolve('');
|
||||
},
|
||||
PluginSyncNow: function (pluginId) {
|
||||
var err = requirePluginSyncPermission(pluginId, true);
|
||||
if (err) return Promise.resolve([{}, err]);
|
||||
|
||||
Reference in New Issue
Block a user