Add sync reset key bridge

This commit is contained in:
2026-06-27 18:46:05 +08:00
parent a2791c494f
commit 35012025b6
7 changed files with 113 additions and 1 deletions
@@ -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() {
+16
View File
@@ -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]);