11
2- from flask import request
2+ from flask import Blueprint , render_template , request
33
44from CTFd .cache import clear_standings
5+ from CTFd .constants .languages import SELECT_LANGUAGE_LIST
56from CTFd .models import Hints , Unlocks , db , get_class_by_tablename
7+ from CTFd .plugins .LuaUtils import ConfigPanel , _LuaAsset
68from CTFd .schemas .awards import AwardSchema
79from CTFd .schemas .unlocks import UnlockSchema
10+ from CTFd .utils import get_config
811from CTFd .utils .decorators import (
12+ admins_only ,
913 authed_only ,
1014 during_ctf_time_only ,
1115 require_verified_emails ,
@@ -29,9 +33,19 @@ def __init__(self, user, hint):
2933 self .challenge = hint .challenge_id
3034
3135
36+ hintpoint = Blueprint (
37+ "hintpointdelay" ,
38+ __name__ ,
39+ template_folder = "templates" ,
40+ static_folder = "staticAssets" ,
41+ )
42+
3243def load (app ):
3344 app .db .create_all ()
34-
45+
46+ app .jinja_env .globals .update (hintpointassets = _LuaAsset ("hintpointdelay" ))
47+ app .register_blueprint (hintpoint , url_prefix = "/hintpointdelay" )
48+
3549 def get_modified_challenge_points (challenge ):
3650 user = get_current_user ()
3751 hintids = DelayedHints .query .filter (
@@ -92,6 +106,21 @@ def apply_delayed_hints(challenge):
92106 clear_standings ()
93107
94108
109+ @app .route ("/admin/hintpointdelay" )
110+ @admins_only
111+ def hintpoint_config ():
112+ standard = get_config ("inlineTranslationStandard" )
113+ configs = [
114+ ConfigPanel (
115+ "Standard Language" ,
116+ "Set the standard language." ,
117+ standard ,
118+ "inlineTranslationStandard" ,
119+ SELECT_LANGUAGE_LIST ,
120+ )
121+ ]
122+ return render_template ("hintconfig.html" , configs = configs )
123+
95124 @during_ctf_time_only
96125 @require_verified_emails
97126 @authed_only
0 commit comments