mirror of
https://github.com/aljazceru/CTFd.git
synced 2026-01-31 11:54:23 +01:00
Add channel to update check and use new endpoint (#1568)
* Add a channel key to update check and use a new GET based update check endpoint * Bump `black` version to `19.10b0`
This commit is contained in:
@@ -27,6 +27,7 @@ from CTFd.utils.sessions import CachingSessionInterface
|
||||
from CTFd.utils.updates import update_check
|
||||
|
||||
__version__ = "3.0.0b3"
|
||||
__channel__ = "oss"
|
||||
|
||||
|
||||
class CTFdRequest(Request):
|
||||
@@ -209,6 +210,7 @@ def create_app(config="CTFd.config.Config"):
|
||||
|
||||
app.db = db
|
||||
app.VERSION = __version__
|
||||
app.CHANNEL = __channel__
|
||||
|
||||
from CTFd.cache import cache
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
2
Makefile
2
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'
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user