Metabolizer Blog Pipeline - integrated CMS for SecuBox: - Gitea: Mirror GitHub repos, store blog content - Streamlit: CMS app with markdown editor and live preview - HexoJS: Static site generator (clean → generate → publish) - Webhooks: Auto-rebuild on git push - Portal: Static blog served at /blog/ Pipeline: Edit in Streamlit CMS → Push to Gitea → Build with Hexo → Publish Packages: - secubox-app-streamlit: Streamlit server with LXC container - luci-app-streamlit: LuCI dashboard for Streamlit apps - secubox-app-metabolizer: CMS pipeline orchestrator CMS Features: - Two-column markdown editor with live preview - YAML front matter editor - Post management (drafts, publish, unpublish) - Media library with image upload - Git sync and Hexo build controls - Cyberpunk theme styling Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
55 lines
1.3 KiB
Bash
55 lines
1.3 KiB
Bash
#!/bin/sh
|
|
# Metabolizer Webhook Handler
|
|
# Receives Gitea push events and triggers rebuild
|
|
# Copyright (C) 2025 CyberMind.fr
|
|
|
|
. /lib/functions.sh
|
|
|
|
CONFIG="metabolizer"
|
|
LOG_TAG="metabolizer-webhook"
|
|
|
|
log_info() { logger -t "$LOG_TAG" "$*"; }
|
|
log_error() { logger -t "$LOG_TAG" -p err "$*"; }
|
|
|
|
# Load config
|
|
config_load "$CONFIG"
|
|
config_get webhook_secret main webhook_secret ""
|
|
config_get content_repo content repo_name "blog-content"
|
|
config_get cms_repo cms repo_name "metabolizer-cms"
|
|
config_get auto_publish hexo auto_publish "1"
|
|
|
|
# Read webhook payload from stdin
|
|
read -r payload
|
|
|
|
# Parse payload
|
|
repo_name=$(echo "$payload" | jsonfilter -e '@.repository.name' 2>/dev/null)
|
|
ref=$(echo "$payload" | jsonfilter -e '@.ref' 2>/dev/null)
|
|
pusher=$(echo "$payload" | jsonfilter -e '@.pusher.name' 2>/dev/null)
|
|
|
|
if [ -z "$repo_name" ]; then
|
|
log_error "Invalid webhook payload"
|
|
exit 1
|
|
fi
|
|
|
|
log_info "Webhook received: repo=$repo_name ref=$ref pusher=$pusher"
|
|
|
|
# Handle based on repository
|
|
case "$repo_name" in
|
|
"$content_repo")
|
|
log_info "Content repo updated, triggering rebuild..."
|
|
/usr/sbin/metabolizerctl sync
|
|
/usr/sbin/metabolizerctl build
|
|
;;
|
|
|
|
"$cms_repo")
|
|
log_info "CMS repo updated, redeploying..."
|
|
/usr/sbin/metabolizerctl cms update
|
|
;;
|
|
|
|
*)
|
|
log_info "Unknown repository: $repo_name"
|
|
;;
|
|
esac
|
|
|
|
log_info "Webhook processed"
|