Release 1.0 (#3)

* Nano and timeout error fix #1

* Nano and timeout error fix #2

* Nano and timeout error fix #3

* Nano and timeout error fix #4

* Nano and timeout error fix #5

* Nano and timeout error fix #6

* Nano and timeout error fix #7 (plus css changes for hide buttons)

* Nano and timeout error fix #8 (zoom method)

* Nano zoom fix #9

* Nano zoom fix #10

* Nano zoom fix #11

* Nano zoom fix #12

* Nano zoom fix #13

* Nano zoom fix #14

* Nano zoom fix #15

* Nano zoom fix #16 (ssh-2-promise)

* Nano zoom fix #17 (ssh-2-promise port  fix)

* Full return back to old code with minor fixes

* Terminal size fix #18 (rows & cols fix)

* Test ntfy build notification system

* Silent resize cmds & Auto resize terminal #1

* Silent resize cmds & Auto resize terminal #2

* Docker build update

* Docker build update #2

* Docker build update #3

* Docker build update #4 (cache and cleanup)

* Docker build update #5 (cache and cleanup)

* Docker build update #6 (cache and cleanup)

* Docker build update #7 (final)

* Docker build update #8 (nevermind not finanl)

* Docker build update #9 (nevermind not finanl)

* Docker build update #10

* Docker build update #10 (I hope final)

* Docker build update #10 (actual final)

* Release 1.0!!!!

* Repo clean-up

* Remove files ignored by .gitignore

* Change project name, create logo, change README.md to be soon updated.

* Update README.md #1 (also added MIT License)

* Update README.md #2

* Update README.md #3

* Update README.md #4

* Update README.md #5

* Update README.md #6

* Update README.md #7

* Update README.md

* Add images

* Update image name

* Update README.md

* Final changes to release-1.0

* Update README.md

* Update name (need to fix logo)

* Final updates (I hope for real this time)

* Fix web-socket timeout.

* Fix timeout on close.
This commit was merged in pull request #3.
This commit is contained in:
Karmaa authored and GitHub committed 2024-12-12 18:46:43 -06:00
1 parent b6a3f881a8
commit 15e1fd215e
37 files changed
+926 -278

No files matched your search

+1 -2
View File
@@ -22,7 +22,6 @@
flex-direction: column;
align-items: flex-start;
justify-content: space-between;
border-radius: 5px;
position: relative;
}
@@ -63,7 +62,7 @@
.hide-sidebar-button {
position: fixed;
bottom: 10px;
right: 10px;
right: 23px;
background-color: rgb(108, 108, 108);
color: white;
border: none;
+119 -69
View File
@@ -1,7 +1,7 @@
import React, { useEffect, useRef, useState } from 'react';
import { Terminal } from 'xterm';
import { Terminal } from '@xterm/xterm';
import 'xterm/css/xterm.css';
import { FitAddon } from 'xterm-addon-fit';
import { FitAddon } from '@xterm/addon-fit';
import './App.css';
const App = () => {
@@ -10,13 +10,13 @@ const App = () => {
const fitAddon = useRef(null);
const socket = useRef(null);
const [host, setHost] = useState('');
const [port, setPort] = useState('22');
const [username, setUsername] = useState('');
const [password, setPassword] = useState('');
const [isConnected, setIsConnected] = useState(false);
const [isSideBarHidden, setIsSideBarHidden] = useState(false);
useEffect(() => {
// Initialize the terminal and the fit addon
terminal.current = new Terminal({
cursorBlink: true,
theme: {
@@ -25,23 +25,37 @@ const App = () => {
},
macOptionIsMeta: true,
allowProposedApi: true,
scrollback: 1000, // Allow scrollback so the terminal doesn't lose state
scrollback: 5000,
});
// Initialize and attach the fit addon to the terminal
fitAddon.current = new FitAddon();
terminal.current.loadAddon(fitAddon.current);
terminal.current.open(terminalRef.current);
// Resize terminal to fit the container initially
fitAddon.current.fit();
// Adjust terminal size on window resize
const resizeListener = () => {
// Fit the terminal and send the size when needed
const fitAndNotifyResize = () => {
fitAddon.current.fit();
if (socket.current && socket.current.readyState === WebSocket.OPEN) {
socket.current.send(JSON.stringify({
cols: terminal.current.cols,
rows: terminal.current.rows,
}));
}
};
window.addEventListener('resize', resizeListener);
window.addEventListener('resize', fitAndNotifyResize);
terminal.current.onResize(({ cols, rows }) => {
console.log(`Terminal resized to cols:${cols}, rows:${rows}`);
fitAndNotifyResize();
});
const handleConnectionEstablished = () => {
fitAndNotifyResize();
};
window.addEventListener('connection-established', handleConnectionEstablished);
// Monitor terminal data (activity)
terminal.current.onData((data) => {
@@ -50,50 +64,54 @@ const App = () => {
}
});
// Add specific resize call for certain programs like nano or vim
const resizeTerminalOnStart = () => {
// Resize immediately after starting vim/nano or other programs
fitAddon.current.fit();
terminal.current.clear();
};
terminal.current.onData((data) => {
if (data.includes('nano') || data.includes('vim')) {
// Trigger resize immediately when these programs start
resizeTerminalOnStart();
}
});
// Cleanup on component unmount
return () => {
terminal.current.dispose();
if (socket.current) {
socket.current.close();
}
window.removeEventListener('resize', resizeListener);
window.removeEventListener('resize', fitAndNotifyResize);
};
}, []);
const handleConnect = () => {
const protocol = window.location.protocol === 'https:' ? 'wss:' : 'ws:';
const wsUrl = `${protocol}//${window.location.host}/ws/`; // Use current host and "/ws/" endpoint
socket.current = new WebSocket(wsUrl);
if (!host || !username || !password) {
terminal.current.writeln('Please fill in all fields.');
return;
}
socket.current = new WebSocket("ws://localhost:8081");
socket.current.onopen = () => {
terminal.current.writeln(`Connected to WebSocket server at ${wsUrl}`);
socket.current.send(JSON.stringify({ host, username, password }));
socket.current.send(
JSON.stringify({
host,
port,
username,
password,
rows: terminal.current.rows,
cols: terminal.current.cols
})
);
// Dispatch a custom event when connection is open
const event = new Event('connection-established');
window.dispatchEvent(event);
setIsConnected(true);
};
socket.current.onmessage = (event) => {
terminal.current.write(event.data);
};
socket.current.onerror = (error) => {
terminal.current.writeln(`WebSocket error: ${error.message}`);
};
socket.current.onclose = () => {
terminal.current.writeln('Disconnected from WebSocket server.');
setIsConnected(false);
@@ -105,48 +123,80 @@ const App = () => {
};
const handleSideBarHiding = () => {
setIsSideBarHidden((prevState) => !prevState);
setIsSideBarHidden((prevState) => {
const newState = !prevState;
if (newState) {
setTimeout(() => {
// Add a delay to ensure layout settles before resize action
fitAddon.current.fit();
if (socket.current && socket.current.readyState === WebSocket.OPEN) {
socket.current.send(JSON.stringify({
cols: terminal.current.cols,
rows: terminal.current.rows,
}));
}
}, 100); // Delay of 100 milliseconds
} else {
setTimeout(() => {
// Refit terminal when showing sidebar as well
fitAddon.current.fit();
if (socket.current && socket.current.readyState === WebSocket.OPEN) {
socket.current.send(JSON.stringify({
cols: terminal.current.cols,
rows: terminal.current.rows,
}));
}
}, 100); // Delay of 100 milliseconds
}
return newState;
});
};
return (
<div className="app-container">
<div className="main-content">
<div className={`sidebar ${isSideBarHidden ? 'hidden' : ''}`}>
<h2>Connection Details</h2>
<input
type="text"
placeholder="Host"
value={host}
onChange={(e) => handleInputChange(e, setHost)}
/>
<input
type="text"
placeholder="Username"
value={username}
onChange={(e) => handleInputChange(e, setUsername)}
/>
<input
type="password"
placeholder="Password"
value={password}
onChange={(e) => handleInputChange(e, setPassword)}
/>
<button onClick={handleConnect} disabled={isConnected}>
{isConnected ? 'Connected' : 'Start Session'}
</button>
<div className="app-container">
<div className="main-content">
<div className={`sidebar ${isSideBarHidden ? 'hidden' : ''}`}>
<h2>Connection Details</h2>
<input
type="text"
placeholder="Host"
value={host}
onChange={(e) => handleInputChange(e, setHost)}
/>
<input
type="text"
placeholder="Port"
value={port}
onChange={(e) => handleInputChange(e, setPort)}
/>
<input
type="text"
placeholder="Username"
value={username}
onChange={(e) => handleInputChange(e, setUsername)}
/>
<input
type="password"
placeholder="Password"
value={password}
onChange={(e) => handleInputChange(e, setPassword)}
/>
<button onClick={handleConnect} disabled={isConnected}>
{isConnected ? 'Connected' : 'Start Session'}
</button>
</div>
<div ref={terminalRef} className="terminal-container"></div>
</div>
<div ref={terminalRef} className="terminal-container"></div>
{/* Hide button always positioned in the bottom-right corner */}
<button
className="hide-sidebar-button"
onClick={handleSideBarHiding}
>
{isSideBarHidden ? '+' : '-'}
</button>
</div>
{/* Hide button always positioned in the bottom-right corner */}
<button
className="hide-sidebar-button"
onClick={handleSideBarHiding}
>
{isSideBarHidden ? '+' : '-'}
</button>
</div>
);
};
+1 -1
View File
@@ -5,7 +5,7 @@ body {
sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
overflow: hidden; /* Prevent scrolling */
overflow: hidden;
}
code {
+1 -1
View File
@@ -1 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3"><g fill="#61DAFB"><path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/><circle cx="420.9" cy="296.5" r="45.7"/><path d="M520.5 78.1z"/></g></svg>
<svg id="svg" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="400" height="400" viewBox="0, 0, 400,400"><g id="svgg"><path id="path0" d="M109.557 87.399 C 107.077 88.747,107.200 87.048,107.200 120.026 L 107.200 150.080 108.577 151.457 L 109.954 152.834 121.966 152.717 C 136.715 152.573,135.661 153.055,136.022 146.298 C 136.411 139.003,137.406 138.000,144.254 138.000 C 148.371 138.000,148.487 137.975,149.631 136.831 L 150.800 135.662 150.800 120.418 C 150.800 100.465,150.659 100.802,159.000 100.804 C 163.752 100.805,165.152 101.282,166.259 103.276 C 166.672 104.021,166.774 124.554,166.786 209.113 C 166.801 322.394,166.676 315.827,168.847 317.348 C 169.688 317.937,172.713 318.000,200.083 318.000 L 230.387 318.000 231.694 316.833 L 233.000 315.666 233.200 209.733 C 233.371 119.206,233.482 103.676,233.967 102.947 C 235.128 101.200,236.451 100.800,241.062 100.801 C 249.331 100.804,249.200 100.488,249.200 120.418 L 249.200 135.662 250.369 136.831 C 251.517 137.979,251.617 138.000,255.869 138.003 C 262.683 138.007,263.626 138.945,263.988 146.077 C 264.344 153.080,263.293 152.571,277.711 152.726 C 290.473 152.864,291.356 152.732,292.353 150.544 C 292.670 149.849,292.800 140.844,292.800 119.670 C 292.800 86.839,292.940 88.713,290.396 87.398 C 288.694 86.518,111.176 86.519,109.557 87.399 " stroke="none" fill="#dbdbdb" fill-rule="evenodd"></path><path id="path1" d="M188.000 5.600 C 188.000 5.840,186.408 6.000,184.024 6.000 C 181.804 6.000,179.938 6.177,179.800 6.400 C 179.664 6.620,177.943 6.800,175.976 6.800 C 173.859 6.800,172.400 6.963,172.400 7.200 C 172.400 7.420,171.421 7.600,170.224 7.600 C 169.027 7.600,167.936 7.780,167.800 8.000 C 167.664 8.220,166.674 8.400,165.600 8.400 C 164.526 8.400,163.524 8.599,163.374 8.843 C 163.183 9.151,162.996 9.121,162.756 8.743 C 162.567 8.444,162.409 8.389,162.406 8.621 C 162.403 8.852,161.746 9.060,160.947 9.083 C 160.148 9.105,159.383 9.293,159.247 9.499 C 159.111 9.705,158.371 9.827,157.601 9.770 C 156.832 9.713,155.957 9.870,155.656 10.119 C 155.356 10.368,154.505 10.520,153.765 10.456 C 153.025 10.393,152.190 10.488,151.910 10.668 C 151.208 11.118,147.996 11.961,146.900 11.982 C 146.405 11.992,146.000 12.180,146.000 12.400 C 146.000 12.620,145.608 12.800,145.128 12.800 C 144.256 12.800,141.577 13.617,141.200 13.998 C 140.966 14.234,140.013 14.495,139.300 14.518 C 139.025 14.526,138.800 14.694,138.800 14.890 C 138.800 15.087,138.665 15.168,138.500 15.071 C 138.335 14.973,137.750 15.080,137.200 15.306 C 136.650 15.533,135.961 15.768,135.669 15.829 C 135.377 15.889,134.837 16.070,134.469 16.231 C 134.101 16.391,133.350 16.596,132.800 16.686 C 132.250 16.776,131.740 17.018,131.667 17.225 C 131.593 17.431,131.188 17.600,130.767 17.600 C 130.345 17.600,130.000 17.780,130.000 18.000 C 130.000 18.220,129.550 18.400,129.000 18.400 C 128.450 18.400,128.000 18.547,128.000 18.728 C 128.000 18.908,127.100 19.300,126.000 19.600 C 124.900 19.900,124.000 20.292,124.000 20.472 C 124.000 20.653,123.651 20.800,123.224 20.800 C 122.797 20.800,122.336 20.980,122.200 21.200 C 122.064 21.420,121.503 21.600,120.953 21.600 C 120.388 21.600,120.060 21.774,120.200 22.000 C 120.348 22.240,119.836 22.402,118.924 22.406 C 117.793 22.411,117.555 22.512,118.000 22.800 C 118.468 23.102,118.357 23.189,117.500 23.194 C 116.895 23.197,116.400 23.380,116.400 23.600 C 116.400 23.820,116.122 24.000,115.783 24.000 C 115.444 24.000,114.780 24.360,114.308 24.800 C 113.836 25.240,113.134 25.600,112.748 25.600 C 112.363 25.600,111.936 25.780,111.800 26.000 C 111.664 26.220,111.203 26.400,110.776 26.400 C 110.349 26.400,110.000 26.591,110.000 26.824 C 110.000 27.057,109.820 27.136,109.600 27.000 C 109.380 26.864,109.200 27.011,109.200 27.326 C 109.200 27.644,108.620 28.036,107.900 28.206 C 107.185 28.374,106.510 28.541,106.400 28.577 C 105.688 28.808,102.081 31.186,101.056 32.100 C 100.377 32.705,99.504 33.200,99.115 33.200 C 98.470 33.200,97.574 33.780,96.184 35.100 C 95.894 35.375,95.483 35.600,95.271 35.600 C 95.058 35.600,94.307 36.140,93.600 36.800 C 92.893 37.460,91.968 38.000,91.544 38.000 C 91.120 38.000,90.139 38.634,89.364 39.409 C 88.589 40.185,87.785 40.714,87.577 40.586 C 87.370 40.458,87.200 40.543,87.200 40.776 C 87.200 41.009,86.942 41.200,86.627 41.200 C 86.312 41.200,85.939 41.563,85.798 42.006 C 85.657 42.449,85.390 42.717,85.203 42.602 C 85.017 42.487,84.601 42.656,84.280 42.977 C 83.958 43.299,83.605 43.472,83.495 43.361 C 83.384 43.251,82.452 43.890,81.423 44.780 C 80.393 45.671,79.388 46.400,79.188 46.400 C 78.989 46.400,78.940 46.700,79.081 47.066 C 79.252 47.513,79.183 47.636,78.868 47.442 C 78.611 47.283,78.400 47.343,78.400 47.576 C 78.400 47.809,78.170 48.000,77.888 48.000 C 77.607 48.000,77.117 48.360,76.800 48.800 C 76.483 49.240,75.983 49.600,75.688 49.600 C 75.394 49.600,75.251 49.759,75.371 49.954 C 75.491 50.148,75.054 50.529,74.400 50.800 C 73.746 51.071,73.309 51.452,73.429 51.646 C 73.549 51.841,73.470 52.000,73.254 52.000 C 73.Line truncated

Before

Width:  |  Height:  |  Size: 2.6 KiB

After

Width:  |  Height:  |  Size: 49 KiB