From b0393cfe8a6cba06cb1ba10567caca21bb1fab1a Mon Sep 17 00:00:00 2001 From: Brian Read Date: Sun, 1 Dec 2024 15:29:08 +0000 Subject: [PATCH] Add in check domains, and highlight any files created .new in red --- Targets/Letsencrypt/Letsencrypt-Custom.pm | 32 ++++++- Targets/Letsencrypt/Letsencrypt.pm | 2 +- .../Letsencrypt/_lets_CHECKALLDOMAINS.html.ep | 2 +- .../_lets_CHECKALLENABLEDDOMAINS.html.ep | 2 +- .../Letsencrypt/_lets_CHECKONEDOMAIN.html.ep | 4 +- Targets/Letsencrypt/_lets_LIST.html.ep | 2 +- Targets/Letsencrypt/_lets_PARAMS.html.ep | 2 +- Targets/Letsencrypt/letsencrypt.css | 2 +- Targets/Letsencrypt/letsencrypt.html.ep | 2 +- Targets/Letsencrypt/letsencrypt_en.lex | 94 +++++++++---------- json5/Letsencrypt.json5 | 4 +- sm2gen.py | 51 ++++++++-- 12 files changed, 131 insertions(+), 68 deletions(-) diff --git a/Targets/Letsencrypt/Letsencrypt-Custom.pm b/Targets/Letsencrypt/Letsencrypt-Custom.pm index a3720f3..e6f32d7 100644 --- a/Targets/Letsencrypt/Letsencrypt-Custom.pm +++ b/Targets/Letsencrypt/Letsencrypt-Custom.pm @@ -159,7 +159,7 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); my %ret = ( 'Data1'=>'Data for CHECKALLDOMAINS', #Example # fields from Inputs in CHECKALLDOMAINS $fields['CHECKALLDOMAINS'] - 'AllDomainsCheck'=>'AllDomainsCheck contents', + 'AllDomainsCheck'=>$c->update_all_domains(), ); return %ret; @@ -171,7 +171,7 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); my %ret = ( 'Data1'=>'Data for CHECKALLENABLEDDOMAINS', #Example # fields from Inputs in CHECKALLENABLEDDOMAINS $fields['CHECKALLENABLEDDOMAINS'] - 'EnabledDomainsCheck'=>'EnabledDomainsCheck contents', + 'EnabledDomainsCheck'=>$c->update_enabled_domains(), ); return %ret; @@ -184,8 +184,7 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db"); 'Data1'=>'Data for CHECKONEDOMAIN', #Example # fields from Inputs in CHECKONEDOMAIN $fields['CHECKONEDOMAIN'] 'OneDomainToCheck'=>$c->param("CHECKONEDOMAIN"), - 'OneDomainsCheck'=>'OneDomainsCheck contents', - + 'OneDomainsCheck'=>$c->update_one_domain($c->param("CHECKONEDOMAIN")) ); return %ret; } @@ -445,4 +444,29 @@ sub get_my_ip my $output = `/usr/sbin/e-smith/getmyip`; return $output || "IP"; } + +sub update_one_domain +{ + my ($self,$domain) = @_; + return "$domain not domain" unless ($ddb->get($domain) || $hdb->get($domain)); + ($domain) = ($domain =~ /([\w\p{L}.]+)/); + my $output = `/etc/e-smith/events/actions/letsencrypt-setdomains " " $domain `; + return $output || "-empty-"; +} + +sub update_all_domains +{ + my $self = shift; + my $output = `/etc/e-smith/events/actions/letsencrypt-setdomains "" "" all `; + return $output || "-empty-"; +} + +sub update_enabled_domains +{ + my $self = shift; + my $output = `/etc/e-smith/events/actions/letsencrypt-setdomains "" "" enabled `; + return $output || "-empty-"; +} + + 1; \ No newline at end of file diff --git a/Targets/Letsencrypt/Letsencrypt.pm b/Targets/Letsencrypt/Letsencrypt.pm index 96653bd..220b439 100644 --- a/Targets/Letsencrypt/Letsencrypt.pm +++ b/Targets/Letsencrypt/Letsencrypt.pm @@ -1,6 +1,6 @@ package SrvMngr::Controller::Letsencrypt; # -# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 13:34:33 +# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 15:22:43 # #---------------------------------------------------------------------- # heading : Network diff --git a/Targets/Letsencrypt/_lets_CHECKALLDOMAINS.html.ep b/Targets/Letsencrypt/_lets_CHECKALLDOMAINS.html.ep index 941a99e..84d9c1a 100644 --- a/Targets/Letsencrypt/_lets_CHECKALLDOMAINS.html.ep +++ b/Targets/Letsencrypt/_lets_CHECKALLDOMAINS.html.ep @@ -1,5 +1,5 @@ %# -%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 13:34:33 +%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-12-01 15:22:43 %#