diff --git a/src/var/lib/tyto/program/__pycache__/check.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/check.cpython-311.pyc index def5999..561c139 100644 Binary files a/src/var/lib/tyto/program/__pycache__/check.cpython-311.pyc and b/src/var/lib/tyto/program/__pycache__/check.cpython-311.pyc differ diff --git a/src/var/lib/tyto/program/__pycache__/debug.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/debug.cpython-311.pyc index d77ef52..26bdfea 100644 Binary files a/src/var/lib/tyto/program/__pycache__/debug.cpython-311.pyc and b/src/var/lib/tyto/program/__pycache__/debug.cpython-311.pyc differ diff --git a/src/var/lib/tyto/program/__pycache__/domain.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/domain.cpython-311.pyc index 4c0a051..c5c7a11 100644 Binary files a/src/var/lib/tyto/program/__pycache__/domain.cpython-311.pyc and b/src/var/lib/tyto/program/__pycache__/domain.cpython-311.pyc differ diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index 8ea0d42..f0ab8dc 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -33,11 +33,13 @@ #-------------------------- import sys -import domain, langs +import domain, langs, debug def manage(action, target): # Load domain configuration, update if needed, check if valid - domain.valid_conf() + if not domain.valid_conf(): + debug.out(105, domain.conf_name, domain.dcf_uri, True, 1, True) + langs.load_website_lang() - print("check:", action, target, domain.dcf.get("DOMAIN", "name")) + print("check:", action, target) diff --git a/src/var/lib/tyto/program/debug.py b/src/var/lib/tyto/program/debug.py index bef6a6a..b2f86f8 100644 --- a/src/var/lib/tyto/program/debug.py +++ b/src/var/lib/tyto/program/debug.py @@ -89,6 +89,7 @@ def out(nbr, var, val, show, color, stop): 102 : langs.logs.reset_dom, 103 : langs.logs.website_lang, 104 : langs.logs.domains_no, + 105 : langs.logs.domain_off, # Great (200-255) 200 : langs.logs.load_file, 201 : langs.logs.lang_logs_sys, diff --git a/src/var/lib/tyto/program/domain.py b/src/var/lib/tyto/program/domain.py index a762b6f..4b44b64 100644 --- a/src/var/lib/tyto/program/domain.py +++ b/src/var/lib/tyto/program/domain.py @@ -184,14 +184,27 @@ def dcf_update_values(srv): srv_wip = os.path.join(srv_dom, "wip/") srv_www = os.path.join(srv_dom, "www/") + # Set booleans if invalid values + try: dcf.getboolean("DOMAIN", "activated") + except: dcf.set("DOMAIN", "activated", "no") + try: dcf.getboolean("WEBSITE", "article_code") + except: dcf.set("WEBSITE", "article_code", "yes") + try: dcf.getboolean("WEBSITE", "static") + except: dcf.set("WEBSITE", "static", "no") + try: dcf.getboolean("WEBSITE_MODULES", "sitemaps") + except: dcf.set("WEBSITE_MODULES", "sitemaps", "yes") + + # Set template filenames to default if none favicon = dcf.get("TEMPLATE_FILENAMES", "favicon") or "favicon.png" logo = dcf.get("TEMPLATE_FILENAMES", "logo") or "logo.png" styles = dcf.get("TEMPLATE_FILENAMES", "styles") or "styles.css" rss = dcf.get("TEMPLATE_FILENAMES", "rss") or "rss.xml" stats = dcf.get("TEMPLATE_FILENAMES", "stats") or "stats.ini" - www_url = dcf.get("WEBSITE", "www_url") - wip_url = dcf.get("WEBSITE", "wip_url") + dcf.get("WEBSITE", "www_url") or \ + dcf.set("WEBSITE", "www_url", "https://%s/"%conf_name) + dcf.get("WEBSITE", "wip_url") or \ + dcf.set("WEBSITE", "wip_url", create_wip_url()) usr_mods = os.path.join(dcf_dir + "modules/") usr_tpl = os.path.join(dcf_dir, "template/") @@ -242,8 +255,6 @@ def dcf_update_values(srv): # WEBSITE dcf.set("WEBSITE", "lang", langs.site_lang) - www_url or dcf.set("WEBSITE", "www_url", "https://%s/"%conf_name) - wip_url or dcf.set("WEBSITE", "wip_url", create_wip_url()) dcf.get("WEBSITE_MODULES", "sidebar_title") or \ dcf.set("WEBSITE_MODULES", "sidebar_title", langs.site.sidebar_title) dcf.get("WEBSITE_MODULES", "sidebar_items").isdigit() or \ @@ -324,24 +335,18 @@ def dcf_update_values(srv): # Ensure domain is valid and ready to be used # #---------------------------------------------# def valid_conf(): + global active + dcf_load() - - # Most importants # - dcf name must be config_name - # - root server must exists - try: - dcf_name = dcf.get("DOMAIN", "name") - if dcf_name != conf_name: - debug.out(100, conf_name, dcf_uri, True, 2, True) - except: + try: dcf_name = dcf.get("DOMAIN", "name") + except: debug.out(100, conf_name, dcf_uri, True, 2, True) + if dcf_name != conf_name: debug.out(100, conf_name, dcf_uri, True, 2, True) - - - - # Server root + + # - root server must exists try: dcf_srv = dcf.get("SERVER", "root") except: debug.out(100, "SERVER root", "?", True, 2, True) - if not dcf_srv or not tools.dir_exists(dcf_srv, True): debug.out(100, "SERVER root", "? %s"%dcf_srv, True, 2, True) @@ -366,6 +371,19 @@ def valid_conf(): if now_dcf_hash != ult_dcf_hash: dcf_update_values("") + return is_active() + + +#==============================# +# Check if domain is activated # +# Return True or False +#------------------------------# +def is_active(): + dcf_load() + # Domain activated ? + try: return dcf.getboolean("DOMAIN", "activated") + except: return False + #======#======================================================================= # MAIN # diff --git a/src/var/lib/tyto/translations/__pycache__/logs_fr.cpython-311.pyc b/src/var/lib/tyto/translations/__pycache__/logs_fr.cpython-311.pyc index b8e22f4..18871d6 100644 Binary files a/src/var/lib/tyto/translations/__pycache__/logs_fr.cpython-311.pyc and b/src/var/lib/tyto/translations/__pycache__/logs_fr.cpython-311.pyc differ diff --git a/src/var/lib/tyto/translations/logs_fr.py b/src/var/lib/tyto/translations/logs_fr.py index 7ecb177..f854c3e 100644 --- a/src/var/lib/tyto/translations/logs_fr.py +++ b/src/var/lib/tyto/translations/logs_fr.py @@ -59,6 +59,7 @@ err_cr_file = "Fichier non créé" # Warnings warn_no_dom = "Domaine non configuré" +domain_off = "Domaine désactivé" reset_dom = "RÉINITIALISE le domaine" # infos