Update letsencrypt, plus typos in template files

This commit is contained in:
Brian Read 2024-10-18 19:01:59 +01:00
parent d83a74100e
commit 964771d876
13 changed files with 889 additions and 39 deletions

View File

@ -0,0 +1,97 @@
#
# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-10-18 19:00:38
#
#
# Routines to be edited by the developer to provide validation for parameters
# and provison of the control data for table(s)
#
use esmith::util;
use esmith::HostsDB;
use esmith::AccountsDB;
use esmith::NetworksDB;
use esmith::HostsDB;
use esmith::DomainsDB;
#The most common ones
our $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
our $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
# Validation routines - parameters for each panel
sub validate_LIST {
my $c = shift;
my $prefix_data = shift; #Data hash as parameter
my $ret = 'ok';
return $ret;
}
sub validate_PARAMS {
my $c = shift;
my $prefix_data = shift; #Data hash as parameter
my $ret = 'ok';
return $ret;
}
# Get control data for tables(s)
sub get_DomainList {
# Return an array of hashes of the contents for each row and column for DomainList
# default is a single row of strings "col1header-1, col2header-1, col3Header-1 etc"
my $c = shift;
my $control_data = $c->stash('DomainList');
my @ret = {};
# foreach my $colHead (@$control_data) {
# my ret{$colHead} = "$colhead-1";
# };
return \@ret;
}
# Return hash with values from row in which link clicked on table
sub get_selected_LIST {
my $c = shift;
my $selected = shift; #Parameter is name of selected row.
my $is_new_record = shift; #Indicates new record required (defaults)
my %ret = {};
return $ret;
}
sub get_selected_PARAMS {
my $c = shift;
my $selected = shift; #Parameter is name of selected row.
my $is_new_record = shift; #Indicates new record required (defaults)
my %ret = {};
return $ret;
}
#after sucessful modify or create or whatever and submit then perfom (if the params validate)
sub perform_LIST {
my $c = shift;
my $prefix_data = shift; #Data hash as parameter
my $ret = 'ok';
return $ret;
}
sub perform_PARAMS {
my $c = shift;
my $prefix_data = shift; #Data hash as parameter
my $ret = 'ok';
return $ret;
}
sub create_link{
# WIP
my ($c,$route, $panel, $index) = shift;
my $link = "$route?trt=$panel&Selected=$index";
return $link;
}
1;

View File

