Compare commits
3 Commits
v1.1.0
...
7f5991f60d
| Author | SHA1 | Date | |
|---|---|---|---|
| 7f5991f60d | |||
|
|
5e4950563c | ||
| 091e985ff2 |
@@ -2,8 +2,9 @@
|
||||
import os
|
||||
|
||||
def create_default_user(db, User, bcrypt):
|
||||
username = os.getenv('DEFAULT_USER', 'admin')
|
||||
password = os.getenv('DEFAULT_PASSWORD', '1234')
|
||||
# Use ADMIN_USER and ADMIN_PASSWORD to match docker-compose environment variables
|
||||
username = os.getenv('ADMIN_USER', os.getenv('DEFAULT_USER', 'admin'))
|
||||
password = os.getenv('ADMIN_PASSWORD', os.getenv('DEFAULT_PASSWORD', '1234'))
|
||||
hashed_password = bcrypt.generate_password_hash(password).decode('utf-8')
|
||||
existing_user = User.query.filter_by(username=username).first()
|
||||
if not existing_user:
|
||||
|
||||
BIN
app/static/uploads/Castle_192452700-CSL._V392937836_RI_.jpg
Normal file
BIN
app/static/uploads/Castle_192452700-CSL._V392937836_RI_.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 331 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 432 KiB |
Binary file not shown.
@@ -131,14 +131,14 @@
|
||||
<div class="flex-grow-1">
|
||||
<p class="mb-0"><strong>Media Name:</strong> {{ media.file_name }}</p>
|
||||
</div>
|
||||
<form action="{{ url_for('edit_group_media', group_id=group.id, content_id=media.id) }}" method="post" class="d-flex align-items-center">
|
||||
<form action="{{ url_for('edit_group_media_route', group_id=group.id, content_id=media.id) }}" method="post" class="d-flex align-items-center">
|
||||
<div class="input-group me-2">
|
||||
<span class="input-group-text">seconds</span>
|
||||
<input type="number" class="form-control {{ 'dark-mode' if theme == 'dark' else '' }}" name="duration" value="{{ media.duration }}" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-warning me-2">Edit</button>
|
||||
</form>
|
||||
<form action="{{ url_for('delete_group_media', group_id=group.id, content_id=media.id) }}" method="post" style="display:inline;">
|
||||
<form action="{{ url_for('delete_group_media_route', group_id=group.id, content_id=media.id) }}" method="post" style="display:inline;">
|
||||
<button type="submit" class="btn btn-danger" onclick="return confirm('Are you sure you want to delete this media?');">Delete</button>
|
||||
</form>
|
||||
</li>
|
||||
|
||||
@@ -12,10 +12,10 @@ def add_image_to_playlist(app, file, filename, duration, target_type, target_id)
|
||||
"""
|
||||
Save the image file and add it to the playlist database.
|
||||
"""
|
||||
# Ensure we use absolute path for upload folder
|
||||
# Use simple path resolution for containerized environment
|
||||
upload_folder = app.config['UPLOAD_FOLDER']
|
||||
if not os.path.isabs(upload_folder):
|
||||
upload_folder = os.path.abspath(upload_folder)
|
||||
# In container, working directory is /app, so static/uploads resolves correctly
|
||||
print(f"Upload folder config: {upload_folder}")
|
||||
|
||||
# Ensure upload folder exists
|
||||
if not os.path.exists(upload_folder):
|
||||
@@ -55,10 +55,12 @@ def convert_video(input_file, output_folder):
|
||||
"""
|
||||
Converts a video file to MP4 format with H.264 codec.
|
||||
"""
|
||||
# Ensure we use absolute path for output folder
|
||||
# Use simple path resolution for containerized environment
|
||||
if not os.path.isabs(output_folder):
|
||||
output_folder = os.path.abspath(output_folder)
|
||||
print(f"Converted output folder to absolute path: {output_folder}")
|
||||
# In container, relative paths work from /app directory
|
||||
print(f"Using relative path: {output_folder}")
|
||||
else:
|
||||
print(f"Using absolute path: {output_folder}")
|
||||
|
||||
if not os.path.exists(output_folder):
|
||||
os.makedirs(output_folder, exist_ok=True)
|
||||
@@ -98,11 +100,9 @@ def convert_video_and_update_playlist(app, file_path, original_filename, target_
|
||||
"""
|
||||
print(f"Starting video conversion for: {file_path}")
|
||||
|
||||
# Ensure we use absolute path for upload folder
|
||||
# Use simple path resolution for containerized environment
|
||||
upload_folder = app.config['UPLOAD_FOLDER']
|
||||
if not os.path.isabs(upload_folder):
|
||||
upload_folder = os.path.abspath(upload_folder)
|
||||
print(f"Converted upload folder to absolute path: {upload_folder}")
|
||||
print(f"Upload folder: {upload_folder}")
|
||||
|
||||
converted_file = convert_video(file_path, upload_folder)
|
||||
if converted_file:
|
||||
@@ -140,25 +140,7 @@ def convert_pdf_to_images(pdf_file, output_folder, delete_pdf=True, dpi=300):
|
||||
Uses standard 300 DPI for reliable conversion.
|
||||
"""
|
||||
print(f"Converting PDF to JPG images: {pdf_file} at {dpi} DPI")
|
||||
print(f"Original output folder: {output_folder}")
|
||||
|
||||
# Force absolute path resolution to ensure we use the app directory
|
||||
if not os.path.isabs(output_folder):
|
||||
# If relative path, resolve from the current working directory
|
||||
output_folder = os.path.abspath(output_folder)
|
||||
print(f"Converted relative path to absolute: {output_folder}")
|
||||
else:
|
||||
print(f"Using provided absolute path: {output_folder}")
|
||||
|
||||
# Ensure we're using the app static folder, not workspace root
|
||||
if output_folder.endswith('static/uploads'):
|
||||
# Check if we're accidentally using workspace root instead of app folder
|
||||
expected_app_path = '/opt/digiserver/app/static/uploads'
|
||||
if output_folder != expected_app_path:
|
||||
print(f"WARNING: Correcting path from {output_folder} to {expected_app_path}")
|
||||
output_folder = expected_app_path
|
||||
|
||||
print(f"Final output folder: {output_folder}")
|
||||
print(f"Output folder: {output_folder}")
|
||||
|
||||
try:
|
||||
# Ensure output folder exists
|
||||
@@ -266,11 +248,6 @@ def process_pdf(input_file, output_folder, duration, target_type, target_id):
|
||||
print(f"Processing PDF file: {input_file}")
|
||||
print(f"Output folder: {output_folder}")
|
||||
|
||||
# Ensure we have absolute path for output folder
|
||||
if not os.path.isabs(output_folder):
|
||||
output_folder = os.path.abspath(output_folder)
|
||||
print(f"Converted output folder to absolute path: {output_folder}")
|
||||
|
||||
# Ensure output folder exists
|
||||
if not os.path.exists(output_folder):
|
||||
os.makedirs(output_folder, exist_ok=True)
|
||||
@@ -306,11 +283,6 @@ def process_pptx(input_file, output_folder, duration, target_type, target_id):
|
||||
print(f"Processing PPTX file using PDF workflow: {input_file}")
|
||||
print(f"Output folder: {output_folder}")
|
||||
|
||||
# Ensure we have absolute path for output folder
|
||||
if not os.path.isabs(output_folder):
|
||||
output_folder = os.path.abspath(output_folder)
|
||||
print(f"Converted output folder to absolute path: {output_folder}")
|
||||
|
||||
# Ensure output folder exists
|
||||
if not os.path.exists(output_folder):
|
||||
os.makedirs(output_folder, exist_ok=True)
|
||||
@@ -377,10 +349,9 @@ def process_uploaded_files(app, files, media_type, duration, target_type, target
|
||||
# Generate a secure filename and save the file
|
||||
filename = secure_filename(file.filename)
|
||||
|
||||
# Ensure we use absolute path for upload folder
|
||||
# Use simple path resolution for containerized environment
|
||||
upload_folder = app.config['UPLOAD_FOLDER']
|
||||
if not os.path.isabs(upload_folder):
|
||||
upload_folder = os.path.abspath(upload_folder)
|
||||
print(f"Upload folder: {upload_folder}")
|
||||
|
||||
# Ensure upload folder exists
|
||||
if not os.path.exists(upload_folder):
|
||||
|
||||
@@ -8,18 +8,16 @@ services:
|
||||
image: digiserver:latest
|
||||
container_name: digiserver
|
||||
ports:
|
||||
- "8880:5000"
|
||||
- "80:5000"
|
||||
environment:
|
||||
- FLASK_APP=app.py
|
||||
- FLASK_RUN_HOST=0.0.0.0
|
||||
- DEFAULT_USER=admin
|
||||
- DEFAULT_PASSWORD=Initial01!
|
||||
- ADMIN_USER=admin
|
||||
- ADMIN_PASSWORD=Initial01!
|
||||
- SECRET_KEY=Ma_Duc_Dupa_Merele_Lui_Ana
|
||||
volumes:
|
||||
# Persistent data volumes
|
||||
- ./data/instance:/app/instance
|
||||
- ./data/uploads:/app/static/uploads
|
||||
- ./data/resurse:/app/static/resurse
|
||||
# Bind mount the app folder for easier development and debugging
|
||||
- ./app:/app
|
||||
restart: unless-stopped
|
||||
healthcheck:
|
||||
test: ["CMD", "curl", "-f", "http://localhost:5000/"]
|
||||
|
||||
Reference in New Issue
Block a user