mirror of
https://github.com/Termix-SSH/Termix.git
synced 2026-07-15 21:03:47 +00:00
fix: enable terminal session persistence by default
This commit is contained in:
@@ -954,7 +954,7 @@ const TerminalInner = forwardRef<TerminalHandle, SSHTerminalProps>(
|
|||||||
currentHostConfigRef.current = hostConfig;
|
currentHostConfigRef.current = hostConfig;
|
||||||
|
|
||||||
const persistenceEnabled =
|
const persistenceEnabled =
|
||||||
localStorage.getItem("enableTerminalSessionPersistence") === "true";
|
localStorage.getItem("enableTerminalSessionPersistence") !== "false";
|
||||||
const tabId = hostConfig.instanceId
|
const tabId = hostConfig.instanceId
|
||||||
? `${hostConfig.id}_${hostConfig.instanceId}`
|
? `${hostConfig.id}_${hostConfig.instanceId}`
|
||||||
: `${hostConfig.id}_${Date.now()}`;
|
: `${hostConfig.id}_${Date.now()}`;
|
||||||
@@ -1455,8 +1455,8 @@ const TerminalInner = forwardRef<TerminalHandle, SSHTerminalProps>(
|
|||||||
} else if (msg.type === "sessionCreated") {
|
} else if (msg.type === "sessionCreated") {
|
||||||
sessionIdRef.current = msg.sessionId;
|
sessionIdRef.current = msg.sessionId;
|
||||||
const persistenceEnabled =
|
const persistenceEnabled =
|
||||||
localStorage.getItem("enableTerminalSessionPersistence") ===
|
localStorage.getItem("enableTerminalSessionPersistence") !==
|
||||||
"true";
|
"false";
|
||||||
if (persistenceEnabled && hostConfig.instanceId) {
|
if (persistenceEnabled && hostConfig.instanceId) {
|
||||||
const tabId = `${hostConfig.id}_${hostConfig.instanceId}`;
|
const tabId = `${hostConfig.id}_${hostConfig.instanceId}`;
|
||||||
localStorage.setItem(`termix_session_${tabId}`, msg.sessionId);
|
localStorage.setItem(`termix_session_${tabId}`, msg.sessionId);
|
||||||
@@ -2138,7 +2138,7 @@ const TerminalInner = forwardRef<TerminalHandle, SSHTerminalProps>(
|
|||||||
}
|
}
|
||||||
|
|
||||||
const persistenceEnabled =
|
const persistenceEnabled =
|
||||||
localStorage.getItem("enableTerminalSessionPersistence") === "true";
|
localStorage.getItem("enableTerminalSessionPersistence") !== "false";
|
||||||
if (
|
if (
|
||||||
!persistenceEnabled &&
|
!persistenceEnabled &&
|
||||||
sessionIdRef.current &&
|
sessionIdRef.current &&
|
||||||
|
|||||||
@@ -96,7 +96,7 @@ export function TabProvider({ children }: TabProviderProps) {
|
|||||||
const isElectron =
|
const isElectron =
|
||||||
typeof window !== "undefined" && !!(window as ElectronWindow).electronAPI;
|
typeof window !== "undefined" && !!(window as ElectronWindow).electronAPI;
|
||||||
const persistenceEnabled =
|
const persistenceEnabled =
|
||||||
localStorage.getItem("enableTerminalSessionPersistence") === "true";
|
localStorage.getItem("enableTerminalSessionPersistence") !== "false";
|
||||||
const shouldRestore = isMobile || isElectron || persistenceEnabled;
|
const shouldRestore = isMobile || isElectron || persistenceEnabled;
|
||||||
|
|
||||||
if (!shouldRestore) {
|
if (!shouldRestore) {
|
||||||
@@ -165,7 +165,7 @@ export function TabProvider({ children }: TabProviderProps) {
|
|||||||
const isElectron =
|
const isElectron =
|
||||||
typeof window !== "undefined" && !!(window as ElectronWindow).electronAPI;
|
typeof window !== "undefined" && !!(window as ElectronWindow).electronAPI;
|
||||||
const persistenceEnabled =
|
const persistenceEnabled =
|
||||||
localStorage.getItem("enableTerminalSessionPersistence") === "true";
|
localStorage.getItem("enableTerminalSessionPersistence") !== "false";
|
||||||
const shouldSave = isMobile || isElectron || persistenceEnabled;
|
const shouldSave = isMobile || isElectron || persistenceEnabled;
|
||||||
|
|
||||||
if (shouldSave) {
|
if (shouldSave) {
|
||||||
|
|||||||
@@ -465,7 +465,7 @@ export function UserProfilePanel({
|
|||||||
return v !== null ? v === "true" : true;
|
return v !== null ? v === "true" : true;
|
||||||
});
|
});
|
||||||
const [sessionPersistence, setSessionPersistence] = useState(
|
const [sessionPersistence, setSessionPersistence] = useState(
|
||||||
() => localStorage.getItem("enableTerminalSessionPersistence") === "true",
|
() => localStorage.getItem("enableTerminalSessionPersistence") !== "false",
|
||||||
);
|
);
|
||||||
const [showHostTags, setShowHostTags] = useState(() => {
|
const [showHostTags, setShowHostTags] = useState(() => {
|
||||||
const v = localStorage.getItem("showHostTags");
|
const v = localStorage.getItem("showHostTags");
|
||||||
|
|||||||
Reference in New Issue
Block a user