Skip to main content

Module branding

Module branding 

Source
Expand description

Instance branding: administrators replace the built-in logos.

Two slots exist – the wide logo (top left of the web header and the desktop title bar) and the square logo (web footer and tab icon, desktop navigation rail). Without an upload the built-in TeamCraft logos are shown.

Uploads are small images (PNG, JPEG, WebP or SVG, at most MAX_LOGO_BYTES) kept in the database, so a backup contains them. The type is decided from the content, never from the file name or the Content-Type of the upload. SVG files are shown only through <img> and are served with a sandboxing policy; files with scripts, event handlers or external references are refused.

Structs§

Branding
Which slots hold a custom logo, as the version token (first 12 hex digits of the SHA-256) used to bust caches. None = the built-in logo. Also the header texts an administrator may change.
Logo
A stored logo.

Enums§

Kind
A logo slot.

Constants§

DEFAULT_SUBTITLE
The subtitle next to the name unless an administrator changes it.
MAX_LOGO_BYTES
Largest accepted logo file.
MAX_LOGO_PIXELS
Largest side of a bitmap logo in pixels.
MAX_NAME_CHARS
Longest header name (characters).
MAX_SUBTITLE_CHARS
Longest subtitle (characters).

Functions§

current
The custom slots (one cheap query; used for every page).
get
The stored logo of a slot, if any.
reset
Back to the built-in logo of a slot (administrators). Returns whether a custom logo existed.
set
Replaces the logo of a slot (administrators).
set_names
Sets the header name and subtitle (administrators). An empty display name restores the default name; a subtitle equal to DEFAULT_SUBTITLE restores the default subtitle; an empty subtitle shows none.
validate
Checks an upload and returns its content type.
validate_names
Validates the display name (empty after trimming = back to the default) and the subtitle (empty = none). Pure.