Skip to content

Commit

Permalink
Merge pull request #11 from XLixl4snSU/dev
Browse files Browse the repository at this point in the history
Various improvements
  • Loading branch information
XLixl4snSU authored Mar 2, 2023
2 parents 03735c9 + b8852ec commit 505550c
Show file tree
Hide file tree
Showing 6 changed files with 66 additions and 6 deletions.
19 changes: 17 additions & 2 deletions webserver_files/root/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,19 @@ button {
display: flex;
margin: auto;
margin-bottom: 10px;
color: blue;
color: hotpink;
font-size: 20px;
font-weight: bold;
border-radius: 14px;
padding: 10px;
}

a {
color: hotpink;
}

a:link {
text-decoration: none;
}

.log_block{
Expand All @@ -57,4 +68,8 @@ box-shadow: rgba(0, 0, 0, 0.8) 0px 10px 25px;
button {
font-size: 30px;
}
}
}

#overview {
font-size: 22px;
}
21 changes: 21 additions & 0 deletions webserver_files/root/output-single-rsync.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
require_once __DIR__.'/../assets/vendor/autoload.php';
use SensioLabs\AnsiConverter\AnsiToHtmlConverter;
$converter = new AnsiToHtmlConverter();
$date = $_GET['date'];
$date = basename("$date");
$filename = "../logs/rsync-" . $date . ".log";
?>
<h2>Rsync logs for backup of <?php echo $date ?></h2>
<?php
$fh = fopen($filename, 'r');
if(filesize($filename) > 0) {
$pageText = fread($fh, filesize($filename));
$erg = $converter->convert($pageText);
$erg = str_replace("color: white","color: black",$erg);
$erg = str_replace("background-color: black;","",$erg);
echo nl2br($erg);
} else {
echo "Error. This log does not exist.";
}
?>
2 changes: 1 addition & 1 deletion webserver_files/root/output-single.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
$date = basename("$date");
$filename = "../logs/backup_script-" . $date . ".log";
?>
<h2>Logs for backup of <?php echo $date ?></h2>
<h2>Logs for backup of <?php echo $date ?> <a href="/show-rsync-log?date=<?php echo $date ?>">(rsync)</a></h2>
<?php
$fh = fopen($filename, 'r');
if(filesize($filename) > 0) {
Expand Down
2 changes: 1 addition & 1 deletion webserver_files/root/output.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
}

?>
<h2>Last Backup: <?php echo $first_log_date ?></h2>
<h2>Last Backup: <?php echo $first_log_date ?> <a href="/show-rsync-log?date=<?php echo $first_log_date ?>">(rsync)</a></h2>
<?php
$fh = fopen($first_log, 'r');
$pageText = fread($fh, 25000);
Expand Down
4 changes: 2 additions & 2 deletions webserver_files/root/show-log.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,5 +20,5 @@
<div id="main" class="log_block">
Loading...
</div>
<button type=button onclick="window.location.href='/';">Back</button>
</body>
<button type=button onclick="window.location.href='javascript:history.back()';">Back</button>
</body>
24 changes: 24 additions & 0 deletions webserver_files/root/show-rsync-log.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<head>
<title>SFTP-Backup log of <?php echo $date?></title>
<meta name="title" content="example" />
<link rel="stylesheet" href="css/style.css" type="text/css" />
</head>

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript">
$(function(){

var date=window.location.search.substr(1)
$.get(`output-single-rsync.php?${date}`, function(data){
document.getElementById("main").innerHTML=data;
});
});
</script>

<body>
<h1>Single log</h1>
<div id="main" class="log_block">
Loading...
</div>
<button type=button onclick="window.location.href='javascript:history.back()';">Back</button>
</body>

0 comments on commit 505550c

Please sign in to comment.