feat: Add license and attribution routes, update templates and documentation

- Added a new license route to serve the LGPL license text.
- Introduced a new attribution page to acknowledge third-party software used in the project.
- Updated the base HTML template to include a link to the attribution page.
- Included the license router in the main application router.
- Added the license text file for LGPL to the static licenses directory.
- Updated the NOTICE file to include detailed attributions for third-party libraries.
- Added a new requirements-dev.txt for license compliance checking.
- Updated the requirements.txt to clarify the LGPL license for Paramiko.
This commit is contained in:
Christian Krakau-Louis
2025-04-11 02:39:26 +02:00
parent 2a8c45d661
commit 05ede35059
14 changed files with 924 additions and 20 deletions
+2 -8
View File
@@ -176,14 +176,8 @@ class Settings(BaseSettings):
with open(build_date_file, "r") as f:
return f.read().strip()
# If a timestamp file doesn't exist, try to get the app.py creation/modification time
app_file = os.path.join(os.path.dirname(__file__), "app.py")
if os.path.exists(app_file):
timestamp = os.path.getmtime(app_file)
return datetime.fromtimestamp(timestamp).strftime("%B %d, %Y")
# Default to current date if not found elsewhere
return datetime.now().strftime("%B %d, %Y")
# Default to unknown if not found
return "Unknown build date"
# Get version from file or environment
@property
+1
View File
@@ -115,3 +115,4 @@ app.include_router(auth_router)
app.include_router(api_router, prefix="/api")
+18
View File
@@ -0,0 +1,18 @@
from fastapi import APIRouter, HTTPException
from fastapi.responses import PlainTextResponse, HTMLResponse
from pathlib import Path
import os
router = APIRouter()
@router.get("/licenses/lgpl.txt", response_class=PlainTextResponse)
async def get_lgpl_license():
"""
Serve the LGPL license text file
"""
license_path = Path("frontend/static/licenses/lgpl.txt")
if not license_path.exists():
raise HTTPException(status_code=404, detail="License file not found")
with open(license_path, "r") as f:
return f.read()
+7 -10
View File
@@ -1,24 +1,21 @@
"""
Frontend views/pages for the application.
This module combines all the individual view routers into a single router.
Aggregated view routers for the application.
"""
from fastapi import APIRouter
# Import routers from view modules
# Import all the view routers
from app.views.general import router as general_router
from app.views.files import router as files_router
from app.views.status import router as status_router
from app.views.dropbox import router as dropbox_router
from app.views.onedrive import router as onedrive_router
from app.views.dropbox import router as dropbox_router
from app.views.google_drive import router as google_drive_router
from app.views.license_routes import router as license_router # Add the license router
# Create a combined router
# Create a main router that includes all the view routers
router = APIRouter()
# Include all view routers
router.include_router(general_router)
router.include_router(files_router)
router.include_router(status_router)
router.include_router(dropbox_router)
router.include_router(onedrive_router)
router.include_router(dropbox_router)
router.include_router(google_drive_router)
router.include_router(license_router) # Include the license router
+27
View File
@@ -0,0 +1,27 @@
from fastapi import APIRouter, HTTPException, Request
from fastapi.responses import PlainTextResponse, HTMLResponse
from pathlib import Path
import os
from app.views.base import templates, require_login
router = APIRouter()
@router.get("/licenses/lgpl.txt", response_class=PlainTextResponse)
async def get_lgpl_license():
"""
Serve the LGPL license text file
"""
license_path = Path("frontend/static/licenses/lgpl.txt")
if not license_path.exists():
raise HTTPException(status_code=404, detail="License file not found")
with open(license_path, "r") as f:
return f.read()
@router.get("/attribution", response_class=HTMLResponse, include_in_schema=False)
async def serve_attribution(request: Request):
"""
Serve the third-party attribution page
"""
return templates.TemplateResponse("attribution.html", {"request": request})