-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path__init__.py
More file actions
24 lines (17 loc) · 855 Bytes
/
__init__.py
File metadata and controls
24 lines (17 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# plugins/github_backup/__init__.py
from pathlib import Path
from jinja2 import ChoiceLoader, FileSystemLoader
from CTFd.plugins import register_plugin_assets_directory
from .blueprints import my_bp
from CTFd.plugins.CTFd_github_backup.models import UserGitHubToken, GithubRepositories, GithubChallengeSync, GithubFlagSync, GithubHintSync
def load(app):
app.register_blueprint(my_bp)
from CTFd.models import db
db.create_all()
plugin_templates_path = Path(__file__).parent / "templates"
plugin_loader = FileSystemLoader(str(plugin_templates_path))
if isinstance(app.jinja_loader, ChoiceLoader):
app.jinja_loader.loaders.insert(0, plugin_loader)
else:
app.jinja_loader = ChoiceLoader([plugin_loader, app.jinja_loader])
register_plugin_assets_directory(app, base_path="/plugins/github_backup/assets/")