Merge pull request #29 from Moonlite-Media/adding-listen-on-run

Adding listen on run
This commit is contained in:
Darrel Pol 2024-11-04 21:28:40 -06:00 committed by GitHub
commit c132e19c15
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 3 additions and 5 deletions

View file

@ -56,4 +56,4 @@ RUN pip install --no-cache-dir -r requirements.txt
RUN pip install --no-cache-dir python-dotenv insightface
# Run the application
CMD ["python", "launch.py", "--nowebui", "--deforum-api", "--api", "--port", "7861"]
CMD ["python", "launch.py", "--nowebui", "--deforum-api", "--listen", "--api", "--port", "7861"]

View file

@ -13,7 +13,6 @@ class BasicAuthMiddleware(BaseHTTPMiddleware):
async def dispatch(self, request, call_next):
# Extract the Authorization header
logger.warning(f"{request.headers}")
auth_header = request.headers.get("Authorization") or request.headers.get("authorization")
if not auth_header or not auth_header.startswith("Basic "):
return self._unauthorized_response()
@ -24,7 +23,6 @@ class BasicAuthMiddleware(BaseHTTPMiddleware):
# We should add a step to santize the input here
decoded_credentials = base64.b64decode(encoded_credentials).decode("utf-8")
provided_username, provided_password = decoded_credentials.split(":")
logger.warning(f"provided_username: {provided_username}: provided_password: {provided_password}")
# Check credentials
if provided_username == self.username and provided_password == self.password:

View file

@ -40,8 +40,8 @@ def api_only():
from basic_auth_middleware import BasicAuthMiddleware
USERNAME = os.getenv('SDAPI_USERNAME')
PASSWORD = os.getenv('SDAPI_PASSWORD')
logger.warning(f"{USERNAME}:{PASSWORD}")
app.add_middleware(BasicAuthMiddleware, username="administrator", password="vY0WFuGCpL3lILb74ZzMCbSAL10x5V")
app.add_middleware(BasicAuthMiddleware, username=USERNAME, password=PASSWORD)
initialize_util.setup_middleware(app)
api = create_api(app)