creaded correct docker image creation file

This commit is contained in:
DigiServer Developer
2025-11-17 22:03:52 +02:00
parent 2db0033bc0
commit c16383ed75
16 changed files with 1025 additions and 33 deletions

View File

@@ -516,3 +516,100 @@ def delete_single_leftover(content_id):
flash(f'Error deleting file: {str(e)}', 'danger')
return redirect(url_for('admin.leftover_media'))
@admin_bp.route('/dependencies')
@login_required
@admin_required
def dependencies():
"""Show system dependencies status."""
import subprocess
# Check LibreOffice
libreoffice_installed = False
libreoffice_version = "Not installed"
try:
result = subprocess.run(['libreoffice', '--version'],
capture_output=True,
text=True,
timeout=5)
if result.returncode == 0:
libreoffice_installed = True
libreoffice_version = result.stdout.strip()
except Exception:
pass
# Check Poppler (for PDF)
poppler_installed = False
poppler_version = "Not installed"
try:
result = subprocess.run(['pdftoppm', '-v'],
capture_output=True,
text=True,
timeout=5)
if result.returncode == 0 or 'pdftoppm' in result.stderr:
poppler_installed = True
poppler_version = "Installed"
except Exception:
pass
# Check FFmpeg (for video)
ffmpeg_installed = False
ffmpeg_version = "Not installed"
try:
result = subprocess.run(['ffmpeg', '-version'],
capture_output=True,
text=True,
timeout=5)
if result.returncode == 0:
ffmpeg_installed = True
ffmpeg_version = result.stdout.split('\n')[0]
except Exception:
pass
return render_template('admin/dependencies.html',
libreoffice_installed=libreoffice_installed,
libreoffice_version=libreoffice_version,
poppler_installed=poppler_installed,
poppler_version=poppler_version,
ffmpeg_installed=ffmpeg_installed,
ffmpeg_version=ffmpeg_version,
emoji_installed=emoji_installed,
emoji_version=emoji_version)
@admin_bp.route('/install-libreoffice', methods=['POST'])
@login_required
@admin_required
def install_libreoffice():
"""Install LibreOffice for PPTX conversion."""
import subprocess
try:
# Run installation script
script_path = os.path.join(os.path.dirname(os.path.dirname(os.path.dirname(__file__))),
'install_libreoffice.sh')
if not os.path.exists(script_path):
flash('Installation script not found', 'danger')
return redirect(url_for('admin.dependencies'))
result = subprocess.run(['sudo', 'bash', script_path],
capture_output=True,
text=True,
timeout=300)
if result.returncode == 0:
log_action('info', 'LibreOffice installed successfully')
flash('LibreOffice installed successfully! You can now convert PPTX files.', 'success')
else:
log_action('error', f'LibreOffice installation failed: {result.stderr}')
flash(f'Installation failed: {result.stderr}', 'danger')
except subprocess.TimeoutExpired:
flash('Installation timeout. Please try again.', 'warning')
except Exception as e:
log_action('error', f'Error installing LibreOffice: {str(e)}')
flash(f'Error: {str(e)}', 'danger')
return redirect(url_for('admin.dependencies'))

View File

@@ -401,8 +401,8 @@ def process_presentation_file(filepath: str, filename: str) -> tuple[bool, str]:
continue
if not libreoffice_cmd:
log_action('warning', f'LibreOffice not found, skipping slide conversion for: {filename}')
return True, "Presentation accepted without conversion (LibreOffice unavailable)"
log_action('warning', f'LibreOffice not found, cannot convert: {filename}')
return False, "LibreOffice is not installed. Please install it from the Admin Panel → System Dependencies to upload PowerPoint files."
# Create temporary directory for conversion
with tempfile.TemporaryDirectory() as temp_dir: