mirror of
https://github.com/tcsenpai/pensieve.git
synced 2025-06-06 03:05:25 +00:00
feat: no auth by default
This commit is contained in:
parent
bdac92fb34
commit
e889aa86de
@ -70,8 +70,8 @@ class Settings(BaseSettings):
|
||||
# Embedding settings
|
||||
embedding: EmbeddingSettings = EmbeddingSettings()
|
||||
|
||||
auth_username: str = "admin"
|
||||
auth_password: SecretStr = SecretStr("changeme")
|
||||
auth_username: str = ""
|
||||
auth_password: SecretStr = SecretStr("")
|
||||
|
||||
default_plugins: List[str] = ["builtin_ocr"]
|
||||
|
||||
|
@ -6,8 +6,10 @@ screenshots_dir: screenshots
|
||||
server_host: 0.0.0.0
|
||||
server_port: 8839
|
||||
|
||||
auth_username: admin
|
||||
auth_password: changeme
|
||||
# Enable authentication by uncommenting the following lines
|
||||
# auth_username: admin
|
||||
# auth_password: changeme
|
||||
|
||||
default_plugins:
|
||||
- builtin_ocr
|
||||
# - builtin_vlm
|
||||
|
@ -96,6 +96,7 @@ def is_auth_enabled():
|
||||
|
||||
def authenticate(credentials: HTTPBasicCredentials = Depends(security)):
|
||||
if not is_auth_enabled():
|
||||
logging.info("Authentication is disabled - no username/password configured")
|
||||
return None
|
||||
correct_username = compare_digest(credentials.username, settings.auth_username)
|
||||
correct_password = compare_digest(
|
||||
@ -117,7 +118,7 @@ def optional_auth(credentials: HTTPBasicCredentials = Depends(security)):
|
||||
|
||||
|
||||
@app.get("/")
|
||||
async def serve_spa():
|
||||
async def serve_spa(username: str = Depends(optional_auth)):
|
||||
return FileResponse(os.path.join(current_dir, "static/app.html"))
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user