@ -0,0 +1,267 @@
package SrvMngr::Controller::Letsencrypt;
#
# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-10-18 19:00:38
#
#----------------------------------------------------------------------
# heading : Miscellaneous
# description : letsencrypt
# navigation : 2000 400
#
# name : letsencrypt, method : get, url : /letsencrypt, ctlact : Letsencrypt#main
# name : letsencryptu, method : post, url : /letsencryptu, ctlact : Letsencrypt#do_update
# name : letsencryptd, method : get, url : /letsencryptd, ctlact : Letsencrypt#do_display
#
# routes : end
#
# Documentation: https://wiki.contribs.org/Letsencrypt
#----------------------------------------------------------------------
#
# Scheme of things:
#
# TBA!!
use strict;
use warnings;
use Mojo::Base 'Mojolicious::Controller';
use constant FALSE => 0;
use constant TRUE => 1;
use Locale::gettext;
use SrvMngr::I18N;
use SrvMngr qw(theme_list init_session);
use Data::Dumper;
use esmith::util;
use esmith::HostsDB;
use esmith::AccountsDB;
use esmith::NetworksDB;
use esmith::HostsDB;
use esmith::DomainsDB;
#The most common ones
our $cdb = esmith::ConfigDB->open() || die("Couldn't open config db");
our $adb = esmith::AccountsDB->open() || die("Couldn't open Accounts db");
our $ndb = esmith::NetworksDB->open() || die("Couldn't open Network db");
our $hdb = esmith::HostsDB->open() || die("Couldn't open Hosts db");
our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
require '/usr/share/smanager/lib/SrvMngr/Controller/Letsencrypt-Custom.pm'; #The code that is to be added by the developer
sub main {
#
# Initial entry - route is "/<whatever>"
#
#set initial panel
#for initial panel:
#Specifiy panel to enter
#load up _data hash with DB fields
#load up stash with pointer(s) to control fields hash(= get-))
#and a pointer to the prefix_data hash
#render initial panel
my $c = shift;
$c->app->log->info( $c->log_req );
my %lets_data = ();
my $title = $c->l('lets_letsencrypt');
my $modul = '';
$lets_data{'trt'} = 'LIST';
#Load any DB entries into the <prefix>_data area so as they are preset in the form
# which DB - this only really works if the initial panel is a PARAMS type panel and not a TABLE
my $db = $cdb; #pickup local or global db or Default to config
# and table control fields
$c->stash(DomainList=>$c->get_DomainList());
$c->stash(
title => $title,
modul => $modul,
lets_data => \%lets_data
);
$c->render( template => "letsencrypt" );
}
# Post request with params - submit from the form
sub do_update {
#
# Return after submit pushed on panel (this is a post) - route is "/<whatever>u"
# parameters in the params hash.
#
#load up all params into prefix_data hash:
#By panel (series of if statements - only one executed):
#call validate-PANEL() - return ret = ok or error message
#if validation not ok:
#render back to current panel with error message in stash
#otherwise:
#By panel (series of if statements - only one executed):
#do whatever is required: call perform-PANEL() - return "ok" or Error Message
#call signal-event for any global actions specified (check it exists - error and continue?)
#if action smeserver-<whatever>-update exists
#signal_event smeserver-<whatever>-update
#call signal-event for any specific actions for thids panel (check it exists first - error and continue)
#set success in stash
#if no "nextpanel" entry:
#set firstpanel
#else
#set nextpanel
#call render
my $c = shift;
$c->app->log->info($c->log_req);
my %lets_data = ();
my $title = $c->l('lets_letsencrypt');
# Accessing all POST parameters
my %params = $c->req->params->to_hash;
# Get number of POST parameters
my $num_params = keys %params;
#Params are available in the hash "params" - copy to the prefix_data hash
while (my ($key, $value) = each %{$c->req->params->to_hash}) {
$lets_data{$key} = $value;
}
# the value of trt will tell you which panel has returned
my $trt = $c->param('trt') || 'LIST'; #hidden control on every form.
my $ret = 'ok';
#Validate the parameters in a custom sub one for each panel (although only one of these will be executed)
my $thispanel;
if ($trt eq 'LIST'){
#Validate form parameters for panel LIST
$ret = $c->validate_LIST(\%lets_data);
$thispanel = 'LIST';
}
if ($trt eq 'PARAMS'){
#Validate form parameters for panel PARAMS
$ret = $c->validate_PARAMS(\%lets_data);
$thispanel = 'PARAMS';
}
if ($ret ne "ok") {
# return to the panel with error message
$c->stash(error => $c->l($ret));
$c->render("letsencrypt");
} else {
#Do whatever is needed, including writing values to the DB
if ($trt eq 'LIST'){
#do whatever is required ...
$ret = $c->perform_LIST(\%lets_data);
if ($ret ne "ok") {
# return to the panel with error message
$c->stash(error => $c->l($ret));
$c->render("letsencrypt");
} else {
$c->stash( success => $c->l('lets_LIST_panel_action_was_successful')); #A bit bland - edit it in the lex file
}
}
if ($trt eq 'PARAMS'){
#do whatever is required ...
$ret = $c->perform_PARAMS(\%lets_data);
if ($ret ne "ok") {
# return to the panel with error message
$c->stash(error => $c->l($ret));
$c->render("letsencrypt");
} else {
$c->stash( success => $c->l('lets_PARAMS_panel_action_was_successful')); #A bit bland - edit it in the lex file
}
}
# and call any signal-events needed
# Setup shared data and call panel
$c->stash(
title => $title,
lets_data => \%lets_data
);
if ('none' eq 'none') {
$lets_data{'trt'} = 'LIST';
} else {
$lets_data{'trt'} = 'none';
}
$c->render("letsencrypt");
}
}
sub do_display {
#
# Return after link clicked in table (this is a get) - route is "/<whatever>d"
# Expects ?trt=PANEL&selected="TableRowName" plus any other required
#
# OR it maybe a post from the main panel to add a new record
#
#load up all supplied params into prefix_data hash
#call get-selected-PANEL() - returns hash of all relevent parameters
#load up returned hash into prefix_data
#render - to called panel
my $c = shift;
$c->app->log->info($c->log_req);
my %lets_data = ();
my $title = $c->l('lets_letsencrypt');
# Accessing all parameters
my %params = $c->req->params->to_hash;
# Get number of parameters
my $num_params = keys %params;
#Tag as Post or Get (ie. create new entry or edit existing one
my $is_new_record = ($c->req->method() eq 'POST');
#Params are available in the hash "params" - copy to the prefix_data hash
while (my ($key, $value) = each %{$c->req->params->to_hash}) {
$lets_data{$key} = $value;
}
# the value of trt will tell you which panel has returned
my $trt = $c->param('trt') || 'LIST'; #Indicates where to go now
# Now add in the params from the selected row from the table
my %selectedrow;
if ($trt eq 'LIST'){
#Validate form parameters for panel LIST
%selectedrow = $c->get_selected_LIST($lets_data{'Selected'},$is_new_record);
}
if ($trt eq 'PARAMS'){
#Validate form parameters for panel PARAMS
%selectedrow = $c->get_selected_PARAMS($lets_data{'Selected'},$is_new_record);
}
#Copy in the selected row params to the prefix_data hash to pass to the panel
while (my ($key, $value) = each %selectedrow){
$lets_data{$key} = $value;
}
# Where to go now
$lets_data{'trt'} = $trt;
# Data for panel
$c->stash(
title => $title,
lets_data => \%lets_data
);
$c->render("letsencrypt");
}
1;

View File

@ -0,0 +1,71 @@
%#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-10-18 19:00:38
%#
<div id="Letsencrypt-LIST" class="partial Letsencrypt-LIST">
<script>
window.onload = function() {
SelectInput();
};
</script>
<h2>
%= l('lets_Hello_LIST');
</h2>
% my $btn = l('lets_APPLY');
%= form_for "Letsencryptd" => (method => 'POST') => begin
% param 'trt' => $lets_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $lets_data->{trt}
%# Inputs etc in here.
<h1 class='head'><%=l('lets_List_of_Domains')%></h1>
<h2 class='subh'><%=l('lets_FORM_DESCRIPTION')%></h2>
<p><span class=label>
%=l('lets_Internal_IP')
</span><span class=data>
% param 'InternalIP' => $lets_data->{InternalIP} unless param 'InternalIP';
%= text_field 'InternalIP', size => '50', class => 'textinput InternalIP' , pattern=>'.*' , placeholder=>'InternalIP', Readonly=>'true'
<br></span></p>
<p><span class=label>
%=l('lets_Internet_IP')
</span><span class=data>
% param 'ObserverIP' => $lets_data->{ObserverIP} unless param 'ObserverIP';
%= text_field 'ObserverIP', size => '50', class => 'textinput ObserverIP' , pattern=>'.*' , placeholder=>'ObserverIP', Readonly=>'true'
<br></span></p>
<br /><table class="sme-border TableSort sme-table tabl1 ">
<thead class='tabl1'>
<tr table-head-row>
<th class='sme-border table-head-col table-head-col-Domain name / HOSTNAME '><%=l('lets_Domain_name_/_HOSTNAME')%></th>
<th class='sme-border table-head-col table-head-col-Brief description '><%=l('lets_Brief_description')%></th>
<th class='sme-border table-head-col table-head-col-Content '><%=l('lets_Content')%></th>
<th class='sme-border table-head-col table-head-col-LABEL_NAMESERVERS '><%=l('lets_LABEL_NAMESERVERS')%></th>
<th class='sme-border table-head-col table-head-col-LABEL_POINT '><%=l('lets_LABEL_POINT')%></th>
<th class='sme-border table-head-col table-head-col-LABEL_LECERT '><%=l('lets_LABEL_LECERT')%></th>
<th class='sme-border table-head-col table-head-col-IS_IN_CERT '><%=l('lets_IS_IN_CERT')%></th>
<th class='sme-border table-head-col table-head-col-CHECK '><%=l('lets_CHECK')%></th>
</tr>
</thead>
<tbody class='tabl1'>
% my $control_data = $self->stash('DomainList');
% foreach my $row (@$control_data) {
<tr class='table-row'>
<td class='sme-border table-col table-col-Table1-Domain name / HOSTNAME'><%=$c->render_to_string(inline=>$row->{'Table1-Domain name / HOSTNAME'})%></td>
<td class='sme-border table-col table-col-Table1-Brief description'><%=$c->render_to_string(inline=>$row->{'Table1-Brief description'})%></td>
<td class='sme-border table-col table-col-Table1-Content'><%=$c->render_to_string(inline=>$row->{'Table1-Content'})%></td>
<td class='sme-border table-col table-col-Table1-LABEL_NAMESERVERS'><%=$c->render_to_string(inline=>$row->{'Table1-LABEL_NAMESERVERS'})%></td>
<td class='sme-border table-col table-col-Table1-LABEL_POINT'><%=$c->render_to_string(inline=>$row->{'Table1-LABEL_POINT'})%></td>
<td class='sme-border table-col table-col-Table1-LABEL_LECERT'><%=$c->render_to_string(inline=>$row->{'Table1-LABEL_LECERT'})%></td>
<td class='sme-border table-col table-col-Table1-IS_IN_CERT'><%=$c->render_to_string(inline=>$row->{'Table1-IS_IN_CERT'})%></td>
<td class='sme-border table-col table-col-Table1-CHECK'><%=$c->render_to_string(inline=>$row->{'Table1-CHECK'})%></td>
</tr>
%}
</tbody>
</table>
%# Probably finally by a submit.
%end
</div>

View File

@ -0,0 +1,97 @@
%#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-10-18 19:00:38
%#
<div id="Letsencrypt-PARAMS" class="partial Letsencrypt-PARAMS">
<script>
window.onload = function() {
SelectInput();
};
</script>
<h2>
%= l('lets_Hello_PARAMS');
</h2>
% my $btn = l('lets_APPLY');
%= form_for "Letsencryptd" => (method => 'POST') => begin
% param 'trt' => $lets_data->{trt} unless param 'trt';
%= hidden_field 'trt' => $lets_data->{trt}
%# Inputs etc in here.
<h1 class='head'><%=l('lets_Configuration_for_Letsencrypt')%></h1>
<h2 class='subh'><%=l('lets_Manage_letsencrypt-config_settings:')%></h2>
<p class='paragraph para1'>
%=l('lets_CONFIG_LETSENCRYPT')
</p>
<p><span class=label>
%=l('lets_SERVICE_STATUS')
</span><span class=data>
% my @status_options = Disabled;
% param 'status' => $lets_data->{status} unless param 'status';
%= select_field 'status' => @status_options, class => 'input'
<br></span> </p>
<p><span class=label>
%=l('lets_HOOKSCRIPT_STATUS')
</span><span class=data>
% my @hookScript_options = ;
% param 'hookScript' => $lets_data->{hookScript} unless param 'hookScript';
%= select_field 'hookScript' => @hookScript_options, class => 'input'
<br></span> </p>
<p><span class=label>
%=l('lets_HOSTOVERRIDE_STATUS')
</span><span class=data>
% my @hostOverride_options = ;
% param 'hostOverride' => $lets_data->{hostOverride} unless param 'hostOverride';
%= select_field 'hostOverride' => @hostOverride_options, class => 'input'
<br></span> </p>
<p><span class=label>
%=l('lets_ACCEPT_TERMS_STATUS')
</span><span class=data>
% my @ACCEPT_TERMS_options = ;
% param 'ACCEPT_TERMS' => $lets_data->{ACCEPT_TERMS} unless param 'ACCEPT_TERMS';
%= select_field 'ACCEPT_TERMS' => @ACCEPT_TERMS_options, class => 'input'
<br></span> </p>
<p><span class=label>
%=l('lets_API_STATUS')
</span><span class=data>
% my @API_options = ;
% param 'API' => $lets_data->{API} unless param 'API';
%= select_field 'API' => @API_options, class => 'input'
<br></span> </p>
<p><span class=label>
%=l('lets_KEYSIZE_STATUS')
</span><span class=data>
% my @keysize_options = ;
% param 'keysize' => $lets_data->{keysize} unless param 'keysize';
%= select_field 'keysize' => @keysize_options, class => 'input'
<br></span> </p>
<p><span class=label>
%=l('lets_CONFIGUREMODE_STATUS')
</span><span class=data>
% my @configure_options = ;
% param 'configure' => $lets_data->{configure} unless param 'configure';
%= select_field 'configure' => @configure_options, class => 'input'
<br></span> </p>
<p><span class=label>
%=l('lets_EMAIL')
</span><span class=data>
% param 'email' => $lets_data->{email} unless param 'email';
%= text_field 'email', size => '50', class => 'textinput email' , pattern=>'.*' , placeholder=>'email'
<br></span></p>
<span class='data'>
%= submit_button l('lets_Save'), class => 'action subm9'
</span>
%# Probably finally by a submit.
%end
</div>

View File

@ -0,0 +1,18 @@
/*
Generated by SM2Gen version: SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-10-18 19:00:38
*/
.Letsencrypt-panel {}
.name {}
.rout {}
.head {}
.subh {}
.para1 {}
.sele1 {}
.sele2 {}
.sele3 {}
.sele4 {}
.sele5 {}
.sele6 {}
.sele7 {}
.text8 {}
.subm9 {}

View File

@ -0,0 +1,56 @@
%#
%# Generated by SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-10-18 19:00:38
%#
% layout 'default', title => "Sme server 2 - letsencrypt", share_dir => './';
%# css specific to this panel:
% content_for 'module' => begin
%= stylesheet '/css/letsencrypt.css'
<div id="module" class="module Letsencrypt-panel">
% if ($config->{debug} == 1) {
<p>
%= dumper $c->current_route
</p>
% }
<h1><%=$title%></h1>
% if ( stash('modul') ) {
%= $c->render_to_string(inline => stash('modul') );
% }
%if ($lets_data->{first}) {
<br><p>
%=$c->render_to_string(inline =>$c->l($lets_data->{first}))
</p>
%} elsif ($lets_data->{success}) {
<div class='sme-border'>
<h2> Operation Status Report</h2><p>
%= $c->l($lets_data->{success});
</p>
</div>
%} elsif ($lets_data->{error}) {
<div class='sme-error'>
<h2> Operation Status Report - error</h2><p>
%= $c->l($lets_data->{error});
</p>
</div>
%}
%#Routing to partials according to trt parameter.
%#This ought to be cascading if/then/elsif, but is easier to just stack the if/then's rather like a case statement'
% if ($lets_data->{trt} eq "LIST") {
%= include 'partials/_lets_LIST'
%}
% if ($lets_data->{trt} eq "PARAMS") {
%= include 'partials/_lets_PARAMS'
%}
</div>
%end

View File

@ -0,0 +1,33 @@
#
# Generated by SM2Gen version: SM2Gen version:0.8 Chameleon version:4.5.4 On Python:3.12.3 at 2024-10-18 19:00:38
#
'lets_LABEL_LECERT' => 'LABEL LECERT',
'lets_Hello_LIST' => 'Hello LIST',
'lets_Domain_name_/_HOSTNAME' => 'Domain name / HOSTNAME',
'lets_IS_IN_CERT' => 'IS IN CERT',
'lets_Internet_IP' => 'Internet IP',
'lets_HOOKSCRIPT_STATUS' => 'HOOKSCRIPT STATUS',
'lets_Save' => 'Save',
'lets_FORM_DESCRIPTION' => 'FORM DESCRIPTION',
'lets_EMAIL' => 'Email',
'lets_Hello_PARAMS' => 'Hello PARAMS',
'lets_HOSTOVERRIDE_STATUS' => 'HOSTOVERRIDE STATUS',
'lets_Brief_description' => 'Brief description',
'lets_Internal_IP' => 'Internal IP',
'lets_CONFIG_LETSENCRYPT' => 'CONFIG LETSENCRYPT',
'lets_KEYSIZE_STATUS' => 'KEYSIZE STATUS',
'lets_CONFIGUREMODE_STATUS' => 'CONFIGUREMODE STATUS',
'lets_List_of_Domains' => 'List of Domains',
'lets_SERVICE_STATUS' => 'SERVICE STATUS',
'lets_Configuration_for_Letsencrypt' => 'Configuration for Letsencrypt',
'lets_LABEL_POINT' => 'LABEL POINT',
'lets_API_STATUS' => 'API STATUS',
'lets_letsencrypt' => 'Letsencrypt',
'lets_LIST_panel_action_was_successful' => 'LIST panel action was successful',
'lets_CHECK' => 'Check',
'lets_LABEL_NAMESERVERS' => 'LABEL NAMESERVERS',
'lets_Content' => 'Content',
'lets_ACCEPT_TERMS_STATUS' => 'ACCEPT TERMS STATUS',
'lets_PARAMS_panel_action_was_successful' => 'PARAMS panel action was successful',
'lets_Manage_letsencrypt-config_settings:' => 'Manage letsencrypt-config settings:',
'lets_APPLY' => 'Apply',

View File

@ -36,12 +36,12 @@ our $ddb = esmith::DomainsDB->open() || die("Couldn't open Domains db");
# Return an array of hashes of the contents for each row and column for ${tablecontrol} # Return an array of hashes of the contents for each row and column for ${tablecontrol}
# default is a single row of strings "col1header-1, col2header-1, col3Header-1 etc" # default is a single row of strings "col1header-1, col2header-1, col3Header-1 etc"
my $c = shift; my $c = shift;
my $control_data = $self->stash('${tablecontrol}'); my $control_data = $c->stash('${tablecontrol}');
my @ret = {} my @ret = {};
# foreach my $colHead (@$control_data) { # foreach my $colHead (@$control_data) {
# my ret{$colHead} = "$colhead-1" # my ret{$colHead} = "$colhead-1";
# }; # };
return \@ret return \@ret;
} }
</tal:block> </tal:block>
@ -72,4 +72,4 @@ sub create_link{
my $link = "$route?trt=$panel&Selected=$index"; my $link = "$route?trt=$panel&Selected=$index";
return $link; return $link;
} }
1; 1;

View File

