migrate SettingsRouter + more fixes

This commit is contained in:
thororen1234 2026-02-05 00:08:58 -05:00
parent 18fe0cf4b0
commit 22e453f362
No known key found for this signature in database
6 changed files with 10 additions and 11 deletions

View file

@ -34,6 +34,7 @@ import { debounce } from "@shared/debounce";
import { IS_WINDOWS } from "@utils/constants";
import { createAndAppendStyle } from "@utils/css";
import { StartAt } from "@utils/types";
import { SettingsRouter } from "@webpack/common";
import { get as dsGet } from "./api/DataStore";
import { NotificationData, showNotification } from "./api/Notifications";
@ -44,7 +45,6 @@ import { localStorage } from "./utils/localStorage";
import { relaunch } from "./utils/native";
import { checkForUpdates, update, UpdateLogger } from "./utils/updater";
import { onceReady } from "./webpack";
import { SettingsRouter } from "./webpack/common";
import { patches } from "./webpack/patchWebpack";
if (IS_REPORTER) {
@ -68,7 +68,7 @@ async function syncSettings() {
body: "We've noticed you have cloud integrations enabled in another client! Due to limitations, you will " +
"need to re-authenticate to continue using them. Click here to go to the settings page to do so!",
color: "var(--yellow-360)",
onClick: () => SettingsRouter.open("VencordCloud")
onClick: () => SettingsRouter.openUserSettings("vencord_cloud_panel")
});
return;
}

View file

@ -23,15 +23,14 @@ import { definePluginSettings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { findByPropsLazy, findComponentByCodeLazy, findCssClassesLazy, findStoreLazy } from "@webpack";
import { Constants, React, RestAPI, Tooltip } from "@webpack/common";
import { findComponentByCodeLazy, findCssClassesLazy, findStoreLazy } from "@webpack";
import { Constants, React, RestAPI, SettingsRouter, Tooltip } from "@webpack/common";
import { RenameButton } from "./components/RenameButton";
import { Session, SessionInfo } from "./types";
import { fetchNamesFromDataStore, getDefaultName, GetOsColor, GetPlatformIcon, savedSessionsCache, saveSessionsToDataStore } from "./utils";
const AuthSessionsStore = findStoreLazy("AuthSessionsStore");
const UserSettingsModal = findByPropsLazy("saveAccountChanges", "open");
const TimestampClasses = findCssClassesLazy("timestamp", "blockquoteContainer");
const SessionIconClasses = findCssClassesLazy("sessionIcon");
@ -175,7 +174,7 @@ export default definePlugin({
title: "BetterSessions",
body: `New session:\n${session.client_info.os} · ${session.client_info.platform} · ${session.client_info.location}`,
permanent: true,
onClick: () => UserSettingsModal.open("Sessions")
onClick: () => SettingsRouter.open("sessions_panel")
});
}

View file

@ -34,7 +34,7 @@ interface CopyIdMenuItemProps {
}
let CopyIdMenuItem: (props: CopyIdMenuItemProps) => React.ReactElement | null = NoopComponent;
waitFor(filters.componentByCode('"devmode-copy-id-".concat'), m => CopyIdMenuItem = m);
waitFor(filters.componentByCode('"cannot copy null text"'), m => CopyIdMenuItem = m);
function MessageMenu({ message, channel, onHeightUpdate }) {
const canReport = message.author &&

View file

@ -31,7 +31,7 @@ const Transforms = findByPropsLazy("insertNodes", "textToText");
const Editor = findByPropsLazy("start", "end", "toSlateRange");
const ChatInputTypes = findByPropsLazy("FORM", "USER_PROFILE");
const InputComponent = findComponentByCodeLazy("editorClassName", "CHANNEL_TEXT_AREA");
const createChannelRecordFromServer = findByCodeLazy(".GUILD_TEXT])", "fromServer)");
const createChannelRecordFromServer = findByCodeLazy(".GUILD_TEXT]", "fromServer)");
interface UserProps {
discordId: string;

View file

@ -55,7 +55,7 @@ export default definePlugin({
break;
case ",":
e.preventDefault();
SettingsRouter.open("My Account");
SettingsRouter.openUserSettings("my_account_panel");
break;
default:
if (e.key >= "1" && e.key <= "9") {

View file

@ -143,7 +143,7 @@ export const UploadHandler = {
export const ApplicationAssetUtils = mapMangledModuleLazy("getAssetImage: size must === [", {
fetchAssetIds: filters.byCode('.startsWith("http:")', ".dispatch({"),
getAssetFromImageURL: filters.byCode("].serialize(", ',":"'),
getAssetFromImageURL: filters.byCode("].serialize(", ":null"),
getAssetImage: filters.byCode("getAssetImage: size must === ["),
getAssets: filters.byCode(".assets")
});
@ -160,7 +160,7 @@ export const ChannelRouter: t.ChannelRouter = mapMangledModuleLazy('"Thread must
});
export let SettingsRouter: any;
waitFor(["open", "saveAccountChanges"], m => SettingsRouter = m);
waitFor(["openUserSettings", "USER_SETTINGS_MODAL_KEY"], m => SettingsRouter = m);
export const PermissionsBits: t.PermissionsBits = findLazy(m => typeof m.ADMINISTRATOR === "bigint");