diff --git a/src/plugins/betterSessions/components/RenameButton.tsx b/src/plugins/betterSessions/components/RenameButton.tsx
index b20649d06..db2e9ef65 100644
--- a/src/plugins/betterSessions/components/RenameButton.tsx
+++ b/src/plugins/betterSessions/components/RenameButton.tsx
@@ -6,6 +6,7 @@
import { Button } from "@components/Button";
import { SessionInfo } from "@plugins/betterSessions/types";
+import { cl } from "@plugins/betterSessions/utils";
import { openModal } from "@webpack/common";
import { RenameModal } from "./RenameModal";
@@ -15,7 +16,7 @@ export function RenameButton({ session, state }: { session: SessionInfo["session
diff --git a/src/plugins/betterSessions/index.tsx b/src/plugins/betterSessions/index.tsx
index bfe1f59cf..db7efdf4c 100644
--- a/src/plugins/betterSessions/index.tsx
+++ b/src/plugins/betterSessions/index.tsx
@@ -21,6 +21,7 @@ import "./styles.css";
import { showNotification } from "@api/Notifications";
import { definePluginSettings } from "@api/Settings";
import ErrorBoundary from "@components/ErrorBoundary";
+import { Paragraph } from "@components/Paragraph";
import { Devs } from "@utils/constants";
import definePlugin, { OptionType } from "@utils/types";
import { findComponentByCodeLazy, findCssClassesLazy, findStoreLazy } from "@webpack";
@@ -28,13 +29,10 @@ import { Constants, React, RestAPI, SettingsRouter, Tooltip } from "@webpack/com
import { NewButton, RenameButton } from "./components/RenameButton";
import { Session, SessionInfo } from "./types";
-import { fetchNamesFromDataStore, getDefaultName, GetOsColor, GetPlatformIcon, savedSessionsCache, saveSessionsToDataStore } from "./utils";
+import { cl, fetchNamesFromDataStore, getDefaultName, GetOsColor, GetPlatformIcon, savedSessionsCache, saveSessionsToDataStore } from "./utils";
const AuthSessionsStore = findStoreLazy("AuthSessionsStore");
-
const TimestampClasses = findCssClassesLazy("timestamp", "blockquoteContainer");
-const SessionIconClasses = findCssClassesLazy("sessionIcon");
-
const BlobMask = findComponentByCodeLazy("!1,lowerBadgeSize:");
const settings = definePluginSettings({
@@ -61,24 +59,26 @@ export default definePlugin({
patches: [
{
- find: "#{intl::AUTH_SESSIONS_SESSION_LOG_OUT}",
+ find: "#{intl::AUTH_SESSIONS_OS_UNKNOWN}",
replacement: [
- // Replace children with a single label with state
{
- match: /({variant:"eyebrow",className:\i\.\i,children:).{70,110}{children:"\\xb7"}\),\(0,\i\.\i\)\("span",{children:\i\[\d+\]}\)\]}\)\]/,
- replace: "$1$self.renderName(arguments[0])"
+ match: /(#{intl::AUTH_SESSIONS_ACTIVE_RECENTLY}.{0,230}role:"listitem",children:\[.{0,15},\{Icon:)\i/,
+ replace: "$1()=>$self.renderIcon(arguments[0])"
},
{
- match: /({variant:"text-sm\/medium",className:\i\.\i,children:.{70,110}{children:"\\xb7"}\),\(0,\i\.\i\)\("span",{children:)(\i\[\d+\])}/,
- replace: "$1$self.renderTimestamp({...arguments[0],timeLabel:$2})}"
+ match: /("horizontal",gap:"xs",children:)\[.{0,250}"text-subtle",children:\i\}\)\]\}\),/,
+ replace: "$1$self.renderName(arguments[0])}),"
},
- // Replace the icon
{
- match: /(?<=Icon:(\i).{0,250}className:\i\.\i,children:\[)/,
- replace: "$self.renderIcon({...arguments[0],DeviceIcon:$1}),false&&"
- }
+ match: /("text-muted",children:)\i(?=\}\)\]\}\),.{0,120}\.client_info\?\.location)/,
+ replace: "$1$self.renderDescription(arguments[0])"
+ },
+ {
+ match: /:\i\(\i\.approx_last_used_time\).{0,40}\(0,\i\.jsxs?\)\(\i,\{/,
+ replace: "$&session:arguments[0]?.session,"
+ },
]
- }
+ },
],
renderName: ErrorBoundary.wrap(({ session }: SessionInfo) => {
@@ -86,32 +86,43 @@ export default definePlugin({
const state = React.useState(savedSession?.name ? `${savedSession.name}*` : getDefaultName(session.client_info));
const [title, setTitle] = state;
-
// Show a "NEW" badge if the session is seen for the first time
return (
<>
- {title}
- {(savedSession == null || savedSession.isNew) && (
-