mirror of
https://github.com/myronblair/epic-download
synced 2026-06-30 17:51:00 -05:00
Auto-generated changes
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
{
|
||||
"env_image_name": "fastapi_react_mongo_shadcn_base_image_cloud_arm:release-03032026-1"
|
||||
"env_image_name": "fastapi_react_mongo_shadcn_base_image_cloud_arm:release-03032026-1",
|
||||
"job_id": "9e069d60-3427-465f-91df-8499645b62a7",
|
||||
"created_at": "2026-05-06T03:53:16.075091+00:00Z"
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
[user]
|
||||
email = github@emergent.sh
|
||||
name = emergent-agent-e1
|
||||
+9
-1
@@ -77,4 +77,12 @@ agenthub/agents/youtube/db
|
||||
.cache/
|
||||
|
||||
# Mobile development
|
||||
android-sdk/
|
||||
android-sdk/ -e
|
||||
# Environment and credential files
|
||||
.env
|
||||
.env.*
|
||||
*.env
|
||||
credentials.json
|
||||
*.pem
|
||||
*.key
|
||||
.credentials
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from fastapi.responses import FileResponse
|
||||
from pathlib import Path
|
||||
import os
|
||||
|
||||
router = APIRouter(prefix="/api/download", tags=["Downloads"])
|
||||
|
||||
# Package directory
|
||||
PACKAGE_DIR = Path("/app/cpanel_deployment")
|
||||
|
||||
@router.get("/package/{format}")
|
||||
async def download_package(format: str):
|
||||
"""
|
||||
Download the cPanel deployment package
|
||||
Formats: tar.gz or zip
|
||||
"""
|
||||
# Find the package file
|
||||
if format == "tar.gz":
|
||||
pattern = "epic-travel-cpanel-*.tar.gz"
|
||||
elif format == "zip":
|
||||
pattern = "epic-travel-cpanel-*.zip"
|
||||
else:
|
||||
raise HTTPException(status_code=400, detail="Invalid format. Use 'tar.gz' or 'zip'")
|
||||
|
||||
# Find the latest package
|
||||
import glob
|
||||
files = glob.glob(str(PACKAGE_DIR / pattern))
|
||||
|
||||
if not files:
|
||||
raise HTTPException(status_code=404, detail="Package not found")
|
||||
|
||||
# Get the most recent file
|
||||
latest_file = max(files, key=os.path.getctime)
|
||||
file_path = Path(latest_file)
|
||||
|
||||
if not file_path.exists():
|
||||
raise HTTPException(status_code=404, detail="Package file not found")
|
||||
|
||||
# Determine media type
|
||||
media_type = "application/gzip" if format == "tar.gz" else "application/zip"
|
||||
|
||||
return FileResponse(
|
||||
path=str(file_path),
|
||||
media_type=media_type,
|
||||
filename=file_path.name,
|
||||
headers={
|
||||
"Content-Disposition": f"attachment; filename={file_path.name}"
|
||||
}
|
||||
)
|
||||
|
||||
@router.get("/list")
|
||||
async def list_packages():
|
||||
"""
|
||||
List available deployment packages
|
||||
"""
|
||||
import glob
|
||||
|
||||
packages = []
|
||||
|
||||
# Find all package files
|
||||
for pattern in ["*.tar.gz", "*.zip"]:
|
||||
files = glob.glob(str(PACKAGE_DIR / pattern))
|
||||
for file_path in files:
|
||||
file_stat = os.stat(file_path)
|
||||
packages.append({
|
||||
"filename": Path(file_path).name,
|
||||
"size": f"{file_stat.st_size / 1024:.0f} KB",
|
||||
"format": "tar.gz" if file_path.endswith(".tar.gz") else "zip",
|
||||
"download_url": f"/api/download/package/{'tar.gz' if file_path.endswith('.tar.gz') else 'zip'}"
|
||||
})
|
||||
|
||||
return {
|
||||
"packages": packages,
|
||||
"total": len(packages)
|
||||
}
|
||||
+2
-1
@@ -9,7 +9,7 @@ from auth import hash_password
|
||||
from datetime import datetime
|
||||
|
||||
# Import route modules
|
||||
from routes import auth_routes, destination_routes, special_routes, other_routes
|
||||
from routes import auth_routes, destination_routes, special_routes, other_routes, download_routes
|
||||
|
||||
ROOT_DIR = Path(__file__).parent
|
||||
load_dotenv(ROOT_DIR / '.env')
|
||||
@@ -33,6 +33,7 @@ app.include_router(auth_routes.router)
|
||||
app.include_router(destination_routes.router)
|
||||
app.include_router(special_routes.router)
|
||||
app.include_router(other_routes.router)
|
||||
app.include_router(download_routes.router)
|
||||
|
||||
# Health check endpoint
|
||||
@app.get("/api")
|
||||
|
||||
Reference in New Issue
Block a user