@ -1,5 +1,5 @@
<root> <root>
<Selection><![CDATA[ <Select><![CDATA[
<p><span class=label> <p><span class=label>
%=l('${prefix}_${Label}') %=l('${prefix}_${Label}')
</span><span class=data> </span><span class=data>
@ -7,7 +7,7 @@
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}'; % param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
%= select_field '${Name}' => @${Name}_options, class => 'input' %= select_field '${Name}' => @${Name}_options, class => 'input'
<br></span> </p> <br></span> </p>
]]></Selection> ]]></Select>
@ -46,6 +46,15 @@
<br></span></p> <br></span></p>
]]></Text> ]]></Text>
<ReadonlyText><![CDATA[
<p><span class=label>
%=l('${prefix}_${Label}')
</span><span class=data>
% param '${Name}' => $$${prefix}_data->{${Name}} unless param '${Name}';
%= text_field '${Name}', size => '${size | 50}', class => 'textinput ${Name}' , pattern=>'${regexp | ".*"}' , placeholder=>'${placeholder | Name}', Readonly=>'true'
<br></span></p>
]]></ReadonlyText>
<SubHeader><![CDATA[ <SubHeader><![CDATA[
<h2 class='subh${type_serial}'><%=l('${Value}')%></h2>]]> <h2 class='subh${type_serial}'><%=l('${Value}')%></h2>]]>
</SubHeader> </SubHeader>
@ -71,7 +80,7 @@
%=l('${prefix}_${Label}') %=l('${prefix}_${Label}')
</span><span class=data> </span><span class=data>
%=Search field %=Search field
%=search field , class => 'searc${type_serial}' %=search_field , class => 'searc${type_serial}'
</span>span></p> </span>span></p>
]]> ]]>
</search> </search>
@ -80,7 +89,7 @@
<p><span class=label> <p><span class=label>
%=l('${Label}') %=l('${Label}')
</span><span class=data> </span><span class=data>
%=URL field , class => 'url${type_serial}' %=URL_field , class => 'url${type_serial}'
</span>span></p> </span>span></p>
]]> ]]>
</url> </url>
@ -89,7 +98,7 @@
<p><span class=label> <p><span class=label>
%=l('${Label}') %=l('${Label}')
</span><span class=data> </span><span class=data>
%=tel field, class => 'tel${type_serial}' %=tel_field, class => 'tel${type_serial}'
</span>span></p> </span>span></p>
]]> ]]>
</tel> </tel>
@ -98,7 +107,7 @@
<p><span class=label> <p><span class=label>
%=l('${Label}') %=l('${Label}')
</span><span class=data> </span><span class=data>
%=email field, class => 'emai${type_serial}' %=email_field, class => 'emai${type_serial}'
</span>span></p> </span>span></p>
]]> ]]>
</email> </email>
@ -107,7 +116,7 @@
<p><span class='label'> <p><span class='label'>
%=l('${Label}') %=l('${Label}')
</span><span class=data> </span><span class=data>
%=password field, class => 'pass${type_serial}' %=password_field, class => 'pass${type_serial}'
</span>span></p> </span>span></p>
]]> ]]>
</password> </password>
@ -116,7 +125,7 @@
<p><span class='label'> <p><span class='label'>
%=l('${Label}') %=l('${Label}')
</span><span class=data> </span><span class=data>
%=timedate field, class => 'time${type_serial}' %=timedate_field, class => 'time${type_serial}'
</span>span></p> </span>span></p>
]]> ]]>
</timedate> </timedate>
@ -125,7 +134,7 @@
<p><span class='label'> <p><span class='label'>
%=l('${Label}') %=l('${Label}')
</span><span class=data> </span><span class=data>
%=week field, class => 'week${type_serial}' %=week_field, class => 'week${type_serial}'
</span>span></p> </span>span></p>
]]> ]]>
</week> </week>
@ -134,7 +143,7 @@
<p><span class='label'> <p><span class='label'>
%=l('${Label}') %=l('${Label}')
</span><span class=data> </span><span class=data>
%=month field, class => 'mont${type_serial}' %=month_field, class => 'mont${type_serial}'
</span>span></p> </span>span></p>
]]> ]]>
</month> </month>
@ -143,7 +152,7 @@
<p><span class='label'> <p><span class='label'>
%=l('${Label}') %=l('${Label}')
</span><span class=data> </span><span class=data>
%=range field, class => 'rang${type_serial}' %=range_field, class => 'rang${type_serial}'
</span>span></p> </span>span></p>
]]> ]]>
</range> </range>
@ -152,7 +161,7 @@
<p><span class='label'> <p><span class='label'>
%=l('${Label}') %=l('${Label}')
</span><span class=data> </span><span class=data>
%=radio field, class => 'radi${type_serial}' %=radio_field, class => 'radi${type_serial}'
</span>span></p> </span>span></p>
]]> ]]>
</radio> </radio>
@ -161,7 +170,7 @@
<p><span class='label'> <p><span class='label'>
%=l('${Label}') %=l('${Label}')
</span><span class=data> </span><span class=data>
%=number field, class => 'numb${type_serial}' %=number_field, class => 'numb${type_serial}'
</span>span></p> </span>span></p>
]]> ]]>
</number> </number>
@ -170,7 +179,7 @@
<p><span class='label'> <p><span class='label'>
%=l('${Label}') %=l('${Label}')
</span><span class=data> </span><span class=data>
%=file field, class => 'file${type_serial}' %=file_field, class => 'file${type_serial}'
</span>span></p> </span>span></p>
]]> ]]>
</file> </file>
@ -179,7 +188,7 @@
<p><span class='label'> <p><span class='label'>
%=l('${Label}') %=l('${Label}')
</span><span class=data> </span><span class=data>
%=color field, class => 'colo${type_serial}' %=color_field, class => 'colo${type_serial}'
</span>span></p> </span>span></p>
]]> ]]>
</color> </color>
@ -188,7 +197,7 @@
<p><span class='label'> <p><span class='label'>
%=l('${Label}') %=l('${Label}')
</span><span class=data> </span><span class=data>
%=checkbox field, class => 'chec${type_serial}' %=checkbox_field, class => 'chec${type_serial}'
</span>span></p> </span>span></p>
]]> ]]>
</checkbox> </checkbox>
@ -220,4 +229,4 @@
</Preformatted> </Preformatted>
</root> </root>

View File

@ -33,7 +33,8 @@
href="letsencrypt?page=0&page_stack=&Next=Next&wherenext=CHECK_DOMAINS_PAGE">CHECK_ALL_DOMAINS</a> href="letsencrypt?page=0&page_stack=&Next=Next&wherenext=CHECK_DOMAINS_PAGE">CHECK_ALL_DOMAINS</a>
<a class="button-like" <a class="button-like"
href="letsencrypt?page=0&page_stack=&Next=Next&wherenext=CHECK_ENABLED_DOMAINS_PAGE">CHECK_ENABLED_DOMAINS</a> href="letsencrypt?page=0&page_stack=&Next=Next&wherenext=CHECK_ENABLED_DOMAINS_PAGE">CHECK_ENABLED_DOMAINS</a>
<br> Issuer: /C=--/ST=----/L=Ottawa/O=XYZ Corporation/OU=Main/CN=sme11.thereadclan.me.uk/emailAddress=admin@thereadclan.me.uk<br> <br> Expiry: 2025-10-03T02:09:03Z<br> <br> Not Before: 2024-10-03T02:09:03Z<br> <p>> Issuer: /C=--/ST=----/L=Ottawa/O=XYZ Corporation/OU=Main/CN=sme11.thereadclan.me.uk/emailAddress=admin@thereadclan.me.uk<br> <br> Expiry: 2025-10-03T02:09:03Z<br> <br> Not Before: 2024-10-03T02:09:03Z</p>>
<h2>CURRENT_LIST_OF_DOMAINS</h2> <h2>CURRENT_LIST_OF_DOMAINS</h2>
<table class="sme-border"> <table class="sme-border">

