Update AppImage

This commit is contained in:
MacRimi
2025-09-29 18:16:01 +02:00
parent b4e25ae66d
commit 269828c79e
4 changed files with 25 additions and 32 deletions

View File

@@ -1,6 +1,6 @@
/** @type {import('next').NextConfig} */ /** @type {import('next').NextConfig} */
const nextConfig = { const nextConfig = {
output: 'standalone', output: 'export',
trailingSlash: true, trailingSlash: true,
eslint: { eslint: {
ignoreDuringBuilds: true, ignoreDuringBuilds: true,

View File

@@ -7,7 +7,8 @@
"dev": "next dev", "dev": "next dev",
"build": "next build", "build": "next build",
"start": "next start", "start": "next start",
"lint": "next lint" "lint": "next lint",
"export": "next build"
}, },
"dependencies": { "dependencies": {
"@hookform/resolvers": "^3.10.0", "@hookform/resolvers": "^3.10.0",

View File

@@ -48,17 +48,16 @@ if [ ! -d "node_modules" ]; then
npm install npm install
fi fi
# Build Next.js application echo "🏗️ Building Next.js static export..."
echo "🏗️ Building Next.js application..." npm run export
npm run build
# Verify build was successful # Verify export was successful
if [ ! -d ".next" ]; then if [ ! -d "out" ]; then
echo "❌ Error: Next.js build failed - .next directory not found" echo "❌ Error: Next.js export failed - out directory not found"
exit 1 exit 1
fi fi
echo "✅ Next.js build completed successfully" echo "✅ Next.js static export completed successfully"
# Return to script directory # Return to script directory
cd "$SCRIPT_DIR" cd "$SCRIPT_DIR"
@@ -193,24 +192,15 @@ chmod +x "$APP_DIR/usr/bin/translate_cli.py"
# Copy Next.js build # Copy Next.js build
echo "📋 Copying web dashboard..." echo "📋 Copying web dashboard..."
if [ -d "$APPIMAGE_ROOT/.next" ]; then if [ -d "$APPIMAGE_ROOT/out" ]; then
mkdir -p "$APP_DIR/web" mkdir -p "$APP_DIR/web"
cp -r "$APPIMAGE_ROOT/.next" "$APP_DIR/web/" cp -r "$APPIMAGE_ROOT/out" "$APP_DIR/web/"
cp -r "$APPIMAGE_ROOT/public" "$APP_DIR/web/" cp -r "$APPIMAGE_ROOT/public" "$APP_DIR/web/"
cp "$APPIMAGE_ROOT/package.json" "$APP_DIR/web/" cp "$APPIMAGE_ROOT/package.json" "$APP_DIR/web/"
# Also try to create a static export if possible echo "✅ Next.js static export copied successfully"
cd "$APPIMAGE_ROOT"
if npm run export 2>/dev/null; then
echo "✅ Next.js static export created"
if [ -d "out" ]; then
cp -r "out" "$APP_DIR/web/"
fi
fi
echo "✅ Next.js build copied successfully"
else else
echo "❌ Error: Next.js build not found even after building" echo "❌ Error: Next.js export not found even after building"
exit 1 exit 1
fi fi

View File

@@ -23,13 +23,10 @@ CORS(app) # Enable CORS for Next.js frontend
def serve_dashboard(): def serve_dashboard():
"""Serve the main dashboard page from Next.js build""" """Serve the main dashboard page from Next.js build"""
try: try:
next_dir = os.path.join(os.path.dirname(__file__), '..', 'web', '.next')
# Try to serve the Next.js built index page
index_paths = [ index_paths = [
os.path.join(next_dir, 'server', 'app', 'page.html'),
os.path.join(next_dir, 'server', 'pages', 'index.html'),
os.path.join(os.path.dirname(__file__), '..', 'web', 'out', 'index.html'), os.path.join(os.path.dirname(__file__), '..', 'web', 'out', 'index.html'),
os.path.join(os.path.dirname(__file__), '..', 'web', '.next', 'server', 'app', 'page.html'),
os.path.join(os.path.dirname(__file__), '..', 'web', '.next', 'server', 'pages', 'index.html'),
os.path.join(os.path.dirname(__file__), '..', 'web', 'dist', 'index.html') os.path.join(os.path.dirname(__file__), '..', 'web', 'dist', 'index.html')
] ]
@@ -130,9 +127,15 @@ def serve_sw():
def serve_next_static(filename): def serve_next_static(filename):
"""Serve Next.js static files""" """Serve Next.js static files"""
try: try:
next_static_dir = os.path.join(os.path.dirname(__file__), '..', 'web', '.next', 'static') static_paths = [
if os.path.exists(os.path.join(next_static_dir, filename)): os.path.join(os.path.dirname(__file__), '..', 'web', 'out', '_next'),
return send_from_directory(next_static_dir, filename) os.path.join(os.path.dirname(__file__), '..', 'web', '.next', 'static')
]
for static_dir in static_paths:
file_path = os.path.join(static_dir, filename)
if os.path.exists(file_path):
return send_file(file_path)
return '', 404 return '', 404
except Exception as e: except Exception as e:
print(f"Error serving Next.js static file {filename}: {e}") print(f"Error serving Next.js static file {filename}: {e}")
@@ -142,11 +145,10 @@ def serve_next_static(filename):
def serve_static_files(filename): def serve_static_files(filename):
"""Serve static files (icons, etc.)""" """Serve static files (icons, etc.)"""
try: try:
# Try Next.js public directory first
public_paths = [ public_paths = [
os.path.join(os.path.dirname(__file__), '..', 'web', 'out'),
os.path.join(os.path.dirname(__file__), '..', 'web', 'public'), os.path.join(os.path.dirname(__file__), '..', 'web', 'public'),
os.path.join(os.path.dirname(__file__), '..', 'public'), os.path.join(os.path.dirname(__file__), '..', 'public'),
os.path.join(os.path.dirname(__file__), '..', 'web', 'out'),
os.path.join(os.path.dirname(__file__), '..', 'web', '.next', 'static') os.path.join(os.path.dirname(__file__), '..', 'web', '.next', 'static')
] ]