Add vim keybindings, man pages
This commit is contained in:
parent
bf9363aaf8
commit
e5ac660413
@ -179,6 +179,12 @@ textarea:focus {
|
|||||||
border: 1px solid var(--gold-color);
|
border: 1px solid var(--gold-color);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.man-page-title {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-itemts: center;
|
||||||
|
}
|
||||||
|
|
||||||
.modal {
|
.modal {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
|
@ -7,6 +7,7 @@ import { Root } from "./root";
|
|||||||
import { Demo } from "./routes/demo";
|
import { Demo } from "./routes/demo";
|
||||||
import { Home } from "./routes/home";
|
import { Home } from "./routes/home";
|
||||||
import { Keys } from "./routes/keys";
|
import { Keys } from "./routes/keys";
|
||||||
|
import { ManPages } from "./routes/man_pages";
|
||||||
import { Password } from "./routes/password";
|
import { Password } from "./routes/password";
|
||||||
import { AuthSuccessful } from "./routes/auth_successful";
|
import { AuthSuccessful } from "./routes/auth_successful";
|
||||||
|
|
||||||
@ -35,6 +36,10 @@ const router = createBrowserRouter([
|
|||||||
path: "auth-successful",
|
path: "auth-successful",
|
||||||
element: <AuthSuccessful />,
|
element: <AuthSuccessful />,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
path: "man-pages",
|
||||||
|
element: <ManPages />,
|
||||||
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
|
@ -42,6 +42,9 @@ export const Root = () => {
|
|||||||
</a>
|
</a>
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
<Link className="link" to="/man-pages">
|
||||||
|
Man Pages
|
||||||
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div className="content">
|
<div className="content">
|
||||||
|
@ -3,15 +3,20 @@ import { Link } from "react-router-dom";
|
|||||||
|
|
||||||
import { useAuthContext } from "../context/auth_context";
|
import { useAuthContext } from "../context/auth_context";
|
||||||
|
|
||||||
|
const generateSSHConfig = (username) => `
|
||||||
|
Host chessh
|
||||||
|
Hostname ${process.env.REACT_APP_SSH_SERVER}
|
||||||
|
Port ${process.env.REACT_APP_SSH_PORT}
|
||||||
|
User "${username}"
|
||||||
|
PubkeyAuthentication yes
|
||||||
|
`;
|
||||||
|
|
||||||
export const Home = () => {
|
export const Home = () => {
|
||||||
const { player, signedIn } = useAuthContext();
|
const { player, signedIn } = useAuthContext();
|
||||||
|
|
||||||
if (signedIn) {
|
if (signedIn) {
|
||||||
const sshConfig = `Host chessh
|
const sshConfig = generateSSHConfig(player?.username);
|
||||||
Hostname ${process.env.REACT_APP_SSH_SERVER}
|
|
||||||
Port ${process.env.REACT_APP_SSH_PORT}
|
|
||||||
User "${player?.username}"
|
|
||||||
PubkeyAuthentication yes`;
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<h2>Welcome, {player?.username}</h2>
|
<h2>Welcome, {player?.username}</h2>
|
||||||
@ -51,7 +56,7 @@ export const Home = () => {
|
|||||||
<li>Then, connect with:</li>
|
<li>Then, connect with:</li>
|
||||||
<CopyBlock
|
<CopyBlock
|
||||||
theme={dracula}
|
theme={dracula}
|
||||||
text={"ssh -t chessh"}
|
text={"ssh chessh"}
|
||||||
language={"shell"}
|
language={"shell"}
|
||||||
showLineNumbers={false}
|
showLineNumbers={false}
|
||||||
codeBlock
|
codeBlock
|
||||||
@ -59,19 +64,8 @@ export const Home = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<li>
|
<li>
|
||||||
Finally, play chess! Ideally, keeping the following contols in
|
Finally, check out the short <a href="/man-pages">man pages</a> .
|
||||||
mind:
|
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<ul>
|
|
||||||
<li>Ctrl + b / Escape to return to the main menu.</li>
|
|
||||||
<li>Ctrl + c / Ctrl + d to exit CheSSH at any point.</li>
|
|
||||||
<li>Arrow keys to move around the board.</li>
|
|
||||||
<li>
|
|
||||||
Select a piece with "enter", and move it to a square by pressing
|
|
||||||
"enter" again.
|
|
||||||
</li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</ol>
|
</ol>
|
||||||
</>
|
</>
|
||||||
|
69
front/src/routes/man_pages.jsx
Normal file
69
front/src/routes/man_pages.jsx
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
export const ManPages = () => {
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<div className="man-page-title">
|
||||||
|
<div>CHESSH(1)</div>
|
||||||
|
<div>User Help</div>
|
||||||
|
<div>CHESSH(1)</div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<b>NAME</b>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<ul>
|
||||||
|
<li>chessh - multiplayer chess over ssh</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<b>SYNOPSIS</b>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<ul>
|
||||||
|
<li>
|
||||||
|
ssh <b>chessh</b>
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<b>DESCRIPTION</b>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
CheSSH uses the SSH protocol to send sequences of ANSI codes &
|
||||||
|
plaintext to render a chess board in your shell, and listen to I/O
|
||||||
|
by abusing the hell out of the{" "}
|
||||||
|
<a href="https://www.erlang.org/doc/man/ssh.html">
|
||||||
|
Erlang SSH Module
|
||||||
|
</a>
|
||||||
|
.
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<br />
|
||||||
|
<div>
|
||||||
|
<div>
|
||||||
|
<b>INTERACTION</b>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<ul>
|
||||||
|
<li>Ctrl + b / Escape to return to the main menu.</li>
|
||||||
|
<li>Ctrl + c / Ctrl + d to exit CheSSH at any point.</li>
|
||||||
|
<li>Arrow keys / vim keybinds to move around the board.</li>
|
||||||
|
<li>
|
||||||
|
Select a piece with "enter", and move it to a square by pressing
|
||||||
|
"enter" again.
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
@ -157,6 +157,11 @@ defmodule Chessh.SSH.Client do
|
|||||||
<<2>> -> :menu
|
<<2>> -> :menu
|
||||||
# Escape
|
# Escape
|
||||||
"\e" -> :menu
|
"\e" -> :menu
|
||||||
|
# VIM keys, per request
|
||||||
|
"k" -> :up
|
||||||
|
"j" -> :down
|
||||||
|
"h" -> :left
|
||||||
|
"l" -> :right
|
||||||
# Arrow keys
|
# Arrow keys
|
||||||
"\e[A" -> :up
|
"\e[A" -> :up
|
||||||
"\e[B" -> :down
|
"\e[B" -> :down
|
||||||
|
Loading…
Reference in New Issue
Block a user