200
json5/Letsencrypt.json5 Normal file
View File

@ -0,0 +1,200 @@
//
// Generated by sm1-html-2-json5 version:0.5 Chameleon version:4.5.4 On Python:3.12.3 at 2024-10-18 14:47:03
//
{
'PackageName': 'Letsencrypt',
'prefix': 'lets',
'MenuHeading': 'Miscellaneous',
'MenuDescription': 'letsencrypt',
'MenuNavigation': '2000 400',
'firstPanel': 'LIST',
'signalEvent': 'smeserver-letsencrypt-update',
'html': [
{
'Name': 'List',
'route': 'LIST',
'Header': 'lets_List of Domains',
'SubHeader': 'lets_FORM_DESCRIPTION',
'Subheader': 'SERVER_IPS',
Input1: {
Name: 'InternalIP',
Type: 'ReadonlyText',
Label: 'Internal IP',
Value: 'stash("InternalIP")',
},
Input2: {
Name: 'ObserverIP',
Type: 'ReadonlyText',
Label: 'Internet IP',
Value: 'stash("InternetIP")',
},
'Table1': {
'Type': 'Table',
'TableControl': 'DomainList',
'TopHeadings': [
'Domain name / HOSTNAME',
'Brief description',
'Content',
'LABEL_NAMESERVERS',
'LABEL_POINT',
'LABEL_LECERT',
'IS_IN_CERT',
'CHECK'
],
'Columns': [
'Table1-Domain name / HOSTNAME',
'Table1-Brief description',
'Table1-Content',
'Table1-LABEL_NAMESERVERS',
'Table1-LABEL_POINT',
'Table1-LABEL_LECERT',
'Table1-IS_IN_CERT',
'Table1-CHECK'
]
}
},
{
'Name': 'params',
'route': 'PARAMS',
'Header': 'Configuration for Letsencrypt',
'SubHeader': 'Manage letsencrypt-config settings:',
'Paragraph1': 'CONFIG_LETSENCRYPT',
'Input1': {
'Type': 'Select',
'Value': 'Disabled',
'Name': 'status',
'Label': 'SERVICE_STATUS',
'Options': [
{
'Value': 'disabled',
'Text': 'Disabled'
},
{
'Value': 'enabled',
'Text': 'Enabled'
},
{
'Value': 'test',
'Text': 'TEST'
}
]
},
'Input2': {
'Type': 'Select',
'Value': '',
'Name': 'hookScript',
'Label': 'HOOKSCRIPT_STATUS',
'Options': [
{
'Value': 'disabled',
'Text': 'Disabled'
},
{
'Value': 'enabled',
'Text': 'Enabled'
}
]
},
'Input3': {
'Type': 'Select',
'Value': '',
'Name': 'hostOverride',
'Label': 'HOSTOVERRIDE_STATUS',
'Options': [
{
'Value': 'disabled',
'Text': 'Disabled'
},
{
'Value': 'yes',
'Text': 'Yes'
}
]
},
'Input4': {
'Type': 'Select',
'Value': '',
'Name': 'ACCEPT_TERMS',
'Label': 'ACCEPT_TERMS_STATUS',
'Options': [
{
'Value': 'disabled',
'Text': 'Disabled'
},
{
'Value': 'yes',
'Text': 'Yes'
}
]
},
'Input5': {
'Type': 'Select',
'Value': '',
'Name': 'API',
'Label': 'API_STATUS',
'Options': [
{
'Value': '2',
'Text': '2'
}
]
},
'Input6': {
'Type': 'Select',
'Value': '',
'Name': 'keysize',
'Label': 'KEYSIZE_STATUS',
'Options': [
{
'Value': '2048',
'Text': '2048'
},
{
'Value': '3072',
'Text': '3072'
},
{
'Value': '4096',
'Text': '4096'
}
]
},
'Input7': {
'Type': 'Select',
'Value': '',
'Name': 'configure',
'Label': 'CONFIGUREMODE_STATUS',
'Options': [
{
'Value': 'all',
'Text': 'ALL'
},
{
'Value': 'domains',
'Text': 'Domains'
},
{
'Value': 'hosts',
'Text': 'HOSTS'
},
{
'Value': 'none',
'Text': 'NONE'
}
]
},
'Input8': {
'Type': 'Text',
'Value': '',
'Name': 'email',
'Label': 'EMAIL'
},
'Input9': {
'Type': 'Submit',
'Value': 'Save',
'Name': 'Next',
'Label': null
}
}
]
}

View File

@ -20,7 +20,7 @@
}, },
Input2: { Input2: {
Name: 'ShareOwnerGrp', Name: 'ShareOwnerGrp',
Type: 'Selection', Type: 'Select',
Label: 'Share owner Group', Label: 'Share owner Group',
Value: [ Value: [
'Write = admin, Read = group', 'Write = admin, Read = group',
@ -31,7 +31,7 @@
}, },
Input3: { Input3: {
Name: 'EnableNFSshare', Name: 'EnableNFSshare',
Type: 'Selection', Type: 'Select',
Label: 'Enable the NFS Share', Label: 'Enable the NFS Share',
Value: [ Value: [
'Disabled', 'Disabled',
@ -41,7 +41,7 @@
}, },
Input4: { Input4: {
Name: 'ShareOnLocalNetwork', Name: 'ShareOnLocalNetwork',
Type: 'Selection', Type: 'Select',
Label: 'EnableShare on local network', Label: 'EnableShare on local network',
Value: [ Value: [
'Disabled', 'Disabled',
@ -58,7 +58,7 @@
}, },
Input6: { Input6: {
Name: 'FileSystemPermissions', Name: 'FileSystemPermissions',
Type: 'Selection', Type: 'Select',
Label: 'File system permissions', Label: 'File system permissions',
Value: [ Value: [
'Read only', 'Read only',
@ -68,7 +68,7 @@
}, },
Input7: { Input7: {
Name: 'WriteAsync', Name: 'WriteAsync',
Type: 'Selection', Type: 'Select',
Label: 'Write (a)synchronously', Label: 'Write (a)synchronously',
Value: [ Value: [
'Synchronous', 'Synchronous',
@ -77,7 +77,7 @@
}, },
Input8: { Input8: {
Name: 'DelayWrite', Name: 'DelayWrite',
Type: 'Selection', Type: 'Select',
Label: 'Delays the disk writing', Label: 'Delays the disk writing',
Value: [ Value: [
'Write delay', 'Write delay',
@ -87,7 +87,7 @@
}, },
Input9: { Input9: {
Name: 'Squash', Name: 'Squash',
Type: 'Selection', Type: 'Select',
Label: 'Squash the power of users', Label: 'Squash the power of users',
Value: [ Value: [
'All users squash', 'All users squash',
@ -98,7 +98,7 @@
}, },
Input10: { Input10: {
Name: 'BrowseParents', Name: 'BrowseParents',
Type: 'Selection', Type: 'Select',
Label: 'Browse the parent folders', Label: 'Browse the parent folders',
Value: [ Value: [
'Hide folder', 'Hide folder',
@ -108,7 +108,7 @@
}, },
Input11: { Input11: {
Name: 'SecurePorts', Name: 'SecurePorts',
Type: 'Selection', Type: 'Select',
Label: 'Requests on secure ports', Label: 'Requests on secure ports',
Value: [ Value: [
'Secure', 'Secure',
@ -143,4 +143,4 @@
} }
} }
] ]
} }

View File

@ -526,9 +526,9 @@ if __name__ == "__main__":
file.write(controller_perl) file.write(controller_perl)
print(f"{controller_file} controller generated ok") print(f"{controller_file} controller generated ok")
except Exception as e: except Exception as e:
print(f"A Chameleon controller render error occurred: {e}") print(f"A Chameleon controller render error occurred: {e} {traceback.format_exc()}")
except Exception as e: except Exception as e:
print(f"A Chameleon controller template error occurred: {e}") print(f"A Chameleon controller template error occurred: {e} {traceback.format_exc()}")
# Generate Custom controller file # Generate Custom controller file
try: try:
@ -542,9 +542,9 @@ if __name__ == "__main__":
file.write(custom_controller_perl) file.write(custom_controller_perl)
print(f"{custom_controller_file} custom controller generated ok") print(f"{custom_controller_file} custom controller generated ok")
except Exception as e: except Exception as e:
print(f"A Chameleon custom controller render error occurred: {e}") print(f"A Chameleon custom controller render error occurred: {e} {traceback.format_exc()}")
except Exception as e: except Exception as e:
print(f"A Chameleon custom controller template error occurred: {e}") print(f"A Chameleon custom controller template error occurred: {e} {traceback.format_exc()}")
# generate Layout file # generate Layout file
layout_template = PageTemplateFile("Templates/layout.html.ep.tem") layout_template = PageTemplateFile("Templates/layout.html.ep.tem")
@ -608,7 +608,8 @@ if __name__ == "__main__":
try: try:
control_html = control_template.render( control_html = control_template.render(
version=strVersion, **inner_html, prefix=prefix_is, version=strVersion, **inner_html, prefix=prefix_is,
classname=class_name classname=class_name,
type_serial=type_serial
) )
all_controls_html = all_controls_html + control_html all_controls_html = all_controls_html + control_html
except Exception as e: except Exception as e:
@ -783,4 +784,4 @@ if __name__ == "__main__":
# print( # print(
# f"Skipping the creation of {translated_lex_file} as it exists already" # f"Skipping the creation of {translated_lex_file} as it exists already"
# ) # )
quit() # end of the program quit() # end of the program