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 %#