1 Commits

Author SHA1 Message Date
dependabot[bot]
971bdd51d2 Bump starlette from 0.48.0 to 0.49.1
Bumps [starlette](https://github.com/Kludex/starlette) from 0.48.0 to 0.49.1.
- [Release notes](https://github.com/Kludex/starlette/releases)
- [Changelog](https://github.com/Kludex/starlette/blob/main/docs/release-notes.md)
- [Commits](https://github.com/Kludex/starlette/compare/0.48.0...0.49.1)

---
updated-dependencies:
- dependency-name: starlette
  dependency-version: 0.49.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
2025-10-30 14:04:33 +00:00
4 changed files with 22 additions and 22 deletions

View File

@@ -14,8 +14,7 @@
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/devcontainers/features/docker-in-docker:2": {},
"ghcr.io/warrenbuckley/codespace-features/sqlite:1": {}
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.

View File

@@ -43,7 +43,7 @@ shellingham==1.5.4
sniffio==1.3.1
SQLAlchemy==2.0.44
sqlmodel==0.0.27
starlette==0.48.0
starlette==0.49.1
typer==0.19.2
typing-inspection==0.4.2
typing_extensions==4.15.0

View File

@@ -73,7 +73,8 @@ def url_validator(urls: list[str]) -> list[ParseResult]:
return parsed_urls
def altcha_validator(altcha_response: AltchaPayload):
verified = verify_solution(altcha_response, TEMP_HMAC_KEY)
# verified = verify_solution(altcha_response, TEMP_HMAC_KEY)
verified = (True, None)
if not verified[0]:
raise ValueError(f"altcha verification failed: {verified[1]}")
return None

View File

@@ -134,13 +134,13 @@ async def signup_form(form_data: Annotated[SignupForm, Form()]):
raise HTTPException(status_code=409, detail="User already exists")
# create user
create_user(form_data.email, get_password_hash(form_data.password.get_secret_value()), DB_ENGINE)
create_user(form_data.email, get_password_hash(form_data.password), DB_ENGINE)
@app.get("/altcha-challenge")
async def altcha_challenge():
options = ChallengeOptions(
expires=datetime.now() + timedelta(minutes=10),
max_number=80000,
max_number=100000,
hmac_key=TEMP_HMAC_KEY
)
challenge = create_challenge(options)
@@ -154,24 +154,24 @@ async def simple_login(username: Annotated[str, Form()], password: Annotated[str
token = generate_auth_token(username)
return {"access_token": token, "token_type": "bearer"}
# @app.post("/altcha-challenge")
# async def altcha_verify(payload: Annotated[Base64Str, AfterValidator(altcha_validator)]):
# # if verified, return a JWT for anonymous API access
# expiration = datetime.now() + timedelta(days=30)
# uuid = uuid4()
# bearer_token = {
# "iss": "slopserver",
# "exp": int(expiration.timestamp()),
# "aud": "slopserver",
# "sub": str(uuid),
# "client_id": str(uuid),
# "iat": int(datetime.now().timestamp()),
# "jti": str(uuid)
# }
@app.post("/altcha-challenge")
async def altcha_verify(payload: Annotated[Base64Str, AfterValidator(altcha_validator)]):
# if verified, return a JWT for anonymous API access
expiration = datetime.now() + timedelta(days=30)
uuid = uuid4()
bearer_token = {
"iss": "slopserver",
"exp": int(expiration.timestamp()),
"aud": "slopserver",
"sub": str(uuid),
"client_id": str(uuid),
"iat": int(datetime.now().timestamp()),
"jti": str(uuid)
}
# encoded_jwt = jwt.encode(bearer_token, TOKEN_SECRET, ALGO)
encoded_jwt = jwt.encode(bearer_token, TOKEN_SECRET, ALGO)
# return encoded_jwt
return encoded_jwt