CloudSync: fix accidently applying stale settings (#915

* modify the cloud timestamp before importing

* use util/native relaunch

* lambda why

* "should work!" - Vendicated, 15th April 2023
This commit is contained in:
Lewis Crichton 2023-04-15 13:50:00 +01:00 committed by GitHub
parent 7a98f1dfcb
commit ff3589d157
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

@ -27,14 +27,13 @@ export { PlainSettings, Settings };
import "./utils/quickCss"; import "./utils/quickCss";
import "./webpack/patchWebpack"; import "./webpack/patchWebpack";
import { relaunch } from "@utils/native";
import { showNotification } from "./api/Notifications"; import { showNotification } from "./api/Notifications";
import { PlainSettings, Settings } from "./api/settings"; import { PlainSettings, Settings } from "./api/settings";
import { patches, PMLogger, startAllPlugins } from "./plugins"; import { patches, PMLogger, startAllPlugins } from "./plugins";
import { localStorage } from "./utils/localStorage"; import { localStorage } from "./utils/localStorage";
import { relaunch } from "./utils/native";
import { getCloudSettings, putCloudSettings } from "./utils/settingsSync"; import { getCloudSettings, putCloudSettings } from "./utils/settingsSync";
import { checkForUpdates, rebuild, update,UpdateLogger } from "./utils/updater"; import { checkForUpdates, rebuild, update, UpdateLogger } from "./utils/updater";
import { onceReady } from "./webpack"; import { onceReady } from "./webpack";
import { SettingsRouter } from "./webpack/common"; import { SettingsRouter } from "./webpack/common";
@ -57,7 +56,7 @@ async function syncSettings() {
title: "Cloud Settings", title: "Cloud Settings",
body: "Your settings have been updated! Click here to restart to fully apply changes!", body: "Your settings have been updated! Click here to restart to fully apply changes!",
color: "var(--green-360)", color: "var(--green-360)",
onClick: () => window.DiscordNative.app.relaunch() onClick: relaunch
}); });
} }
} }

@ -35,6 +35,7 @@ export async function importSettings(data: string) {
} }
if ("settings" in parsed && "quickCss" in parsed) { if ("settings" in parsed && "quickCss" in parsed) {
Object.assign(PlainSettings, parsed.settings);
await VencordNative.ipc.invoke(IpcEvents.SET_SETTINGS, JSON.stringify(parsed.settings, null, 4)); await VencordNative.ipc.invoke(IpcEvents.SET_SETTINGS, JSON.stringify(parsed.settings, null, 4));
await VencordNative.ipc.invoke(IpcEvents.SET_QUICK_CSS, parsed.quickCss); await VencordNative.ipc.invoke(IpcEvents.SET_QUICK_CSS, parsed.quickCss);
} else } else