Files
cv-app/onlyoffice-init.sh

23 lines
1.0 KiB
Bash

#!/bin/bash
# ONLYOFFICE init script - runs before the document server starts
# Hides the ONLYOFFICE logo from the editor header
patch_css() {
local CSS_FILE=$1
if [ -f "$CSS_FILE" ]; then
# Check if already patched
if ! grep -q 'display:none!important' <<< "$(grep '#header-logo{' "$CSS_FILE" | head -1)"; then
sed -i 's/#header-logo{/#header-logo{display:none!important;/g' "$CSS_FILE"
echo "[onlyoffice-init] Patched $CSS_FILE to hide logo"
fi
# Always regenerate the .gz file so nginx serves the patched version
# (nginx gzip_static serves .gz files directly, bypassing the patched .css)
gzip -kf "$CSS_FILE"
echo "[onlyoffice-init] Regenerated ${CSS_FILE}.gz"
fi
}
# Patch all editor types
patch_css /var/www/onlyoffice/documentserver/web-apps/apps/documenteditor/main/resources/css/app.css
patch_css /var/www/onlyoffice/documentserver/web-apps/apps/spreadsheeteditor/main/resources/css/app.css
patch_css /var/www/onlyoffice/documentserver/web-apps/apps/presentationeditor/main/resources/css/app.css