From 8f8d41413ff775b6d721059783a0e2de4f90f50c Mon Sep 17 00:00:00 2001 From: Bobby Date: Sat, 7 Mar 2026 15:09:42 +0530 Subject: feat: add configuration management and server setup - Implemented configuration file creation and loading in config.go. - Added default configuration content embedded in embed.go. - Introduced logging middleware for HTTP requests. - Created Makefile for build and setup automation. - Integrated Tailwind CSS and HTMX for frontend styling and interactivity. - Developed basic authentication flow with login and dashboard pages. - Enhanced error handling and user feedback in templates. - Updated dependencies in go.mod and go.sum. --- scripts/htmx.setup.sh | 32 +++++++++++++++++++ scripts/tailwind.setup.sh | 78 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 110 insertions(+) create mode 100644 scripts/htmx.setup.sh create mode 100644 scripts/tailwind.setup.sh (limited to 'scripts') diff --git a/scripts/htmx.setup.sh b/scripts/htmx.setup.sh new file mode 100644 index 0000000..b8d6fe6 --- /dev/null +++ b/scripts/htmx.setup.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash +set -e + +STATIC_JS_DIR="static/js" +HTMX_FILE="$STATIC_JS_DIR/htmx.min.js" + +echo "Fetching latest HTMX release..." +LATEST_RELEASE=$(curl -s https://api.github.com/repos/bigskysoftware/htmx/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/') + +if [ -z "$LATEST_RELEASE" ]; then + echo "Failed to fetch latest release, using default version 2.0.8." + LATEST_RELEASE="2.0.8" +fi + +echo "Latest version: $LATEST_RELEASE" +DOWNLOAD_URL="https://unpkg.com/htmx.org@${LATEST_RELEASE}/dist/htmx.min.js" + +echo "Downloading from: $DOWNLOAD_URL" +echo "" + +mkdir -p "$STATIC_JS_DIR" + +if curl -fSL "$DOWNLOAD_URL" -o "$HTMX_FILE"; then + echo "" + echo "HTMX installed successfully!" + echo "Location: $HTMX_FILE" + echo "Version: $LATEST_RELEASE" +else + echo "" + echo "Failed to download HTMX." + exit 1 +fi diff --git a/scripts/tailwind.setup.sh b/scripts/tailwind.setup.sh new file mode 100644 index 0000000..c77f615 --- /dev/null +++ b/scripts/tailwind.setup.sh @@ -0,0 +1,78 @@ +#!/usr/bin/env bash +set -e + +TOOLCHAIN_DIR="toolchain" +TAILWIND_BIN="$TOOLCHAIN_DIR/tailwind" + +echo "Detecting platform..." + +OS=$(uname -s | tr '[:upper:]' '[:lower:]') +ARCH=$(uname -m) + +case "$OS" in + linux*) + PLATFORM="linux" + ;; + darwin*) + PLATFORM="macos" + ;; + msys*|mingw*|cygwin*) + PLATFORM="windows" + ;; + *) + echo "Unsupported OS: $OS" + exit 1 + ;; +esac + +case "$ARCH" in + x86_64|amd64) + ARCHITECTURE="x64" + ;; + arm64|aarch64) + ARCHITECTURE="arm64" + ;; + armv7l) + ARCHITECTURE="armv7" + ;; + *) + echo "Unsupported architecture: $ARCH" + exit 1 + ;; +esac + +BINARY_NAME="tailwindcss-${PLATFORM}-${ARCHITECTURE}" + +echo "Platform: $PLATFORM" +echo "Architecture: $ARCHITECTURE" +echo "Binary: $BINARY_NAME" +echo "" + +echo "Fetching latest Tailwind CSS release..." +LATEST_RELEASE=$(curl -s https://api.github.com/repos/tailwindlabs/tailwindcss/releases/latest | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/') + +if [ -z "$LATEST_RELEASE" ]; then + echo "Failed to fetch latest release." + exit 1 +fi + +echo "Latest version: $LATEST_RELEASE" +DOWNLOAD_URL="https://github.com/tailwindlabs/tailwindcss/releases/download/${LATEST_RELEASE}/${BINARY_NAME}" + +echo "Downloading from: $DOWNLOAD_URL" +echo "" + +mkdir -p "$TOOLCHAIN_DIR" + +if curl -fSL "$DOWNLOAD_URL" -o "$TAILWIND_BIN"; then + chmod +x "$TAILWIND_BIN" + echo "" + echo "Tailwind CSS installed successfully!" + echo "Location: $TAILWIND_BIN" + echo "Version: $LATEST_RELEASE" +else + echo "" + echo "Failed to download Tailwind CSS binary." + echo "URL: $DOWNLOAD_URL" + exit 1 +fi -- cgit v1.2.3