You've already forked Vaultwarden
31 lines
739 B
Bash
31 lines
739 B
Bash
#!/bin/bash
|
|
|
|
|
|
###
|
|
#
|
|
# Options Section
|
|
#
|
|
###
|
|
|
|
set -e
|
|
set -u
|
|
set -o pipefail
|
|
|
|
|
|
###
|
|
#
|
|
# Runtime Environment
|
|
#
|
|
###
|
|
|
|
HEADER='/usr/lib/vaultwarden/templates/email/email_header.hbs'
|
|
IMAGE='/etc/vaultwarden/email_logo.png'
|
|
WIDTH=$(/usr/bin/exiftool -s -s -s -ImageWidth "${IMAGE}")
|
|
HEIGHT=$(/usr/bin/exiftool -s -s -s -ImageHeight "${IMAGE}")
|
|
BASE64=$(/usr/bin/base64 --wrap='0' "${IMAGE}")
|
|
BASE64="data:image/bmp;base64,${BASE64}"
|
|
/usr/bin/sed --in-place --expression="s|src=\"data:image/[^\"]*\"|src=\"${BASE64}\"|g" "${HEADER}" || true
|
|
/usr/bin/sed --in-place --expression="s|width=\"[0-9]*\"|width=\"${WIDTH}\"|g" "${HEADER}" || true
|
|
/usr/bin/sed --in-place --expression="s|height=\"[0-9]*\"|height=\"${HEIGHT}\"|g" "${HEADER}" || true
|
|
exit 0
|