run formatter

This commit is contained in:
Elizabeth Hunt 2023-11-20 13:08:12 -07:00
parent a4b89b6de4
commit 2b063d19cb
Signed by: simponic
GPG Key ID: 52B3774857EB24B1
3 changed files with 32 additions and 20 deletions

View File

@ -62,7 +62,10 @@ const BotButton = ({ onSave, givenBot }) => {
return ( return (
<div> <div>
<ul> <ul>
<li>It is Highly Recommend to peek at <Link to="/man-pages">the man pages</Link>.</li> <li>
It is Highly Recommend to peek at{" "}
<Link to="/man-pages">the man pages</Link>.
</li>
</ul> </ul>
<button className="button" onClick={() => setOpen(true)}> <button className="button" onClick={() => setOpen(true)}>
{givenBot ? "Update" : "+ Add"} Bot {givenBot ? "Update" : "+ Add"} Bot

View File

@ -108,29 +108,37 @@ export const ManPages = () => {
</div> </div>
<div> <div>
<ul> <ul>
<li>Goto <Link to="/bots">/bots</Link> and create a bot, taking note of the new bot's token (keep this private!).</li>
<li>Highly recommend <a
href="https://ngrok.io"
target="_blank"
rel="noreferrer"
>
ngrok
</a> for testing.</li>
<li>A "public" bot can be seen and played against by any player.</li>
<li>A "private" bot can be seen and played against by the player which created it.</li>
<li> <li>
A bot's "webhook" is the route that CheSSH will POST a Goto <Link to="/bots">/bots</Link> and create a bot, taking note
JSON message to upon an update in a game it is playing. Upon a move, of the new bot's token (keep this private!).
it will be immediately POST'd to with a single GameUpdate object, but </li>
when using the "redrive" feature (mostly for testing), an array of game that <li>
correspond to games in which it is still the bot's turn: Highly recommend{" "}
<a href="https://ngrok.io" target="_blank" rel="noreferrer">
ngrok
</a>{" "}
for testing.
</li>
<li>
A "public" bot can be seen and played against by any player.
</li>
<li>
A "private" bot can be seen and played against by the player which
created it.
</li>
<li>
A bot's "webhook" is the route that CheSSH will POST a JSON
message to upon an update in a game it is playing. Upon a move, it
will be immediately POST'd to with a single GameUpdate object, but
when using the "redrive" feature (mostly for testing), an array of
game that correspond to games in which it is still the bot's turn:
<pre>{botMoveRequestSchema}</pre> <pre>{botMoveRequestSchema}</pre>
</li> </li>
<li> <li>
After receiving the update, the bot must "respond" with its attempted move, After receiving the update, the bot must "respond" with its
with the plain token (no "Bearer" prefix) in its "Authorization" header, and attempted move, with the plain token (no "Bearer" prefix) in its
a body of (given "attempted_move" is the from space appended to the destination space i.e. "Authorization" header, and a body of (given "attempted_move" is
"e2e4"): the from space appended to the destination space i.e. "e2e4"):
<pre>{botMoveResponseSchema}</pre> <pre>{botMoveResponseSchema}</pre>
</li> </li>
<li> <li>

View File

@ -295,6 +295,7 @@ defmodule Chessh.Web.Endpoint do
Enum.find_value(conn.req_headers, fn {header, value} -> Enum.find_value(conn.req_headers, fn {header, value} ->
if header === "authorization", do: value if header === "authorization", do: value
end) end)
attempted_move = conn.body_params["attempted_move"] attempted_move = conn.body_params["attempted_move"]
bot = Repo.one(from(b in Bot, where: b.token == ^token)) bot = Repo.one(from(b in Bot, where: b.token == ^token))