From 8d33776a96d3aba9bfabbb63ac8a1ef609714b7a Mon Sep 17 00:00:00 2001 From: thororen1234 <78185467+thororen1234@users.noreply.github.com> Date: Wed, 27 May 2026 15:50:48 -0400 Subject: [PATCH] BetterSessions: Improve Patches --- .../components/RenameButton.tsx | 2 +- src/plugins/betterSessions/index.tsx | 27 ++++++++++--------- src/plugins/betterSessions/styles.css | 8 ++++++ 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/src/plugins/betterSessions/components/RenameButton.tsx b/src/plugins/betterSessions/components/RenameButton.tsx index 153c96a18..db2e9ef65 100644 --- a/src/plugins/betterSessions/components/RenameButton.tsx +++ b/src/plugins/betterSessions/components/RenameButton.tsx @@ -6,9 +6,9 @@ import { Button } from "@components/Button"; import { SessionInfo } from "@plugins/betterSessions/types"; +import { cl } from "@plugins/betterSessions/utils"; import { openModal } from "@webpack/common"; -import { cl } from "../utils"; import { RenameModal } from "./RenameModal"; export function RenameButton({ session, state }: { session: SessionInfo["session"], state: [string, React.Dispatch>]; }) { diff --git a/src/plugins/betterSessions/index.tsx b/src/plugins/betterSessions/index.tsx index 0057e0faa..63de7af81 100644 --- a/src/plugins/betterSessions/index.tsx +++ b/src/plugins/betterSessions/index.tsx @@ -62,19 +62,19 @@ export default definePlugin({ find: "#{intl::AUTH_SESSIONS_OS_UNKNOWN}", replacement: [ { - match: /Icon:(\i)(?=.{0,85}gap:"xxs",children:\[)/, - replace: "Icon:()=>$self.renderIcon({...arguments[0],DeviceIcon:$1})" + match: /(?<=#{intl::AUTH_SESSIONS_ACTIVE_RECENTLY}.{0,230}role:"listitem",children:\[.{0,15},\{Icon:)(\i)/, + replace: "()=>$self.renderIcon({...arguments[0],DeviceIcon:$1})" }, { - match: /(\.ICON_MUTED:"currentColor".{0,250}gap:"xs",children:)\[.*?"text-subtle",children:\i\}\)\]/, - replace: "$1$self.renderName(arguments[0])" + match: /("horizontal",gap:"xs",children:)\[.*?"text-subtle",children:\i\}\)\]\}\),/, + replace: "$1$self.renderName(arguments[0])})," }, { - match: /("text-muted",children:)\i(?=\}\)\]\}\),\i\])/, + match: /("text-muted",children:)\i(?=\}\)\]\}\),.{0,120}\.client_info\?\.location)/, replace: "$1$self.renderDescription({...arguments[0]})" }, { - match: /:\i\(\i\.approx_last_used_time\).{0,50}\.jsxs?\)\(\i,\{/, + match: /:\i\(\i\.approx_last_used_time\).{0,40}\(0,\i\.jsxs?\)\(\i,\{/, replace: "$&session:arguments[0]?.session," }, ] @@ -89,18 +89,19 @@ export default definePlugin({ // Show a "NEW" badge if the session is seen for the first time return ( <> - {title} - {(savedSession == null || savedSession.isNew) && ( - - )} - + {title} +
+ {(savedSession == null || savedSession.isNew) && ( + + )} + +
); }, { noop: true }), renderDescription: ErrorBoundary.wrap(({ session, description }: { session: Session, description: string; }) => { - const label = description.split(" \xb7 ")[0]; - const timeLabel = description.split(" \xb7 ")[1]; + const [label, timeLabel] = description.split(" \\xb7 "); return (
diff --git a/src/plugins/betterSessions/styles.css b/src/plugins/betterSessions/styles.css index f1c0d2443..f590ce387 100644 --- a/src/plugins/betterSessions/styles.css +++ b/src/plugins/betterSessions/styles.css @@ -1,3 +1,11 @@ +.vc-betterSessions-footer-buttons { + display: flex; + gap: 0.5em; + align-items: center; + justify-content: center; + margin-top: 2px; +} + .vc-betterSessions-rename-btn { margin-left: 4px; translate: 0 -2px;