def during_ctf_time_only(f):
    """
    Decorator to restrict an endpoint to only be seen during a CTF
    :param f:
    :return:
    """

    @functools.wraps(f)
    def during_ctf_time_only_wrapper(*args, **kwargs):
        if ctftime() or current_user.is_admin():
            return f(*args, **kwargs)
        else:
            if ctf_ended():
                if view_after_ctf():
                    return f(*args, **kwargs)
                else:
                    error = gettext(
                        "%(ctf_name)s has ended", ctf_name=config.ctf_name()
                    )
                    abort(403, description=error)
            if ctf_started() is False:
                if is_teams_mode() and get_current_team() is None:
                    return redirect(url_for("teams.private", next=request.full_path))
                else:
                    error = gettext(
                        "%(ctf_name)s has not started yet", ctf_name=config.ctf_name()
                    )
                    abort(403, description=error)

    return during_ctf_time_only_wrapper

    Decorator to restrict an endpoint to only be seen during a CTF
    :param f:
    :return:
    
CTFd/utils/decorators/__init__.py