We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Move plugin focused functions to the plugins folder
`override_template`
`register_plugin_script`
`register_plugin_stylesheet`

These should move to the plugins directory.

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `CTFd/plugins/__init__.py`
Content:
```
1 import glob
2 import importlib
3 import os
4 
5 from flask.helpers import safe_join
6 from flask import send_file, send_from_directory, abort
7 from CTFd.utils import admins_only as admins_only_wrapper
8 
9 
10 def register_plugin_assets_directory(app, base_path, admins_only=False):
11     """
12     Registers a directory to serve assets
13 
14     :param app: A CTFd application
15     :param string base_path: The path to the directory
16     :param boolean admins_only: Whether or not the assets served out of the directory should be accessible to the public
17     :return:
18     """
19     base_path = base_path.strip('/')
20 
21     def assets_handler(path):
22         return send_from_directory(base_path, path)
23 
24     if admins_only:
25         asset_handler = admins_only_wrapper(assets_handler)
26 
27     rule = '/' + base_path + '/<path:path>'
28     app.add_url_rule(rule=rule, endpoint=base_path, view_func=assets_handler)
29 
30 
31 def register_plugin_asset(app, asset_path, admins_only=False):
32     """
33     Registers an file path to be served by CTFd
34 
35     :param app: A CTFd application
36     :param string asset_path: The path to the asset file
37     :param boolean admins_only: Whether or not this file should be accessible to the public
38     :return:
39     """
40     asset_path = asset_path.strip('/')
41 
42     def asset_handler():
43         return send_file(asset_path)
44 
45     if admins_only:
46         asset_handler = admins_only_wrapper(asset_handler)
47     rule = '/' + asset_path
48     app.add_url_rule(rule=rule, endpoint=asset_path, view_func=asset_handler)
49 
50 
51 def init_plugins(app):
52     """
53     Searches for the load function in modules in the CTFd/plugins folder. This function is called with the current CTFd
54     app as a parameter. This allows CTFd plugins to modify CTFd's behavior.
55 
56     :param app: A CTFd application
57     :return:
58     """
59     modules = glob.glob(os.path.dirname(__file__) + "/*")
60     blacklist = {'__pycache__'}
61     for module in modules:
62         module_name = os.path.basename(module)
63         if os.path.isdir(module) and module_name not in blacklist:
64             module = '.' + module_name
65             module = importlib.import_module(module, package='CTFd.plugins')
66             module.load(app)
67             print(" * Loaded module, %s" % module)
68
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/CTFd/plugins/__init__.py b/CTFd/plugins/__init__.py
--- a/CTFd/plugins/__init__.py
+++ b/CTFd/plugins/__init__.py
@@ -3,8 +3,13 @@
 import os
 
 from flask.helpers import safe_join
-from flask import send_file, send_from_directory, abort
-from CTFd.utils import admins_only as admins_only_wrapper
+from flask import current_app as app, send_file, send_from_directory, abort
+from CTFd.utils import (
+    admins_only as admins_only_wrapper,
+    override_template as utils_override_template,
+    register_plugin_script as utils_register_plugin_script,
+    register_plugin_stylesheet as utils_register_plugin_stylesheet
+)
 
 
 def register_plugin_assets_directory(app, base_path, admins_only=False):
@@ -48,6 +53,29 @@
     app.add_url_rule(rule=rule, endpoint=asset_path, view_func=asset_handler)
 
 
+def override_template(*args, **kwargs):
+    """
+    Overrides a template with the provided html content.
+
+    e.g. override_template('scoreboard.html', '<h1>scores</h1>')
+    """
+    utils_override_template(*args, **kwargs)
+
+
+def register_plugin_script(*args, **kwargs):
+    """
+    Adds a given script to the base.html template which all pages inherit from
+    """
+    utils_register_plugin_script(*args, **kwargs)
+
+
+def register_plugin_stylesheet(*args, **kwargs):
+    """
+    Adds a given stylesheet to the base.html template which all pages inherit from.
+    """
+    utils_register_plugin_stylesheet(*args, **kwargs)
+
+
 def init_plugins(app):
     """
     Searches for the load function in modules in the CTFd/plugins folder. This function is called with the current CTFd

{"golden_diff": "diff --git a/CTFd/plugins/__init__.py b/CTFd/plugins/__init__.py\n--- a/CTFd/plugins/__init__.py\n+++ b/CTFd/plugins/__init__.py\n@@ -3,8 +3,13 @@\n import os\n \n from flask.helpers import safe_join\n-from flask import send_file, send_from_directory, abort\n-from CTFd.utils import admins_only as admins_only_wrapper\n+from flask import current_app as app, send_file, send_from_directory, abort\n+from CTFd.utils import (\n+    admins_only as admins_only_wrapper,\n+    override_template as utils_override_template,\n+    register_plugin_script as utils_register_plugin_script,\n+    register_plugin_stylesheet as utils_register_plugin_stylesheet\n+)\n \n \n def register_plugin_assets_directory(app, base_path, admins_only=False):\n@@ -48,6 +53,29 @@\n     app.add_url_rule(rule=rule, endpoint=asset_path, view_func=asset_handler)\n \n \n+def override_template(*args, **kwargs):\n+    \"\"\"\n+    Overrides a template with the provided html content.\n+\n+    e.g. override_template('scoreboard.html', '<h1>scores</h1>')\n+    \"\"\"\n+    utils_override_template(*args, **kwargs)\n+\n+\n+def register_plugin_script(*args, **kwargs):\n+    \"\"\"\n+    Adds a given script to the base.html template which all pages inherit from\n+    \"\"\"\n+    utils_register_plugin_script(*args, **kwargs)\n+\n+\n+def register_plugin_stylesheet(*args, **kwargs):\n+    \"\"\"\n+    Adds a given stylesheet to the base.html template which all pages inherit from.\n+    \"\"\"\n+    utils_register_plugin_stylesheet(*args, **kwargs)\n+\n+\n def init_plugins(app):\n     \"\"\"\n     Searches for the load function in modules in the CTFd/plugins folder. This function is called with the current CTFd\n", "issue": "Move plugin focused functions to the plugins folder\n`override_template`\r\n`register_plugin_script`\r\n`register_plugin_stylesheet`\r\n\r\nThese should move to the plugins directory.\n", "before_files": [{"content": "import glob\nimport importlib\nimport os\n\nfrom flask.helpers import safe_join\nfrom flask import send_file, send_from_directory, abort\nfrom CTFd.utils import admins_only as admins_only_wrapper\n\n\ndef register_plugin_assets_directory(app, base_path, admins_only=False):\n    \"\"\"\n    Registers a directory to serve assets\n\n    :param app: A CTFd application\n    :param string base_path: The path to the directory\n    :param boolean admins_only: Whether or not the assets served out of the directory should be accessible to the public\n    :return:\n    \"\"\"\n    base_path = base_path.strip('/')\n\n    def assets_handler(path):\n        return send_from_directory(base_path, path)\n\n    if admins_only:\n        asset_handler = admins_only_wrapper(assets_handler)\n\n    rule = '/' + base_path + '/<path:path>'\n    app.add_url_rule(rule=rule, endpoint=base_path, view_func=assets_handler)\n\n\ndef register_plugin_asset(app, asset_path, admins_only=False):\n    \"\"\"\n    Registers an file path to be served by CTFd\n\n    :param app: A CTFd application\n    :param string asset_path: The path to the asset file\n    :param boolean admins_only: Whether or not this file should be accessible to the public\n    :return:\n    \"\"\"\n    asset_path = asset_path.strip('/')\n\n    def asset_handler():\n        return send_file(asset_path)\n\n    if admins_only:\n        asset_handler = admins_only_wrapper(asset_handler)\n    rule = '/' + asset_path\n    app.add_url_rule(rule=rule, endpoint=asset_path, view_func=asset_handler)\n\n\ndef init_plugins(app):\n    \"\"\"\n    Searches for the load function in modules in the CTFd/plugins folder. This function is called with the current CTFd\n    app as a parameter. This allows CTFd plugins to modify CTFd's behavior.\n\n    :param app: A CTFd application\n    :return:\n    \"\"\"\n    modules = glob.glob(os.path.dirname(__file__) + \"/*\")\n    blacklist = {'__pycache__'}\n    for module in modules:\n        module_name = os.path.basename(module)\n        if os.path.isdir(module) and module_name not in blacklist:\n            module = '.' + module_name\n            module = importlib.import_module(module, package='CTFd.plugins')\n            module.load(app)\n            print(\" * Loaded module, %s\" % module)\n", "path": "CTFd/plugins/__init__.py"}], "after_files": [{"content": "import glob\nimport importlib\nimport os\n\nfrom flask.helpers import safe_join\nfrom flask import current_app as app, send_file, send_from_directory, abort\nfrom CTFd.utils import (\n    admins_only as admins_only_wrapper,\n    override_template as utils_override_template,\n    register_plugin_script as utils_register_plugin_script,\n    register_plugin_stylesheet as utils_register_plugin_stylesheet\n)\n\n\ndef register_plugin_assets_directory(app, base_path, admins_only=False):\n    \"\"\"\n    Registers a directory to serve assets\n\n    :param app: A CTFd application\n    :param string base_path: The path to the directory\n    :param boolean admins_only: Whether or not the assets served out of the directory should be accessible to the public\n    :return:\n    \"\"\"\n    base_path = base_path.strip('/')\n\n    def assets_handler(path):\n        return send_from_directory(base_path, path)\n\n    if admins_only:\n        asset_handler = admins_only_wrapper(assets_handler)\n\n    rule = '/' + base_path + '/<path:path>'\n    app.add_url_rule(rule=rule, endpoint=base_path, view_func=assets_handler)\n\n\ndef register_plugin_asset(app, asset_path, admins_only=False):\n    \"\"\"\n    Registers an file path to be served by CTFd\n\n    :param app: A CTFd application\n    :param string asset_path: The path to the asset file\n    :param boolean admins_only: Whether or not this file should be accessible to the public\n    :return:\n    \"\"\"\n    asset_path = asset_path.strip('/')\n\n    def asset_handler():\n        return send_file(asset_path)\n\n    if admins_only:\n        asset_handler = admins_only_wrapper(asset_handler)\n    rule = '/' + asset_path\n    app.add_url_rule(rule=rule, endpoint=asset_path, view_func=asset_handler)\n\n\ndef override_template(*args, **kwargs):\n    \"\"\"\n    Overrides a template with the provided html content.\n\n    e.g. override_template('scoreboard.html', '<h1>scores</h1>')\n    \"\"\"\n    utils_override_template(*args, **kwargs)\n\n\ndef register_plugin_script(*args, **kwargs):\n    \"\"\"\n    Adds a given script to the base.html template which all pages inherit from\n    \"\"\"\n    utils_register_plugin_script(*args, **kwargs)\n\n\ndef register_plugin_stylesheet(*args, **kwargs):\n    \"\"\"\n    Adds a given stylesheet to the base.html template which all pages inherit from.\n    \"\"\"\n    utils_register_plugin_stylesheet(*args, **kwargs)\n\n\ndef init_plugins(app):\n    \"\"\"\n    Searches for the load function in modules in the CTFd/plugins folder. This function is called with the current CTFd\n    app as a parameter. This allows CTFd plugins to modify CTFd's behavior.\n\n    :param app: A CTFd application\n    :return:\n    \"\"\"\n    modules = glob.glob(os.path.dirname(__file__) + \"/*\")\n    blacklist = {'__pycache__'}\n    for module in modules:\n        module_name = os.path.basename(module)\n        if os.path.isdir(module) and module_name not in blacklist:\n            module = '.' + module_name\n            module = importlib.import_module(module, package='CTFd.plugins')\n            module.load(app)\n            print(\" * Loaded module, %s\" % module)\n", "path": "CTFd/plugins/__init__.py"}]}