From 790317428c28824f49c37c6a17a5e75d23b5d7bc Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Thu, 3 Feb 2022 16:06:41 -0800 Subject: [PATCH] Added a couple helper admin scrtipt Signed-off-by: James Ketrenos --- server/roll | 22 ++++++++++++++++++++++ server/state | 22 ++++++++++++++++++++++ 2 files changed, 44 insertions(+) create mode 100755 server/roll create mode 100755 server/state diff --git a/server/roll b/server/roll new file mode 100755 index 0000000..4748466 --- /dev/null +++ b/server/roll @@ -0,0 +1,22 @@ +#!/bin/bash +ADMIN=$(jq -r .admin config/local.json) +if [[ "${ADMIN}" == "" ]]; then + echo "You need to set your { 'admin': 'secret' } in config/local.json" + exit 1 +fi + +id=$1 +color=$2 + +if [[ "${id}" == "" ]] || [[ "${color}" == "" ]]; then + echo "Usage: roll GAME-ID (red|white|blue|orange)-DICE" + exit 1 +fi + +curl --noproxy '*' -s -L \ + --request PUT \ + --header "PRIVATE-TOKEN: ${ADMIN}" \ + --header "Content-Type: application/json" \ + http://localhost:8930/ketr.ketran/api/v1/games/${id}/roll/${color} | + jq -r .status + diff --git a/server/state b/server/state new file mode 100755 index 0000000..8d6787f --- /dev/null +++ b/server/state @@ -0,0 +1,22 @@ +#!/bin/bash +ADMIN=$(jq -r .admin config/local.json) +if [[ "${ADMIN}" == "" ]]; then + echo "You need to set your { 'admin': 'secret' } in config/local.json" + exit 1 +fi + +id=$1 +state=$2 + +if [[ "${id}" == "" ]] || [[ "${state}" == "" ]]; then + echo "Usage: roll GAME-ID game-order" + exit 1 +fi + +curl --noproxy '*' -s -L \ + --request PUT \ + --header "PRIVATE-TOKEN: ${ADMIN}" \ + --header "Content-Type: application/json" \ + http://localhost:8930/ketr.ketran/api/v1/games/${id}/state/${state} | + jq -r .status +