From f41e03a6712536b057b676c60625828e99fa4036 Mon Sep 17 00:00:00 2001 From: Jage9 Date: Wed, 25 Feb 2026 00:31:23 -0500 Subject: [PATCH] Make deploy defaults host-agnostic and support Enter auth submit --- client/public/version.js | 2 +- client/src/main.ts | 13 ++++++++ deploy/apache/chgrid-vhost-snippet.conf | 2 +- deploy/scripts/deploy_client.sh | 5 +-- deploy/scripts/install_apache.sh | 5 +-- deploy/scripts/install_server.sh | 5 +-- deploy/scripts/install_service.sh | 43 ++++++++++++++++++++----- deploy/scripts/up.sh | 5 +-- deploy/systemd/chat-grid.service | 10 ++---- 9 files changed, 64 insertions(+), 26 deletions(-) diff --git a/client/public/version.js b/client/public/version.js index 22b3f66..9910c97 100644 --- a/client/public/version.js +++ b/client/public/version.js @@ -1,5 +1,5 @@ // Maintainer-controlled web client version. // Format: YYYY.MM.DD Rn (example: 2026.02.20 R2) -window.CHGRID_WEB_VERSION = "2026.02.25 R256"; +window.CHGRID_WEB_VERSION = "2026.02.25 R257"; // Optional display timezone for timestamps. Falls back to America/Detroit if unset/invalid. window.CHGRID_TIME_ZONE = "America/Detroit"; diff --git a/client/src/main.ts b/client/src/main.ts index 330e0d4..7172e6d 100644 --- a/client/src/main.ts +++ b/client/src/main.ts @@ -2690,6 +2690,19 @@ function setupUiHandlers(): void { dom.registerEmail.addEventListener('input', () => { updateConnectAvailability(); }); + + const submitAuthOnEnter = (event: KeyboardEvent): void => { + if (event.key !== 'Enter') return; + if (dom.connectButton.disabled) return; + event.preventDefault(); + connect(); + }; + dom.authUsername.addEventListener('keydown', submitAuthOnEnter); + dom.authPassword.addEventListener('keydown', submitAuthOnEnter); + dom.registerUsername.addEventListener('keydown', submitAuthOnEnter); + dom.registerPassword.addEventListener('keydown', submitAuthOnEnter); + dom.registerPasswordConfirm.addEventListener('keydown', submitAuthOnEnter); + dom.registerEmail.addEventListener('keydown', submitAuthOnEnter); } setupInputHandlers(); diff --git a/deploy/apache/chgrid-vhost-snippet.conf b/deploy/apache/chgrid-vhost-snippet.conf index ba7680e..6b5cfa8 100644 --- a/deploy/apache/chgrid-vhost-snippet.conf +++ b/deploy/apache/chgrid-vhost-snippet.conf @@ -1,4 +1,4 @@ -# Add inside your SSL VirtualHost include for bestmidi.com. +# Add inside your SSL VirtualHost include for your domain. # Keep your existing main DocumentRoot unchanged when hosting Chat Grid under /chgrid. # Required modules: proxy, proxy_http, proxy_wstunnel # Optional but recommended modules for client update freshness: headers, setenvif diff --git a/deploy/scripts/deploy_client.sh b/deploy/scripts/deploy_client.sh index d40cc9a..8c79c0b 100755 --- a/deploy/scripts/deploy_client.sh +++ b/deploy/scripts/deploy_client.sh @@ -1,8 +1,9 @@ #!/usr/bin/env bash set -euo pipefail -REPO_ROOT="${1:-/home/bestmidi/chgrid}" -PUBLISH_DIR="${2:-/home/bestmidi/public_html/chgrid}" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="${1:-$(cd "$SCRIPT_DIR/../.." && pwd)}" +PUBLISH_DIR="${2:-$REPO_ROOT/deploy/publish/chgrid}" BASE_PATH="${3:-/chgrid/}" CLIENT_DIR="$REPO_ROOT/client" PHP_PROXY_DIR="$REPO_ROOT/deploy/php" diff --git a/deploy/scripts/install_apache.sh b/deploy/scripts/install_apache.sh index ef330ba..00b7cbd 100755 --- a/deploy/scripts/install_apache.sh +++ b/deploy/scripts/install_apache.sh @@ -1,14 +1,15 @@ #!/usr/bin/env bash set -euo pipefail -REPO_ROOT="${1:-/home/bestmidi/chgrid}" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="${1:-$(cd "$SCRIPT_DIR/../.." && pwd)}" INCLUDE_PATH="${2:-}" RESTART_CMD="${3:-/usr/local/cpanel/scripts/restartsrv_httpd}" SNIPPET_PATH="$REPO_ROOT/deploy/apache/chgrid-vhost-snippet.conf" if [[ -z "$INCLUDE_PATH" ]]; then echo "usage: $0 [restart_cmd]" >&2 - echo "example: $0 /home/bestmidi/chgrid /etc/apache2/conf.d/userdata/ssl/2_4/bestmidi/example.com/chgrid.conf" >&2 + echo "example: $0 $REPO_ROOT /etc/apache2/conf.d/userdata/ssl/2_4/account/example.com/chgrid.conf" >&2 exit 1 fi diff --git a/deploy/scripts/install_server.sh b/deploy/scripts/install_server.sh index f52e80c..1e4297e 100755 --- a/deploy/scripts/install_server.sh +++ b/deploy/scripts/install_server.sh @@ -1,7 +1,8 @@ #!/usr/bin/env bash set -euo pipefail -REPO_ROOT="${1:-/home/bestmidi/chgrid}" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="${1:-$(cd "$SCRIPT_DIR/../.." && pwd)}" SERVER_DIR="$REPO_ROOT/server" PYTHON_SPEC="${PYTHON_SPEC:-3.13}" @@ -16,7 +17,7 @@ if [[ ! -d "$SERVER_DIR" ]]; then fi if [[ ! -f "$SERVER_DIR/pyproject.toml" ]]; then echo "error: missing $SERVER_DIR/pyproject.toml" >&2 - echo " verify repository files were copied to /home/bestmidi/chgrid/server" >&2 + echo " verify repository files were copied to the expected repo directory" >&2 exit 1 fi diff --git a/deploy/scripts/install_service.sh b/deploy/scripts/install_service.sh index 3b46d53..ffa426d 100755 --- a/deploy/scripts/install_service.sh +++ b/deploy/scripts/install_service.sh @@ -1,24 +1,51 @@ #!/usr/bin/env bash set -euo pipefail -REPO_ROOT="${1:-/home/bestmidi/chgrid}" +SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +REPO_ROOT="${1:-$(cd "$SCRIPT_DIR/../.." && pwd)}" UNIT_NAME="${2:-chat-grid.service}" -SRC_UNIT="$REPO_ROOT/deploy/systemd/$UNIT_NAME" DST_UNIT="/etc/systemd/system/$UNIT_NAME" DROPIN_FILE="/etc/systemd/system/$UNIT_NAME.d/env.conf" +OWNER_USER="$(stat -c '%U' "$REPO_ROOT")" +OWNER_GROUP="$(stat -c '%G' "$REPO_ROOT")" +SERVER_DIR="$REPO_ROOT/server" +RUNTIME_DIR="$SERVER_DIR/runtime" +RUN_SERVER="$SERVER_DIR/run_server.sh" +SERVER_LOG="$RUNTIME_DIR/server.log" -if [[ ! -f "$SRC_UNIT" ]]; then - echo "error: unit file not found: $SRC_UNIT" >&2 +if [[ ! -x "$RUN_SERVER" ]]; then + echo "error: executable run script not found: $RUN_SERVER" >&2 exit 1 fi -sudo cp "$SRC_UNIT" "$DST_UNIT" +sudo tee "$DST_UNIT" >/dev/null <