Skip to content

Commit

Permalink
use renovate instead of dependabot
Browse files Browse the repository at this point in the history
  • Loading branch information
ThePhaseless committed Nov 28, 2024
1 parent dfea0a8 commit f051597
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 22 deletions.
16 changes: 0 additions & 16 deletions .github/dependabot.yml

This file was deleted.

20 changes: 16 additions & 4 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
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
Expand Down Expand Up @@ -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",
Expand All @@ -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
8 changes: 6 additions & 2 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
{
"$schema": "https://docs.renovatebot.com/renovate-schema.json",
"extends": [
"config:recommended"
"extends": ["config:recommended"],
"packageRules": [
{
"automerge": true,
"matchUpdateTypes": ["minor", "patch"]
}
]
}
11 changes: 11 additions & 0 deletions tests/main_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@

@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,
)
Expand All @@ -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

0 comments on commit f051597

Please sign in to comment.