mirror of
https://github.com/aljazceru/CTFd.git
synced 2026-02-20 05:34:33 +01:00
Adding init_plugins (example plugin soon)
Also fixing an issue in the docker functions
This commit is contained in:
@@ -68,4 +68,8 @@ def create_app(config='CTFd.config'):
|
||||
app.register_blueprint(auth)
|
||||
app.register_blueprint(admin)
|
||||
|
||||
from CTFd.plugins import init_plugins
|
||||
|
||||
init_plugins(app)
|
||||
|
||||
return app
|
||||
|
||||
15
CTFd/plugins/__init__.py
Normal file
15
CTFd/plugins/__init__.py
Normal file
@@ -0,0 +1,15 @@
|
||||
from CTFd.models import db, WrongKeys, Pages, Config, Tracking, Teams, Containers, ip2long, long2ip
|
||||
from flask import current_app as app, g, request, redirect, url_for, session, render_template, abort
|
||||
import os
|
||||
import importlib
|
||||
import glob
|
||||
|
||||
|
||||
def init_plugins(app):
|
||||
modules = glob.glob(os.path.dirname(__file__) + "/*")
|
||||
for module in modules:
|
||||
if os.path.isdir(module):
|
||||
module = '.' + os.path.basename(module)
|
||||
module = importlib.import_module(module, package='CTFd.plugins')
|
||||
module.load(app)
|
||||
print " * Loaded module,", module
|
||||
@@ -500,6 +500,7 @@ def run_image(name):
|
||||
ports_asked = []
|
||||
|
||||
cmd = ['docker', 'run', '-d']
|
||||
ports_used = []
|
||||
for port in ports_asked:
|
||||
if is_port_free(port):
|
||||
cmd.append('-p')
|
||||
|
||||
Reference in New Issue
Block a user