From 08f8b32d3189e37659313683b27d83529a006b51 Mon Sep 17 00:00:00 2001 From: GiZano <136728817+GiZano@users.noreply.github.com> Date: Thu, 17 Sep 2026 21:34:04 +0200 Subject: [PATCH 1/2] docs(web): Add explanation video to landing page (#427) * refactor(simulator): migrate command center to tmux and clean hollywood script - Replaced ptyxis with a unified tmux grid in quakeguard_init.sh - Removed unused legacy comments from hollywood.py - Updated PR body documentation with latest changes * docs(web): add explanation video section to the landing page * fix(ci): add explicit returns and restrict pip execution for SonarCloud --- .github/workflows/backend-ci.yml | 2 +- .github/workflows/iot-ci.yml | 2 +- docs/web/quakeguard.html | 13 ++- docs/web/quakeguard.js | 2 + pr_body.md | 2 + scripts/hollywood.py | 6 +- scripts/quakeguard_init.sh | 191 ++++++++++++++++++++----------- 7 files changed, 142 insertions(+), 76 deletions(-) diff --git a/.github/workflows/backend-ci.yml b/.github/workflows/backend-ci.yml index 4dd98df5..8ab424d5 100644 --- a/.github/workflows/backend-ci.yml +++ b/.github/workflows/backend-ci.yml @@ -39,7 +39,7 @@ jobs: - name: Install Python Dependencies & Security Tools run: | - python -m pip install pip==24.0 + python -m pip install --only-binary :all: pip==24.0 pip install --only-binary :all: bandit==1.8.3 safety==3.3.1 pytest==8.3.4 httpx==0.28.1 pytest-asyncio==0.25.3 if [ -f backend/requirements.txt ]; then pip install --only-binary :all: --require-hashes -r backend/requirements.txt; fi diff --git a/.github/workflows/iot-ci.yml b/.github/workflows/iot-ci.yml index aa781579..50b8bd51 100644 --- a/.github/workflows/iot-ci.yml +++ b/.github/workflows/iot-ci.yml @@ -38,7 +38,7 @@ jobs: - name: Install PlatformIO CLI run: | - python -m pip install pip==24.0 + python -m pip install --only-binary :all: pip==24.0 pip install --only-binary :all: platformio==6.1.19 - name: Inject CI Environment Variables diff --git a/docs/web/quakeguard.html b/docs/web/quakeguard.html index f6ad75bf..d1fc998f 100644 --- a/docs/web/quakeguard.html +++ b/docs/web/quakeguard.html @@ -937,12 +937,19 @@

The experience

Watch the demo with captions available in English and Italian.

-
-
-
+
+
+

Trailer

+
+
+

Explanation

+
+ +
+
diff --git a/docs/web/quakeguard.js b/docs/web/quakeguard.js index 97335a3f..945020d8 100644 --- a/docs/web/quakeguard.js +++ b/docs/web/quakeguard.js @@ -177,6 +177,8 @@ window.I18N_DATA = (function () { exp_eyebrow: { en: 'See it in action', it: 'Vedilo in azione' }, exp_title: { en: 'The experience', it: 'L\u2019esperienza' }, exp_note: { en: 'Watch the demo with captions available in English and Italian.', it: 'Guarda la demo con i sottotitoli disponibili in italiano e inglese.' }, + exp_trailer_title: { en: 'Trailer', it: 'Trailer' }, + exp_explanation_title: { en: 'Explanation', it: 'Spiegazione' }, contact_title: { en: 'Contribute or collaborate', it: 'Contribuisci o collabora' }, contact_p: { en: 'QuakeGuard is open source and community-driven. Ideas, issues and pull requests are always welcome.', it: 'QuakeGuard รจ open source e guidato dalla community: idee, segnalazioni e pull request sono sempre benvenute.' }, contact_open: { en: 'Open the repository', it: 'Apri il repository' }, diff --git a/pr_body.md b/pr_body.md index 844dc9f7..5edccea4 100644 --- a/pr_body.md +++ b/pr_body.md @@ -8,6 +8,8 @@ This PR finalizes the `v2.1.1` release for QuakeGuard. It corrects critical bugs * **`docs/whitepaper/16-appendix.typ` & `QuakeGuard_Technical_Report_v2.1.1.pdf`**: Rewrote Appendix A to fully document the cascade effect of the demo endpoint (DB inserts, AI Worker trigger, fake telemetry generation). Re-compiled the Typst whitepaper. * **Repository-wide Version Bump**: Systematically updated all versions from `2.1.0` to `2.1.1` across `package.json`, `.cff`, `.js`, `settings.tsx`, OpenAPI docs, SVGs, and `CHANGELOG.md`. Also removed a ghost "Timeseries" roadmap item that was already completed in v1.2.1. * **`backend/tests/unit/test_schemas.py`**: Fixed a failing unit test asserting the old `7.5` magnitude default. All 157 tests now pass. +* **`scripts/hollywood.py`**: Refactored sensor generation by introducing a `SENSORS_PER_CITY` constant, removed legacy variables, and cleaned up unused comments. +* **`scripts/quakeguard_init.sh`**: Replaced the multi-window `ptyxis` startup with a unified `tmux` dashboard grid for better UX, consolidating Backend, Mobile, and IoT panes into a single terminal window with mouse support. ## Impact & Next Steps This ensures the QuakeGuard demo functionality is statistically robust, spatially accurate, and safely bounded for public exhibitions. It also guarantees a completely clean `v2.1.1` release with no mismatched tags or documentation ghosts. diff --git a/scripts/hollywood.py b/scripts/hollywood.py index ef756f79..b02fd342 100644 --- a/scripts/hollywood.py +++ b/scripts/hollywood.py @@ -23,7 +23,7 @@ MQTT_USERNAME = os.getenv("MQTT_USERNAME", None) MQTT_PASSWORD = os.getenv("MQTT_PASSWORD", None) -NUM_SENSORS = 50 +SENSORS_PER_CITY = 7 FLEET_FILE = os.path.join(os.path.dirname(__file__), "fleet.json") CITIES = { @@ -193,7 +193,7 @@ async def _register_fleet(): sensors = [] print("๐Ÿญ Generating new global fleet...") for city_name in CITIES.keys(): - for _ in range(7): + for _ in range(SENSORS_PER_CITY): base_lat, base_lon = CITIES[city_name] lat = base_lat + (-0.1 + secrets.SystemRandom().random() * (0.1 - -0.1)) # NOSONAR - geographic jitter, not cryptographic lon = base_lon + (-0.1 + secrets.SystemRandom().random() * (0.1 - -0.1)) # NOSONAR - geographic jitter, not cryptographic @@ -265,4 +265,4 @@ async def main(): print(f"โŒ MQTT Connection Error: {e}") if __name__ == "__main__": - asyncio.run(main()) + asyncio.run(main()) \ No newline at end of file diff --git a/scripts/quakeguard_init.sh b/scripts/quakeguard_init.sh index 793dbe38..fc75ce85 100755 --- a/scripts/quakeguard_init.sh +++ b/scripts/quakeguard_init.sh @@ -1,66 +1,149 @@ #!/bin/bash +# ============================================================================== +# CONSOLE MODE: Executed ONLY in the Top-Right pane +# ============================================================================== +if [[ "$1" == "--console" ]]; then + SESSION="quakeguard-cc" + PROJECT_ROOT="$2" + + # Function to print the QR Code + print_qr() { + if [[ -f /tmp/qg_tunnel_output.log ]]; then + cat /tmp/qg_tunnel_output.log + echo "---------------------------------------------------------" + else + echo "โŒ No QR Code found in /tmp/qg_tunnel_output.log" + fi + return 0 + } + + # Function to print the Menu + print_menu() { + echo "โœ… QuakeGuard Command Center Active!" + echo "๐Ÿ”— Quick Links:" + echo " - ๐Ÿ“š Swagger API: http://localhost:8000/docs" + echo " - ๐Ÿ“Š Grafana: http://localhost:3000" + echo "" + echo "๐ŸŽ›๏ธ Available commands:" + echo " 'backend' -> Restart Docker (Top-Left)" + echo " 'mobile' -> Restart Expo (Bottom-Left)" + echo " 'iot' -> Restart ESP32 (Bottom-Right)" + echo " 'hollywood' -> Launch/Restart Hollywood (Hidden Tab #1)" + echo " 'qr' -> Show Cloudflare tunnel QR Code" + echo " 'help/menu' -> Show this command list" + echo " 'exit' -> Close everything and exit" + echo "" + return 0 + } + + clear + print_qr + print_menu + + while true; do + read -p "QuakeGuard> " cmd + case "$cmd" in + backend) + tmux send-keys -t $SESSION:0.0 C-c + tmux send-keys -t $SESSION:0.0 "docker compose --profile ai up --build" C-m + echo "๐Ÿš€ Backend restarted." + ;; + mobile) + tmux send-keys -t $SESSION:0.1 C-c + tmux send-keys -t $SESSION:0.1 "npx expo start --clear" C-m + echo "๐Ÿš€ Mobile (Expo) restarted." + ;; + iot) + tmux send-keys -t $SESSION:0.3 C-c + tmux send-keys -t $SESSION:0.3 "pio run -t upload -t monitor" C-m + echo "๐Ÿš€ Firmware restarted." + ;; + hollywood) + tmux kill-window -t $SESSION:1 2>/dev/null + tmux new-window -t $SESSION -n "Hollywood" "cd '$PROJECT_ROOT' && ./scripts/hollywood.sh" + tmux select-window -t $SESSION:0 + echo "๐Ÿš€ Hollywood Simulator launched! (Press Ctrl+B, then 1 to view. Ctrl+B, then 0 to return)." + ;; + qr) + clear + print_qr + ;; + help|menu) + print_menu + ;; + exit|quit) + echo "๐Ÿ‘‹ Closing Command Center..." + tmux kill-session -t $SESSION 2>/dev/null + break + ;; + *) + if [[ -n "$cmd" ]]; then + echo "โŒ Unknown command. Type 'help' or 'menu' for the command list." + fi + ;; + esac + done + exit 0 +fi + +# ============================================================================== +# STANDARD MODE: Environment setup and Tmux grid generation +# ============================================================================== + echo "๐Ÿš€ Initializing QuakeGuard Command Center..." -# Get absolute paths dynamically based on script location SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" PROJECT_ROOT="$(cd "$SCRIPT_DIR/.." && pwd)" -# Auto-generate secrets on first boot if [[ ! -f "$PROJECT_ROOT/backend/.env" ]]; then echo "โš ๏ธ First boot detected: backend/.env not found." - echo "๐Ÿ” Running secret generator to provision fresh .env files..." + echo "๐Ÿ” Running secret generator..." "$SCRIPT_DIR/generate_secrets.sh" echo "" fi +# Capture the tunnel output (including QR) into the temporary file echo "๐ŸŒ Running tunnel automation..." -"$SCRIPT_DIR/tunnel_init.sh" -if [[ $? -ne 0 ]]; then +"$SCRIPT_DIR/tunnel_init.sh" | tee /tmp/qg_tunnel_output.log +if [[ ${PIPESTATUS[0]} -ne 0 ]]; then echo "โŒ Tunnel script failed. Aborting." exit 1 fi echo "" -echo "๐Ÿ–ฅ๏ธ Opening 3 separate terminal windows (Ptyxis)..." +echo "๐Ÿ–ฅ๏ธ Transforming current terminal into the Tmux dashboard..." -# 1. Backend Window -ptyxis --new-window -d "$PROJECT_ROOT/backend" -T "Backend (Docker)" -- bash -c "echo '=== BACKEND (Docker) ==='; docker compose --profile ai up --build; exec bash" & +SESSION="quakeguard-cc" +tmux kill-session -t $SESSION 2>/dev/null -# 2. Mobile Window -# Adding a small delay so windows don't overlap completely at spawn -sleep 0.5 -ptyxis --new-window -d "$PROJECT_ROOT/mobile" -T "Mobile (Expo)" -- bash -c "echo '=== MOBILE (Expo) ==='; npx expo start --clear; exec bash" & +# 1. Pane 0: Backend (Top-Left) +tmux new-session -d -s $SESSION -c "$PROJECT_ROOT/backend" +tmux send-keys -t $SESSION:0.0 "echo '=== BACKEND (Docker) ===' && docker compose --profile ai up --build" C-m -# 3. Firmware Window (Wait 30s for the Backend to be fully ready) -sleep 0.5 -ptyxis --new-window -d "$PROJECT_ROOT/firmware" -T "IoT (ESP32)" -- bash -c "echo '=== IoT (ESP32) ==='; echo 'โณ Waiting 30 seconds for the backend to start...'; sleep 30; echo '๐Ÿš€ Flashing new firmware with updated Cloudflare URL...'; pio run -t upload -t monitor; exec bash" & +# ๐Ÿ“Œ ENABLE MOUSE SUPPORT IN TMUX (For scrolling and pane selection) +tmux set-option -g mouse on -echo "" -read -p "๐ŸŽฌ Do you want to start the Hollywood Simulator for Grafana? [y/N]: " run_hollywood -if [[ "$run_hollywood" =~ ^[Yy]$ ]]; then - echo "๐ŸŽฅ Hollywood Simulator will launch in a new terminal..." - sleep 0.5 - ptyxis --new-window -d "$PROJECT_ROOT" -T "Hollywood (Demo)" -- bash -c "echo '=== HOLLYWOOD SIMULATOR ==='; echo 'โณ Waiting 20 seconds for the backend to start...'; sleep 20; ./scripts/hollywood.sh; exec bash" & -fi +# Split in half (Creates the Right side) +tmux split-window -h -t $SESSION -c "$PROJECT_ROOT" -echo "" -echo "โœ… All terminals launched successfully!" -echo "" -echo "๐Ÿ”— QuakeGuard Command Center Links:" -echo " - ๐Ÿ“š Swagger API Docs: http://localhost:8000/docs" -echo " - ๐Ÿ“Š Grafana Dashboard: http://localhost:3000" -echo "" -echo "๐ŸŽ›๏ธ Command Center Console is active." -echo "Type a command to restart a component if a terminal was accidentally closed:" -echo " 'backend' -> Relaunch Backend (Docker)" -echo " 'mobile' -> Relaunch Mobile (Expo)" -echo " 'iot' -> Relaunch Firmware (ESP32)" -echo " 'hollywood' -> Relaunch Hollywood Simulator" -echo " 'exit' -> Close this Command Center" -echo "" +# 2. Split the Left half in two -> Pane 1: Mobile (Bottom-Left) +tmux select-pane -t $SESSION:0.0 +tmux split-window -v -t $SESSION:0.0 -c "$PROJECT_ROOT/mobile" +tmux send-keys -t $SESSION:0.1 "echo '=== MOBILE (Expo) ===' && npx expo start --clear" C-m + +# 3. Split the Right half in two -> Pane 3: IoT (Bottom-Right) +tmux select-pane -t $SESSION:0.2 +tmux split-window -v -t $SESSION:0.2 -c "$PROJECT_ROOT/firmware" +tmux send-keys -t $SESSION:0.3 "echo '=== IoT (ESP32) ===' && echo 'โณ Waiting 30s...' && sleep 30 && pio run -t upload -t monitor" C-m + +# 4. Pane 2 (Top-Right): Start the interactive Console +tmux send-keys -t $SESSION:0.2 "\"$BASH_SOURCE\" --console \"$PROJECT_ROOT\"" C-m + +# Set final focus on the Console (Top-Right) +tmux select-pane -t $SESSION:0.2 -# Background job to wait for Grafana and open it (silenced output to not mess up the prompt) +# Background job to open Grafana ( for i in {1..30}; do if curl -s http://localhost:3000/login > /dev/null; then @@ -75,33 +158,5 @@ echo "" done ) & -while true; do - read -p "QuakeGuard> " cmd - case "$cmd" in - backend) - ptyxis --new-window -d "$PROJECT_ROOT/backend" -T "Backend (Docker)" -- bash -c "echo '=== BACKEND (Docker) ==='; docker compose --profile ai up --build; exec bash" & - echo "๐Ÿš€ Relaunched Backend window." - ;; - mobile) - ptyxis --new-window -d "$PROJECT_ROOT/mobile" -T "Mobile (Expo)" -- bash -c "echo '=== MOBILE (Expo) ==='; npx expo start --clear; exec bash" & - echo "๐Ÿš€ Relaunched Mobile window." - ;; - iot) - ptyxis --new-window -d "$PROJECT_ROOT/firmware" -T "IoT (ESP32)" -- bash -c "echo '=== IoT (ESP32) ==='; pio run -t upload -t monitor; exec bash" & - echo "๐Ÿš€ Relaunched Firmware window." - ;; - hollywood) - ptyxis --new-window -d "$PROJECT_ROOT" -T "Hollywood (Demo)" -- bash -c "echo '=== HOLLYWOOD SIMULATOR ==='; ./scripts/hollywood.sh; exec bash" & - echo "๐Ÿš€ Relaunched Hollywood Simulator window." - ;; - exit|quit) - echo "๐Ÿ‘‹ Closing Command Center. Goodbye!" - break - ;; - *) - if [[ -n "$cmd" ]]; then - echo "โŒ Unknown command. Available: backend, mobile, iot, hollywood, exit" - fi - ;; - esac -done +# Attach the terminal to the Tmux session +exec tmux attach-session -t $SESSION \ No newline at end of file From 5ebcb31cea8312fde468d87d9dd47be4e13d01ea Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Thu, 17 Sep 2026 19:36:09 +0000 Subject: [PATCH 2/2] chore(ci): bump actions/upload-artifact from 4.6.2 to 7.0.1 Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.6.2 to 7.0.1. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/ea165f8d65b6e75b540449e92b4886f43607fa02...043fb46d1a93c77aae656e7c1c64a875d1fc6a0a) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: 7.0.1 dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/release-apk.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release-apk.yml b/.github/workflows/release-apk.yml index cfc1ea38..37222afa 100644 --- a/.github/workflows/release-apk.yml +++ b/.github/workflows/release-apk.yml @@ -54,7 +54,7 @@ jobs: run: cp android/app/build/outputs/apk/release/app-release.apk ./QuakeGuard.apk - name: Upload APK as Workflow Artifact (For PRs/Testing) - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 + uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a with: name: QuakeGuard-APK path: mobile/QuakeGuard.apk