first commit
This commit is contained in:
Executable
Executable
+67
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
// --- Compute current build step for OG tags / initial display ---
|
||||
$logs = glob('/var/www/nix.roulaise.net/status/qt-temp/qtw*/temp/build.log');
|
||||
$logs = array_unique($logs);
|
||||
|
||||
$step = "Unknown";
|
||||
foreach ($logs as $file) {
|
||||
$line = trim(@shell_exec('tail -n 1 ' . escapeshellarg($file)));
|
||||
if (preg_match('/\[\d+\/\d+\]/', $line, $m)) {
|
||||
$step = $m[0];
|
||||
break; // stop at first match
|
||||
}
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
|
||||
<!-- OpenGraph tags -->
|
||||
<meta property="og:title" content="QT Build Status <?= htmlspecialchars($step) ?>" />
|
||||
<meta property="og:description" content="Current build progress: <?= htmlspecialchars($step) ?>" />
|
||||
<meta property="og:image" content="https://nix.roulaise.net/data/Guweiz1.jpeg" />
|
||||
<meta property="og:url" content="https://nix.roulaise.net/status/QT.php" />
|
||||
<meta property="og:type" content="website" />
|
||||
|
||||
<title>QT Build Status <?= htmlspecialchars($step) ?></title>
|
||||
<link rel="stylesheet" href="/data/dracula-log.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<h1>Étape de construction : <span id="step"><?= htmlspecialchars($step) ?></span></h1>
|
||||
|
||||
<div class="log-box" id="log"></div>
|
||||
|
||||
<footer>
|
||||
Tempo pas QT ! Je fait des tests !!
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
async function update() {
|
||||
try {
|
||||
const res = await fetch("build-data.php");
|
||||
const data = await res.json();
|
||||
|
||||
// Update DOM
|
||||
document.getElementById("step").textContent = data.step;
|
||||
document.getElementById("log").innerHTML = data.output.replace(/\n/g, "<br>");
|
||||
|
||||
// Update page title (tab)
|
||||
document.title = `QT Build Status ${data.step}`;
|
||||
|
||||
// Auto-scroll log
|
||||
const logBox = document.getElementById("log");
|
||||
logBox.scrollTop = logBox.scrollHeight;
|
||||
} catch(e) {
|
||||
console.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
// Refresh every 2 seconds
|
||||
setInterval(update, 2000);
|
||||
update();
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Executable
+26
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// --- Get all build logs ---
|
||||
$logs = glob('/var/www/nix.roulaise.net/status/qt-temp/qtw*/temp/build.log');
|
||||
$logs = array_unique($logs);
|
||||
|
||||
$output = "";
|
||||
$step = "Unknown";
|
||||
|
||||
// --- Loop through each log ---
|
||||
foreach ($logs as $file) {
|
||||
// Get last line to reduce output
|
||||
$line = trim(@shell_exec('tail -n 1 ' . escapeshellarg($file)));
|
||||
$output .= "==> $file <==\n$line\n\n";
|
||||
|
||||
// Extract current step [123/456]
|
||||
if (preg_match('/\[\d+\/\d+\]/', $line, $m)) {
|
||||
$step = $m[0];
|
||||
}
|
||||
}
|
||||
|
||||
echo json_encode([
|
||||
'output' => $output,
|
||||
'step' => $step
|
||||
]);
|
||||
Executable
+23
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
// get_log.php
|
||||
|
||||
header('Content-Type: text/plain; charset=UTF-8');
|
||||
|
||||
$logFile = '/var/www/nix.roulaise.net/status/qt-temp/qtw*/temp/build.log';
|
||||
$lines = 50;
|
||||
|
||||
$command = sprintf(
|
||||
'tail -n %d %s 2>&1',
|
||||
$lines,
|
||||
escapeshellarg($logFile)
|
||||
);
|
||||
|
||||
$output = shell_exec($command);
|
||||
|
||||
if ($output === null) {
|
||||
http_response_code(500);
|
||||
echo "Error: Unable to read log file.\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
echo $output;
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Outils Status</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<h1>Status serveur</h1>
|
||||
|
||||
<div class="card">
|
||||
<a href="status.php">
|
||||
Status serveur
|
||||
<span class="file-type">CPU / RAM / SWAP</span>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<a href="QT.php">
|
||||
Status QT-web-engine
|
||||
<span class="file-type">[Étape/Étape]</span>
|
||||
</a>
|
||||
</div>
|
||||
<!--
|
||||
<div class="card">
|
||||
<a href="emerge.php">
|
||||
Status Portage
|
||||
<span class="file-type">Infos : Emerging, Installing, Completed</span>
|
||||
</a>
|
||||
</div>
|
||||
-->
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
Server Monitor | PHP / Linux
|
||||
</footer>
|
||||
</body>
|
||||
</html>
|
||||
Symlink
+1
@@ -0,0 +1 @@
|
||||
/mnt/gentoo/var/tmp/portage/dev-qt
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
header('Content-Type: application/json');
|
||||
|
||||
// CPU
|
||||
function getCpuUsage() {
|
||||
$stat1 = file('/proc/stat');
|
||||
usleep(500000); // less load
|
||||
$stat2 = file('/proc/stat');
|
||||
$info1 = explode(" ", preg_replace("/\s+/", " ", $stat1[0]));
|
||||
$info2 = explode(" ", preg_replace("/\s+/", " ", $stat2[0]));
|
||||
$idle1 = $info1[4];
|
||||
$idle2 = $info2[4];
|
||||
$total1 = array_sum($info1);
|
||||
$total2 = array_sum($info2);
|
||||
$total = $total2 - $total1;
|
||||
$idle = $idle2 - $idle1;
|
||||
$cpu = round(100 * (($total - $idle) / $total), 2);
|
||||
return $cpu;
|
||||
}
|
||||
|
||||
// RAM
|
||||
function getRamUsage() {
|
||||
$data = file('/proc/meminfo');
|
||||
$info = [];
|
||||
foreach ($data as $line) {
|
||||
list($key, $value) = explode(":", $line);
|
||||
$info[$key] = trim(preg_replace("/[^0-9]/", "", $value));
|
||||
}
|
||||
$total = $info['MemTotal'];
|
||||
$free = $info['MemAvailable'];
|
||||
$used = $total - $free;
|
||||
return [
|
||||
'total' => round($total / 1024),
|
||||
'used' => round($used / 1024),
|
||||
'percent' => round(($used / $total) * 100, 2)
|
||||
];
|
||||
}
|
||||
|
||||
// SWAP
|
||||
function getSwapUsage() {
|
||||
$data = file('/proc/meminfo');
|
||||
$info = [];
|
||||
foreach ($data as $line) {
|
||||
list($key, $value) = explode(":", $line);
|
||||
$info[$key] = trim(preg_replace("/[^0-9]/", "", $value));
|
||||
}
|
||||
$total = $info['SwapTotal'];
|
||||
$free = $info['SwapFree'];
|
||||
if ($total == 0) return ['total'=>0,'used'=>0,'percent'=>0];
|
||||
$used = $total - $free;
|
||||
return [
|
||||
'total' => round($total / 1024),
|
||||
'used' => round($used / 1024),
|
||||
'percent' => round(($used / $total) * 100, 2)
|
||||
];
|
||||
}
|
||||
|
||||
echo json_encode([
|
||||
'cpu' => getCpuUsage(),
|
||||
'ram' => getRamUsage(),
|
||||
'swap' => getSwapUsage(),
|
||||
]);
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="fr">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Status Serveur</title>
|
||||
<link rel="stylesheet" href="style.css">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<div class="container">
|
||||
<h1>Status Serveur</h1>
|
||||
|
||||
<div class="card">
|
||||
CPU: <span id="cpu">--</span>%
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
RAM: <span id="ramUsed">--</span> / <span id="ramTotal">--</span> MiB
|
||||
<div class="file-type"><span id="ramPercent">--</span>%</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
SWAP: <span id="swapUsed">--</span> / <span id="swapTotal">--</span> MiB
|
||||
<div class="file-type"><span id="swapPercent">--</span>%</div>
|
||||
</div>
|
||||
|
||||
<div class="card">
|
||||
<a href="index.php">⟵ Back</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer>
|
||||
Mise à jour toutes les secondes
|
||||
</footer>
|
||||
|
||||
<script>
|
||||
function updateStats() {
|
||||
fetch("stats.php")
|
||||
.then(r => r.json())
|
||||
.then(data => {
|
||||
document.getElementById("cpu").textContent = data.cpu;
|
||||
document.getElementById("ramUsed").textContent = data.ram.used;
|
||||
document.getElementById("ramTotal").textContent = data.ram.total;
|
||||
document.getElementById("ramPercent").textContent = data.ram.percent;
|
||||
document.getElementById("swapUsed").textContent = data.swap.used;
|
||||
document.getElementById("swapTotal").textContent = data.swap.total;
|
||||
document.getElementById("swapPercent").textContent = data.swap.percent;
|
||||
});
|
||||
}
|
||||
|
||||
setInterval(updateStats, 1000);
|
||||
updateStats(); // first call right away
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Executable
+177
@@ -0,0 +1,177 @@
|
||||
/* Import Comfortaa font */
|
||||
@import url('https://fonts.googleapis.com/css2?family=Comfortaa:wght@400;700&display=swap');
|
||||
|
||||
/* Reset */
|
||||
* {
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
/* Body */
|
||||
body {
|
||||
font-family: 'Comfortaa', cursive;
|
||||
background-color: #282a36; /* Dracula dark */
|
||||
color: #f8f8f2;
|
||||
line-height: 1.6;
|
||||
min-height: 100vh;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: flex-start;
|
||||
padding: 2rem;
|
||||
}
|
||||
|
||||
/* Container */
|
||||
.container {
|
||||
max-width: 900px;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
/* Header */
|
||||
h1 {
|
||||
font-size: 2.5rem;
|
||||
color: #bd93f9;
|
||||
margin-bottom: 2rem;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Card styling (buttons, forms) */
|
||||
.card {
|
||||
background-color: #44475a; /* secondary Dracula */
|
||||
color: #f8f8f2;
|
||||
padding: 1.5rem 2rem;
|
||||
border-radius: 12px;
|
||||
font-weight: 600;
|
||||
font-size: 1.2rem;
|
||||
text-align: center;
|
||||
width: 100%;
|
||||
max-width: 400px;
|
||||
margin: 0.7rem 0;
|
||||
transition: transform 0.2s, box-shadow 0.2s, background-color 0.2s;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
/* Hover effect for card buttons */
|
||||
.card:hover {
|
||||
background-color: #6272a4; /* lighter Dracula */
|
||||
transform: translateY(-3px);
|
||||
box-shadow: 0 8px 20px rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
/* Links inside cards fill the whole div */
|
||||
.card a {
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
display: block;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
/* Form elements */
|
||||
form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
background-color: #44475a;
|
||||
padding: 2rem;
|
||||
border-radius: 12px;
|
||||
max-width: 400px;
|
||||
width: 100%;
|
||||
margin: 1rem 0;
|
||||
box-shadow: 0 4px 15px rgba(0,0,0,0.3);
|
||||
}
|
||||
|
||||
label {
|
||||
font-weight: 600;
|
||||
margin-bottom: 0.5rem;
|
||||
color: #f8f8f2;
|
||||
text-align: left;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
input[type="text"],
|
||||
select {
|
||||
width: 100%;
|
||||
padding: 0.6rem 1rem;
|
||||
margin-bottom: 1rem;
|
||||
border-radius: 8px;
|
||||
border: none;
|
||||
background-color: #6272a4;
|
||||
color: #f8f8f2;
|
||||
font-family: 'Comfortaa', cursive;
|
||||
font-size: 1rem;
|
||||
outline: none;
|
||||
transition: background-color 0.2s, transform 0.2s;
|
||||
}
|
||||
|
||||
input[type="text"]:focus,
|
||||
select:focus {
|
||||
background-color: #50fa7b; /* accent color on focus */
|
||||
color: #282a36;
|
||||
transform: scale(1.02);
|
||||
}
|
||||
|
||||
button {
|
||||
background-color: #bd93f9;
|
||||
color: #282a36;
|
||||
font-family: 'Comfortaa', cursive;
|
||||
font-weight: 700;
|
||||
font-size: 1.1rem;
|
||||
padding: 0.7rem 1.5rem;
|
||||
border-radius: 10px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
transition: background-color 0.2s, transform 0.2s, box-shadow 0.2s;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
background-color: #ff79c6;
|
||||
transform: translateY(-2px);
|
||||
box-shadow: 0 5px 15px rgba(0,0,0,0.4);
|
||||
}
|
||||
|
||||
/* Footer */
|
||||
footer {
|
||||
margin-top: 3rem;
|
||||
text-align: center;
|
||||
color: #6272a4;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
|
||||
/* Responsive */
|
||||
@media (max-width: 600px) {
|
||||
body {
|
||||
padding: 1rem;
|
||||
}
|
||||
h1 {
|
||||
font-size: 2rem;
|
||||
}
|
||||
.card, form {
|
||||
width: 100%;
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
}
|
||||
|
||||
/* Classe IMG */
|
||||
.img {
|
||||
height: 200px;
|
||||
object-fit: cover;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
/* Additional styling for PHP directory index */
|
||||
.card .file-type {
|
||||
display: block;
|
||||
font-size: 0.9rem;
|
||||
color: #bd93f9;
|
||||
margin-top: 0.3rem;
|
||||
}
|
||||
.card img {
|
||||
max-width: 100%;
|
||||
border-radius: 8px;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
Reference in New Issue
Block a user