billing frontend for mariadb. setup as otb_billing for outsidethebox.top accounting. also involved with outsidethedb
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.
 
 
 
 

80 lines
2.8 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/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
echo "===== replace shared nav include from otb-shared-brand ====="
cp /opt/otb/otb-shared-brand/fragments/header.html templates/includes/site_nav.html
echo "===== create shared portal statusbar include ====="
cat > templates/includes/otb_statusbar.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>
EOF
echo "===== replace inline portal statusbars with 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"),
]
replacement = '{% include "includes/otb_statusbar.html" %}'
for p in files:
if not p.exists():
continue
text = p.read_text()
new_text = re.sub(
r'<div class="otb-statusbar">.*?</div>\s*</div>',
replacement,
text,
count=1,
flags=re.S
)
if new_text != text:
p.write_text(new_text)
print(f"updated: {p}")
else:
print(f"no inline statusbar found: {p}")
PY
echo "===== verify includes ====="
grep -n "video.outsidethebox.top" templates/includes/site_nav.html
grep -Rni 'includes/otb_statusbar.html' templates/portal_*.html | sed -n '1,50p'
echo "===== restart service ====="
sudo systemctl restart otb-billing
echo "===== quick verify from template side ====="
sed -n '1,40p' templates/includes/site_nav.html