diff --git a/CTFd/__init__.py b/CTFd/__init__.py index 94cc5ced3..ad1cf4202 100644 --- a/CTFd/__init__.py +++ b/CTFd/__init__.py @@ -27,6 +27,7 @@ from CTFd.utils.updates import update_check __version__ = "3.0.0b3" +__channel__ = "oss" class CTFdRequest(Request): @@ -209,6 +210,7 @@ def set_sqlite_pragma(dbapi_connection, connection_record): app.db = db app.VERSION = __version__ + app.CHANNEL = __channel__ from CTFd.cache import cache diff --git a/CTFd/utils/updates/__init__.py b/CTFd/utils/updates/__init__.py index 6eb928b7e..9e0bc8d4f 100644 --- a/CTFd/utils/updates/__init__.py +++ b/CTFd/utils/updates/__init__.py @@ -50,9 +50,10 @@ def update_check(force=False): "team_count": Teams.query.count(), "theme": get_config("ctf_theme"), "upload_provider": get_app_config("UPLOAD_PROVIDER"), + "channel": app.CHANNEL, } - check = requests.post( - "https://versioning.ctfd.io/", json=params, timeout=0.1 + check = requests.get( + "https://versioning.ctfd.io/check", params=params, timeout=0.1 ).json() except requests.exceptions.RequestException: pass diff --git a/Makefile b/Makefile index ac10231ca..f7da0961e 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ lint: flake8 --ignore=E402,E501,E712,W503,E203 --exclude=CTFd/uploads CTFd/ migrations/ tests/ yarn lint - black --check --exclude=CTFd/uploads --exclude=node_modules . + black --check --diff --exclude=CTFd/uploads --exclude=node_modules . prettier --check 'CTFd/themes/**/assets/**/*' prettier --check '**/*.md' diff --git a/development.txt b/development.txt index 39d368738..dec3b4ec5 100644 --- a/development.txt +++ b/development.txt @@ -18,4 +18,4 @@ isort==4.3.21 flake8-isort==3.0.0 Faker==4.1.0 pipdeptree==0.13.2 -black==19.3b0 +black==19.10b0 diff --git a/tests/utils/test_updates.py b/tests/utils/test_updates.py index 6da545dbe..55e8f302a 100644 --- a/tests/utils/test_updates.py +++ b/tests/utils/test_updates.py @@ -14,7 +14,7 @@ def test_update_check_is_called(): assert get_config("version_latest") is None -@patch.object(requests, "post") +@patch.object(requests, "get") def test_update_check_identifies_update(fake_get_request): """Update checks properly identify new versions""" app = create_ctfd()