Small fix

This commit is contained in:
Aaron D. Lee
2026-01-04 19:36:06 -05:00
parent 58673c04fe
commit 46cbf98a23
4 changed files with 119 additions and 118 deletions

View File

1
instance/.secret_key Normal file
View File

@@ -0,0 +1 @@
6a7378172fc0ec37143720f09a4ca34e83ec2409893aa8cd79ace5b78a64276c

BIN
instance/stegasoo.db Normal file

Binary file not shown.

View File

@@ -17,13 +17,13 @@ PROFILE_HOOK="/etc/profile.d/stegasoo-wizard.sh"
# Check if this is first boot # Check if this is first boot
if [ ! -f "$FLAG_FILE" ]; then if [ ! -f "$FLAG_FILE" ]; then
exit 0 exit 0
fi fi
# Check for gum, fall back to basic prompts if not available # Check for gum, fall back to basic prompts if not available
if ! command -v gum &>/dev/null; then if ! command -v gum &>/dev/null; then
echo "Error: gum not found. Install with: sudo apt install gum" echo "Error: gum not found. Install with: sudo apt install gum"
exit 1 exit 1
fi fi
# Gum styling - terminal green buttons with bold dark text # Gum styling - terminal green buttons with bold dark text
@@ -40,20 +40,20 @@ clear
# ============================================================================= # =============================================================================
gum style \ gum style \
--border double \ --border double \
--border-foreground 212 \ --border-foreground 212 \
--padding "1 2" \ --padding "1 2" \
--margin "1" \ --margin "1" \
--align center \ --align center \
" . * . . * . * . * . * ." \ " . * . . * . * . * . * ." \
" ___ _____ ___ ___ _ ___ ___ ___" \ " ___ _____ ___ ___ _ ___ ___ ___ " \
" / __||_ _|| __| / __| /_\\ / __| / _ \\ / _ \\" \ " / __||_ _|| __| / __| /_\\ / __| / _ \\ / _ \\" \
" \\__ \\ | | | _| | (_ | / _ \\ \\__ \\ | (_) || (_) |" \ " \\__ \\ | | | _| | (_ | / _ \\ \\__ \\ | (_) || (_) |" \
" |___/ |_| |___| \\___//_/ \\_\\|___/ \\___/ \\___/" \ " |___/ |_| |___| \\___//_/ \\_\\|___/ \\___/ \\___/" \
"" \ "" \
" * . * . * . * . * . *" \ " * . * . * . * . * . *" \
"" \ "" \
"First Boot Wizard" "First Boot Wizard"
echo "" echo ""
gum style --foreground 245 "This wizard will help you configure your Stegasoo server." gum style --foreground 245 "This wizard will help you configure your Stegasoo server."
@@ -76,8 +76,8 @@ CHANNEL_KEY=""
clear clear
gum style \ gum style \
--foreground 212 --bold \ --foreground 212 --bold \
"Step 1 of 3: HTTPS Configuration" "Step 1 of 3: HTTPS Configuration"
echo "" echo ""
gum style --foreground 245 "\ gum style --foreground 245 "\
@@ -89,10 +89,10 @@ certificate is self-signed. This is normal for home networks."
echo "" echo ""
if gum confirm "Enable HTTPS?" --default=true; then if gum confirm "Enable HTTPS?" --default=true; then
ENABLE_HTTPS="true" ENABLE_HTTPS="true"
gum style --foreground 82 "✓ HTTPS will be enabled" gum style --foreground 82 "✓ HTTPS will be enabled"
else else
gum style --foreground 214 "→ Using HTTP (unencrypted)" gum style --foreground 214 "→ Using HTTP (unencrypted)"
fi fi
sleep 0.5 sleep 0.5
@@ -101,13 +101,13 @@ sleep 0.5
# ============================================================================= # =============================================================================
if [ "$ENABLE_HTTPS" = "true" ]; then if [ "$ENABLE_HTTPS" = "true" ]; then
clear clear
gum style \ gum style \
--foreground 212 --bold \ --foreground 212 --bold \
"Step 2 of 3: Port Configuration" "Step 2 of 3: Port Configuration"
echo "" echo ""
gum style --foreground 245 "\ gum style --foreground 245 "\
The standard HTTPS port is 443, which means you can access The standard HTTPS port is 443, which means you can access
Stegasoo without specifying a port in the URL. Stegasoo without specifying a port in the URL.
@@ -115,15 +115,15 @@ Stegasoo without specifying a port in the URL.
Port 5000: https://stegasoo.local:5000 Port 5000: https://stegasoo.local:5000
NOTE: Port 443 requires an iptables redirect rule." NOTE: Port 443 requires an iptables redirect rule."
echo "" echo ""
if gum confirm "Use standard port 443?" --default=true; then if gum confirm "Use standard port 443?" --default=true; then
USE_PORT_443="true" USE_PORT_443="true"
gum style --foreground 82 "✓ Port 443 will be configured" gum style --foreground 82 "✓ Port 443 will be configured"
else else
gum style --foreground 214 "→ Using port 5000" gum style --foreground 214 "→ Using port 5000"
fi fi
sleep 0.5 sleep 0.5
fi fi
# ============================================================================= # =============================================================================
@@ -132,8 +132,8 @@ fi
clear clear
gum style \ gum style \
--foreground 212 --bold \ --foreground 212 --bold \
"Step 3 of 3: Channel Key Configuration" "Step 3 of 3: Channel Key Configuration"
echo "" echo ""
gum style --foreground 245 "\ gum style --foreground 245 "\
@@ -147,50 +147,50 @@ specific people (family, team, etc)."
echo "" echo ""
if gum confirm "Generate a private channel key?" --default=false; then if gum confirm "Generate a private channel key?" --default=false; then
echo ""
# Generate key to temp file (gum spin doesn't capture stdout well)
KEY_FILE=$(mktemp)
ERR_FILE=$(mktemp)
VENV_PYTHON="$INSTALL_DIR/venv/bin/python"
gum spin --spinner dot --title "Generating channel key..." -- \
bash -c "'$VENV_PYTHON' -c 'from stegasoo.channel import generate_channel_key; print(generate_channel_key())' > '$KEY_FILE' 2>'$ERR_FILE'"
CHANNEL_KEY=$(cat "$KEY_FILE" 2>/dev/null | head -1)
KEY_ERROR=$(cat "$ERR_FILE" 2>/dev/null)
rm -f "$KEY_FILE" "$ERR_FILE"
if [ -n "$CHANNEL_KEY" ] && [[ "$CHANNEL_KEY" =~ ^[A-Za-z0-9] ]]; then
echo "" echo ""
# Generate key to temp file (gum spin doesn't capture stdout well) gum style --foreground 82 "✓ Channel key generated!"
KEY_FILE=$(mktemp) echo ""
ERR_FILE=$(mktemp) gum style \
VENV_PYTHON="$INSTALL_DIR/venv/bin/python" --border rounded \
gum spin --spinner dot --title "Generating channel key..." -- \ --border-foreground 226 \
bash -c "'$VENV_PYTHON' -c 'from stegasoo.channel import generate_channel_key; print(generate_channel_key())' > '$KEY_FILE' 2>'$ERR_FILE'" --padding "1 2" \
--foreground 226 --bold \
CHANNEL_KEY=$(cat "$KEY_FILE" 2>/dev/null | head -1) "$CHANNEL_KEY"
KEY_ERROR=$(cat "$ERR_FILE" 2>/dev/null) echo ""
rm -f "$KEY_FILE" "$ERR_FILE" gum style --foreground 196 --bold \
"*** IMPORTANT: Write down or copy this key NOW! ***"
if [ -n "$CHANNEL_KEY" ] && [[ "$CHANNEL_KEY" =~ ^[A-Za-z0-9] ]]; then gum style --foreground 196 \
echo "" "You'll need to share it with anyone who should decode" \
gum style --foreground 82 "✓ Channel key generated!" "your images. This key won't be shown again."
echo "" echo ""
gum style \ gum confirm "I've saved the key" --default=true --affirmative="Continue" --negative=""
--border rounded \ else
--border-foreground 226 \ gum style --foreground 196 "Failed to generate key. Using public mode."
--padding "1 2" \ if [ -n "$KEY_ERROR" ]; then
--foreground 226 --bold \ echo ""
"$CHANNEL_KEY" gum style --foreground 245 "Error details:"
echo "" echo "$KEY_ERROR"
gum style --foreground 196 --bold \
"*** IMPORTANT: Write down or copy this key NOW! ***"
gum style --foreground 196 \
"You'll need to share it with anyone who should decode" \
"your images. This key won't be shown again."
echo ""
gum confirm "I've saved the key" --default=true --affirmative="Continue" --negative=""
else
gum style --foreground 196 "Failed to generate key. Using public mode."
if [ -n "$KEY_ERROR" ]; then
echo ""
gum style --foreground 245 "Error details:"
echo "$KEY_ERROR"
fi
CHANNEL_KEY=""
echo ""
gum confirm "Continue" --default=true --affirmative="OK" --negative=""
fi fi
CHANNEL_KEY=""
echo ""
gum confirm "Continue" --default=true --affirmative="OK" --negative=""
fi
else else
gum style --foreground 214 "→ Using public mode" gum style --foreground 214 "→ Using public mode"
sleep 0.5 sleep 0.5
fi fi
# ============================================================================= # =============================================================================
@@ -199,8 +199,8 @@ fi
clear clear
gum style \ gum style \
--foreground 212 --bold \ --foreground 212 --bold \
"Applying Configuration..." "Applying Configuration..."
echo "" echo ""
# Find the stegasoo user (whoever owns the install dir) # Find the stegasoo user (whoever owns the install dir)
@@ -233,7 +233,7 @@ gum style --foreground 82 "✓ Service configured"
# Setup port 443 if requested # Setup port 443 if requested
if [ "$USE_PORT_443" = "true" ]; then if [ "$USE_PORT_443" = "true" ]; then
gum spin --spinner dot --title "Setting up port 443 redirect..." -- bash -c " gum spin --spinner dot --title "Setting up port 443 redirect..." -- bash -c "
if ! command -v iptables &>/dev/null; then if ! command -v iptables &>/dev/null; then
sudo apt-get install -y iptables >/dev/null 2>&1 sudo apt-get install -y iptables >/dev/null 2>&1
fi fi
@@ -255,7 +255,7 @@ WantedBy=multi-user.target
EOF EOF
sudo systemctl enable iptables-restore.service >/dev/null 2>&1 sudo systemctl enable iptables-restore.service >/dev/null 2>&1
" "
gum style --foreground 82 "✓ Port 443 redirect configured" gum style --foreground 82 "✓ Port 443 redirect configured"
fi fi
gum spin --spinner dot --title "Reloading systemd..." -- sudo systemctl daemon-reload gum spin --spinner dot --title "Reloading systemd..." -- sudo systemctl daemon-reload
@@ -264,9 +264,9 @@ gum style --foreground 82 "✓ Systemd reloaded"
gum spin --spinner dot --title "Starting Stegasoo..." -- bash -c "sudo systemctl restart stegasoo && sleep 2" gum spin --spinner dot --title "Starting Stegasoo..." -- bash -c "sudo systemctl restart stegasoo && sleep 2"
if systemctl is-active --quiet stegasoo; then if systemctl is-active --quiet stegasoo; then
gum style --foreground 82 "✓ Stegasoo started successfully" gum style --foreground 82 "✓ Stegasoo started successfully"
else else
gum style --foreground 196 "✗ Failed to start (check: journalctl -u stegasoo)" gum style --foreground 196 "✗ Failed to start (check: journalctl -u stegasoo)"
fi fi
gum spin --spinner dot --title "Cleaning up wizard..." -- bash -c " gum spin --spinner dot --title "Cleaning up wizard..." -- bash -c "
@@ -288,33 +288,33 @@ HOSTNAME=$(hostname)
# Build the access URL # Build the access URL
if [ "$ENABLE_HTTPS" = "true" ]; then if [ "$ENABLE_HTTPS" = "true" ]; then
if [ "$USE_PORT_443" = "true" ]; then if [ "$USE_PORT_443" = "true" ]; then
ACCESS_URL="https://$PI_IP" ACCESS_URL="https://$PI_IP"
ACCESS_URL_LOCAL="https://$HOSTNAME.local" ACCESS_URL_LOCAL="https://$HOSTNAME.local"
else else
ACCESS_URL="https://$PI_IP:5000" ACCESS_URL="https://$PI_IP:5000"
ACCESS_URL_LOCAL="https://$HOSTNAME.local:5000" ACCESS_URL_LOCAL="https://$HOSTNAME.local:5000"
fi fi
else else
ACCESS_URL="http://$PI_IP:5000" ACCESS_URL="http://$PI_IP:5000"
ACCESS_URL_LOCAL="http://$HOSTNAME.local:5000" ACCESS_URL_LOCAL="http://$HOSTNAME.local:5000"
fi fi
gum style \ gum style \
--border double \ --border double \
--border-foreground 82 \ --border-foreground 82 \
--padding "1 2" \ --padding "1 2" \
--margin "1" \ --margin "1" \
--align center \ --align center \
" . * . . * . * . * . * ." \ " . * . . * . * . * . * ." \
" ___ _____ ___ ___ _ ___ ___ ___" \ " ___ _____ ___ ___ _ ___ ___ ___" \
" / __||_ _|| __| / __| /_\\ / __| / _ \\ / _ \\" \ " / __||_ _|| __| / __| /_\\ / __| / _ \\ / _ \\" \
" \\__ \\ | | | _| | (_ | / _ \\ \\__ \\ | (_) || (_) |" \ " \\__ \\ | | | _| | (_ | / _ \\ \\__ \\ | (_) || (_) |" \
" |___/ |_| |___| \\___//_/ \\_\\|___/ \\___/ \\___/" \ " |___/ |_| |___| \\___//_/ \\_\\|___/ \\___/ \\___/" \
"" \ "" \
" * . * . * . * . * . *" \ " * . * . * . * . * . *" \
"" \ "" \
"Setup Complete!" "Setup Complete!"
echo "" echo ""
gum style --foreground 82 --bold "Access URL:" gum style --foreground 82 --bold "Access URL:"
@@ -323,24 +323,24 @@ gum style --foreground 245 " $ACCESS_URL_LOCAL (if mDNS works)"
echo "" echo ""
if [ -n "$CHANNEL_KEY" ]; then if [ -n "$CHANNEL_KEY" ]; then
gum style --foreground 82 --bold "Channel Key:" gum style --foreground 82 --bold "Channel Key:"
gum style --foreground 226 " $CHANNEL_KEY" gum style --foreground 226 " $CHANNEL_KEY"
echo "" echo ""
fi fi
gum style --foreground 82 --bold "First Steps:" gum style --foreground 82 --bold "First Steps:"
gum style --foreground 255 \ gum style --foreground 255 \
" 1. Open the URL above in your browser" \ " 1. Open the URL above in your browser" \
" 2. Accept the security warning (self-signed cert)" \ " 2. Accept the security warning (self-signed cert)" \
" 3. Create your admin account" \ " 3. Create your admin account" \
" 4. Start encoding secret messages!" " 4. Start encoding secret messages!"
echo "" echo ""
gum style --foreground 82 --bold "Useful Commands:" gum style --foreground 82 --bold "Useful Commands:"
gum style --foreground 245 \ gum style --foreground 245 \
" sudo systemctl status stegasoo # Check status" \ " sudo systemctl status stegasoo # Check status" \
" sudo systemctl restart stegasoo # Restart" \ " sudo systemctl restart stegasoo # Restart" \
" journalctl -u stegasoo -f # View logs" " journalctl -u stegasoo -f # View logs"
echo "" echo ""
gum style --foreground 212 --bold "Enjoy Stegasoo!" gum style --foreground 212 --bold "Enjoy Stegasoo!"