cd /opt/otb_tracker || exit 1 cat > /tmp/otb_tracker_shared_brand_patch.sh <<'EOF' #!/usr/bin/env bash set -euo pipefail APP_ROOT="/opt/otb_tracker" SHARED_ROOT="/opt/otb/otb-shared-brand" STAMP="$(date +%Y%m%d-%H%M%S)" cd "$APP_ROOT" || exit 1 echo "===== detect template/static roots =====" TPL_ROOT="" STATIC_ROOT="" if [ -d "$APP_ROOT/templates" ]; then TPL_ROOT="$APP_ROOT/templates" elif [ -d "$APP_ROOT/backend/templates" ]; then TPL_ROOT="$APP_ROOT/backend/templates" else echo "ERROR: no templates dir found" exit 1 fi if [ -d "$APP_ROOT/static" ]; then STATIC_ROOT="$APP_ROOT/static" elif [ -d "$APP_ROOT/backend/static" ]; then STATIC_ROOT="$APP_ROOT/backend/static" else echo "ERROR: no static dir found" exit 1 fi echo "Templates: $TPL_ROOT" echo "Static: $STATIC_ROOT" echo "===== ensure shared brand exists and is current =====" cd "$SHARED_ROOT" || exit 1 git pull origin main cd "$APP_ROOT" || exit 1 echo "===== backup =====" mkdir -p "$APP_ROOT/backups/shared-brand-$STAMP" cp -a "$TPL_ROOT" "$APP_ROOT/backups/shared-brand-$STAMP/templates" cp -a "$STATIC_ROOT" "$APP_ROOT/backups/shared-brand-$STAMP/static" echo "===== create includes dir =====" mkdir -p "$TPL_ROOT/includes" mkdir -p "$STATIC_ROOT/css" echo "===== sync shared assets =====" cp "$SHARED_ROOT/brand.css" "$STATIC_ROOT/css/brand.css" cp "$SHARED_ROOT/brand.js" "$STATIC_ROOT/brand.js" echo "===== sync shared header include =====" cp "$SHARED_ROOT/fragments/header.html" "$TPL_ROOT/includes/site_nav.html" echo "===== write canonical shared footer includes =====" cat > "$TPL_ROOT/includes/otb_statusbar.html" <<'EOT'
All billing is calculated in 🇨🇦 CAD Crypto conversions use the OTB Oracle Methods: Credit Card (via Square), e-Transfer, and enabled crypto assets
EOT cat > "$TPL_ROOT/includes/otb_footer.html" <<'EOT' {% include "includes/otb_statusbar.html" %} EOT echo "===== patch html templates =====" python3 <)', r'\\1\n ', text, count=1 ) text = re.sub( r'()', r'\\1\n ', text, count=1 ) # normalize brand css/js cache versions text = text.replace('/static/css/brand.css?v=0.3.5', '/static/css/brand.css?v=0.3.6') text = text.replace('/static/css/brand.css?v=0.3.6?v=0.3.6', '/static/css/brand.css?v=0.3.6') text = text.replace('/static/brand.js?v=0.3.5', '/static/brand.js?v=0.3.6') text = text.replace('/static/brand.js?v=0.3.6?v=0.3.6', '/static/brand.js?v=0.3.6') # replace inline shared header block if present text = re.sub( r'', '{% include "includes/site_nav.html" %}', text, count=1, flags=re.S ) # replace older nav block if present text = re.sub( r'
\s*\s*', '{% include "includes/site_nav.html" %}\n', text, count=1, flags=re.S ) # if no shared nav include and no obvious header/nav remains, insert after if '{% include "includes/site_nav.html" %}' not in text: if '' in text: text = text.replace('', '\n {% include "includes/site_nav.html" %}', 1) # replace inline statusbar/footer block with shared footer include text = re.sub( r'
.*?
\s*
\s*(\s*', '\n', text, flags=re.S ) # if footer include absent, append before if '{% include "includes/otb_footer.html" %}' not in text: text = text.replace('', ' {% include "includes/otb_footer.html" %}\n', 1) p.write_text(text, encoding="utf-8") print(f"patched: {p}") PY echo "===== restart service =====" sudo systemctl restart otb-tracker.service echo "===== verify =====" grep -Rni 'includes/site_nav.html\|includes/otb_footer.html\|/static/css/brand.css\|video.outsidethebox.top' "$TPL_ROOT" | sed -n '1,200p' ls -l "$STATIC_ROOT/css/brand.css" "$STATIC_ROOT/brand.js" echo "===== done =====" EOF chmod +x /tmp/otb_tracker_shared_brand_patch.sh /tmp/otb_tracker_shared_brand_patch.sh