diff --git a/confs/site/cookie-flags.conf b/confs/site/cookie-flags.conf index 675feb3..3482954 100644 --- a/confs/site/cookie-flags.conf +++ b/confs/site/cookie-flags.conf @@ -1 +1 @@ -set_cookie_flag {{ COOKIE_FLAGS }}{% if COOKIE_AUTO_SECURE_FLAG == "yes" %} Secure{% endif %}; +set_cookie_flag {{ COOKIE_FLAGS }}{% if COOKIE_AUTO_SECURE_FLAG == "yes" and (AUTO_LETS_ENCRYPT == "yes" or USE_CUSTOM_HTTPS == "yes" or GENERATE_SELF_SIGNED_SSL == "yes") %} Secure{% endif %}; diff --git a/gen/Templator.py b/gen/Templator.py index ad3f442..7b7de4d 100644 --- a/gen/Templator.py +++ b/gen/Templator.py @@ -50,10 +50,18 @@ class Templator : real_config["ROOT_FOLDER"] += "/" + real_config["ROOT_SITE_SUBFOLDER"] return real_config + def __filter_var(self, variable) : + filters = ["FIRST_SERVER", "NGINX_PREFIX"] + for filter in filters : + if variable == filter or variable.endswith("_" + filter) : + return True + return False + def __save_config(self, type, config) : data = "" for variable, value in config.items() : - data += variable + "=" + value + "\n" + if not self.__filter_var(variable) : + data += variable + "=" + value + "\n" file = self.__output_path if type == "global" : file += "/global.env" diff --git a/gen/utils.py b/gen/utils.py index c78d85d..ccdd944 100644 --- a/gen/utils.py +++ b/gen/utils.py @@ -3,7 +3,7 @@ def load_variables(path) : with open(path) as f : lines = f.read().splitlines() for line in lines : - if line.startswith("#") : + if line.startswith("#") or line == "" or not "=" in line : continue var = line.split("=")[0] value = line[len(var)+1:] diff --git a/settings.json b/settings.json index e9ad29b..99df434 100644 --- a/settings.json +++ b/settings.json @@ -937,7 +937,7 @@ "env": "REDIRECT_TO", "id": "redirect-to", "label": "Redirect every requests to another web service", - "regex": "^https?://.*$", + "regex": "^(https?://.+|.{0})$", "type": "text" } ] @@ -1001,7 +1001,7 @@ "env": "LOCAL_PHP", "id": "local-php", "label": "local php", - "regex": "^\\/[a-zA-Z\\-0-9_\\.\\/]*$", + "regex": "^(\\/[a-zA-Z\\-0-9_\\.\\/]*|.{0})$", "type": "text" }, { @@ -1010,7 +1010,7 @@ "env": "LOCAL_PHP_PATH", "id": "local-php-path", "label": "Local php path", - "regex": "^\\/[a-zA-Z\\-0-9_\\.\\/]*$", + "regex": "^(\\/[a-zA-Z\\-0-9_\\.\\/]*|.{0})$", "type": "text" } ] @@ -1225,7 +1225,7 @@ "env": "REDIS_HOST", "id": "redis-host", "label": "Hostname/IP of the Redis service", - "regex": "^[A-Za-z0-9\\-\\.\\_]+$", + "regex": "^([A-Za-z0-9\\-\\.\\_]+|.{0})$", "type": "text" } ] diff --git a/ui/entrypoint.py b/ui/entrypoint.py index 7229df3..c2e3af6 100644 --- a/ui/entrypoint.py +++ b/ui/entrypoint.py @@ -44,7 +44,7 @@ csrf = CSRFProtect() csrf.init_app(app) @app.errorhandler(CSRFError) def handle_csrf_error(e): - return render_template("error.html", title="Error", error="Wrong CSRF token !"), 401 + return render_template("error.html", title="Error", error="Wrong CSRF token !"), 401 @app.route('/login', methods=["GET", "POST"]) def login() : @@ -146,7 +146,7 @@ def services(): operation = app.config["CONFIG"].edit_service(request.form["OLD_SERVER_NAME"], variables) elif request.form["operation"] == "delete" : operation = app.config["CONFIG"].delete_service(request.form["SERVER_NAME"]) - + # Reload instances reload = app.config["INSTANCES"].reload_instances() if not reload : diff --git a/ui/src/Config.py b/ui/src/Config.py index f0dd96d..750f810 100644 --- a/ui/src/Config.py +++ b/ui/src/Config.py @@ -13,6 +13,8 @@ class Config : env = f.read() data = {} for line in env.split("\n") : + if not "=" in line : + continue var = line.split("=")[0] val = line.replace(var + "=", "", 1) data[var] = val @@ -37,7 +39,8 @@ class Config : if not first_server in servers : servers.append(first_server) for k, v in service.items() : - conf[first_server + "_" + k] = v + if not k.startswith(first_server + "_") : + conf[first_server + "_" + k] = v conf["SERVER_NAME"] = " ".join(servers) env_file = "/tmp/" + str(uuid.uuid4()) + ".env" self.__dict_to_env(env_file, conf) diff --git a/ui/src/Instances.py b/ui/src/Instances.py index 7fd9cbf..d6adda2 100644 --- a/ui/src/Instances.py +++ b/ui/src/Instances.py @@ -34,6 +34,7 @@ class Instances : result = False except : result = False + return result def __instance_from_id(self, id) : instances = self.get_instances() @@ -91,7 +92,6 @@ class Instances : all_reload = False elif instance["type"] == "container" or instance["type"] == "service" : all_reload = self.__api_request(instance, "/reload") - return all_reload def reload_instance(self, id) : diff --git a/ui/static/js/custom.js b/ui/static/js/custom.js index a50b21c..31cf551 100644 --- a/ui/static/js/custom.js +++ b/ui/static/js/custom.js @@ -57,6 +57,7 @@ function deleteService(id) { function reloadInstance(id) { post("reload", "instances", getData('form-instance-' + id)); + return false; } function startInstance(id) { diff --git a/ui/templates/instances.html b/ui/templates/instances.html index d7d6ff5..1fc0e51 100644 --- a/ui/templates/instances.html +++ b/ui/templates/instances.html @@ -5,9 +5,11 @@