diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 207a6fd..4882fc5 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -51,12 +51,12 @@ jobs: with: images: ${{ secrets.DOCKERHUB_USERNAME }}/simpleguardhome tags: | + type=raw,value=latest,enable={{is_default_branch}} type=sha,format=long type=ref,event=branch type=ref,event=pr type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} - type=ref,event=latest - name: Build and push uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 diff --git a/README.md b/README.md index a7b5893..77e3690 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,30 @@ -# SimpleGuardHome +

+ SimpleGuardHome Logo +

+ +

SimpleGuardHome

+ +

+ Version 0.1.0 + MIT License + Python 3.9+ +

A modern web application for checking and managing domain filtering in AdGuard Home. Built with FastAPI and modern JavaScript, following the official AdGuard Home OpenAPI specification. +## Quick Start + +```bash +# Using Docker +docker run -d -p 8000:8000 -e ADGUARD_HOST=http://localhost -e ADGUARD_PORT=3000 pacnpal/simpleguardhome:latest + +# Or using Python +pip install simpleguardhome +python -m uvicorn simpleguardhome.main:app --port 8000 +``` + +Then visit `http://localhost:8000` to start managing your AdGuard Home filtering. + ## Features - 🔍 Real-time domain filtering status checks @@ -13,18 +36,79 @@ A modern web application for checking and managing domain filtering in AdGuard H - ⚙️ Environment-based configuration - 📚 Full OpenAPI/Swagger documentation - ✅ Implements official AdGuard Home API spec +- 🐳 Docker support ## Requirements -- Python 3.9 or higher +### System Requirements +- Python 3.9 or higher (for local installation) - Running AdGuard Home instance - AdGuard Home API credentials (if authentication is enabled) +- Docker (optional, for containerized deployment) -## Installation +### Python Dependencies +- FastAPI - Web framework for building APIs +- Uvicorn - ASGI server implementation +- Python-dotenv - Environment variable management +- HTTPX - Modern HTTP client +- Pydantic - Data validation using Python type annotations +- Jinja2 - Template engine for the web interface + +## Docker Installation + +The easiest way to get started is using Docker: + +1. Pull the Docker image: +```bash +docker pull pacnpal/simpleguardhome:latest +``` + +2. Create a `.env` file with your AdGuard Home settings: +```env +ADGUARD_HOST=http://localhost # AdGuard Home host URL +ADGUARD_PORT=3000 # AdGuard Home API port +ADGUARD_USERNAME=admin # Optional: AdGuard Home username +ADGUARD_PASSWORD=password # Optional: AdGuard Home password +``` + +3. Run the container: +```bash +docker run -d \ + --name simpleguardhome \ + -p 8000:8000 \ + --env-file .env \ + pacnpal/simpleguardhome:latest +``` + +The application will be available at `http://localhost:8000` + +### Docker Compose + +Alternatively, you can use Docker Compose. Create a `docker-compose.yml` file: + +```yaml +version: '3' +services: + simpleguardhome: + image: pacnpal/simpleguardhome:latest + container_name: simpleguardhome + ports: + - "8000:8000" + env_file: + - .env + restart: unless-stopped +``` + +Then run: +```bash +docker-compose up -d +``` + +## Local Installation 1. Clone this repository: ```bash -git clone https://github.com/yourusername/simpleguardhome.git +git clone https://github.com/pacnpal/simpleguardhome.git cd simpleguardhome ``` @@ -56,6 +140,7 @@ ADGUARD_PASSWORD=password # Optional: AdGuard Home password ## Running the Application +### Local Development Start the application: ```bash python -m uvicorn src.simpleguardhome.main:app --reload @@ -151,9 +236,13 @@ simpleguardhome/ │ ├── adguard.py # AdGuard Home API client │ └── templates/ │ └── index.html # Web interface +├── static/ +│ └── simpleguardhome.png # Project logo ├── requirements.txt ├── setup.py ├── .env.example +├── Dockerfile +├── docker-compose.yml └── README.md ``` @@ -182,4 +271,4 @@ simpleguardhome/ ## License -MIT License - See LICENSE file for details +MIT License - See LICENSE file for details \ No newline at end of file diff --git a/src/simpleguardhome/favicon.ico b/src/simpleguardhome/favicon.ico new file mode 100644 index 0000000..762d786 Binary files /dev/null and b/src/simpleguardhome/favicon.ico differ diff --git a/src/simpleguardhome/main.py b/src/simpleguardhome/main.py index d02332d..1cf4f6d 100644 --- a/src/simpleguardhome/main.py +++ b/src/simpleguardhome/main.py @@ -44,10 +44,16 @@ app.add_middleware( expose_headers=["X-Request-ID"] ) -# Setup templates directory +# Setup templates and static directories templates_path = Path(__file__).parent / "templates" templates = Jinja2Templates(directory=str(templates_path)) +# Mount static files from package directory +app.mount("/static", StaticFiles(directory=str(Path(__file__).parent)), name="static") + +# Mount favicon.ico at root +app.mount("/favicon.ico", StaticFiles(directory=str(Path(__file__).parent), files={"favicon.ico": "favicon.ico"}), name="favicon") + # Response models matching AdGuard spec class ErrorResponse(BaseModel): """Error response model according to AdGuard spec.""" diff --git a/static/simpleguardhome.png b/static/simpleguardhome.png new file mode 100644 index 0000000..e79a7e7 Binary files /dev/null and b/static/simpleguardhome.png differ