diff --git a/front/src/index.css b/front/src/index.css index 40d45cb..f9c4620 100644 --- a/front/src/index.css +++ b/front/src/index.css @@ -179,6 +179,12 @@ textarea:focus { border: 1px solid var(--gold-color); } +.man-page-title { + display: flex; + justify-content: space-between; + align-itemts: center; +} + .modal { display: flex; flex-direction: column; diff --git a/front/src/index.js b/front/src/index.js index e827e0a..eb2801c 100644 --- a/front/src/index.js +++ b/front/src/index.js @@ -7,6 +7,7 @@ import { Root } from "./root"; import { Demo } from "./routes/demo"; import { Home } from "./routes/home"; import { Keys } from "./routes/keys"; +import { ManPages } from "./routes/man_pages"; import { Password } from "./routes/password"; import { AuthSuccessful } from "./routes/auth_successful"; @@ -35,6 +36,10 @@ const router = createBrowserRouter([ path: "auth-successful", element: , }, + { + path: "man-pages", + element: , + }, ], }, ]); diff --git a/front/src/root.jsx b/front/src/root.jsx index 1abc67b..3e9ea53 100644 --- a/front/src/root.jsx +++ b/front/src/root.jsx @@ -42,6 +42,9 @@ export const Root = () => { )} + + Man Pages +
diff --git a/front/src/routes/home.jsx b/front/src/routes/home.jsx index 3495d20..d4ba22b 100644 --- a/front/src/routes/home.jsx +++ b/front/src/routes/home.jsx @@ -3,15 +3,20 @@ import { Link } from "react-router-dom"; 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 = () => { const { player, signedIn } = useAuthContext(); if (signedIn) { - const sshConfig = `Host chessh - Hostname ${process.env.REACT_APP_SSH_SERVER} - Port ${process.env.REACT_APP_SSH_PORT} - User "${player?.username}" - PubkeyAuthentication yes`; + const sshConfig = generateSSHConfig(player?.username); + return ( <>

Welcome, {player?.username}

@@ -51,7 +56,7 @@ export const Home = () => {
  • Then, connect with:
  • {
  • - Finally, play chess! Ideally, keeping the following contols in - mind: + Finally, check out the short man pages .
  • - -
      -
    • Ctrl + b / Escape to return to the main menu.
    • -
    • Ctrl + c / Ctrl + d to exit CheSSH at any point.
    • -
    • Arrow keys to move around the board.
    • -
    • - Select a piece with "enter", and move it to a square by pressing - "enter" again. -
    • -
    diff --git a/front/src/routes/man_pages.jsx b/front/src/routes/man_pages.jsx new file mode 100644 index 0000000..30324c8 --- /dev/null +++ b/front/src/routes/man_pages.jsx @@ -0,0 +1,69 @@ +export const ManPages = () => { + return ( +
    +
    +
    CHESSH(1)
    +
    User Help
    +
    CHESSH(1)
    +
    +
    +
    +
    + NAME +
    +
    +
      +
    • chessh - multiplayer chess over ssh
    • +
    +
    +
    + +
    +
    + SYNOPSIS +
    +
    +
      +
    • + ssh chessh +
    • +
    +
    +
    + +
    +
    + DESCRIPTION +
    +
    +
    + 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{" "} + + Erlang SSH Module + + . +
    +
    +
    +
    +
    +
    + INTERACTION +
    +
    +
      +
    • Ctrl + b / Escape to return to the main menu.
    • +
    • Ctrl + c / Ctrl + d to exit CheSSH at any point.
    • +
    • Arrow keys / vim keybinds to move around the board.
    • +
    • + Select a piece with "enter", and move it to a square by pressing + "enter" again. +
    • +
    +
    +
    +
    + ); +}; diff --git a/lib/chessh/ssh/client/client.ex b/lib/chessh/ssh/client/client.ex index 9ec1250..882a90e 100644 --- a/lib/chessh/ssh/client/client.ex +++ b/lib/chessh/ssh/client/client.ex @@ -157,6 +157,11 @@ defmodule Chessh.SSH.Client do <<2>> -> :menu # Escape "\e" -> :menu + # VIM keys, per request + "k" -> :up + "j" -> :down + "h" -> :left + "l" -> :right # Arrow keys "\e[A" -> :up "\e[B" -> :down