diff options
author | Simponic <elizabeth.hunt@simponic.xyz> | 2023-02-11 23:37:47 -0700 |
---|---|---|
committer | Simponic <elizabeth.hunt@simponic.xyz> | 2023-02-11 23:37:47 -0700 |
commit | 7568b614447eb0d6f93a578837d1d5ea79e71936 (patch) | |
tree | 3849fb0f773f4fec0c77f32025048f3bd55a6a6e | |
parent | e5ac660413fd8e2879706cfb06c476aae9164b31 (diff) | |
download | chessh-7568b614447eb0d6f93a578837d1d5ea79e71936.tar.gz chessh-7568b614447eb0d6f93a578837d1d5ea79e71936.zip |
Format buildscripts (pretty unsubstantial but needed to happen :3)
-rwxr-xr-x | buildscripts/build/build.sh | 2 | ||||
-rwxr-xr-x | buildscripts/build/build_front.sh | 22 | ||||
-rwxr-xr-x | buildscripts/build/build_server.sh | 20 | ||||
-rwxr-xr-x | buildscripts/docker/build.sh | 8 | ||||
-rwxr-xr-x | buildscripts/docker/deploy.sh | 68 | ||||
-rw-r--r-- | front/src/root.jsx | 6 | ||||
-rw-r--r-- | front/src/routes/home.jsx | 5 | ||||
-rw-r--r-- | front/src/routes/man_pages.jsx | 2 | ||||
-rw-r--r-- | lib/chessh/discord/notifier.ex | 10 |
9 files changed, 72 insertions, 71 deletions
diff --git a/buildscripts/build/build.sh b/buildscripts/build/build.sh index 5930c00..90856f3 100755 --- a/buildscripts/build/build.sh +++ b/buildscripts/build/build.sh @@ -167,7 +167,7 @@ function build_server_nodes() { copy_ssh_keys for node_id in "${server_node_ids[@]}" do - build_server $node_id + build_server $node_id & done } diff --git a/buildscripts/build/build_front.sh b/buildscripts/build/build_front.sh index ed3cb8b..117f302 100755 --- a/buildscripts/build/build_front.sh +++ b/buildscripts/build/build_front.sh @@ -23,8 +23,8 @@ server { # Grab deps if [ $(which node) == "" ] then - curl -sSL https://deb.nodesource.com/setup_16.x | sudo bash - - sudo apt install -y nodejs + curl -sSL https://deb.nodesource.com/setup_16.x | sudo bash - + sudo apt install -y nodejs fi [ "$(which git)" != "" ] || sudo apt install -y git [ "$(which nginx)" != "" ] || sudo apt install -y nginx @@ -32,16 +32,16 @@ fi # Checkout source if [ ! -d $chessh_path ] then - mkdir -p $chessh_path - cd $chessh_path - git init - git remote add origin $chessh_source - git pull origin - git checkout main - git config pull.rebase true + mkdir -p $chessh_path + cd $chessh_path + git init + git remote add origin $chessh_source + git pull origin + git checkout main + git config pull.rebase true else - cd $chessh_path - git pull origin main + cd $chessh_path + git pull origin main fi # Build diff --git a/buildscripts/build/build_server.sh b/buildscripts/build/build_server.sh index 80e6e91..57a3a1c 100755 --- a/buildscripts/build/build_server.sh +++ b/buildscripts/build/build_server.sh @@ -9,22 +9,22 @@ chessh_path="$HOME/src/chessh" [ "$(which git)" != "" ] || sudo apt install -y git if [ "$(which docker)" = "" ] then - curl -sSL https://get.docker.com | sh + curl -sSL https://get.docker.com | sh fi # Checkout source if [ ! -d $chessh_path ] then - mkdir -p $chessh_path - cd $chessh_path - git init - git remote add origin $chessh_source - git pull origin - git checkout main - git config pull.rebase true + mkdir -p $chessh_path + cd $chessh_path + git init + git remote add origin $chessh_source + git pull origin + git checkout main + git config pull.rebase true else - cd $chessh_path - git pull origin main + cd $chessh_path + git pull origin main fi # Build diff --git a/buildscripts/docker/build.sh b/buildscripts/docker/build.sh index a33be21..5771384 100755 --- a/buildscripts/docker/build.sh +++ b/buildscripts/docker/build.sh @@ -7,7 +7,7 @@ export $(cat $env_file | xargs) docker build ../.. -t chessh/server docker build \ - --build-arg REACT_APP_DISCORD_OAUTH=${REACT_APP_DISCORD_OAUTH} \ - --build-arg REACT_APP_SSH_SERVER=${REACT_APP_SSH_SERVER} \ - --build-arg REACT_APP_SSH_PORT=${REACT_APP_SSH_PORT} \ - ../../front -t chessh/frontend + --build-arg REACT_APP_DISCORD_OAUTH=${REACT_APP_DISCORD_OAUTH} \ + --build-arg REACT_APP_SSH_SERVER=${REACT_APP_SSH_SERVER} \ + --build-arg REACT_APP_SSH_PORT=${REACT_APP_SSH_PORT} \ + ../../front -t chessh/frontend diff --git a/buildscripts/docker/deploy.sh b/buildscripts/docker/deploy.sh index 8299aea..5b90c27 100755 --- a/buildscripts/docker/deploy.sh +++ b/buildscripts/docker/deploy.sh @@ -8,50 +8,50 @@ container_names=("chessh-redis" "chessh-database" "chessh-server" "chessh-fronte export $(cat $env_file | xargs) for name in ${container_names[@]}; do - docker stop $name - docker rm $name + docker stop $name + docker rm $name done docker network ls | grep -q $project_name || docker network create --driver bridge $project_name docker volume ls | grep -q $project_name-redisdata || docker volume create $project_name-redisdata docker run \ - -d \ - --restart unless-stopped \ - --env-file $env_file \ - --network $project_name \ - --name $project_name-redis \ - --net-alias redis \ - --volume $project_name-redisdata:/data/ \ - redis + -d \ + --restart unless-stopped \ + --env-file $env_file \ + --network $project_name \ + --name $project_name-redis \ + --net-alias redis \ + --volume $project_name-redisdata:/data/ \ + redis docker volume ls | grep -q $project_name-pgdata || docker volume create $project_name-pgdata docker run \ - -d \ - --restart unless-stopped \ - --env-file $env_file \ - --network $project_name \ - --name $project_name-database \ - --net-alias database \ - --volume $project_name-pgdata:/var/lib/postgresql/data/ \ - postgres + -d \ + --restart unless-stopped \ + --env-file $env_file \ + --network $project_name \ + --name $project_name-database \ + --net-alias database \ + --volume $project_name-pgdata:/var/lib/postgresql/data/ \ + postgres docker run \ - -d \ - --restart unless-stopped \ - --env-file $env_file \ - --network $project_name \ - --name $project_name-server \ - --publish "${HOST}:${SSH_PORT}:${SSH_PORT}/tcp" \ - --net-alias server \ - chessh/server + -d \ + --restart unless-stopped \ + --env-file $env_file \ + --network $project_name \ + --name $project_name-server \ + --publish "${HOST}:${SSH_PORT}:${SSH_PORT}/tcp" \ + --net-alias server \ + chessh/server docker run \ - -d \ - --restart unless-stopped \ - --env-file $env_file \ - --network $project_name \ - --name $project_name-frontend \ - --publish "${HOST}:${WEB_PORT}:80/tcp" \ - --net-alias frontend \ - chessh/frontend + -d \ + --restart unless-stopped \ + --env-file $env_file \ + --network $project_name \ + --name $project_name-frontend \ + --publish "${HOST}:${WEB_PORT}:80/tcp" \ + --net-alias frontend \ + chessh/frontend diff --git a/front/src/root.jsx b/front/src/root.jsx index 3e9ea53..2b1e603 100644 --- a/front/src/root.jsx +++ b/front/src/root.jsx @@ -17,6 +17,9 @@ export const Root = () => { </Link> </div> <div className="nav"> + <Link className="link" to="/man-pages"> + Man Pages + </Link> {signedIn ? ( <> <Link className="link" to="/home"> @@ -42,9 +45,6 @@ export const Root = () => { </a> </> )} - <Link className="link" to="/man-pages"> - Man Pages - </Link> </div> </div> <div className="content"> diff --git a/front/src/routes/home.jsx b/front/src/routes/home.jsx index d4ba22b..05129a2 100644 --- a/front/src/routes/home.jsx +++ b/front/src/routes/home.jsx @@ -3,11 +3,10 @@ import { Link } from "react-router-dom"; import { useAuthContext } from "../context/auth_context"; -const generateSSHConfig = (username) => ` -Host chessh +const generateSSHConfig = (username) => `Host chessh Hostname ${process.env.REACT_APP_SSH_SERVER} Port ${process.env.REACT_APP_SSH_PORT} - User "${username}" + User ${username.includes(" ") ? '"' + username + '"' : username}" PubkeyAuthentication yes `; diff --git a/front/src/routes/man_pages.jsx b/front/src/routes/man_pages.jsx index 30324c8..2d988d8 100644 --- a/front/src/routes/man_pages.jsx +++ b/front/src/routes/man_pages.jsx @@ -56,7 +56,7 @@ export const ManPages = () => { <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>Arrow keys / hjkl keybinds to move around the board.</li> <li> Select a piece with "enter", and move it to a square by pressing "enter" again. diff --git a/lib/chessh/discord/notifier.ex b/lib/chessh/discord/notifier.ex index c15febe..20a99ec 100644 --- a/lib/chessh/discord/notifier.ex +++ b/lib/chessh/discord/notifier.ex @@ -21,13 +21,15 @@ defmodule Chessh.DiscordNotifier do @impl true def handle_info({:attempt_notification, notification} = body, state) do - [discord_notification_rate, discord_notification_rate_ms] = + [discord_notification_rate, discord_notification_rate_ms, reschedule_delay] = Application.get_env(:chessh, RateLimits) - |> Keyword.take([:discord_notification_rate, :discord_notification_rate_ms]) + |> Keyword.take([ + :discord_notification_rate, + :discord_notification_rate_ms, + :reschedule_delay + ]) |> Keyword.values() - reschedule_delay = Application.get_env(:chessh, RateLimits)[:reschedule_delay] - case Hammer.check_rate_inc( :redis, "discord-rate", |