Improved: remote management

This commit is contained in:
vorotamoroz
2026-04-05 16:00:57 +09:00
parent f17f1ecd93
commit d7088be8af
14 changed files with 619 additions and 159 deletions

View File

@@ -176,7 +176,7 @@ export async function adjustSettingToRemote(
...config,
...Object.fromEntries(differentItems),
} satisfies ObsidianLiveSyncSettings;
await host.services.setting.applyPartial(config, true);
await host.services.setting.applyExternalSettings(config, true);
log("Remote configuration applied.", LOG_LEVEL_NOTICE);
canProceed = true;
const updatedConfig = host.services.setting.currentSettings();

View File

@@ -49,6 +49,10 @@ const createSettingServiceMock = () => {
return {
settings,
currentSettings: vi.fn(() => settings),
applyExternalSettings: vi.fn((partial: any, _feedback?: boolean) => {
Object.assign(settings, partial);
return Promise.resolve();
}),
applyPartial: vi.fn((partial: any, _feedback?: boolean) => {
Object.assign(settings, partial);
return Promise.resolve();
@@ -552,7 +556,7 @@ describe("Red Flag Feature", () => {
await adjustSettingToRemote(host as any, createLoggerMock(), config);
expect(host.mocks.ui.confirm.askSelectStringDialogue).toHaveBeenCalled();
expect(host.mocks.setting.applyPartial).toHaveBeenCalled();
expect(host.mocks.setting.applyExternalSettings).toHaveBeenCalled();
}
);
const mismatchAcceptedKeys = Object.keys(TweakValuesRecommendedTemplate).filter(
@@ -579,7 +583,7 @@ describe("Red Flag Feature", () => {
await adjustSettingToRemote(host as any, createLoggerMock(), config);
expect(host.mocks.setting.applyPartial).toHaveBeenCalled();
expect(host.mocks.setting.applyExternalSettings).toHaveBeenCalled();
expect(host.mocks.ui.confirm.askSelectStringDialogue).not.toHaveBeenCalled();
}
);