PDF rendering for page 2 is fixed
This commit is contained in:
@@ -30,6 +30,11 @@
|
||||
* verbessere Versionserstellung
|
||||
* Waffenfertigkeiten haben keine Bonuseigenschaft.
|
||||
* waffenfertigkeiten müssen in andere Katagorien eingeteilt werden. Nahkampf, Schusswaffen, Verteidigungswaffen etc.
|
||||
* ersetzen:
|
||||
if dbURL == "" {
|
||||
dbURL = "bamort:bG4)efozrc@tcp(192.168.0.5:3306)/bamort?charset=utf8mb4&parseTime=True&loc=Local"
|
||||
* fehlgeschlagene Tests ausbessern
|
||||
./backend$ go test ./... -v 2>&1 |grep FAIL
|
||||
|
||||
## Refaktor
|
||||
|
||||
|
||||
@@ -1,57 +0,0 @@
|
||||
# Bamort Server Konfiguration
|
||||
|
||||
# ======================
|
||||
# Server Einstellungen
|
||||
# ======================
|
||||
PORT=8180
|
||||
SERVER_PORT=8180
|
||||
|
||||
# ======================
|
||||
# Umgebung
|
||||
# ======================
|
||||
# Optionen: development, production, test
|
||||
ENVIRONMENT=development
|
||||
# Alternative:
|
||||
# GO_ENV=development
|
||||
|
||||
# ======================
|
||||
# Logging Konfiguration
|
||||
# ======================
|
||||
# Debug-Modus (true/false oder 1/0)
|
||||
DEBUG=true
|
||||
|
||||
# Log-Level (DEBUG, INFO, WARN, ERROR)
|
||||
LOG_LEVEL=DEBUG
|
||||
|
||||
# ======================
|
||||
# Datenbank Konfiguration
|
||||
# ======================
|
||||
# Unterstützte Typen: mysql, sqlite
|
||||
DATABASE_TYPE=mysql
|
||||
# Beispiel-URLs für verschiedene Datenbank-Typen:
|
||||
# MySQL: DATABASE_URL=user:password@tcp(localhost:3306)/database?charset=utf8mb4&parseTime=True&loc=Local
|
||||
# PostgreSQL: DATABASE_URL=postgresql://user:password@localhost:5432/database
|
||||
# SQLite: DATABASE_URL=./database.db
|
||||
DATABASE_URL=
|
||||
|
||||
# ======================
|
||||
# Beispiel-Konfigurationen
|
||||
# ======================
|
||||
|
||||
# Development:
|
||||
# ENVIRONMENT=development
|
||||
# DEBUG=true
|
||||
# LOG_LEVEL=DEBUG
|
||||
# PORT=8180
|
||||
|
||||
# Production:
|
||||
# ENVIRONMENT=production
|
||||
# DEBUG=false
|
||||
# LOG_LEVEL=INFO
|
||||
# PORT=8180
|
||||
|
||||
# Testing:
|
||||
# ENVIRONMENT=test
|
||||
# DEBUG=true
|
||||
# LOG_LEVEL=WARN
|
||||
# PORT=8181
|
||||
@@ -1,28 +0,0 @@
|
||||
# Bamort Server Konfiguration - Produktionsumgebung
|
||||
# Diese Datei sollte für die Produktionsumgebung verwendet werden
|
||||
|
||||
# ======================
|
||||
# Server Einstellungen
|
||||
# ======================
|
||||
PORT=8180
|
||||
|
||||
# ======================
|
||||
# Umgebung
|
||||
# ======================
|
||||
ENVIRONMENT=production
|
||||
|
||||
# ======================
|
||||
# Logging Konfiguration
|
||||
# ======================
|
||||
# Debug-Modus (deaktiviert für Produktion)
|
||||
DEBUG=false
|
||||
|
||||
# Log-Level (nur wichtige Nachrichten in Produktion)
|
||||
LOG_LEVEL=INFO
|
||||
|
||||
# ======================
|
||||
# Datenbank Konfiguration
|
||||
# ======================
|
||||
# Unterstützte Typen: mysql, sqlite
|
||||
DATABASE_TYPE=mysql
|
||||
# DATABASE_URL=user:password@tcp(prod-host:3306)/bamort_prod?charset=utf8mb4&parseTime=True&loc=Local
|
||||
@@ -1,6 +1,7 @@
|
||||
package pdfrender
|
||||
|
||||
import (
|
||||
"bamort/config"
|
||||
"fmt"
|
||||
"os"
|
||||
)
|
||||
@@ -91,7 +92,9 @@ func LoadTemplateSetFromFiles(templateDir string) (TemplateSet, error) {
|
||||
// Now loads from actual template files instead of hardcoded values
|
||||
func DefaultA4QuerTemplateSet() TemplateSet {
|
||||
// Try to load from files
|
||||
templateSet, err := LoadTemplateSetFromFiles("backend/templates/Default_A4_Quer")
|
||||
cfg := config.Cfg
|
||||
templateDir := cfg.TemplatesDir + "/Default_A4_Quer"
|
||||
templateSet, err := LoadTemplateSetFromFiles(templateDir)
|
||||
if err != nil {
|
||||
// Fallback to relative path from test directory
|
||||
templateSet, err = LoadTemplateSetFromFiles("../templates/Default_A4_Quer")
|
||||
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
#!/bin/bash
|
||||
# check_chrome.sh - Verify Chrome/Chromium is available for PDF export
|
||||
|
||||
echo "=== Chrome/Chromium Availability Check ==="
|
||||
echo ""
|
||||
|
||||
# Check for Chrome in common locations
|
||||
CHROME_PATHS=(
|
||||
"/usr/bin/google-chrome"
|
||||
"/usr/bin/google-chrome-stable"
|
||||
"/usr/bin/chromium"
|
||||
"/usr/bin/chromium-browser"
|
||||
"/Applications/Google Chrome.app/Contents/MacOS/Google Chrome"
|
||||
"/snap/bin/chromium"
|
||||
)
|
||||
|
||||
FOUND=false
|
||||
|
||||
for path in "${CHROME_PATHS[@]}"; do
|
||||
if [ -x "$path" ]; then
|
||||
echo "✓ Found Chrome at: $path"
|
||||
VERSION=$("$path" --version 2>/dev/null || echo "Unknown")
|
||||
echo " Version: $VERSION"
|
||||
FOUND=true
|
||||
|
||||
# Suggest setting CHROME_BIN if not already set
|
||||
if [ -z "$CHROME_BIN" ]; then
|
||||
echo " Suggestion: export CHROME_BIN=\"$path\""
|
||||
fi
|
||||
echo ""
|
||||
fi
|
||||
done
|
||||
|
||||
# Check PATH
|
||||
echo "Checking PATH for chrome/chromium..."
|
||||
if command -v google-chrome &> /dev/null; then
|
||||
echo "✓ 'google-chrome' found in PATH"
|
||||
google-chrome --version
|
||||
FOUND=true
|
||||
elif command -v chromium-browser &> /dev/null; then
|
||||
echo "✓ 'chromium-browser' found in PATH"
|
||||
chromium-browser --version
|
||||
FOUND=true
|
||||
elif command -v chromium &> /dev/null; then
|
||||
echo "✓ 'chromium' found in PATH"
|
||||
chromium --version
|
||||
FOUND=true
|
||||
else
|
||||
echo "✗ No chrome/chromium found in PATH"
|
||||
fi
|
||||
|
||||
echo ""
|
||||
echo "Current CHROME_BIN: ${CHROME_BIN:-not set}"
|
||||
echo ""
|
||||
|
||||
if [ "$FOUND" = true ]; then
|
||||
echo "✓ Chrome/Chromium is available - PDF export should work"
|
||||
exit 0
|
||||
else
|
||||
echo "✗ Chrome/Chromium NOT found - PDF export will FAIL"
|
||||
echo ""
|
||||
echo "Please install Chrome or Chromium:"
|
||||
echo " Debian/Ubuntu: sudo apt-get install chromium-browser"
|
||||
echo " Alpine: apk add chromium"
|
||||
echo " macOS: brew install --cask google-chrome"
|
||||
echo ""
|
||||
echo "Or set CHROME_BIN to point to your Chrome installation"
|
||||
exit 1
|
||||
fi
|
||||
@@ -0,0 +1,33 @@
|
||||
#!/bin/bash
|
||||
# Test PDF export via running server
|
||||
|
||||
echo "Testing PDF export with go run..."
|
||||
echo ""
|
||||
|
||||
# Start the server in background
|
||||
cd /data/dev/bamort/backend
|
||||
/usr/local/go/bin/go run ./cmd/main.go &
|
||||
SERVER_PID=$!
|
||||
|
||||
echo "Server started with PID: $SERVER_PID"
|
||||
echo "Waiting for server to start..."
|
||||
sleep 5
|
||||
|
||||
# Check if server is running
|
||||
if ! kill -0 $SERVER_PID 2>/dev/null; then
|
||||
echo "✗ Server failed to start"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Server is running, testing PDF export..."
|
||||
|
||||
# Get auth token (you'll need to implement this based on your auth)
|
||||
# For now, just try to access the endpoint
|
||||
curl -s "http://localhost:8180/api/pdf/templates" || echo "Server not responding yet..."
|
||||
|
||||
echo ""
|
||||
echo "Press Ctrl+C to stop the server (PID: $SERVER_PID)"
|
||||
echo "Then manually test: curl -H 'Authorization: Bearer YOUR_TOKEN' 'http://localhost:8180/api/pdf/export/18?template=Default_A4_Quer'"
|
||||
|
||||
# Wait for user interrupt
|
||||
wait $SERVER_PID
|
||||
Executable
+29
@@ -0,0 +1,29 @@
|
||||
# Environment variables for Bamort development environment
|
||||
|
||||
# API Configuration
|
||||
# API_URL=http://localhost:8180
|
||||
|
||||
# Database Configuration (for development)
|
||||
DATABASE_TYPE=mysql
|
||||
DATABASE_URL="bamort:bG4)efozrc@tcp(mariadb-dev:3306)/bamort?charset=utf8mb4&parseTime=True&loc=Local"
|
||||
|
||||
# MariaDB Configuration (development)
|
||||
MARIADB_ROOT_PASSWORD=root_password_dev
|
||||
MARIADB_PASSWORD="bG4)efozrc"
|
||||
MARIADB_DATABASE=bamort
|
||||
MARIADB_USER=bamort
|
||||
|
||||
# Frontend Configuration
|
||||
API_URL="http://192.168.0.36:8180"
|
||||
VITE_API_URL="http://192.168.0.36:8180"
|
||||
API_PORT=8180
|
||||
BASE_URL="http://localhost:5173"
|
||||
TEMPLATES_DIR=./templates
|
||||
EXPORT_TEMP_DIR=./export_temp
|
||||
GIT_COMMIT=d0c177b
|
||||
LOG_LEVEL=debug
|
||||
COMPOSE_PROJECT_NAME=bamort
|
||||
CHROME_BIN="/usr/bin/chromium"
|
||||
|
||||
#./server
|
||||
/usr/local/go/bin/go run ./cmd/main.go
|
||||
Reference in New Issue
Block a user