use renovate instead of dependabot

This commit is contained in:
Thephaseless 2024-11-28 12:33:04 +00:00
parent dfea0a806a
commit f051597902
4 changed files with 33 additions and 22 deletions

View File

@ -1,16 +0,0 @@
# To get started with Dependabot version updates, you'll need to specify which
# package ecosystems to update and where the package manifests are located.
# Please see the documentation for more information:
# https://docs.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
# https://containers.dev/guide/dependabot
version: 2
updates:
- package-ecosystem: "devcontainers"
directory: "/"
schedule:
interval: weekly
- package-ecosystem: github-actions
directory: ".github/workflows/"
schedule:
interval: weekly

20
main.py
View File

@ -4,7 +4,7 @@ import logging
import time import time
from http import HTTPStatus from http import HTTPStatus
import uvicorn.config import uvicorn
from bs4 import BeautifulSoup from bs4 import BeautifulSoup
from fastapi import FastAPI, HTTPException from fastapi import FastAPI, HTTPException
from fastapi.responses import RedirectResponse from fastapi.responses import RedirectResponse
@ -72,9 +72,7 @@ def read_item(request: LinkRequest):
if title_tag and title_tag.string in src.utils.consts.CHALLENGE_TITLES: if title_tag and title_tag.string in src.utils.consts.CHALLENGE_TITLES:
sb.save_screenshot(f"./screenshots/{request.url}.png") sb.save_screenshot(f"./screenshots/{request.url}.png")
raise HTTPException( raise_captcha_bypass_error()
status_code=500, detail="Could not bypass challenge"
)
response = LinkResponse( response = LinkResponse(
message="Success", message="Success",
@ -95,5 +93,19 @@ def read_item(request: LinkRequest):
return response return response
def raise_captcha_bypass_error():
"""
Raise a 500 error if the challenge could not be bypassed.
This function should be called if the challenge is not bypassed after
clicking the captcha.
Returns:
None
"""
raise HTTPException(status_code=500, detail="Could not bypass challenge")
if __name__ == "__main__": if __name__ == "__main__":
uvicorn.run(app, host="0.0.0.0", port=8191, log_level=LOG_LEVEL) # noqa: S104 uvicorn.run(app, host="0.0.0.0", port=8191, log_level=LOG_LEVEL) # noqa: S104

View File

@ -1,6 +1,10 @@
{ {
"$schema": "https://docs.renovatebot.com/renovate-schema.json", "$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [ "extends": ["config:recommended"],
"config:recommended" "packageRules": [
{
"automerge": true,
"matchUpdateTypes": ["minor", "patch"]
}
] ]
} }

View File

@ -28,6 +28,11 @@ test_websites.extend(github_restricted)
@pytest.mark.parametrize("website", test_websites) @pytest.mark.parametrize("website", test_websites)
def test_bypass(website: str): def test_bypass(website: str):
"""
Tests if the service can bypass cloudflare/DDOS-GUARD on given websites.
This test is skipped if the website is not reachable or does not have cloudflare/DDOS-GUARD.
"""
test_request = httpx.get( test_request = httpx.get(
website, website,
) )
@ -48,5 +53,11 @@ def test_bypass(website: str):
def test_health_check(): def test_health_check():
"""
Tests the health check endpoint.
This test ensures that the health check
endpoint returns HTTPStatus.OK.
"""
response = client.get("/health") response = client.get("/health")
assert response.status_code == HTTPStatus.OK assert response.status_code == HTTPStatus.OK