Some checks failed
Lock Threads / action (push) Has been cancelled
Store all 44 Finnish translation files in custom-logo/translations/ and update bin/rebrand to restore them after upstream merges. Ensures Finnish translations persist across future git pulls from Chatwoot upstream.
90 lines
3.6 KiB
Bash
Executable File
90 lines
3.6 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# bin/rebrand — applies LeadChat branding on top of upstream Chatwoot source.
|
|
# Re-runnable after every `git merge upstream/*` to restore the brand.
|
|
#
|
|
# What it does:
|
|
# 1. Copies logo files from custom-logo/ to their target locations
|
|
# 2. Copies favicons and manifest.json from custom-logo/favicons/ to public/
|
|
# 3. Replaces Chatwoot brand colors (#1f93ff / #2781F6) with LeadChat teal (#01a0a5)
|
|
# 4. Updates installation_config.yml defaults (name + URLs)
|
|
|
|
set -euo pipefail
|
|
|
|
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
|
|
CUSTOM="$REPO_ROOT/custom-logo"
|
|
PUBLIC="$REPO_ROOT/public"
|
|
|
|
BRAND_COLOR="#01a0a5"
|
|
BRAND_NAME="LeadChat"
|
|
BRAND_URL="https://chat.leadm.app"
|
|
|
|
if [[ ! -d "$CUSTOM" ]]; then
|
|
echo "ERROR: custom-logo/ not found at $CUSTOM" >&2
|
|
exit 1
|
|
fi
|
|
|
|
echo "=== LeadChat Rebrand ==="
|
|
|
|
# --- 1. Logos ---
|
|
echo "[1/4] Copying logos..."
|
|
install -D -m 644 "$CUSTOM/logo.svg" "$PUBLIC/brand-assets/logo.svg"
|
|
install -D -m 644 "$CUSTOM/logo_dark.svg" "$PUBLIC/brand-assets/logo_dark.svg"
|
|
install -D -m 644 "$CUSTOM/logo_thumbnail.svg" "$PUBLIC/brand-assets/logo_thumbnail.svg"
|
|
|
|
install -D -m 644 "$CUSTOM/design-system/logo.png" "$REPO_ROOT/app/javascript/design-system/images/logo.png"
|
|
install -D -m 644 "$CUSTOM/design-system/logo-dark.png" "$REPO_ROOT/app/javascript/design-system/images/logo-dark.png"
|
|
install -D -m 644 "$CUSTOM/design-system/logo_thumbnail.svg" "$REPO_ROOT/app/javascript/design-system/images/logo-thumbnail.svg"
|
|
|
|
install -D -m 644 "$CUSTOM/widget/logo.svg" "$REPO_ROOT/app/javascript/widget/assets/images/logo.svg"
|
|
install -D -m 644 "$CUSTOM/dashboard/bubble-logo.svg" "$REPO_ROOT/app/javascript/dashboard/assets/images/bubble-logo.svg"
|
|
|
|
# --- 2. Favicons + manifest ---
|
|
echo "[2/5] Copying favicons + manifest.json..."
|
|
cp "$CUSTOM/favicons/"*.png "$PUBLIC/"
|
|
cp "$CUSTOM/favicons/"*.ico "$PUBLIC/"
|
|
cp "$CUSTOM/favicons/manifest.json" "$PUBLIC/manifest.json"
|
|
|
|
# --- 3. Finnish translations ---
|
|
echo "[3/5] Restoring Finnish translations..."
|
|
if [[ -d "$CUSTOM/translations" ]]; then
|
|
cp -r "$CUSTOM/translations/dashboard/i18n/locale/fi" "$REPO_ROOT/app/javascript/dashboard/i18n/locale/"
|
|
else
|
|
echo " WARN: translations/ directory not found (first run after rebrand setup)"
|
|
fi
|
|
|
|
# --- 4. Brand color replacement ---
|
|
echo "[4/5] Replacing brand colors..."
|
|
COLOR_FILES=(
|
|
"theme/colors.js"
|
|
"app/javascript/shared/components/emoji/EmojiInput.vue"
|
|
"app/assets/stylesheets/administrate/library/_variables.scss"
|
|
"app/assets/stylesheets/administrate/utilities/_variables.scss"
|
|
"app/models/portal.rb"
|
|
"app/views/layouts/vueapp.html.erb"
|
|
"app/javascript/sdk/sdk.js"
|
|
"app/javascript/dashboard/components-next/HelpCenter/PortalSwitcher/CreatePortalDialog.vue"
|
|
"app/javascript/dashboard/components-next/icon/Logo.vue"
|
|
"app/javascript/dashboard/components/widgets/conversation/conversation/LabelSuggestion.vue"
|
|
"app/javascript/dashboard/components-next/message/bubbles/Dyte.vue"
|
|
"app/javascript/dashboard/components/widgets/WootWriter/AudioRecorder.vue"
|
|
"app/javascript/widget/components/ChatInputWrap.vue"
|
|
)
|
|
|
|
for f in "${COLOR_FILES[@]}"; do
|
|
path="$REPO_ROOT/$f"
|
|
if [[ -f "$path" ]]; then
|
|
sed -i -E "s/#1[Ff]93[Ff][Ff]/$BRAND_COLOR/g; s/#2781[Ff]6/$BRAND_COLOR/g" "$path"
|
|
else
|
|
echo " WARN: $f not found (upstream may have moved/renamed it)"
|
|
fi
|
|
done
|
|
|
|
# --- 5. installation_config.yml defaults ---
|
|
echo "[5/5] Updating installation_config.yml defaults..."
|
|
CONFIG="$REPO_ROOT/config/installation_config.yml"
|
|
sed -i "s|value: 'Chatwoot'|value: '$BRAND_NAME'|g" "$CONFIG"
|
|
sed -i "s|value: 'https://www.chatwoot.com|value: '$BRAND_URL|g" "$CONFIG"
|
|
|
|
echo
|
|
echo "=== Rebrand complete ==="
|