mirror of
https://github.com/Manuel83/craftbeerpi3
synced 2026-08-09 18:52:40 +02:00
Fix
This commit is contained in:
+10
-14
@@ -20,9 +20,9 @@ modules = {}
|
|||||||
def merge(source, destination):
|
def merge(source, destination):
|
||||||
"""
|
"""
|
||||||
Helper method to merge two dicts
|
Helper method to merge two dicts
|
||||||
:param source:
|
:param source:
|
||||||
:param destination:
|
:param destination:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
for key, value in source.items():
|
for key, value in source.items():
|
||||||
if isinstance(value, dict):
|
if isinstance(value, dict):
|
||||||
@@ -38,7 +38,7 @@ def merge(source, destination):
|
|||||||
def getPlugins():
|
def getPlugins():
|
||||||
"""
|
"""
|
||||||
Endpoint for all plugins
|
Endpoint for all plugins
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
result = []
|
result = []
|
||||||
for filename in os.listdir("./modules/plugins"):
|
for filename in os.listdir("./modules/plugins"):
|
||||||
@@ -96,9 +96,9 @@ def saveFile(name):
|
|||||||
def deletePlugin(name):
|
def deletePlugin(name):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
Delete plugin
|
Delete plugin
|
||||||
:param name: plugin name
|
:param name: plugin name
|
||||||
:return: HTTP 204 if ok - HTTP 500 if plugin not exists
|
:return: HTTP 204 if ok - HTTP 500 if plugin not exists
|
||||||
"""
|
"""
|
||||||
if os.path.isdir("./modules/plugins/"+name) is False:
|
if os.path.isdir("./modules/plugins/"+name) is False:
|
||||||
return ('Dir Not found', 500)
|
return ('Dir Not found', 500)
|
||||||
@@ -110,8 +110,8 @@ def deletePlugin(name):
|
|||||||
def reload(name):
|
def reload(name):
|
||||||
"""
|
"""
|
||||||
hot reload plugnin
|
hot reload plugnin
|
||||||
:param name:
|
:param name:
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
try:
|
try:
|
||||||
if name in cache["modules"]:
|
if name in cache["modules"]:
|
||||||
@@ -130,9 +130,9 @@ def reload(name):
|
|||||||
def plugins():
|
def plugins():
|
||||||
"""
|
"""
|
||||||
Read the central plugin yaml to get a list of all official plugins
|
Read the central plugin yaml to get a list of all official plugins
|
||||||
:return:
|
:return:
|
||||||
"""
|
"""
|
||||||
response = requests.get("https://raw.githubusercontent.com/craftbeerpi/pluginlist/master/plugins.yaml")
|
response = requests.get("https://raw.githubusercontent.com/Manuel83/craftbeerpi-plugins/master/plugins.yaml")
|
||||||
cbpi.cache["plugins"] = merge(yaml.load(response.text), cbpi.cache["plugins"])
|
cbpi.cache["plugins"] = merge(yaml.load(response.text), cbpi.cache["plugins"])
|
||||||
for key, value in cbpi.cache["plugins"].iteritems():
|
for key, value in cbpi.cache["plugins"].iteritems():
|
||||||
value["installed"] = os.path.isdir("./modules/plugins/%s/" % (key))
|
value["installed"] = os.path.isdir("./modules/plugins/%s/" % (key))
|
||||||
@@ -196,7 +196,3 @@ def initPlugins(app):
|
|||||||
def init(cbpi):
|
def init(cbpi):
|
||||||
print "INITIALIZE ADDON MODULE"
|
print "INITIALIZE ADDON MODULE"
|
||||||
cbpi.app.register_blueprint(blueprint, url_prefix='/api/editor')
|
cbpi.app.register_blueprint(blueprint, url_prefix='/api/editor')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user