瀏覽代碼

Update endpoints.py

Add user-yaml to be able to load and test not-yet released plugins.
Steps:
Make your own plugins.yaml in github, with references to your plugin(s).
Add parameter user_yaml like:
user_yaml         https://raw.githubusercontent.com/...user.../craftbeerpi-plugins/master/plugins.yaml             User yaml http address
After that you see your own plugins in addon-list.
pull/59/head
Co de Waal GitHub 8 年之前
父節點
當前提交
825ec90c6f
共有 1 個檔案被更改,包括 18 行新增0 行删除
  1. +18
    -0
      modules/addon/endpoints.py

+ 18
- 0
modules/addon/endpoints.py 查看文件

@@ -14,6 +14,7 @@ import shutil

blueprint = Blueprint('addon', __name__)

user_yaml = None

modules = {}

@@ -137,6 +138,15 @@ def plugins():
for key, value in cbpi.cache["plugins"].iteritems():
value["installed"] = os.path.isdir("./modules/plugins/%s/" % (key))

user_yaml=cbpi.get_config_parameter("user_yaml", None)
if user_yaml is None:
pass
else:
response = requests.get(user_yaml)
cbpi.cache["plugins"] = merge(yaml.load(response.text), cbpi.cache["plugins"])
for key, value in cbpi.cache["plugins"].iteritems():
value["installed"] = os.path.isdir("./modules/plugins/%s/" % (key))

return json.dumps(cbpi.cache["plugins"])


@@ -195,4 +205,12 @@ def initPlugins(app):
@cbpi.initalizer(order=2)
def init(cbpi):

global user_yaml
user_yaml = cbpi.get_config_parameter("user_yaml", None)
if user_yaml is None:
try:
cbpi.add_config_parameter("user_yaml", "", "text", "User yaml http address")
except:
pass

cbpi.app.register_blueprint(blueprint, url_prefix='/api/editor')

Loading…
取消
儲存