4.0.1 - fixes
This commit is contained in:
@@ -1,8 +1,17 @@
|
||||
ARG APP_VERSION=4.0.1
|
||||
|
||||
FROM python:3.12-slim
|
||||
ARG APP_VERSION
|
||||
|
||||
WORKDIR /app
|
||||
ENV APP_VERSION=${APP_VERSION}
|
||||
ENV TZ=Pacific/Auckland
|
||||
LABEL org.opencontainers.image.version="${APP_VERSION}"
|
||||
|
||||
COPY requirements.txt .
|
||||
RUN apt-get update \
|
||||
&& apt-get install -y --no-install-recommends tzdata \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
RUN pip install --no-cache-dir -r requirements.txt
|
||||
|
||||
COPY main.py .
|
||||
|
||||
Binary file not shown.
+34
-3
@@ -25,7 +25,7 @@ def _setup_logging() -> logging.Logger:
|
||||
|
||||
fmt = logging.Formatter(
|
||||
"%(asctime)s %(levelname)-8s %(name)s: %(message)s",
|
||||
datefmt="%Y-%m-%d %H:%M:%S",
|
||||
datefmt="%d/%m/%Y %H:%M:%S %Z",
|
||||
)
|
||||
|
||||
root = logging.getLogger()
|
||||
@@ -100,6 +100,7 @@ def _load_config() -> dict:
|
||||
|
||||
|
||||
_config = _load_config()
|
||||
APP_VERSION = os.environ.get("APP_VERSION", "unknown")
|
||||
resend.api_key = _config["resend_api_key"]
|
||||
OWNER_EMAIL = _config["owner_email"]
|
||||
FROM_EMAIL = _config["from_email"]
|
||||
@@ -115,7 +116,9 @@ RATE_LIMIT_MIN_INTERVAL_SECONDS = _config["rate_limit_min_interval_seconds"]
|
||||
LOGO_URL = "https://www.goodwalk.co.nz/images/goodwalk-auckland-dog-walking-logo.png"
|
||||
|
||||
logger.info(
|
||||
"Mail API config: from=%r reply_to=%r owner=%r max_attempts=%d form_min=%ss form_max=%ss rate_window=%ss per_ip=%d per_email=%d min_interval=%ss",
|
||||
"Mail API config: version=%r timezone=%r from=%r reply_to=%r owner=%r max_attempts=%d form_min=%ss form_max=%ss rate_window=%ss per_ip=%d per_email=%d min_interval=%ss",
|
||||
APP_VERSION,
|
||||
os.environ.get("TZ", "system-default"),
|
||||
FROM_EMAIL,
|
||||
REPLY_TO,
|
||||
OWNER_EMAIL,
|
||||
@@ -471,6 +474,7 @@ def owner_email(data: BookingSubmission, ip: str, browser: str) -> str:
|
||||
services_text = ", ".join(data.services) if data.services else "—"
|
||||
now = datetime.now()
|
||||
submitted_at = now.strftime("%d %b %Y at %I:%M %p").lstrip("0")
|
||||
first_name = data.fullName.split()[0] if data.fullName.strip() else "them"
|
||||
|
||||
message_block = f"""
|
||||
<tr>
|
||||
@@ -522,6 +526,33 @@ def owner_email(data: BookingSubmission, ip: str, browser: str) -> str:
|
||||
<tr>
|
||||
<td style="background:#ffffff;padding:40px 48px 36px;">
|
||||
|
||||
<!-- Quick contact -->
|
||||
<table width="100%" cellpadding="0" cellspacing="0" role="presentation"
|
||||
style="background:#213021;border-radius:12px;margin-bottom:28px;">
|
||||
<tr>
|
||||
<td style="padding:22px 24px;">
|
||||
<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
|
||||
font-size:11px;font-weight:700;letter-spacing:0.1em;color:#7aaa7a;
|
||||
text-transform:uppercase;margin-bottom:10px;">
|
||||
Quick contact
|
||||
</div>
|
||||
<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
|
||||
font-size:14px;color:#d8e6d8;line-height:1.6;margin-bottom:10px;">
|
||||
Email {first_name} directly:
|
||||
</div>
|
||||
<div style="font-family:Menlo,Consolas,'SFMono-Regular',monospace;
|
||||
font-size:20px;font-weight:700;color:#ffffff;line-height:1.4;
|
||||
word-break:break-all;margin-bottom:12px;">
|
||||
{data.email}
|
||||
</div>
|
||||
<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
|
||||
font-size:12px;color:#b7cbb7;line-height:1.6;">
|
||||
Tap and hold the address to copy on iPhone, or tap below to open a new email.
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<!-- Owner details -->
|
||||
<div style="font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
|
||||
font-size:11px;font-weight:700;letter-spacing:0.1em;color:#888;
|
||||
@@ -612,7 +643,7 @@ def owner_email(data: BookingSubmission, ip: str, browser: str) -> str:
|
||||
font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',sans-serif;
|
||||
font-size:14px;font-weight:600;text-decoration:none;
|
||||
border-radius:8px;padding:12px 24px;">
|
||||
Reply to {data.fullName.split()[0]}
|
||||
Email {first_name}
|
||||
</a>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
Reference in New Issue
Block a user