Skip to content

Rewrite application structure and dependencies#11

Open
justinh-rahb wants to merge 3 commits intomasterfrom
ota-refac
Open

Rewrite application structure and dependencies#11
justinh-rahb wants to merge 3 commits intomasterfrom
ota-refac

Conversation

@justinh-rahb
Copy link
Copy Markdown
Collaborator

Revamp the application by transitioning to a Svelte frontend and a FastAPI backend. Update dependencies and remove outdated scripts and configurations. Introduce a new Docker setup for streamlined development and deployment.

@justinh-rahb justinh-rahb requested a review from Copilot May 21, 2025 19:38
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Revamp the application by replacing the Flask backend with a FastAPI service, introducing a Svelte frontend, and streamlining development/deployment with Docker. Key changes include:

  • Transition from Flask to FastAPI with modular routers (api, devices, firmware)
  • Addition of core utility functions and Pydantic models in backend/app/utils.py and backend/app/models
  • Updated documentation and removal of legacy Flask scripts, plus new Docker Compose setup

Reviewed Changes

Copilot reviewed 51 out of 51 changed files in this pull request and generated no comments.

Show a summary per file
File Description
ota-server/config.json.example Removed outdated JSON config example
ota-server/backend/requirements.txt Added FastAPI-related dependencies
ota-server/backend/app/utils.py Introduced utility functions (version, MAC, MD5)
ota-server/backend/app/routers Implemented new API endpoints
ota-server/backend/app/models Defined Pydantic schemas for devices/firmware
ota-server/backend/app/main.py Bootstraps FastAPI app with CORS and static mounts
ota-server/backend/app/config.py Switched to environment-driven settings
ota-server/backend/app/auth.py Authentication logic for admin and device routes
ota-server/app.py & admin_tools.py Removed legacy Flask app and CLI
ota-server/README.md Updated docs for FastAPI, Svelte, and Docker
ota-server/Dockerfile Removed old Dockerfile (moved to docker/)
ota-server/.gitignore Cleaned up extra ignores (added Node.js)
Comments suppressed due to low confidence (5)

ota-server/backend/app/routers/devices.py:8

  • The calculate_file_md5 import is not used in this file and should be removed to keep imports clean.
from app.utils import (get_devices, get_device, update_device, delete_device, validate_mac_address, format_mac_address, calculate_file_md5)

ota-server/backend/app/utils.py:21

  • The new utility functions (e.g., generate_auth_token, compare_versions, calculate_file_md5) lack accompanying unit tests. Consider adding test cases to cover edge cases and ensure correct behavior.
"""

ota-server/backend/app/auth.py:43

  • The verify_device_auth dependency declares a mac_address parameter but never extracts it from the request (e.g., via Query). As written, mac_address is always None and authentication will always fail. Update the signature to something like:
async def verify_device_auth(
    auth_token: str = Depends(DEVICE_AUTH_HEADER),
    mac_address: str = Query(..., alias="mac")
) -> bool:
async def verify_device_auth(

ota-server/README.md:42

  • The .env example includes OTA_SERVER_UI_PORT, but the Settings class in config.py does not define this variable. Either remove it from the docs or add it to your settings model.
OTA_SERVER_UI_PORT=80

ota-server/README.md:26

  • The repository URL in the clone command appears to point at panic-button-esp.git instead of this OTA server project. Update the URL to the correct repo path.
git clone https://github.com/RAHB-REALTORS-Association/panic-button-esp.git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants