feat: add Settings and Setup pages for user management
- Implemented Settings page for changing user passwords with validation and feedback. - Created Setup page for initial admin account setup with form handling and navigation. - Added API service layer for handling requests related to proxy hosts, remote servers, and import functionality. - Introduced mock data for testing purposes and set up testing framework with vitest. - Configured Tailwind CSS for styling and Vite for development and build processes. - Added scripts for Dockerfile validation, Python syntax checking, and Sourcery integration. - Implemented release and coverage scripts for better CI/CD practices.
This commit is contained in:
58
tools/dockerfile_check.sh
Executable file
58
tools/dockerfile_check.sh
Executable file
@@ -0,0 +1,58 @@
|
||||
#!/usr/bin/env bash
|
||||
# Dockerfile validation script
|
||||
# Checks for common mismatches between base images and package managers
|
||||
|
||||
set -e
|
||||
|
||||
DOCKERFILE="${1:-Dockerfile}"
|
||||
|
||||
if [ ! -f "$DOCKERFILE" ]; then
|
||||
echo "Error: $DOCKERFILE not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Checking $DOCKERFILE for base image / package manager mismatches..."
|
||||
|
||||
# Read file content
|
||||
dockerfile_content=$(cat "$DOCKERFILE")
|
||||
|
||||
# Check for golang:latest or golang:1.x (Debian) with apk commands in the same stage
|
||||
while IFS= read -r line; do
|
||||
if echo "$line" | grep -qE "^FROM\s+golang:(latest|[0-9]+(\.[0-9]+)?)\s"; then
|
||||
# Found a Debian-based golang image, check the next 20 lines for apk
|
||||
current_stage="$line"
|
||||
checking_stage=true
|
||||
elif echo "$line" | grep -qE "^FROM\s+" && [ "$checking_stage" = true ]; then
|
||||
# New FROM statement, reset
|
||||
checking_stage=false
|
||||
fi
|
||||
|
||||
if [ "$checking_stage" = true ] && echo "$line" | grep -qE "RUN.*apk\s+(add|update|del)"; then
|
||||
echo "❌ ERROR: Found Debian-based golang image with Alpine package manager (apk)"
|
||||
echo " Stage: $current_stage"
|
||||
echo " Command: $line"
|
||||
echo " Fix: Use 'golang:alpine' or 'golang:1.x-alpine' instead"
|
||||
exit 1
|
||||
fi
|
||||
done < "$DOCKERFILE"
|
||||
|
||||
# Check for node:latest or node:XX (Debian) with apk commands
|
||||
if echo "$dockerfile_content" | grep -E "FROM\s+node:(latest|[0-9]+)\s" > /dev/null; then
|
||||
if echo "$dockerfile_content" | grep -A 10 "FROM\s\+node:(latest|[0-9]\+)\s" | grep -E "RUN.*apk\s+(add|update)" > /dev/null; then
|
||||
echo "❌ ERROR: Found Debian-based node image (node:latest or node:XX) with Alpine package manager (apk)"
|
||||
echo " Fix: Use 'node:alpine' or 'node:XX-alpine' instead"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check for alpine images with apt/apt-get
|
||||
if echo "$dockerfile_content" | grep -E "FROM\s+.*:.*alpine" > /dev/null; then
|
||||
if echo "$dockerfile_content" | grep -A 10 "FROM\s\+.*:.*alpine" | grep -E "RUN.*(apt-get|apt)\s+(install|update)" > /dev/null; then
|
||||
echo "❌ ERROR: Found Alpine-based image with Debian package manager (apt/apt-get)"
|
||||
echo " Fix: Use 'apk add' instead of 'apt install'"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "✓ Dockerfile validation passed"
|
||||
exit 0
|
||||
12
tools/python_compile_check.sh
Executable file
12
tools/python_compile_check.sh
Executable file
@@ -0,0 +1,12 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Run python -m compileall quietly to catch syntax errors in the repo.
|
||||
if command -v python3 &>/dev/null; then
|
||||
python3 -m compileall -q .
|
||||
elif command -v python &>/dev/null; then
|
||||
python -m compileall -q .
|
||||
else
|
||||
echo "Error: neither python3 nor python found."
|
||||
exit 1
|
||||
fi
|
||||
28
tools/sourcery_precommit_wrapper.sh
Executable file
28
tools/sourcery_precommit_wrapper.sh
Executable file
@@ -0,0 +1,28 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
# Wrapper for Sourcery pre-commit hook.
|
||||
# Run Sourcery if the CLI is available or a token is provided.
|
||||
# This supports both interactive `sourcery login` and token-based CI usage.
|
||||
|
||||
if command -v sourcery >/dev/null 2>&1; then
|
||||
exec sourcery "$@"
|
||||
fi
|
||||
|
||||
# Try python -m sourcery as a fallback
|
||||
if python -m sourcery --version >/dev/null 2>&1; then
|
||||
exec python -m sourcery "$@"
|
||||
fi
|
||||
|
||||
# If CLI not found but token env var present, try to run via 'sourcery' anyway
|
||||
if [ -n "${SOURCERY_TOKEN:-}" ] || [ -n "${SOURCERY_API_TOKEN:-}" ] || [ -n "${SOURCERY_API_KEY:-}" ]; then
|
||||
if command -v sourcery >/dev/null 2>&1; then
|
||||
exec sourcery "$@"
|
||||
fi
|
||||
if python -m sourcery --version >/dev/null 2>&1; then
|
||||
exec python -m sourcery "$@"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo "Sourcery CLI not available and no token detected; skipping sourcery pre-commit check."
|
||||
exit 0
|
||||
Reference in New Issue
Block a user