Files
computer-playbook/roles/web-app-opencloud/files/shell/theme_sync.sh
T
kevinveenbirkenbachandClaude Opus 5.5 b0edf77ca3 feat(web-app-opencloud): theme the web client through an own theme file
OpenCloud reads its colors from a theme.json and writes them inline on
the page, so a stylesheet cannot reach them. The role now installs an
own theme id next to the upstream one: a task renders the theme file
and hands it, together with logo, mobile logo and favicon, to a sync
script inside the container, which writes a file only when its content
changed and marks the directory as its own. Every color role and file
icon color of the theme refers to a design token, so light and dark
follow the palette and only the logo files are baked. The env file
selects the theme through WEB_UI_THEME_PATH.

With the design service off the role removes the directory it marked
and leaves the upstream theme selected. A directory of that name
without the marker stops the deploy instead of being overwritten.

The role stylesheet covers what the theme does not reach: defaults
before the theme loads, dividers, hover and selected states, focus in
the top bar and the sign-in page of the built-in identity provider. A
design script mirrors the theme a user picked and sets the favicon on
the sign-in page.

The spec signs in as the built-in administrator when no identity
provider fronts the app and asserts tokens, theme roles, states, focus
inside the top bar, the theme choice, logo, title and the sign-in page.
It captures a gallery of 34 views. TODO.md records that the app store
catalogue is blocked by the content security policy.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
2026-10-07 00:51:05 +02:00

36 lines
944 B
Bash

#!/usr/bin/env sh
# Param $1: absolute directory of the corporate theme inside the OpenCloud container.
# Param $2: file path below that directory to write; without it the theme directory is removed.
# Param stdin: desired content of that file.
# Output: CHANGED when the file was written or the directory was removed.
# Exit 3: a file is to be written into a directory that does not carry the marker of this role.
set -eu
theme_dir="${1:?theme directory is required}"
marker="$theme_dir/.infinito-design"
if [ "$#" -lt 2 ]; then
[ -f "$marker" ] || exit 0
rm -rf "$theme_dir"
echo CHANGED
exit 0
fi
if [ -d "$theme_dir" ] && [ ! -f "$marker" ]; then
echo "$theme_dir exists and was not created by this role" >&2
exit 3
fi
target="$theme_dir/$2"
desired="$(cat)"
mkdir -p "$(dirname "$target")"
: >"$marker"
if [ -f "$target" ] && [ "$desired" = "$(cat "$target")" ]; then
exit 0
fi
printf '%s' "$desired" >"$target"
echo CHANGED