diff --git a/.github/dependabot.yml b/.github/dependabot.yml deleted file mode 100644 index 52a086e..0000000 --- a/.github/dependabot.yml +++ /dev/null @@ -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 diff --git a/main.py b/main.py index 7a2d4c6..a0eaf3c 100644 --- a/main.py +++ b/main.py @@ -4,7 +4,7 @@ import logging import time from http import HTTPStatus -import uvicorn.config +import uvicorn from bs4 import BeautifulSoup from fastapi import FastAPI, HTTPException 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: sb.save_screenshot(f"./screenshots/{request.url}.png") - raise HTTPException( - status_code=500, detail="Could not bypass challenge" - ) + raise_captcha_bypass_error() response = LinkResponse( message="Success", @@ -95,5 +93,19 @@ def read_item(request: LinkRequest): 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__": uvicorn.run(app, host="0.0.0.0", port=8191, log_level=LOG_LEVEL) # noqa: S104 diff --git a/renovate.json b/renovate.json index 5db72dd..420edd7 100644 --- a/renovate.json +++ b/renovate.json @@ -1,6 +1,10 @@ { "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": [ - "config:recommended" + "extends": ["config:recommended"], + "packageRules": [ + { + "automerge": true, + "matchUpdateTypes": ["minor", "patch"] + } ] } diff --git a/tests/main_test.py b/tests/main_test.py index 6da2795..46708df 100644 --- a/tests/main_test.py +++ b/tests/main_test.py @@ -28,6 +28,11 @@ test_websites.extend(github_restricted) @pytest.mark.parametrize("website", test_websites) 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( website, ) @@ -48,5 +53,11 @@ def test_bypass(website: str): def test_health_check(): + """ + Tests the health check endpoint. + + This test ensures that the health check + endpoint returns HTTPStatus.OK. + """ response = client.get("/health") assert response.status_code == HTTPStatus.OK