Files
giglez/create-gitea-repo.sh
Trilltechnician 04bd80b25b GPS Auto-Extraction + First Successful Upload Complete
Major milestone: GPS coordinates now auto-extract from filenames and
uploads appear on map with full end-to-end workflow functional!

 GPS Auto-Extraction Features:
- JavaScript GPS extractor class matching Python patterns
- Supports 3 filename formats:
  * N/S/E/W: 34.0478N_118.2349W_filename.sub
  * lat/lon prefix: lat34.0478lon-118.2348_filename.sub
  * Signed decimal: -34.0478_118.2348_filename.sub
- Auto-populates latitude/longitude form fields on file drop
- Green notification toast shows detected coordinates
- File list shows GPS badge for files with coordinates

🗺️ Web Interface Improvements:
- Upload endpoint now stores captures in-memory
- Query endpoint returns uploaded captures for map display
- Stats endpoint shows real-time upload counts
- Map displays uploaded captures as markers
- Color-coded by frequency band

📁 Updated Files:
- static/js/upload.js: GPS extraction + auto-population
- src/api/main_simple.py: In-memory storage + endpoints
- src/parser/gps_extractor.py: Backend GPS extraction (Python)
- scripts/test_gps_extraction.py: Python test suite
- test_gps_extraction.html: Browser test suite

📊 T-Embed Files Updated:
- 34.0478N_118.2348W_1637_raw_8.sub: 315 MHz Princeton
- 34.0478N_118.2349W_1351_raw_10.sub: 433.92 MHz Princeton
- 34.0478N_118.2349W_1650_test_raw.sub: 433.92 MHz RAW
- All now have proper Flipper SubGhz headers

 Tested Features:
- GPS extraction from filename: 34.0478N_118.2349W → 34.0478, -118.2349
- Auto-population of GPS fields in upload form
- File upload with GPS validation
- Capture appears on map after upload
- Statistics update in real-time
- Frequency distribution calculated correctly

🎯 End-to-End Flow Working:
1. User drops .sub file with GPS in filename
2. GPS auto-detected and form fields populate
3. User clicks Upload
4. Server parses RF data + GPS coordinates
5. Capture stored in memory
6. Map refreshes and displays new marker
7. Stats update with new counts

🚀 Demo: http://localhost:8000
Upload 34.0478N_118.2349W_1351_raw_10.sub and watch it appear on map!

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-01-13 18:37:13 -08:00

137 lines
3.9 KiB
Bash
Executable File

#!/bin/bash
# Create giglez repository on Gitea and push
# Based on gitea-command-center pattern
set -e
GREEN='\033[0;32m'
YELLOW='\033[1;33m'
RED='\033[0;31m'
BLUE='\033[0;34m'
NC='\033[0m'
echo -e "${BLUE}🛰️ Creating GigLez Repository on Gitea${NC}"
echo "========================================="
echo ""
# Get token from gopass
echo "Retrieving API token from gopass..."
TOKEN=$(gopass show -o gitea/api-tokens/tea-cli 2>/dev/null)
if [ -z "$TOKEN" ]; then
echo -e "${RED}❌ Token not found in gopass${NC}"
echo "Please setup gopass token first"
exit 1
fi
echo -e "${GREEN}✅ Token retrieved${NC}"
# Get username from API
echo "Getting username..."
USER_INFO=$(curl -sk -H "Authorization: token $TOKEN" https://localhost:3030/api/v1/user)
USERNAME=$(echo "$USER_INFO" | jq -r '.login')
if [ -z "$USERNAME" ] || [ "$USERNAME" = "null" ]; then
echo -e "${RED}❌ Could not get username from API${NC}"
echo "Is Gitea running on localhost:3030?"
echo "Response: $USER_INFO"
exit 1
fi
echo -e "${GREEN}✅ Logged in as: $USERNAME${NC}"
echo ""
# Check if repository exists
echo "Checking if giglez repository exists..."
REPO_CHECK=$(curl -sk -H "Authorization: token $TOKEN" \
https://localhost:3030/api/v1/repos/$USERNAME/giglez)
if echo "$REPO_CHECK" | jq -e '.id' > /dev/null 2>&1; then
echo -e "${YELLOW}⚠️ Repository already exists${NC}"
REPO_EXISTS=true
else
echo -e "${GREEN}✅ Repository doesn't exist, will create${NC}"
REPO_EXISTS=false
fi
# Create repository if it doesn't exist
if [ "$REPO_EXISTS" = false ]; then
echo ""
echo "Creating giglez repository..."
CREATE_RESPONSE=$(curl -sk -X POST \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"name": "giglez",
"description": "IoT RF Device Mapping Platform - Wigle for Sub-GHz Signals",
"private": false,
"default_branch": "main"
}' \
https://localhost:3030/api/v1/user/repos)
if echo "$CREATE_RESPONSE" | jq -e '.id' > /dev/null 2>&1; then
echo -e "${GREEN}✅ Repository created successfully${NC}"
else
echo -e "${RED}❌ Failed to create repository${NC}"
echo "$CREATE_RESPONSE" | jq .
exit 1
fi
fi
echo ""
echo -e "${BLUE}📡 Setting up Git remote${NC}"
echo "================================"
# Get Gitea URL (check for Tailscale or local)
GITEA_URL="https://localhost:3030"
REMOTE_URL="${GITEA_URL}/${USERNAME}/giglez.git"
# Check if origin already exists
if git remote get-url origin > /dev/null 2>&1; then
echo -e "${YELLOW}⚠️ Remote 'origin' already exists${NC}"
CURRENT_ORIGIN=$(git remote get-url origin)
echo " Current: $CURRENT_ORIGIN"
echo " New: $REMOTE_URL"
read -p "Replace origin? (y/n) " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
git remote remove origin
git remote add origin "$REMOTE_URL"
echo -e "${GREEN}✅ Remote 'origin' updated${NC}"
fi
else
git remote add origin "$REMOTE_URL"
echo -e "${GREEN}✅ Remote 'origin' added${NC}"
fi
echo ""
echo -e "${BLUE}🚀 Pushing to Gitea${NC}"
echo "================================"
# Get current branch
CURRENT_BRANCH=$(git branch --show-current)
echo "Current branch: $CURRENT_BRANCH"
# Push
echo "Pushing $CURRENT_BRANCH to origin..."
if git push -u origin "$CURRENT_BRANCH"; then
echo -e "${GREEN}✅ Successfully pushed to Gitea!${NC}"
else
echo -e "${RED}❌ Push failed${NC}"
exit 1
fi
echo ""
echo "========================================="
echo -e "${GREEN}🎉 Repository Setup Complete!${NC}"
echo "========================================="
echo ""
echo "Repository URL: ${GITEA_URL}/${USERNAME}/giglez"
echo "Git Remote: $REMOTE_URL"
echo "Branch: $CURRENT_BRANCH"
echo ""
echo "View your repository:"
echo " ${GITEA_URL}/${USERNAME}/giglez"
echo ""