diff --git a/app.py b/app.py index a819dac..f72fa37 100644 --- a/app.py +++ b/app.py @@ -298,47 +298,25 @@ def send_email(to, subject, body, attachments=None, inline_images=None): server.login(cfg['SMTP_USER'], cfg['SMTP_PASS']) server.send_message(msg) - def build_signature_images(): - """ - Return inline image tuple list for the Dionysis Media logo if present. - The logo path is configurable via /admin/settings. A downscaled, compressed - email-sized JPEG copy is generated in the upload folder so attachments stay small. - :return: list of (path, cid) tuples. Empty if no logo is configured or not found. - """ + """Return inline image tuple list for the Dionysis Media logo if present.""" cfg = load_booth_settings() - logo_path = cfg.get('logo_path') or '/mnt/Storage/DM-Logo.png' + logo_path = cfg.get('logo_path') or '/mnt/Storage/DM-Logo_compress.png' logo_file = Path(logo_path) if not logo_file.exists(): return [] - # Cache a small email-friendly JPEG inside the upload folder. - cache_dir = Path(current_app.config['UPLOAD_FOLDER']) - cache_dir.mkdir(parents=True, exist_ok=True) - email_logo = cache_dir / 'dm-logo.email.jpg' - try: - from PIL import Image - with Image.open(logo_file) as im: - im.thumbnail((600, 600)) - if im.mode in ('RGBA', 'LA', 'P'): - # Composite transparent images onto a white background for JPEG. - background = Image.new('RGB', im.size, (255, 255, 255)) - if im.mode == 'P': - im = im.convert('RGBA') - background.paste(im, mask=im.split()[-1] if im.mode == 'RGBA' else None) - im = background - else: - im = im.convert('RGB') - im.save(email_logo, format='JPEG', optimize=True, quality=85) - except Exception: - # If resize fails, fall back to the original file. - return [(str(logo_file), 'dm-logo')] - return [(str(email_logo), 'dm-logo')] + return [(str(logo_file), 'dm-logo')] # --------------------------------------------------------------------------- # Public customer routes # --------------------------------------------------------------------------- +@app.route('/') +def index(): + """Root route: redirect customers straight to the request form.""" + return redirect(url_for('request_form')) + @app.route('/request', methods=['GET', 'POST']) @limiter.limit("5 per minute") @@ -712,7 +690,7 @@ def admin_settings(): 'smtp_user': runtime_settings.get('smtp_user', current_app.config['SMTP_USER']), 'smtp_from': runtime_settings.get('smtp_from', current_app.config['SMTP_FROM']), 'smtp_pass_set': bool(runtime_settings.get('smtp_pass', '')), - 'logo_path': runtime_settings.get('logo_path', '/mnt/Storage/DM-Logo.png'), + 'logo_path': runtime_settings.get('logo_path', '/mnt/Storage/DM-Logo_compress.png'), } # Compute upload folder stats. diff --git a/booth_settings.json b/booth_settings.json new file mode 100644 index 0000000..b828788 --- /dev/null +++ b/booth_settings.json @@ -0,0 +1,3 @@ +{ + "logo_path": "/mnt/Storage/DM-Logo_compress.png" +} \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index 2a411fd..5f37eae 100644 --- a/requirements.txt +++ b/requirements.txt @@ -15,4 +15,3 @@ werkzeug mutagen flask-limiter cryptography -Pillow diff --git a/templates/admin/settings.html b/templates/admin/settings.html index 5424362..ae51d1b 100644 --- a/templates/admin/settings.html +++ b/templates/admin/settings.html @@ -265,7 +265,7 @@