s365b.core.branding¶
Branding: product name, colours, logo and sign-in text.
Branding applies to the web UI (including the sign-in page, so it is readable without signing in), notification emails and exports. Defaults give the stock Mail Safehouse look.
Images are stored in the asset table rather than on disk, so every API
replica serves the same files and the containers can keep a read-only
filesystem.
Attributes¶
Exceptions¶
Raised for an invalid branding image. |
Classes¶
Branding settings. |
Functions¶
|
Validate an uploaded image and return its content type. |
|
Validate and store a branding image. |
Module Contents¶
- exception s365b.core.branding.BrandingError[source]¶
Bases:
ValueErrorRaised for an invalid branding image.
- class s365b.core.branding.Branding[source]¶
Bases:
s365b.core.settings_store.SettingsGroupBranding settings.
- Variables:
product_name – Name shown in the header, page titles and emails.
tagline – Short line under the name on the sign-in page.
primary_color – Main colour (buttons, links, focus),
#rrggbb.accent_color – Secondary colour (highlights, charts),
#rrggbb.default_theme – Theme for users who have not chosen one.
default_language – Language for users who have not chosen one:
autofollows the browser. Web UI only: emails are in English.login_message – Text on the sign-in page, e.g. an acceptable-use notice.
support_email – Contact shown in the UI footer and emails.
support_url – Link shown in the UI footer and emails.
email_footer – Plain text appended to every notification email.
- s365b.core.branding.sniff_image(data: bytes) str[source]¶
Validate an uploaded image and return its content type.
Accepts PNG, JPEG, WebP, ICO and SVG up to 512 KiB. SVG files must not contain scripts, event handlers or external references; they are also served with a sandboxing Content-Security-Policy.
- Parameters:
data – Uploaded bytes.
- Returns:
The detected content type.
- Raises:
BrandingError – If the file is too large, not an accepted type, or an unsafe SVG.
- async s365b.core.branding.save_asset(session: sqlalchemy.ext.asyncio.AsyncSession, key: str, data: bytes) s365b.db.models.Asset[source]¶
Validate and store a branding image.
- Parameters:
session – Open session; the caller commits.
key – One of
ASSET_KEYS.data – Image bytes.
- Returns:
The stored asset.
- Raises:
BrandingError – If the key or image is invalid.