Silent resize cmds & Auto resize terminal #2
This commit is contained in:
18
.idea/workspace.xml
generated
18
.idea/workspace.xml
generated
@@ -4,11 +4,10 @@
|
||||
<option name="autoReloadType" value="SELECTIVE" />
|
||||
</component>
|
||||
<component name="ChangeListManager">
|
||||
<list default="true" id="8497df64-d86b-4c98-ac58-c157d9d3fb1e" name="Changes" comment="Test ntfy build notification system">
|
||||
<list default="true" id="8497df64-d86b-4c98-ac58-c157d9d3fb1e" name="Changes" comment="Silent resize cmds & Auto resize terminal #1">
|
||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/backend/server.js" beforeDir="false" afterPath="$PROJECT_DIR$/backend/server.js" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/frontend/src/App.jsx" beforeDir="false" afterPath="$PROJECT_DIR$/frontend/src/App.jsx" afterDir="false" />
|
||||
<change beforePath="$PROJECT_DIR$/info.txt" beforeDir="false" afterPath="$PROJECT_DIR$/info.txt" afterDir="false" />
|
||||
</list>
|
||||
<option name="SHOW_DIALOG" value="false" />
|
||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||
@@ -117,7 +116,7 @@
|
||||
<updated>1733439468142</updated>
|
||||
<workItem from="1733439479708" duration="5489000" />
|
||||
<workItem from="1733448523969" duration="3535000" />
|
||||
<workItem from="1733549186397" duration="3022000" />
|
||||
<workItem from="1733549186397" duration="3810000" />
|
||||
</task>
|
||||
<task id="LOCAL-00001" summary="Nano zoom fix #11">
|
||||
<option name="closed" value="true" />
|
||||
@@ -207,7 +206,15 @@
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1733539381433</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="12" />
|
||||
<task id="LOCAL-00012" summary="Silent resize cmds & Auto resize terminal #1">
|
||||
<option name="closed" value="true" />
|
||||
<created>1733553128900</created>
|
||||
<option name="number" value="00012" />
|
||||
<option name="presentableId" value="LOCAL-00012" />
|
||||
<option name="project" value="LOCAL" />
|
||||
<updated>1733553128900</updated>
|
||||
</task>
|
||||
<option name="localTasksCounter" value="13" />
|
||||
<servers />
|
||||
</component>
|
||||
<component name="TypeScriptGeneratedFilesManager">
|
||||
@@ -244,6 +251,7 @@
|
||||
<MESSAGE value="Full return back to old code with minor fixes" />
|
||||
<MESSAGE value="Terminal size fix #18 (rows & cols fix)" />
|
||||
<MESSAGE value="Test ntfy build notification system" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Test ntfy build notification system" />
|
||||
<MESSAGE value="Silent resize cmds & Auto resize terminal #1" />
|
||||
<option name="LAST_COMMIT_MESSAGE" value="Silent resize cmds & Auto resize terminal #1" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -49,10 +49,6 @@ wss.on('connection', (ws) => {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the terminal size dynamically based on the WebSocket message
|
||||
const sttyCommand = `stty -echo rows ${data.rows} cols ${data.cols}\n`;
|
||||
stream.write(sttyCommand);
|
||||
|
||||
// Handle data from SSH session
|
||||
stream.on('data', (data) => {
|
||||
console.log(`SSH Output: ${data}`);
|
||||
|
||||
@@ -38,6 +38,12 @@ const App = () => {
|
||||
// Resize terminal to fit the container initially
|
||||
fitAddon.current.fit();
|
||||
|
||||
terminal.current.onData((data) => {
|
||||
if (socket.current && socket.current.readyState === WebSocket.OPEN) {
|
||||
socket.current.send(data);
|
||||
}
|
||||
});
|
||||
|
||||
// Adjust terminal size on window resize
|
||||
const handleResize = () => {
|
||||
fitAddon.current.fit();
|
||||
@@ -49,8 +55,8 @@ const App = () => {
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
||||
window.addEventListener('resize', handleResize);
|
||||
|
||||
return () => {
|
||||
terminal.current.dispose();
|
||||
if (socket.current) socket.current.close();
|
||||
|
||||
Reference in New Issue
Block a user