From de5c93c668207734e16b7133bcc131c37e28f278 Mon Sep 17 00:00:00 2001 From: Cyrille LOUARN Date: Mon, 25 Sep 2023 10:26:08 +0200 Subject: [PATCH] start/stop domain + local domain directories creations --- src/usr/bin/tyto | 4 +- .../program/__pycache__/args.cpython-311.pyc | Bin 2421 -> 2488 bytes .../program/__pycache__/check.cpython-311.pyc | Bin 755 -> 744 bytes .../__pycache__/domain.cpython-311.pyc | Bin 19612 -> 20329 bytes .../program/__pycache__/forms.cpython-311.pyc | Bin 8631 -> 8587 bytes .../program/__pycache__/langs.cpython-311.pyc | Bin 2836 -> 2871 bytes .../program/__pycache__/new.cpython-311.pyc | Bin 731 -> 729 bytes .../program/__pycache__/tools.cpython-311.pyc | Bin 3559 -> 3771 bytes .../program/__pycache__/tyto.cpython-311.pyc | Bin 1833 -> 1846 bytes .../__pycache__/userset.cpython-311.pyc | Bin 719 -> 946 bytes src/var/lib/tyto/program/args.py | 2 + src/var/lib/tyto/program/check.py | 11 +- src/var/lib/tyto/program/domain.py | 352 ++++++++++-------- src/var/lib/tyto/program/forms.py | 50 +-- src/var/lib/tyto/program/langs.py | 6 +- src/var/lib/tyto/program/new.py | 4 +- src/var/lib/tyto/program/post.py | 33 ++ src/var/lib/tyto/program/tools.py | 41 +- src/var/lib/tyto/program/tyto.py | 1 + src/var/lib/tyto/program/userset.py | 27 +- .../__pycache__/logs_fr.cpython-311.pyc | Bin 2442 -> 2539 bytes src/var/lib/tyto/translations/logs_en.py | 2 + src/var/lib/tyto/translations/logs_fr.py | 2 + 23 files changed, 309 insertions(+), 226 deletions(-) create mode 100644 src/var/lib/tyto/program/post.py diff --git a/src/usr/bin/tyto b/src/usr/bin/tyto index ce6e6e5..46ed4a8 100755 --- a/src/usr/bin/tyto +++ b/src/usr/bin/tyto @@ -1,6 +1,6 @@ #!/usr/bin/env python3 -# Version: 1.9.2 -# Updated: 2023-09-23 1695486804 +# Version: 1.9.4 +# Updated: 2023-09-25 1695630197 # Tyto - Littérateur # Copyright (C) 2023 Cyrille Louarn diff --git a/src/var/lib/tyto/program/__pycache__/args.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/args.cpython-311.pyc index d3e4f597a029a8c2a3ba547a92b5c749dd86562a..3515f88724397e108e28254ba4771ad268eaa3cd 100644 GIT binary patch delta 242 zcmew=v_qJ0IWI340}wp55KNWf+Q_$rb#grmCu7~@J*;0Q&tek;Vm(Io$tT%-RM?9Y zfC_K1CTFB3XWwGZOD(^}T%1~Ri?z5Uv8d!0OL0kl!DJnFOGfRO#Z{9(u?Gl>PqF^M&Bnp` zfdNP~D18u^9Lu4}s5QBrL)KOosH{j6MDTzJArK)4B2+*G$eHswqhXaWQhNqnTJ@OYhrLJ&FePCc@w!6#1+2YxeJk@N9^-{JayempJ i1nywD$YOhi#r6V=?POD?g|Y%{j7lFEFo_~zposv-1T0tp delta 136 zcmaFC`k9q)IWI340}vz&@uxmu-N+ZosLEBAn3I_jpPZkUc8fJ7HK{cH7IS`S$t_Nh zNPJ#mZt5-el*uiOxi;!Rjm1$wqJiNlC;t^rsf(O4S2$%pFfcN^Fy3Y1Z1Lm*=41x^=1`{2zxX>fiB8`m(EzZ~h5U)JGIc zvGf!*qCDvln!KYCM4qM*6L~Tt40)PI%;aeqv5=>A#LA*YYQ)Bx0NPmwpo297bg~wJ zF4hV#kF^2JXYByptOKBjbpkA4T>uN&Jb*=Z3Q=Kd(wolaXW;le{X((%^WYvSh8QJj z&s1sJrGK*S&uGAezjBR~P4BCxXiVKSS)TS~J!}D6$QHq~=raq%hre>s)SJ|_>0Q&C z)EpfyPF1A+^-tDoOoOE~!qkY*kjH&`ytLa8qcZKQe};X=6pU{pRc!G{wSh{F9y{$0 z`@+?qK`nm{f8`pf1wNQ3>(cMxTDBxBM*S}6ma(N-SPi?tYGBK&<*#^#i!wNtE)ag&;BSKeHy;D|h>B`$fuf=sCnzeVb3;V+Vre6)>~E$1_av8P4#$HFRyPBRa(nKf`(R zn`P5fcv@zrLpQ^+h2v+YCZe*L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_O}d|=novj^eP`frNQxkKhaJQc>1|Y(8dWu{^sZ-mEn33G9309HDm4`_+%Yi zV?M)vn5^M$+yM@JV$CjV5MR1IpVoeYcX;i*yH9ZUarQpwVWo)@{0CfM@m%$|vW@sD z>M}B8@bZn}FC^(88sC~a&-^X;Ofo^Bih5sGpW`nb!>g2kJ~9)W@0!H_Y-LsXc){W@ z_?!UL*COeuK^J_NmH&5vBri@tYLYUV!C$PHzr@6aNhKx?m`I9c=_n&Ui!2?;lSGCz zUZvWKW>93$tk75=9AW}kzl|-CMSJMZQgD%$K9g8)MixR+5SF*nfoSGFj%3B3JQP_I zX0St2pff+l(LTfkPbQM263tkUglXm!_G!kX9uxiX!EdamD z$OgmCFnmI;;fU(}?=7O0%lF=)kfCpfP)U*1;MpNmQfoE9@qU$5oA9ejDhmv-Sy9Om zhXK~+Dru|3kyUcR5JZM!JA{Ugn_4hJCGQ(ZL)i|Yl4{b>wpCEN{?5azA76WTZR0p! zP#gDd6*wPGeOXZVq5z*0FK8ADn&aNM7t0TbjzCii>+Zqz<;2WJPtu({ud2^Lg9bO2 zATFXnK9qiur@R8?O}PcCJ#N{t5|H-DmsIr&s(Ry{A5Q&E;I9LzDZZvxsOjaYK7s0s z+kWGyj$5}J1rPflpMG$9!;&oL9c_Z6EpFLzRIm36j%rY4hTyQe0O!@sAgrA3hqI68 zAIxu@NPfT<_6UVN5Vg>yc=jhR^M%KR!eeoV)^j-Z-jA**u^n;vV{uRXg6J6RB);e@ IJ8L%nFWHU;a{vGU diff --git a/src/var/lib/tyto/program/__pycache__/forms.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/forms.cpython-311.pyc index 5192df588d6dce094b65001d3aa88f49268dc665..d8bafe2809964191e1962e36124baec47b4b2586 100644 GIT binary patch delta 1239 zcmb_b&1(}u6rY(S`;m6@*|g~cA6mMDBQ=rg`2%b{>2b@W>aVu6YK6ZZ0y!U>;_xA11`{}3C z!b?H017hX0EB)oIu*KQg`GsU|IVIH)-si5hG32-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yc index d8384982c378a3a3d0d23794b4550c17b180f5b4..00b7f8a613fab87322a4c372c8853367177bad9d 100644 GIT binary patch delta 259 zcmbOtwq1;OIWI340}xoH38aQ>A>xoZ2LODZ;0D@D(gJ7pIRk1NJBr*U^3u5r@Bz%EM_%5GFPgZ|k WSKf@s6>Jyz^sn&gZ}#GN%LD+oeK6zz diff --git a/src/var/lib/tyto/program/__pycache__/new.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/new.cpython-311.pyc index 5f5fcc36b9a31857180035ad8dc27bf52a9c25e2..6edf5f4c156cbc8119bb18a557befebf6ea7b005 100644 GIT binary patch delta 75 zcmcc3dXtrRIWI340}xDM5J$xyT}Rg+=TFi`Zmarg;DwfEAJe delta 77 zcmcb~dYhGZIWI340}xoWaHrnh$a{#9i7RFD1x9fY^@34fMd~7_%oR?V4-8Dq+)G)O baDf?jS-7sSh+bq7zrrGZfkk|>HPbu*Lo^k& diff --git a/src/var/lib/tyto/program/__pycache__/tools.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/tools.cpython-311.pyc index 54ddb3e45ffa6cd1adbf0d8fb1f89b3e43573e22..853beecd6b94f5977223e7b3e64ae5f6e79c898b 100644 GIT binary patch delta 660 zcmaKqO=uHA6o7YjcXoF6&&D=Mo0z2NTG=QRjh9$SD8-;RZ55$NOMce0SUt?v9yR^tWg$ zkL0>Y;&cg4V7V?-P(`gE`dA;Mua0>3;TeGGcbGPOwN&)n2gUoY18Gb-alyxTSJ&KS z?(rZyXOasUVV19#iCe6>%RGUcXP$YcUXtEX+Dktb;aF&^`q@ezSjpzYuI2PBXWi*T z6bL}dzX)$lG%`)x%I>=FZhU}Uoa^CS=ifNQ)_>!)gsy>I`WAhe++oFdGb~75x;LS4y4=F76k+;Yjes!SR!;$au=drfQF4;qmV_B@k_b1a7#xFU@#RR>t@)DY)(EdI zN%Me0&e5kh1*Yi^KCRC%m&?>M0R4n7LiSu^oSIr98z_QeY%XprHc)f43llwKF}W6%XML(iHqkfQ~&dI^E)Ko}xsf_xwhF*O3l0^umgakkeV D=|`qH delta 532 zcmdlj`&^oDIWI340}vGd9n47~q5w7o*4r1~{R> P&Zz%^0h1^a0vZDVSSN=W diff --git a/src/var/lib/tyto/program/__pycache__/tyto.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/tyto.cpython-311.pyc index a72c07157ad3ad07da19e2872f12056f25dde600..ae863330c5e783551379eeefdcc04d7482d11496 100644 GIT binary patch delta 99 zcmZ3gX xMJ2abic9hfHdeZ^Nvi^NF#>UM1d#Z^%*e?2!HSKWr-A*0z~ozO-Ym*MVF0~48_)m% delta 86 zcmdnSw~~)J&`X|jO`X{az<)$_ATb}%z|6&1*J(jnZ+3!+uYcs km4ONwfw(vVNPJ*sWMuqc#mddo!2W@6@^dzC7Db>i054${{{R30 diff --git a/src/var/lib/tyto/program/__pycache__/userset.cpython-311.pyc b/src/var/lib/tyto/program/__pycache__/userset.cpython-311.pyc index 61482d9a4545c26ba778273cb986b4562e04a70e..c09b1eacb6c1dabdc40de4af951647f89b5faf43 100644 GIT binary patch delta 524 zcmX@lx`~}{IWI340}wp55KMJupU5Ynq5|YiXGmd4Va#EOg3ydnj9@-f6jKUQ3qut1 zL?=c!BzF@s$>*76H}A0~MB(7Ej*6=vglXl+Xg=;vOK;z;J_=yQ8!zz9IgpsMHlv z?YkgS3rr%jAtE{-c-gtQKQI7^2B!}~46OVOP7P%(UX4C2J`G@agPr$+pwb0)5W2xF zI3eN^x9kOO*}E)US6C!xs9j`HtiQsdcmak!urhEcgO!3*eFi#+L6hYcYffTbdT|jS zkO%fg5y;6a8H%Jq0+K-D7l%!5eoARhs$G#BkP8Z|VpkyXftit!@q-&91Eb6Z25Ia_ S4JPq{kB?F50|O=jwg&*KrGr8M delta 296 zcmdnQex8+YIWI340}%Yzt<8 diff --git a/src/var/lib/tyto/program/args.py b/src/var/lib/tyto/program/args.py index 35801aa..f6cc65c 100644 --- a/src/var/lib/tyto/program/args.py +++ b/src/var/lib/tyto/program/args.py @@ -94,6 +94,8 @@ def start_process(): "check" : check.manage, "new" : new.manage, "set" : userset.manage, + "start" : userset.manage, + "stop" : userset.manage, "show" : show.manage, } diff --git a/src/var/lib/tyto/program/check.py b/src/var/lib/tyto/program/check.py index f0ab8dc..56045bf 100644 --- a/src/var/lib/tyto/program/check.py +++ b/src/var/lib/tyto/program/check.py @@ -36,10 +36,15 @@ import sys import domain, langs, debug +#===========================================# +# Manage argument from command line "check" # +# Domain must be valid to proceed # +# Create user work domain directories # +#-------------------------------------------# def manage(action, target): # Load domain configuration, update if needed, check if valid - if not domain.valid_conf(): - debug.out(105, domain.conf_name, domain.dcf_uri, True, 1, True) - + if not domain.cf_valid(): + debug.out(105, domain.name, domain.cf_uri, True, 1, True) + langs.load_website_lang() print("check:", action, target) diff --git a/src/var/lib/tyto/program/domain.py b/src/var/lib/tyto/program/domain.py index 4b44b64..a48a7a6 100644 --- a/src/var/lib/tyto/program/domain.py +++ b/src/var/lib/tyto/program/domain.py @@ -40,38 +40,37 @@ import debug, tyto, tools, forms, langs # Exit if directory name is compatible with a domain name # #---------------------------------------------------------# def compatible_name(): - if len(conf_name.rsplit(".")) <= 1: - debug.out(3, "abc.tld", conf_name, True, 2, True) + if len(name.rsplit(".")) <= 1: + debug.out(3, "abc.tld", name, True, 2, True) #================================# # Load Domain Configuration file # # As needed, exit if not exists # #--------------------------------# -def dcf_load(): - global dcf +def cf_load(): + global cf - dcf = False - if not dcf_exists(): - debug.out(100, conf_name, dcf_uri, True, 1, True) - - dcf = configparser.ConfigParser() - dcf.read(dcf_uri) + cf_exists() or sys.exit(100) + + cf = False + cf = configparser.ConfigParser() + cf.read(cf_uri) #=====================================# # Load User Domain Configuration file # # As needed, exit if not exists # #-------------------------------------# -def ult_dcf_load(): - global ult_dcf +def ult_cf_load(): + global ult_cf - ult_dcf = False - if not os.path.exists(ult_dcf_uri): - debug.out(100, conf_name, ult_dcf_uri, True, 1, True) + ult_cf = False + if not os.path.exists(ult_cf_uri): + debug.out(100, name, ult_cf_uri, True, 1, True) - ult_dcf = configparser.ConfigParser() - ult_dcf.read(ult_dcf_uri) + ult_cf = configparser.ConfigParser() + ult_cf.read(ult_cf_uri) #===================================# @@ -90,36 +89,36 @@ def ult_dlf_load(): # Show status message only once # # return True or False #-------------------------------------------# -def dcf_exists(): +def cf_exists(): global shown_ok, shown_no - if os.path.exists(dcf_uri): + if os.path.exists(cf_uri): try: shown_ok - except: debug.out(202, conf_name, dcf_uri, True, 0, False) + except: debug.out(202, name, cf_uri, False, 0, False) shown_ok = True return True else: try: shown_no - except: debug.out(104, "False", dcf_uri, True, 1, False) + except: debug.out(104, "False", cf_uri, True, 1, False) shown_no = True compatible_name() return False #=========================================# -# Guess and return wip_url from conf_name # +# Guess and return wip_url from name # #-----------------------------------------# def create_wip_url(): wip_url = "https://www-wip.%s/" - len_cn = conf_name.count(".") + len_cn = name.count(".") # Domain name Format: a.b if len_cn == 1: - return wip_url%conf_name + return wip_url%name # Domain name format: (at least) a.b.c - len_cn = len(conf_name.rsplit(".")[0]) + 1 - tld = conf_name[len_cn:] + len_cn = len(name.rsplit(".")[0]) + 1 + tld = name[len_cn:] return wip_url%tld @@ -130,21 +129,21 @@ def create_wip_url(): # - default User domain configuration file # # If not User domains list file, create it # #------------------------------------------# -def dcf_create(): +def cf_create(): compatible_name() # This fonction is only called with "new domain" argument # If a conf already exists, show important RESET log - if dcf_exists(): - debug.out(102, "!?", dcf_uri, True, 1, False) + if cf_exists(): + debug.out(102, "!?", cf_uri, True, 1, False) # Ask User to create new domain. Will exit if not ok. - forms.ask_domain_shortname(conf_name) + forms.ask_domain_shortname(name) # Create default files - tools.create_file(dcf_uri, tyto.ini_domain) + tools.create_file(cf_uri, tyto.ini_domain) tools.create_dirs(ult_dir) - tools.create_file(ult_dcf_uri, tyto.ini_domain_user) + tools.create_file(ult_cf_uri, tyto.ini_domain_user) # User Domains list file if not os.path.exists(ult_dlf_uri): @@ -167,47 +166,49 @@ def dcf_create(): #===========================================# # Set or Update domain configuration values # #-------------------------------------------# -def dcf_update_values(srv): +def cf_update_values(srv): # Prepare Domain Configuration File keys values #----------------------------------------------- - dcf_load() + cf_load() # Test server directory, and exit if not exists - srv = srv or dcf.get("SERVER", "root") # Set from db if unknown + srv = srv or cf.get("SERVER", "root") # Set from db if unknown # Test registred website lang # change to default lang sys, or "en" if no translation file # Load website lang file langs.load_website_lang() + cf.set("WEBSITE", "lang", langs.site_lang) - srv_dom = os.path.join(srv, conf_name + "/") + srv_dom = os.path.join(srv, name + "/") 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") + try: cf.getboolean("DOMAIN", "activated") + except: cf.set("DOMAIN", "activated", "no") + try: cf.getboolean("WEBSITE", "article_code") + except: cf.set("WEBSITE", "article_code", "yes") + try: cf.getboolean("WEBSITE", "static") + except: cf.set("WEBSITE", "static", "no") + try: cf.getboolean("WEBSITE_MODULES", "sitemaps") + except: cf.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" + favicon = cf.get("TEMPLATE_FILENAMES", "favicon") or "favicon.png" + logo = cf.get("TEMPLATE_FILENAMES", "logo") or "logo.png" + styles = cf.get("TEMPLATE_FILENAMES", "styles") or "styles.css" + rss = cf.get("TEMPLATE_FILENAMES", "rss") or "rss.xml" + stats = cf.get("TEMPLATE_FILENAMES", "stats") or "stats.ini" - 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()) + # https URLs (www + wip) + cf.get("WEBSITE", "www_url") or \ + cf.set("WEBSITE", "www_url", "https://%s/"%name) + cf.get("WEBSITE", "wip_url") or \ + cf.set("WEBSITE", "wip_url", create_wip_url()) - usr_mods = os.path.join(dcf_dir + "modules/") - usr_tpl = os.path.join(dcf_dir, "template/") + usr_mods = os.path.join(cf_dir, "modules/") + usr_tpl = os.path.join(cf_dir, "template/") usr_favicon = os.path.join(usr_tpl, favicon) usr_logo = os.path.join(usr_tpl, logo) usr_styles = os.path.join(usr_tpl, styles) @@ -229,162 +230,187 @@ def dcf_update_values(srv): # Update Domain Configuration File #--------------------------------- - dcf.set("DOMAIN", "name", conf_name) - dcf.set("TYTO", "domain_hash", tools.get_filesum(dcf_uri, False)) - dcf.set("TYTO", "domain_conf", dcf_uri) - dcf.set("TYTO", "domain_user", ult_dcf_uri) + cf.set("DOMAIN", "name", name) + cf.set("TYTO", "domain_hash", tools.get_filesum(cf_uri, False)) + cf.set("TYTO", "domain_conf", cf_uri) + cf.set("TYTO", "domain_user", ult_cf_uri) # USER - dcf.set("USER_DIRS", "root", dcf_dir) - dcf.set("USER_DIRS", "articles", dcf_dir + "articles/") - dcf.set("USER_DIRS", "images", dcf_dir + "images/") - dcf.set("USER_DIRS", "files", dcf_dir + "files/") - dcf.set("USER_DIRS", "modules", usr_mods) - dcf.set("USER_DIRS", "database", dcf_dir + ".db/") - dcf.set("USER_DIRS", "template", usr_tpl) + cf.set("USER_DIRS", "root", cf_dir) + cf.set("USER_DIRS", "articles", cf_dir + "articles/") + cf.set("USER_DIRS", "images", cf_dir + "images/") + cf.set("USER_DIRS", "files", cf_dir + "files/") + cf.set("USER_DIRS", "modules", usr_mods) + cf.set("USER_DIRS", "database", cf_dir + ".db/") + cf.set("USER_DIRS", "template", usr_tpl) - dcf.set("USER_MODULES_FILES", "metas", usr_mods + "tyto_metas.raw") - dcf.set("USER_MODULES_FILES", "header", usr_mods + "tyto_header.raw") - dcf.set("USER_MODULES_FILES", "navbar", usr_mods + "tyto_navbar.raw") - dcf.set("USER_MODULES_FILES", "sidebar", usr_mods + "tyto_sidebar.raw") - dcf.set("USER_MODULES_FILES", "footer", usr_mods + "tyto_footer.raw") + cf.set("USER_MODULES_FILES", "metas", usr_mods + "tyto_metas.raw") + cf.set("USER_MODULES_FILES", "header", usr_mods + "tyto_header.raw") + cf.set("USER_MODULES_FILES", "navbar", usr_mods + "tyto_navbar.raw") + cf.set("USER_MODULES_FILES", "sidebar", usr_mods + "tyto_sidebar.raw") + cf.set("USER_MODULES_FILES", "footer", usr_mods + "tyto_footer.raw") - dcf.set("USER_TEMPLATE_FILES", "favicon", usr_favicon) - dcf.set("USER_TEMPLATE_FILES", "logo", usr_logo) - dcf.set("USER_TEMPLATE_FILES", "styles", usr_styles) + cf.set("USER_TEMPLATE_FILES", "favicon", usr_favicon) + cf.set("USER_TEMPLATE_FILES", "logo", usr_logo) + cf.set("USER_TEMPLATE_FILES", "styles", usr_styles) # WEBSITE - dcf.set("WEBSITE", "lang", langs.site_lang) - 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 \ - dcf.set("WEBSITE_MODULES", "sidebar_items", "0") - dcf.get("WEBSITE_MODULES", "rss_items").isdigit() or \ - dcf.set("WEBSITE_MODULES", "rss_items", "0") + cf.get("WEBSITE_MODULES", "sidebar_title") or \ + cf.set("WEBSITE_MODULES", "sidebar_title", langs.site.sidebar_title) + cf.get("WEBSITE_MODULES", "sidebar_items").isdigit() or \ + cf.set("WEBSITE_MODULES", "sidebar_items", "0") + cf.get("WEBSITE_MODULES", "rss_items").isdigit() or \ + cf.set("WEBSITE_MODULES", "rss_items", "0") - dcf.set("TEMPLATE_FILENAMES", "favicon", favicon) - dcf.set("TEMPLATE_FILENAMES", "logo", logo) - dcf.set("TEMPLATE_FILENAMES", "styles", styles) - dcf.set("TEMPLATE_FILENAMES", "rss", rss) - dcf.set("TEMPLATE_FILENAMES", "stats", stats) + cf.set("TEMPLATE_FILENAMES", "favicon", favicon) + cf.set("TEMPLATE_FILENAMES", "logo", logo) + cf.set("TEMPLATE_FILENAMES", "styles", styles) + cf.set("TEMPLATE_FILENAMES", "rss", rss) + cf.set("TEMPLATE_FILENAMES", "stats", stats) # SERVER - dcf.set("SERVER", "root", srv) - dcf.set("SERVER", "domain", srv_dom) + cf.set("SERVER", "root", srv) + cf.set("SERVER", "domain", srv_dom) # WIP - dcf.set("WIP_DIRS", "root", srv_wip) - dcf.set("WIP_DIRS", "images", srv_wip + "images/") - dcf.set("WIP_DIRS", "files", srv_wip + "files/") - dcf.set("WIP_DIRS", "template", wip_tpl) - dcf.set("WIP_FILES", "favicon", wip_favicon) - dcf.set("WIP_FILES", "logo", wip_logo) - dcf.set("WIP_FILES", "styles", wip_styles) - dcf.set("WIP_FILES", "rss", wip_rss) - dcf.set("WIP_FILES", "stats", wip_stats) - dcf.set("WIP_FILES", "metas", wip_tpl + "metas.html") - dcf.set("WIP_FILES", "header", wip_tpl + "header.html") - dcf.set("WIP_FILES", "navbar", wip_tpl + "navbar.html") - dcf.set("WIP_FILES", "sidebar", wip_tpl + "sidebar.html") - dcf.set("WIP_FILES", "footer", wip_tpl + "footer.html") + cf.set("WIP_DIRS", "root", srv_wip) + cf.set("WIP_DIRS", "images", srv_wip + "images/") + cf.set("WIP_DIRS", "files", srv_wip + "files/") + cf.set("WIP_DIRS", "template", wip_tpl) + cf.set("WIP_FILES", "favicon", wip_favicon) + cf.set("WIP_FILES", "logo", wip_logo) + cf.set("WIP_FILES", "styles", wip_styles) + cf.set("WIP_FILES", "rss", wip_rss) + cf.set("WIP_FILES", "stats", wip_stats) + cf.set("WIP_FILES", "metas", wip_tpl + "metas.html") + cf.set("WIP_FILES", "header", wip_tpl + "header.html") + cf.set("WIP_FILES", "navbar", wip_tpl + "navbar.html") + cf.set("WIP_FILES", "sidebar", wip_tpl + "sidebar.html") + cf.set("WIP_FILES", "footer", wip_tpl + "footer.html") # WWW - dcf.set("WWW_DIRS", "root", srv_www) - dcf.set("WWW_DIRS", "images", srv_www + "images/") - dcf.set("WWW_DIRS", "files", srv_www + "files/") - dcf.set("WWW_DIRS", "template", www_tpl) - dcf.set("WWW_FILES", "favicon", www_favicon) - dcf.set("WWW_FILES", "logo", www_logo) - dcf.set("WWW_FILES", "styles", www_styles) - dcf.set("WWW_FILES", "rss", www_rss) - dcf.set("WWW_FILES", "stats", www_stats) - dcf.set("WWW_FILES", "metas", www_tpl + "metas.html") - dcf.set("WWW_FILES", "header", www_tpl + "header.html") - dcf.set("WWW_FILES", "navbar", www_tpl + "navbar.html") - dcf.set("WWW_FILES", "sidebar", www_tpl + "sidebar.html") - dcf.set("WWW_FILES", "footer", www_tpl + "footer.html") + cf.set("WWW_DIRS", "root", srv_www) + cf.set("WWW_DIRS", "images", srv_www + "images/") + cf.set("WWW_DIRS", "files", srv_www + "files/") + cf.set("WWW_DIRS", "template", www_tpl) + cf.set("WWW_FILES", "favicon", www_favicon) + cf.set("WWW_FILES", "logo", www_logo) + cf.set("WWW_FILES", "styles", www_styles) + cf.set("WWW_FILES", "rss", www_rss) + cf.set("WWW_FILES", "stats", www_stats) + cf.set("WWW_FILES", "metas", www_tpl + "metas.html") + cf.set("WWW_FILES", "header", www_tpl + "header.html") + cf.set("WWW_FILES", "navbar", www_tpl + "navbar.html") + cf.set("WWW_FILES", "sidebar", www_tpl + "sidebar.html") + cf.set("WWW_FILES", "footer", www_tpl + "footer.html") - with open(dcf_uri, "w") as f: - dcf.write(f) + with open(cf_uri, "w") as f: + cf.write(f) # Update User local domain configuration file #-------------------------------------------- - ult_dcf_load() - ult_dcf.set("DOMAIN", "name", conf_name) - ult_dcf.set("DOMAIN", "hash", tools.get_filesum(dcf_uri, True)) - ult_dcf.set("DOMAIN", "root", dcf_dir) - ult_dcf.set("DOMAIN", "conf", dcf_uri) - ult_dcf.set("SERVER", "root", srv) + ult_cf_load() + ult_cf.set("DOMAIN", "name", name) + ult_cf.set("DOMAIN", "hash", tools.get_filesum(cf_uri, True)) + ult_cf.set("DOMAIN", "root", cf_dir) + ult_cf.set("DOMAIN", "conf", cf_uri) + ult_cf.set("SERVER", "root", srv) - with open(ult_dcf_uri, "w") as f: - ult_dcf.write(f) + with open(ult_cf_uri, "w") as f: + ult_cf.write(f) # Update User local Domains List File #------------------------------------ ult_dlf_load() - ult_dlf.set("DOMAINS", conf_name, dcf_dir) + ult_dlf.set("DOMAINS", name, cf_dir) with open(ult_dlf_uri, "w") as f: ult_dlf.write(f) - debug.out(204, "True", dcf_uri, True, 0, False) + debug.out(204, "True", cf_uri, True, 0, False) #=============================================# # Ensure domain is valid and ready to be used # #---------------------------------------------# -def valid_conf(): +def cf_valid(): global active - dcf_load() - # - dcf name must be config_name - 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) + cf_load() + # - cf name must be config_name + try: cf_name = cf.get("DOMAIN", "name") + except: debug.out(100, name, cf_uri, True, 2, True) + + if cf_name != name: + debug.out(100, name, cf_uri, True, 2, True) # - root server must exists - try: dcf_srv = dcf.get("SERVER", "root") + try: cf_srv = cf.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) + if not cf_srv or not tools.dir_exists(cf_srv, True): + debug.out(100, "SERVER root", "? %s"%cf_srv, True, 2, True) - # Check some values in ult_dcf - ult_dcf_load() + # Check some values in ult_cf + ult_cf_load() try: - ult_dcf_name = ult_dcf.get("DOMAIN", "name") - ult_dcf_hash = ult_dcf.get("DOMAIN", "hash") - ult_dcf_conf = ult_dcf.get("DOMAIN", "conf") - ult_dcf_root = ult_dcf.get("DOMAIN", "root") + ult_cf_name = ult_cf.get("DOMAIN", "name") + ult_cf_hash = ult_cf.get("DOMAIN", "hash") + ult_cf_conf = ult_cf.get("DOMAIN", "conf") + ult_cf_root = ult_cf.get("DOMAIN", "root") except: - debug.out(100, conf_name, ult_dcf_uri, True, 1, True) + debug.out(100, name, ult_cf_uri, True, 1, True) # Compare values (exit if mismatch) - if ult_dcf_name != conf_name or \ - ult_dcf_conf != dcf_uri or \ - dcf_name != ult_dcf_name: - debug.out(100, conf_name, "?", True, 1, True) + if ult_cf_name != name or \ + ult_cf_conf != cf_uri or \ + cf_name != ult_cf_name: + debug.out(100, name, "?", True, 1, True) - # Check if dcf need to be updated - now_dcf_hash = tools.get_filesum(dcf_uri, True) - if now_dcf_hash != ult_dcf_hash: - dcf_update_values("") + # Check if cf need to be updated + now_cf_hash = tools.get_filesum(cf_uri, True) + if now_cf_hash != ult_cf_hash: + cf_update_values("") - return is_active() + active = is_active() + active and create_work_dirs() + return active +#========================================# +# When user wants to (de)activate domain # +#----------------------------------------# +def userset_status(action): + do = { + "start" : "yes", + "stop" : "no" + } + + tools.update_ini_file(cf_uri, "DOMAIN", "activated", do[action]) + cf_valid() + + #==============================# # Check if domain is activated # # Return True or False #------------------------------# def is_active(): - dcf_load() + cf_load() # Domain activated ? - try: return dcf.getboolean("DOMAIN", "activated") + try: return cf.getboolean("DOMAIN", "activated") except: return False +#===================================# +# Create user domain work directory # +#-----------------------------------# +def create_work_dirs(): + cf_load() + + for key, directory in cf.items("USER_DIRS"): + tools.create_dirs(directory) + + #======#======================================================================= # MAIN # #------# @@ -401,20 +427,20 @@ except: #==========================================# # utl: $USER/.local/Tyto # -# dcf: Domain Configuration File # +# cf: Domain Configuration File # #------------------------------------------# # Domain Configuration directory -dcf_dir = user_dir.rsplit("articles/")[0] +cf_dir = user_dir.rsplit("articles/")[0] # Domain name from current basename directory # Exit if not format at least "abc.tld" -conf_name = os.path.basename(os.path.dirname(dcf_dir)) +name = os.path.basename(os.path.dirname(cf_dir)) -dcf_name = "tyto_domain.ini" -dcf_uri = os.path.join(dcf_dir, dcf_name) -dcf_id = tools.get_filesum(dcf_uri, False) # ID from URI +cf_name = "tyto_domain.ini" +cf_uri = os.path.join(cf_dir, cf_name) +cf_id = tools.get_filesum(cf_uri, False) # ID from URI # Tyto directory in home local user files ult_dir = os.path.join(home_dir, ".local/Tyto/") ult_dlf_uri = os.path.join(ult_dir, "domains.ini") # Domains list file -ult_dcf_uri = os.path.join(ult_dir, dcf_id + ".ini") +ult_cf_uri = os.path.join(ult_dir, cf_id + ".ini") diff --git a/src/var/lib/tyto/program/forms.py b/src/var/lib/tyto/program/forms.py index bd9ebc8..7a3e641 100644 --- a/src/var/lib/tyto/program/forms.py +++ b/src/var/lib/tyto/program/forms.py @@ -102,13 +102,13 @@ def ask_domain_shortname(config_name): # Getting domain Title # #----------------------# def ask_domain_title(): - domain.dcf_load() - title = domain.dcf.get("DOMAIN", "title") + domain.cf_load() + title = domain.cf.get("DOMAIN", "title") q = "> %s (%s)%s "%(langs.logs.domain_title, shorter(title), langs.logs.q) answer = ask(q, False, title) if answer != title: - tools.update_ini_file(domain.dcf_uri, "DOMAIN", "title", answer) + tools.update_ini_file(domain.cf_uri, "DOMAIN", "title", answer) #===========================# @@ -116,8 +116,8 @@ def ask_domain_title(): # Check if date match regex # #---------------------------# def ask_domain_date(): - domain.dcf_load() - date = domain.dcf.get("DOMAIN", "date") + domain.cf_load() + date = domain.cf.get("DOMAIN", "date") example = date or "YYYY[-MM-DD]" q = "> %s (%s)%s "%(langs.logs.domain_date, example, langs.logs.q) @@ -141,41 +141,41 @@ def ask_domain_date(): debug.out(50, "YYYY[-MM-DD]", answer, True, 2, True) if answer != date: - tools.update_ini_file(domain.dcf_uri, "DOMAIN", "date", answer) + tools.update_ini_file(domain.cf_uri, "DOMAIN", "date", answer) #========================# # Get domain description # #------------------------# def ask_domain_about(): - domain.dcf_load() - about = domain.dcf.get("DOMAIN", "about") + domain.cf_load() + about = domain.cf.get("DOMAIN", "about") q = "> %s (%s)%s "%(langs.logs.domain_about, shorter(about), langs.logs.q) answer = ask(q, False, about) if answer != about: - tools.update_ini_file(domain.dcf_uri, "DOMAIN", "about", answer) + tools.update_ini_file(domain.cf_uri, "DOMAIN", "about", answer) #=======================# # Get domain admin mail # #-----------------------# def ask_domain_mail(): - domain.dcf_load() - mail = domain.dcf.get("DOMAIN", "mail") + domain.cf_load() + mail = domain.cf.get("DOMAIN", "mail") q = "> %s (%s)%s "%(langs.logs.domain_mail, shorter(mail), langs.logs.q) answer = ask(q, False, mail) if answer != mail: - tools.update_ini_file(domain.dcf_uri, "DOMAIN", "mail", answer) + tools.update_ini_file(domain.cf_uri, "DOMAIN", "mail", answer) #===============================================# # Get domain tags (wil be used in all articles) # #-----------------------------------------------# def ask_domain_tags(): - domain.dcf_load() - tags = domain.dcf.get("DOMAIN", "tags") + domain.cf_load() + tags = domain.cf.get("DOMAIN", "tags") q = "> %s (%s)%s "%(langs.logs.domain_tags, shorter(tags), langs.logs.q) answer = ask(q, False, tags) @@ -189,7 +189,7 @@ def ask_domain_tags(): if i != len(tuple_tags) - 1: answer = answer + "," - tools.update_ini_file(domain.dcf_uri, "DOMAIN", "tags", answer) + tools.update_ini_file(domain.cf_uri, "DOMAIN", "tags", answer) #===================================# @@ -197,8 +197,8 @@ def ask_domain_tags(): # default en if no translation file # > !!!!!!!!!!!!!!!!!!!!!!!!!!!!!! < TODO #-----------------------------------# def ask_domain_lang(): - domain.dcf_load() - lang = domain.dcf.get("WEBSITE", "lang") or langs.get_sys_lang() + langs.get_website_lang() + lang = langs.site_lang q = "> %s (%s)%s "%(langs.logs.domain_lang, lang, langs.logs.q) answer = ask(q, False, lang).lower() @@ -206,26 +206,26 @@ def ask_domain_lang(): # Lang Format is 2 character if len(answer) != 2: debug.out("8", "xx", answer, True, 2, False) - ask_domain_lang() - return + debug.out(103, "en", "%swebsite_en.py"%langs.trfs, True, 1, False) + answer = lang # Check if translation file exists if not langs.translation_exists("website", answer, False): debug.out(103, "en", "%swebsite_en.py"%langs.trfs, True, 1, False) - answer = "en" + answer = lang if answer != lang: - tools.update_ini_file(domain.dcf_uri, "WEBSITE", "lang", answer) + tools.update_ini_file(domain.cf_uri, "WEBSITE", "lang", answer) #===================================# # Get domain server root # #-----------------------------------# def ask_domain_server(): - domain.dcf_load() - srv = domain.dcf.get("SERVER", "root") + domain.cf_load() + srv = domain.cf.get("SERVER", "root") - if srv and not not tools.dir_exists(srv, False): + if srv and not tools.dir_exists(srv, False): srv = "" q = "> %s (%s)%s "%(langs.logs.domain_srv, srv, langs.logs.q) @@ -237,5 +237,5 @@ def ask_domain_server(): ask_domain_server() return - domain.dcf_update_values(answer) + domain.cf_update_values(answer) diff --git a/src/var/lib/tyto/program/langs.py b/src/var/lib/tyto/program/langs.py index 03465c4..a336f1a 100644 --- a/src/var/lib/tyto/program/langs.py +++ b/src/var/lib/tyto/program/langs.py @@ -104,14 +104,14 @@ def load_logs_lang(): # Get/Set and import file | # #=============================================================================# #=======================================# -# Get website lang from dcf to set site # +# Get website lang from cf to set site # #---------------------------------------# def get_website_lang(): global site_lang, tr_website_uri tr_website_uri = "%swebsite_%s.py" - domain.dcf_load() - site_lang = domain.dcf.get("WEBSITE", "lang") + domain.cf_load() + site_lang = domain.cf.get("WEBSITE", "lang") or get_sys_lang() if not translation_exists("website", site_lang, False): site_lang = get_sys_lang() # or default "en" diff --git a/src/var/lib/tyto/program/new.py b/src/var/lib/tyto/program/new.py index 1310e79..58d141c 100644 --- a/src/var/lib/tyto/program/new.py +++ b/src/var/lib/tyto/program/new.py @@ -54,8 +54,8 @@ def manage(action, target): # or if user "force" option #-----------------------------------# def create_domain(): - if not domain.dcf_exists() or args.force: - domain.dcf_create() + if not domain.cf_exists() or args.force: + domain.cf_create() return diff --git a/src/var/lib/tyto/program/post.py b/src/var/lib/tyto/program/post.py new file mode 100644 index 0000000..f5c7407 --- /dev/null +++ b/src/var/lib/tyto/program/post.py @@ -0,0 +1,33 @@ +#!/usr/bin/env python3 +# Tyto - Littérateur + +# Copyright (C) 2023 Cyrille Louarn + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +#---------------------------------------------------------------------- +# XMPP: echolib (im@echolib.re) +# +# Description: About post (from target) database, uri... +# File: /var/lib/tyto/program/new.py +#---------------------------------------------------------------------- + +#------------------------- +# Funny Stats Project +#------------------------- +# file lines : +# file comments : +# file functions: +# file program : +#-------------------------- diff --git a/src/var/lib/tyto/program/tools.py b/src/var/lib/tyto/program/tools.py index 6e8e8a6..429cf5d 100644 --- a/src/var/lib/tyto/program/tools.py +++ b/src/var/lib/tyto/program/tools.py @@ -63,6 +63,19 @@ def dir_exists(dir_path, out): return True +#====================# +# Create directories # +#--------------------# +def create_dirs(path): + try: + if not os.path.exists(path): + os.makedirs(path, exist_ok=True) + debug.out(203, "True", path, False, 0, False) + except: + # Exit if not created + debug.out(5, "False", path, True, 2, True) + + #============================# # Create a new file and logs # #----------------------------# @@ -76,8 +89,10 @@ def create_file(file_path, contents): # Exit at error debug.out(7, "False", file_path, True, 2, True) - if up: debug.out(207, file_path, False, 0, False) - else: debug.out(206, file_path, False, 0, False) + # log "update" or "new" + file_name = os.path.basename(file_path) + if up: debug.out(207, file_name, file_path, False, 0, False) + else: debug.out(206, file_name, file_path, False, 0, False) #===========================================# @@ -88,23 +103,15 @@ def update_ini_file(file_path, section, key, val): if not os.path.exists(file_path): debug.out(5, "False", file_path, True, 2, True) + # Load ini file config = configparser.ConfigParser() config.read(file_path) - config.set(section, key, val) + # New value is same as registred + if config.get(section, key) == val: + return + + # Update file with new value + config.set(section, key, val) with open(file_path, "w") as f: config.write(f) - - -#====================# -# Create directories # -#--------------------# -def create_dirs(path): - try: - if not os.path.exists(path): - os.makedirs(path, exist_ok=True) - debug.out(203, "True", path, False, 0, False) - except: - # Exit if not created - debug.out(5, "False", path, True, 2, True) - diff --git a/src/var/lib/tyto/program/tyto.py b/src/var/lib/tyto/program/tyto.py index 0054efa..a767c37 100644 --- a/src/var/lib/tyto/program/tyto.py +++ b/src/var/lib/tyto/program/tyto.py @@ -28,6 +28,7 @@ # actions = ( "check", "wip", "publish", + "start", "stop", "new", "set", "show", diff --git a/src/var/lib/tyto/program/userset.py b/src/var/lib/tyto/program/userset.py index 29b688b..09eee8c 100644 --- a/src/var/lib/tyto/program/userset.py +++ b/src/var/lib/tyto/program/userset.py @@ -32,7 +32,7 @@ # file program : #-------------------------- -import langs, forms +import langs, forms, domain #====================================# @@ -40,14 +40,19 @@ import langs, forms # Specific to action "set # #------------------------------------# def manage(action, target): - do = { - "title" : forms.ask_domain_title, - "date" : forms.ask_domain_date, - "about" : forms.ask_domain_about, - "mail" : forms.ask_domain_mail, - "lang" : forms.ask_domain_lang, - "server" : forms.ask_domain_server, - } + if action == "set": + do = { + "title" : forms.ask_domain_title, + "date" : forms.ask_domain_date, + "about" : forms.ask_domain_about, + "mail" : forms.ask_domain_mail, + "lang" : forms.ask_domain_lang, + "server" : forms.ask_domain_server, + } + + do[target]() + elif action in ("start", "stop") \ + and target == "domain": + domain.userset_status(action) + - do[target]() - 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 18871d63ebf96ceb6762a4ee320c6a999d5c8983..02ca1b0013cf896f0221ed2870da3a1f4458b193 100644 GIT binary patch delta 142 zcmeAYel5(qoR^o20SKO22&U$2