fix: Move report_cheater to flags to avoid circular import
This commit is contained in:
@@ -8,7 +8,7 @@ from CTFd.models import Flags, db
|
||||
from flask import Blueprint, render_template, request
|
||||
|
||||
from .models import CheaterTeams
|
||||
from .flags import PersonalFlag
|
||||
from .flags import PersonalFlag, report_cheater
|
||||
|
||||
PLUGIN_PATH = os.path.dirname(__file__)
|
||||
|
||||
@@ -17,12 +17,6 @@ directory_name = PLUGIN_PATH.split(os.sep)[-1] # Get the directory name of this
|
||||
bp = Blueprint(directory_name, __name__, template_folder="templates")
|
||||
|
||||
|
||||
def report_cheater(challenge_id: int, cheater_id: int, helper_id: int, flag_id: int):
|
||||
cheater = CheaterTeams(challenge_id, cheater_id, helper_id, flag_id)
|
||||
db.session.add(cheater)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
def create_flag_if_missing(challenge_id: int, user_id: int, flag_content: str):
|
||||
flags = Flags.query.filter_by(id=challenge_id, data=user_id).all()
|
||||
|
||||
|
||||
9
flags.py
9
flags.py
@@ -1,7 +1,14 @@
|
||||
from CTFd.plugins.flags import BaseFlag
|
||||
from CTFd.utils.user import get_current_user
|
||||
from CTFd.models import db
|
||||
from .models import CheaterTeams
|
||||
|
||||
from . import report_cheater
|
||||
|
||||
|
||||
def report_cheater(challenge_id: int, cheater_id: int, helper_id: int, flag_id: int):
|
||||
cheater = CheaterTeams(challenge_id, cheater_id, helper_id, flag_id)
|
||||
db.session.add(cheater)
|
||||
db.session.commit()
|
||||
|
||||
|
||||
class PersonalFlag(BaseFlag):
|
||||
|
||||
Reference in New Issue
Block a user