sojorn/setup_fcm_server.sh
Patrick Britton 3c4680bdd7 Initial commit: Complete threaded conversation system with inline replies
**Major Features Added:**
- **Inline Reply System**: Replace compose screen with inline reply boxes
- **Thread Navigation**: Parent/child navigation with jump functionality
- **Chain Flow UI**: Reply counts, expand/collapse animations, visual hierarchy
- **Enhanced Animations**: Smooth transitions, hover effects, micro-interactions

 **Frontend Changes:**
- **ThreadedCommentWidget**: Complete rewrite with animations and navigation
- **ThreadNode Model**: Added parent references and descendant counting
- **ThreadedConversationScreen**: Integrated navigation handlers
- **PostDetailScreen**: Replaced with threaded conversation view
- **ComposeScreen**: Added reply indicators and context
- **PostActions**: Fixed visibility checks for chain buttons

 **Backend Changes:**
- **API Route**: Added /posts/:id/thread endpoint
- **Post Repository**: Include allow_chain and visibility fields in feed
- **Thread Handler**: Support for fetching post chains

 **UI/UX Improvements:**
- **Reply Context**: Clear indication when replying to specific posts
- **Character Counting**: 500 character limit with live counter
- **Visual Hierarchy**: Depth-based indentation and styling
- **Smooth Animations**: SizeTransition, FadeTransition, hover states
- **Chain Navigation**: Parent/child buttons with visual feedback

 **Technical Enhancements:**
- **Animation Controllers**: Proper lifecycle management
- **State Management**: Clean separation of concerns
- **Navigation Callbacks**: Reusable navigation system
- **Error Handling**: Graceful fallbacks and user feedback

This creates a Reddit-style threaded conversation experience with smooth
animations, inline replies, and intuitive navigation between posts in a chain.
2026-01-30 07:40:19 -06:00

107 lines
3.6 KiB
Bash

#!/bin/bash
# FCM Setup Script for Sojorn Server
# Run this on the server after uploading your firebase-service-account.json
set -e
echo "=== Sojorn FCM Setup Script ==="
echo ""
# Check if running as root or with sudo
if [ "$EUID" -eq 0 ]; then
echo "Please run as regular user (patrick), not root"
exit 1
fi
# Check if firebase service account JSON exists in /tmp
if [ ! -f "/tmp/firebase-service-account.json" ]; then
echo "ERROR: /tmp/firebase-service-account.json not found"
echo ""
echo "Please upload it first:"
echo "scp -i \"C:\\Users\\Patrick\\.ssh\\mpls.pem\" \"path\\to\\firebase-service-account.json\" patrick@194.238.28.122:/tmp/firebase-service-account.json"
exit 1
fi
echo "✓ Found firebase-service-account.json in /tmp"
# Move to /opt/sojorn
echo "Moving firebase-service-account.json to /opt/sojorn..."
sudo mv /tmp/firebase-service-account.json /opt/sojorn/firebase-service-account.json
# Set permissions
echo "Setting permissions..."
sudo chmod 600 /opt/sojorn/firebase-service-account.json
sudo chown patrick:patrick /opt/sojorn/firebase-service-account.json
# Verify
if [ -f "/opt/sojorn/firebase-service-account.json" ]; then
echo "✓ Firebase service account JSON installed"
ls -lh /opt/sojorn/firebase-service-account.json
else
echo "✗ Failed to install firebase-service-account.json"
exit 1
fi
# Check if .env exists
if [ ! -f "/opt/sojorn/.env" ]; then
echo "ERROR: /opt/sojorn/.env not found"
echo "Please create it first"
exit 1
fi
# Check if FIREBASE_CREDENTIALS_FILE is already in .env
if grep -q "FIREBASE_CREDENTIALS_FILE" /opt/sojorn/.env; then
echo "✓ FIREBASE_CREDENTIALS_FILE already in .env"
else
echo "Adding FIREBASE_CREDENTIALS_FILE to .env..."
echo "" | sudo tee -a /opt/sojorn/.env > /dev/null
echo "# Firebase Cloud Messaging" | sudo tee -a /opt/sojorn/.env > /dev/null
echo "FIREBASE_CREDENTIALS_FILE=/opt/sojorn/firebase-service-account.json" | sudo tee -a /opt/sojorn/.env > /dev/null
echo "✓ Added FIREBASE_CREDENTIALS_FILE to .env"
fi
# Prompt for VAPID key if not set
if ! grep -q "FIREBASE_WEB_VAPID_KEY" /opt/sojorn/.env; then
echo ""
echo "VAPID key not found in .env"
echo "Get it from: https://console.firebase.google.com/project/sojorn-a7a78/settings/cloudmessaging"
echo ""
read -p "Enter your FIREBASE_WEB_VAPID_KEY (or press Enter to skip): " vapid_key
if [ ! -z "$vapid_key" ]; then
echo "FIREBASE_WEB_VAPID_KEY=$vapid_key" | sudo tee -a /opt/sojorn/.env > /dev/null
echo "✓ Added FIREBASE_WEB_VAPID_KEY to .env"
else
echo "⚠ Skipped VAPID key - you'll need to add it manually later"
fi
else
echo "✓ FIREBASE_WEB_VAPID_KEY already in .env"
fi
echo ""
echo "=== Configuration Summary ==="
echo "Service Account JSON: /opt/sojorn/firebase-service-account.json"
sudo cat /opt/sojorn/.env | grep FIREBASE || echo "No FIREBASE vars found"
echo ""
echo "=== Restarting Go Backend ==="
cd /home/patrick/sojorn-backend
sudo systemctl restart sojorn-api
sleep 2
sudo systemctl status sojorn-api --no-pager
echo ""
echo "=== Checking Logs ==="
echo "Looking for FCM initialization..."
sudo journalctl -u sojorn-api --since "30 seconds ago" | grep -i "push\|fcm\|firebase" || echo "No FCM logs found yet"
echo ""
echo "✓ FCM Setup Complete!"
echo ""
echo "Next steps:"
echo "1. Update Flutter app with your VAPID key in firebase_web_config.dart"
echo "2. Hot restart the Flutter app"
echo "3. Check browser console for 'FCM token registered'"
echo ""
echo "To view live logs: sudo journalctl -u sojorn-api -f"