fix: regenerate ONLYOFFICE app.css.gz so nginx serves patched CSS with logo hidden
This commit is contained in:
@@ -2,23 +2,22 @@
|
|||||||
# ONLYOFFICE init script - runs before the document server starts
|
# ONLYOFFICE init script - runs before the document server starts
|
||||||
# Hides the ONLYOFFICE logo from the editor header
|
# Hides the ONLYOFFICE logo from the editor header
|
||||||
|
|
||||||
CSS_FILE=/var/www/onlyoffice/documentserver/web-apps/apps/documenteditor/main/resources/css/app.css
|
patch_css() {
|
||||||
if [ -f "$CSS_FILE" ]; then
|
local CSS_FILE=$1
|
||||||
# Check if already patched
|
if [ -f "$CSS_FILE" ]; then
|
||||||
if ! grep -q 'display:none!important' <<< "$(grep '#header-logo{' "$CSS_FILE" | head -1)"; then
|
# Check if already patched
|
||||||
sed -i 's/#header-logo{/#header-logo{display:none!important;/g' "$CSS_FILE"
|
if ! grep -q 'display:none!important' <<< "$(grep '#header-logo{' "$CSS_FILE" | head -1)"; then
|
||||||
echo "[onlyoffice-init] Patched app.css to hide logo"
|
sed -i 's/#header-logo{/#header-logo{display:none!important;/g' "$CSS_FILE"
|
||||||
fi
|
echo "[onlyoffice-init] Patched $CSS_FILE to hide logo"
|
||||||
fi
|
|
||||||
|
|
||||||
# Also patch the spreadsheet and presentation editors if they exist
|
|
||||||
for CSS in \
|
|
||||||
/var/www/onlyoffice/documentserver/web-apps/apps/spreadsheeteditor/main/resources/css/app.css \
|
|
||||||
/var/www/onlyoffice/documentserver/web-apps/apps/presentationeditor/main/resources/css/app.css; do
|
|
||||||
if [ -f "$CSS" ]; then
|
|
||||||
if ! grep -q 'display:none!important' <<< "$(grep '#header-logo{' "$CSS" | head -1)"; then
|
|
||||||
sed -i 's/#header-logo{/#header-logo{display:none!important;/g' "$CSS"
|
|
||||||
echo "[onlyoffice-init] Patched $(basename $(dirname $(dirname $(dirname $(dirname $CSS))))) to hide logo"
|
|
||||||
fi
|
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
|
fi
|
||||||
done
|
}
|
||||||
|
|
||||||
|
# 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
|
||||||
Reference in New Issue
Block a user