diff -urN smeserver-BackupPC-0.2.old/root/usr/share/smanager/lib/SrvMngr/Controller/Backuppc.pm smeserver-BackupPC-0.2/root/usr/share/smanager/lib/SrvMngr/Controller/Backuppc.pm --- smeserver-BackupPC-0.2.old/root/usr/share/smanager/lib/SrvMngr/Controller/Backuppc.pm 1970-01-01 01:00:00.000000000 +0100 +++ smeserver-BackupPC-0.2/root/usr/share/smanager/lib/SrvMngr/Controller/Backuppc.pm 2021-07-20 14:33:00.000000000 +0100 @@ -0,0 +1,104 @@ +package SrvMngr::Controller::Backuppc; + +#---------------------------------------------------------------------- +# heading : Administration +# description : BackupPC +# navigation : 4000 4200 +#---------------------------------------------------------------------- +# name : backuppc, method : get, url : /backuppc, ctlact : Backuppc#main +# routes : end + +use strict; +use warnings; +use Mojo::Base 'Mojolicious::Controller'; +use utf8; + +use Locale::gettext; +use SrvMngr::I18N; +use SrvMngr qw(theme_list init_session ip_number_or_blank); + +use Quota; +use esmith::ConfigDB; +use esmith::AccountsDB; + +use esmith::util; +use File::Basename; +use File::Find; +use File::Path qw(make_path remove_tree); + +use esmith::Backup; +use esmith::BackupHistoryDB; +use esmith::util; +use esmith::lockfile; + +use constant DEBUG => $ENV{MOJO_SMANAGER_DEBUG} || 0; + +our $cdb = esmith::ConfigDB->open || die "Couldn't open config db"; +our $adb = esmith::AccountsDB->open || die "Couldn't open accounts db"; + +sub main { + + my $c = shift; + $c->app->log->info($c->log_req); + + #my $modul = get_backuppc( $c ); + + my $url = "https://".$c->session->{'SystemName'}.".".$c->session->{"DomainName"}."/BackupPC"; + #my $url = 'https://sme10.thereadclan.me.uk/BackupPC'; + $c->stash(url => $url ); + $c->render(template => 'backuppc'); + +} + + +sub get_backuppc { + + my ($c) = @_; + + my $tx = $c->tx; + my $req = $tx->req; + +# 3 env variables for durep.cgi + #$ENV{'SCRIPT_NAME'} = 'durep'; + #$ENV{'REQUEST_METHOD'} = $req->method; + #$ENV{'QUERY_STRING'} = $req->url->query->to_string; + + my $res = `https:////sme10.thereadclan.me.uk//BackupPC`; + + my $res = `/usr/share/BackupPC/sbin/BackupPC_Admin`; # + my $step = 0; my $out; + my @lines = split /\n/, $res; + # remove except 'body' + foreach my $line (@lines) { + if ( $line =~ m|| ) { + $step = 1; + } elsif ( $line =~ m|| ) { + $step = 2; + } elsif ( $step == 1 ) { + $out .= $line; + } + } + return $out; +} + +#sub main { + +# my $c = shift; +# $c->app->log->info($c->log_req); + +# BEGIN +# { +# $ENV {'PATH'} = '/bin:/usr/bin:/sbin'; +# $ENV {'SHELL'} = '/bin/bash'; +# delete $ENV {'ENV'}; +# } + + + #$c = $c->redirect_to("https://".$ENV {'HTTP_X_FORWARDED_HOST'}."/BackupPC"); +# $c = $c->redirect_to("https://sme10.thereadclan.me.uk//BackupPC"); + +#} + + +1; + diff -urN smeserver-BackupPC-0.2.old/root/usr/share/smanager/themes/default/templates/backuppc.html.ep smeserver-BackupPC-0.2/root/usr/share/smanager/themes/default/templates/backuppc.html.ep --- smeserver-BackupPC-0.2.old/root/usr/share/smanager/themes/default/templates/backuppc.html.ep 1970-01-01 01:00:00.000000000 +0100 +++ smeserver-BackupPC-0.2/root/usr/share/smanager/themes/default/templates/backuppc.html.ep 2021-07-19 15:36:00.000000000 +0100 @@ -0,0 +1,26 @@ +% layout 'default', title => 'Sme server 2 - BackupPC'; + +% content_for 'head_contrib' => begin + +%end + +% content_for 'module' => begin + % if ($config->{debug} == 1) { +

+ %= dumper stash 'url' +

+ % } + +
+ % if ( stash 'error' ) { +
+ %= $c->render_to_string(inline => stash 'error') +
+ %} + + + + %#= $c->render_to_string(inline => $modul) + +
+% end