2021-09-27 12:03:35 +02:00
|
|
|
from flask import jsonify
|
|
|
|
from flask_jwt_extended import jwt_required
|
|
|
|
from flask_cors import cross_origin
|
|
|
|
|
2021-10-28 16:09:10 +02:00
|
|
|
from areas import api_v1
|
2021-09-27 12:03:35 +02:00
|
|
|
|
|
|
|
CONFIG_DATA = [
|
|
|
|
{
|
|
|
|
"id": "values.yml",
|
|
|
|
"description": "Some user friendly description",
|
|
|
|
"raw": "cronjob:\n # Set curl to accept insecure connections when acme staging is used\n curlInsecure: false",
|
|
|
|
"fields": [
|
|
|
|
{"name": "cronjob", "type": "string", "value": ""},
|
|
|
|
{"name": "curlInsecure", "type": "boolean", "value": "false"}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
]
|
|
|
|
|
|
|
|
APPS_DATA = [
|
|
|
|
{"id": 1, "name": "Nextcloud", "enabled": True, "status": "ON for everyone"},
|
|
|
|
{"id": 2, "name": "Rocketchat", "enabled": True, "status": "ON for everyone"},
|
|
|
|
{"id": 3, "name": "Wordpress", "enabled": False, "status": "ON for everyone"}
|
|
|
|
]
|
|
|
|
|
|
|
|
APP_DATA = {"id": 1, "name": "Nextcloud", "selected": True, "status": "ON for everyone", "config": CONFIG_DATA},
|
|
|
|
|
2022-08-12 13:08:03 +02:00
|
|
|
# Apps that should not get oauth variables when they are installed
|
|
|
|
APPS_WITHOUT_OAUTH = [
|
|
|
|
"single-sign-on",
|
|
|
|
"prometheus",
|
|
|
|
"alertmanager",
|
|
|
|
]
|
|
|
|
|
|
|
|
APP_NOT_INSTALLED_STATUS = "Not installed"
|
2021-09-27 12:03:35 +02:00
|
|
|
|
|
|
|
@api_v1.route('/apps', methods=['GET'])
|
|
|
|
@jwt_required()
|
|
|
|
@cross_origin()
|
|
|
|
def get_apps():
|
|
|
|
return jsonify(APPS_DATA)
|
|
|
|
|
|
|
|
|
|
|
|
@api_v1.route('/apps/<string:slug>', methods=['GET'])
|
|
|
|
@jwt_required()
|
|
|
|
def get_app(slug):
|
|
|
|
return jsonify(APPS_DATA[0])
|
|
|
|
|
|
|
|
|
|
|
|
@api_v1.route('/apps', methods=['POST'])
|
|
|
|
@jwt_required()
|
|
|
|
@cross_origin()
|
|
|
|
def post_app():
|
|
|
|
return jsonify(APPS_DATA), 201
|
|
|
|
|
|
|
|
|
|
|
|
@api_v1.route('/apps/<string:slug>', methods=['PUT'])
|
|
|
|
@jwt_required()
|
|
|
|
@cross_origin()
|
|
|
|
def put_app(slug):
|
|
|
|
return jsonify(APPS_DATA)
|
|
|
|
|
|
|
|
|
|
|
|
@api_v1.route('/apps/<string:slug>/config', methods=['GET'])
|
|
|
|
@jwt_required()
|
|
|
|
@cross_origin()
|
|
|
|
def get_config(slug):
|
|
|
|
return jsonify(CONFIG_DATA)
|
|
|
|
|
|
|
|
|
|
|
|
@api_v1.route('/apps/<string:slug>/config', methods=['DELETE'])
|
|
|
|
@jwt_required()
|
|
|
|
@cross_origin()
|
|
|
|
def delete_config(slug):
|
|
|
|
return jsonify(CONFIG_DATA)
|