You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
102 lines
3.5 KiB
102 lines
3.5 KiB
cd /home/def/otb_billing || exit 1 |
|
set -e |
|
|
|
STAMP="$(date +%Y%m%d-%H%M%S)" |
|
|
|
echo "===== backups =====" |
|
cp templates/includes/site_nav.html "templates/includes/site_nav.html.bak.${STAMP}" |
|
cp templates/includes/otb_statusbar.html "templates/includes/otb_statusbar.html.bak.${STAMP}" 2>/dev/null || true |
|
cp templates/portal_login.html "templates/portal_login.html.bak.${STAMP}" |
|
cp templates/portal_dashboard.html "templates/portal_dashboard.html.bak.${STAMP}" 2>/dev/null || true |
|
cp templates/portal_set_password.html "templates/portal_set_password.html.bak.${STAMP}" 2>/dev/null || true |
|
cp templates/portal_terms.html "templates/portal_terms.html.bak.${STAMP}" 2>/dev/null || true |
|
cp templates/portal_invoice_detail.html "templates/portal_invoice_detail.html.bak.${STAMP}" 2>/dev/null || true |
|
cp templates/portal_forgot_password.html "templates/portal_forgot_password.html.bak.${STAMP}" 2>/dev/null || true |
|
cp static/css/style.css "static/css/style.css.bak.${STAMP}" 2>/dev/null || true |
|
cp static/brand.js "static/brand.js.bak.${STAMP}" 2>/dev/null || true |
|
|
|
echo "===== sync shared nav/footer assets from mintme-backed shared brand =====" |
|
cp /opt/otb/otb-shared-brand/fragments/header.html templates/includes/site_nav.html |
|
|
|
cat > templates/includes/otb_footer.html <<'EOF' |
|
<div class="otb-statusbar"> |
|
<div class="otb-statusbar-inner"> |
|
<strong>All billing is calculated in 🇨🇦 CAD</strong> |
|
<span class="otb-dot"></span> |
|
<span>Crypto conversions use the <a href="https://monitor.outsidethebox.top" target="_blank" rel="noopener noreferrer">OTB Oracle</a></span> |
|
<span class="otb-dot"></span> |
|
<span> |
|
Methods: |
|
<strong>Credit Card</strong> <span style="opacity:0.7;">(via Square)</span>, |
|
<strong>e-Transfer</strong>, |
|
and <strong>enabled crypto assets</strong> |
|
</span> |
|
</div> |
|
</div> |
|
<script src="/static/brand.js" defer></script> |
|
EOF |
|
|
|
echo "===== sync shared css/js =====" |
|
cp /var/www/outsidethebox.top/assets/brand.js static/brand.js |
|
|
|
python3 <<'PY' |
|
from pathlib import Path |
|
src = Path("/var/www/outsidethebox.top/assets/style.css") |
|
dst = Path("/home/def/otb_billing/static/css/style.css") |
|
text = src.read_text() |
|
|
|
# keep the portal's own css file as the shared base for now |
|
dst.write_text(text) |
|
print("synced style.css from shared public shell") |
|
PY |
|
|
|
echo "===== replace portal footer/statusbar blocks with shared footer include =====" |
|
python3 <<'PY' |
|
from pathlib import Path |
|
import re |
|
|
|
files = [ |
|
Path("templates/portal_login.html"), |
|
Path("templates/portal_dashboard.html"), |
|
Path("templates/portal_set_password.html"), |
|
Path("templates/portal_terms.html"), |
|
Path("templates/portal_invoice_detail.html"), |
|
Path("templates/portal_forgot_password.html"), |
|
] |
|
|
|
for p in files: |
|
if not p.exists(): |
|
continue |
|
text = p.read_text() |
|
|
|
text = re.sub( |
|
r'<div class="otb-statusbar">.*?</div>\s*</div>\s*<script src="/static/brand\.js" defer></script>', |
|
'{% include "includes/otb_footer.html" %}', |
|
text, |
|
count=1, |
|
flags=re.S |
|
) |
|
|
|
text = re.sub( |
|
r'\{\%\s*include\s+"includes/otb_statusbar\.html"\s*\%\}\s*<script src="/static/brand\.js" defer></script>', |
|
'{% include "includes/otb_footer.html" %}', |
|
text, |
|
count=1, |
|
flags=re.S |
|
) |
|
|
|
text = re.sub( |
|
r'\{\%\s*include\s+"includes/otb_statusbar\.html"\s*\%\}', |
|
'{% include "includes/otb_footer.html" %}', |
|
text, |
|
count=1, |
|
flags=re.S |
|
) |
|
|
|
p.write_text(text) |
|
print(f"updated: {p}") |
|
PY |
|
|
|
sudo systemctl restart otb_billing |
|
|
|
echo "===== done ====="
|
|
|