branded header, nav, footer for OTB
https://outsidethebox.top
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.
71 lines
1.8 KiB
71 lines
1.8 KiB
#!/bin/bash |
|
set -e |
|
APP_DIR="/home/def/monitor" |
|
cd "$APP_DIR" || exit 1 |
|
|
|
STAMP="$(date +%Y%m%d-%H%M%S)" |
|
BKDIR="backups/shared-brand-$STAMP" |
|
mkdir -p "$BKDIR" |
|
cp -av frontend/index.html frontend/styles.css "$BKDIR"/ || true |
|
|
|
HEADER="$(cat /home/def/otb-shared-brand/header.html)" |
|
FOOTER="$(cat /home/def/otb-shared-brand/footer.html)" |
|
BRANDCSS="$(cat /home/def/otb-shared-brand/brand.css)" |
|
|
|
cat > frontend/index.html <<HTML |
|
<!doctype html> |
|
<html lang="en" data-theme="dark"> |
|
<head> |
|
<meta charset="utf-8" /> |
|
<meta name="viewport" content="width=device-width, initial-scale=1" /> |
|
<title>Monitor</title> |
|
<link rel="stylesheet" href="/styles.css" /> |
|
</head> |
|
<body> |
|
$HEADER |
|
|
|
<div class="wrap"> |
|
<header class="top"> |
|
<div> |
|
<div class="title">Monitor</div> |
|
<div class="sub">7-day snapshot • rotating refresh</div> |
|
</div> |
|
|
|
<div class="top-right"> |
|
<div class="status-pill" id="status">Loading…</div> |
|
<div class="cycle" id="cycle"></div> |
|
|
|
<label class="switch" title="Toggle theme"> |
|
<input type="checkbox" id="themeToggle" aria-label="Toggle theme" /> |
|
<span class="slider"></span> |
|
</label> |
|
</div> |
|
</header> |
|
|
|
<div class="card"> |
|
<div id="root"></div> |
|
</div> |
|
</div> |
|
|
|
$FOOTER |
|
|
|
<script src="/app.js" defer></script> |
|
</body> |
|
</html> |
|
HTML |
|
|
|
python3 - <<PY |
|
from pathlib import Path |
|
import re |
|
brandcss = """$BRANDCSS""" |
|
p = Path("frontend/styles.css") |
|
css = p.read_text(encoding="utf-8") |
|
if "/* ===== OTB shared branding ===== */" in css: |
|
css = re.sub(r'/\\* ===== OTB shared branding ===== \\*/.*', brandcss, css, flags=re.S) |
|
else: |
|
css = brandcss + "\\n\\n" + css |
|
p.write_text(css, encoding="utf-8") |
|
print("monitor branding css updated") |
|
PY |
|
|
|
/home/def/monitor/deploy-monitor.sh
|
|
|