mirror of
https://github.com/usmannasir/cyberpanel.git
synced 2026-02-05 22:29:05 +01:00
- Create User: Don't show 'Unknown error' on load; fix inverted success/failure logic in static/ and public/static/ userManagment.js - List Users: Use <button> for Edit/Delete/Suspend/Activate; add showModalById/ hideModalById for Bootstrap 3/5; fix public/static missing modal show calls - Modify User: Fix inverted canotModifyUser/canotFetchDetails in all three userManagment.js copies; hide modify error when only fetching details - Add deploy-createuser-fix.sh to copy fixed JS and run collectstatic on server
48 lines
2.0 KiB
Bash
Executable File
48 lines
2.0 KiB
Bash
Executable File
#!/bin/bash
|
|
# Deploy Create User page fix (userCreationFailed / "Unknown error" on load)
|
|
# Run this on the CyberPanel server (e.g. after pulling repo or copying fixed files)
|
|
# Usage: sudo bash deploy-createuser-fix.sh
|
|
|
|
set -e
|
|
|
|
CYBERCP_ROOT="${CYBERCP_ROOT:-/usr/local/CyberCP}"
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
PYTHON="${CYBERCP_ROOT}/bin/python"
|
|
if [ ! -x "$PYTHON" ]; then
|
|
PYTHON="python3"
|
|
fi
|
|
|
|
echo "[$(date +%Y-%m-%d\ %H:%M:%S)] Deploying Create User fix..."
|
|
|
|
# If running from repo (this workspace), copy fixed JS into CyberCP
|
|
if [ -f "$SCRIPT_DIR/userManagment/static/userManagment/userManagment.js" ]; then
|
|
echo " Copying userManagment.js from repo app static..."
|
|
mkdir -p "$CYBERCP_ROOT/userManagment/static/userManagment"
|
|
cp -f "$SCRIPT_DIR/userManagment/static/userManagment/userManagment.js" \
|
|
"$CYBERCP_ROOT/userManagment/static/userManagment/userManagment.js"
|
|
fi
|
|
if [ -f "$SCRIPT_DIR/static/userManagment/userManagment.js" ]; then
|
|
echo " Copying userManagment.js from repo static..."
|
|
mkdir -p "$CYBERCP_ROOT/static/userManagment"
|
|
cp -f "$SCRIPT_DIR/static/userManagment/userManagment.js" \
|
|
"$CYBERCP_ROOT/static/userManagment/userManagment.js"
|
|
fi
|
|
if [ -f "$SCRIPT_DIR/public/static/userManagment/userManagment.js" ]; then
|
|
echo " Copying userManagment.js from repo public/static..."
|
|
mkdir -p "$CYBERCP_ROOT/public/static/userManagment"
|
|
cp -f "$SCRIPT_DIR/public/static/userManagment/userManagment.js" \
|
|
"$CYBERCP_ROOT/public/static/userManagment/userManagment.js"
|
|
fi
|
|
|
|
# Run collectstatic so served static gets the fix
|
|
if [ -f "$CYBERCP_ROOT/manage.py" ]; then
|
|
echo " Running collectstatic..."
|
|
cd "$CYBERCP_ROOT"
|
|
"$PYTHON" manage.py collectstatic --noinput --clear 2>&1 | tail -5
|
|
echo " collectstatic done."
|
|
else
|
|
echo " No $CYBERCP_ROOT/manage.py found; skipping collectstatic."
|
|
fi
|
|
|
|
echo "[$(date +%Y-%m-%d\ %H:%M:%S)] Create User fix deployed. Hard-refresh browser (Ctrl+F5) on the Create User page."
|