#!/usr/bin/env bash
# start static file server for TikTok domain verification + TOS/privacy pages
pkill -f "http.server 4081" 2>/dev/null
sleep 1
cd "$HOME/postiz/site"
setsid nohup /usr/bin/python3 -m http.server 4081 -b 127.0.0.1 -d "$HOME/postiz/site" >"$HOME/postiz/site/site.log" 2>&1 &
sleep 2
pgrep -af "http.server 4081" || { echo "FAILED to start"; cat "$HOME/postiz/site/site.log"; exit 1; }
curl -s -o /dev/null -w "local=%{http_code} %{content_type}\n" http://127.0.0.1:4081/tos.html
