Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
19f3b26864 |
18
api/icon.php
Normal file
18
api/icon.php
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
$size = isset($_GET['size']) ? intval($_GET['size']) : 192;
|
||||||
|
$size = in_array($size, [192, 512]) ? $size : 192;
|
||||||
|
|
||||||
|
$img = imagecreatetruecolor($size, $size);
|
||||||
|
$bg = imagecolorallocate($img, 26, 38, 57); // #1a2639
|
||||||
|
imagefill($img, 0, 0, $bg);
|
||||||
|
|
||||||
|
$white = imagecolorallocate($img, 255, 255, 255);
|
||||||
|
$font = 5; // Built in font
|
||||||
|
$text = "UPTIME";
|
||||||
|
$fw = imagefontwidth($font) * strlen($text);
|
||||||
|
$fh = imagefontheight($font);
|
||||||
|
imagestring($img, $font, ($size - $fw) / 2, ($size - $fh) / 2, $text, $white);
|
||||||
|
|
||||||
|
header('Content-Type: image/png');
|
||||||
|
imagepng($img);
|
||||||
|
imagedestroy($img);
|
||||||
53
api/ping.php
Normal file
53
api/ping.php
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
// Proxy script to bypass CORS and measure latency
|
||||||
|
header('Content-Type: application/json');
|
||||||
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
|
||||||
|
$url = $_GET['url'] ?? '';
|
||||||
|
|
||||||
|
if (empty($url)) {
|
||||||
|
echo json_encode(['error' => 'URL is required', 'status' => 0, 'time' => 0]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Validate URL format
|
||||||
|
if (!filter_var($url, FILTER_VALIDATE_URL)) {
|
||||||
|
echo json_encode(['error' => 'Invalid URL format', 'status' => 0, 'time' => 0]);
|
||||||
|
exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
$start = microtime(true);
|
||||||
|
$ch = curl_init($url);
|
||||||
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||||
|
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
|
||||||
|
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
|
||||||
|
curl_setopt($ch, CURLOPT_USERAGENT, 'NativeUptimeMonitor/2.0');
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
|
||||||
|
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
|
||||||
|
|
||||||
|
$response = curl_exec($ch);
|
||||||
|
$info = curl_getinfo($ch);
|
||||||
|
$error = curl_error($ch);
|
||||||
|
curl_close($ch);
|
||||||
|
|
||||||
|
$end = microtime(true);
|
||||||
|
$timeMs = round(($end - $start) * 1000);
|
||||||
|
|
||||||
|
// Determine final status code
|
||||||
|
$statusCode = $info['http_code'];
|
||||||
|
|
||||||
|
if ($error) {
|
||||||
|
echo json_encode([
|
||||||
|
'url' => $url,
|
||||||
|
'status' => 0, // 0 for network/timeout error
|
||||||
|
'time' => $timeMs,
|
||||||
|
'error_detail' => $error
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
echo json_encode([
|
||||||
|
'url' => $url,
|
||||||
|
'status' => $statusCode,
|
||||||
|
'time' => $timeMs
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
?>
|
||||||
@ -1,302 +1,274 @@
|
|||||||
|
:root {
|
||||||
|
--bg-color: #1a2639;
|
||||||
|
--neon-white: #ffffff;
|
||||||
|
--neon-white-glow: 0 0 5px #ffffff, 0 0 10px #ffffff;
|
||||||
|
--neon-pink: #ff33cc;
|
||||||
|
--neon-pink-glow: 0 0 5px #ff33cc, 0 0 15px #ff33cc;
|
||||||
|
--bar-bg: rgba(255, 255, 255, 0.1);
|
||||||
|
}
|
||||||
|
|
||||||
body {
|
body {
|
||||||
background: linear-gradient(-45deg, #ee7752, #e73c7e, #23a6d5, #23d5ab);
|
background-color: var(--bg-color);
|
||||||
background-size: 400% 400%;
|
color: var(--neon-white);
|
||||||
animation: gradient 15s ease infinite;
|
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
|
||||||
color: #212529;
|
|
||||||
font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
||||||
font-size: 14px;
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
min-height: 100vh;
|
padding: 0;
|
||||||
|
overflow-x: hidden;
|
||||||
|
text-shadow: var(--neon-white-glow);
|
||||||
}
|
}
|
||||||
|
|
||||||
.main-wrapper {
|
.container {
|
||||||
display: flex;
|
padding: 10px;
|
||||||
align-items: center;
|
max-width: 1200px;
|
||||||
justify-content: center;
|
margin: 0 auto;
|
||||||
min-height: 100vh;
|
|
||||||
width: 100%;
|
|
||||||
padding: 20px;
|
|
||||||
box-sizing: border-box;
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@keyframes gradient {
|
header {
|
||||||
0% {
|
|
||||||
background-position: 0% 50%;
|
|
||||||
}
|
|
||||||
50% {
|
|
||||||
background-position: 100% 50%;
|
|
||||||
}
|
|
||||||
100% {
|
|
||||||
background-position: 0% 50%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-container {
|
|
||||||
width: 100%;
|
|
||||||
max-width: 600px;
|
|
||||||
background: rgba(255, 255, 255, 0.85);
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.3);
|
|
||||||
border-radius: 20px;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
height: 85vh;
|
|
||||||
box-shadow: 0 20px 40px rgba(0,0,0,0.2);
|
|
||||||
backdrop-filter: blur(15px);
|
|
||||||
-webkit-backdrop-filter: blur(15px);
|
|
||||||
overflow: hidden;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-header {
|
|
||||||
padding: 1.5rem;
|
|
||||||
border-bottom: 1px solid rgba(0, 0, 0, 0.05);
|
|
||||||
background: rgba(255, 255, 255, 0.5);
|
|
||||||
font-weight: 700;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-between;
|
justify-content: space-between;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
padding: 15px 0;
|
||||||
|
border-bottom: 1px solid rgba(255,255,255,0.2);
|
||||||
|
margin-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-messages {
|
h1 {
|
||||||
flex: 1;
|
margin: 0;
|
||||||
overflow-y: auto;
|
font-size: 1.5rem;
|
||||||
padding: 1.5rem;
|
letter-spacing: 2px;
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
gap: 1.25rem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Custom Scrollbar */
|
.settings-btn {
|
||||||
::-webkit-scrollbar {
|
background: none;
|
||||||
width: 6px;
|
border: 1px solid var(--neon-white);
|
||||||
}
|
color: var(--neon-white);
|
||||||
|
padding: 5px 15px;
|
||||||
::-webkit-scrollbar-track {
|
|
||||||
background: transparent;
|
|
||||||
}
|
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb {
|
|
||||||
background: rgba(255, 255, 255, 0.3);
|
|
||||||
border-radius: 10px;
|
|
||||||
}
|
|
||||||
|
|
||||||
::-webkit-scrollbar-thumb:hover {
|
|
||||||
background: rgba(255, 255, 255, 0.5);
|
|
||||||
}
|
|
||||||
|
|
||||||
.message {
|
|
||||||
max-width: 85%;
|
|
||||||
padding: 0.85rem 1.1rem;
|
|
||||||
border-radius: 16px;
|
|
||||||
line-height: 1.5;
|
|
||||||
font-size: 0.95rem;
|
|
||||||
box-shadow: 0 4px 15px rgba(0,0,0,0.05);
|
|
||||||
animation: fadeIn 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes fadeIn {
|
|
||||||
from { opacity: 0; transform: translateY(20px) scale(0.95); }
|
|
||||||
to { opacity: 1; transform: translateY(0) scale(1); }
|
|
||||||
}
|
|
||||||
|
|
||||||
.message.visitor {
|
|
||||||
align-self: flex-end;
|
|
||||||
background: linear-gradient(135deg, #212529 0%, #343a40 100%);
|
|
||||||
color: #fff;
|
|
||||||
border-bottom-right-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.message.bot {
|
|
||||||
align-self: flex-start;
|
|
||||||
background: #ffffff;
|
|
||||||
color: #212529;
|
|
||||||
border-bottom-left-radius: 4px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area {
|
|
||||||
padding: 1.25rem;
|
|
||||||
background: rgba(255, 255, 255, 0.5);
|
|
||||||
border-top: 1px solid rgba(0, 0, 0, 0.05);
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area form {
|
|
||||||
display: flex;
|
|
||||||
gap: 0.75rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area input {
|
|
||||||
flex: 1;
|
|
||||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
||||||
border-radius: 12px;
|
|
||||||
padding: 0.75rem 1rem;
|
|
||||||
outline: none;
|
|
||||||
background: rgba(255, 255, 255, 0.9);
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area input:focus {
|
|
||||||
border-color: #23a6d5;
|
|
||||||
box-shadow: 0 0 0 3px rgba(35, 166, 213, 0.2);
|
|
||||||
}
|
|
||||||
|
|
||||||
.chat-input-area button {
|
|
||||||
background: #212529;
|
|
||||||
color: #fff;
|
|
||||||
border: none;
|
|
||||||
padding: 0.75rem 1.5rem;
|
|
||||||
border-radius: 12px;
|
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
font-weight: 600;
|
border-radius: 5px;
|
||||||
transition: all 0.3s ease;
|
box-shadow: var(--neon-white-glow);
|
||||||
|
text-shadow: var(--neon-white-glow);
|
||||||
|
transition: all 0.3s;
|
||||||
|
}
|
||||||
|
.settings-btn:active {
|
||||||
|
transform: scale(0.95);
|
||||||
}
|
}
|
||||||
|
|
||||||
.chat-input-area button:hover {
|
.settings-panel {
|
||||||
background: #000;
|
display: none;
|
||||||
transform: translateY(-2px);
|
background: rgba(0,0,0,0.3);
|
||||||
box-shadow: 0 5px 15px rgba(0,0,0,0.2);
|
padding: 20px;
|
||||||
|
border-radius: 10px;
|
||||||
|
margin-bottom: 20px;
|
||||||
|
border: 1px solid rgba(255,255,255,0.1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Background Animations */
|
.settings-panel.active {
|
||||||
.bg-animations {
|
display: block;
|
||||||
position: fixed;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
z-index: 0;
|
|
||||||
overflow: hidden;
|
|
||||||
pointer-events: none;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.blob {
|
|
||||||
position: absolute;
|
|
||||||
width: 500px;
|
|
||||||
height: 500px;
|
|
||||||
background: rgba(255, 255, 255, 0.2);
|
|
||||||
border-radius: 50%;
|
|
||||||
filter: blur(80px);
|
|
||||||
animation: move 20s infinite alternate cubic-bezier(0.45, 0, 0.55, 1);
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob-1 {
|
|
||||||
top: -10%;
|
|
||||||
left: -10%;
|
|
||||||
background: rgba(238, 119, 82, 0.4);
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob-2 {
|
|
||||||
bottom: -10%;
|
|
||||||
right: -10%;
|
|
||||||
background: rgba(35, 166, 213, 0.4);
|
|
||||||
animation-delay: -7s;
|
|
||||||
width: 600px;
|
|
||||||
height: 600px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.blob-3 {
|
|
||||||
top: 40%;
|
|
||||||
left: 30%;
|
|
||||||
background: rgba(231, 60, 126, 0.3);
|
|
||||||
animation-delay: -14s;
|
|
||||||
width: 450px;
|
|
||||||
height: 450px;
|
|
||||||
}
|
|
||||||
|
|
||||||
@keyframes move {
|
|
||||||
0% { transform: translate(0, 0) rotate(0deg) scale(1); }
|
|
||||||
33% { transform: translate(150px, 100px) rotate(120deg) scale(1.1); }
|
|
||||||
66% { transform: translate(-50px, 200px) rotate(240deg) scale(0.9); }
|
|
||||||
100% { transform: translate(0, 0) rotate(360deg) scale(1); }
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-link {
|
|
||||||
font-size: 14px;
|
|
||||||
color: #fff;
|
|
||||||
text-decoration: none;
|
|
||||||
background: rgba(0, 0, 0, 0.2);
|
|
||||||
padding: 0.5rem 1rem;
|
|
||||||
border-radius: 8px;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-link:hover {
|
|
||||||
background: rgba(0, 0, 0, 0.4);
|
|
||||||
text-decoration: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Admin Styles */
|
|
||||||
.admin-container {
|
|
||||||
max-width: 900px;
|
|
||||||
margin: 3rem auto;
|
|
||||||
padding: 2.5rem;
|
|
||||||
background: rgba(255, 255, 255, 0.85);
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
border-radius: 24px;
|
|
||||||
box-shadow: 0 20px 50px rgba(0,0,0,0.15);
|
|
||||||
border: 1px solid rgba(255, 255, 255, 0.4);
|
|
||||||
position: relative;
|
|
||||||
z-index: 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
.admin-container h1 {
|
|
||||||
margin-top: 0;
|
|
||||||
color: #212529;
|
|
||||||
font-weight: 800;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table {
|
|
||||||
width: 100%;
|
|
||||||
border-collapse: separate;
|
|
||||||
border-spacing: 0 8px;
|
|
||||||
margin-top: 1.5rem;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table th {
|
|
||||||
background: transparent;
|
|
||||||
border: none;
|
|
||||||
padding: 1rem;
|
|
||||||
color: #6c757d;
|
|
||||||
font-weight: 600;
|
|
||||||
text-transform: uppercase;
|
|
||||||
font-size: 0.75rem;
|
|
||||||
letter-spacing: 1px;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table td {
|
|
||||||
background: #fff;
|
|
||||||
padding: 1rem;
|
|
||||||
border: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.table tr td:first-child { border-radius: 12px 0 0 12px; }
|
|
||||||
.table tr td:last-child { border-radius: 0 12px 12px 0; }
|
|
||||||
|
|
||||||
.form-group {
|
.form-group {
|
||||||
margin-bottom: 1.25rem;
|
margin-bottom: 15px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-group label {
|
.form-group label {
|
||||||
display: block;
|
display: block;
|
||||||
margin-bottom: 0.5rem;
|
margin-bottom: 5px;
|
||||||
font-weight: 600;
|
|
||||||
font-size: 0.9rem;
|
font-size: 0.9rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-control {
|
.form-group input, .form-group textarea {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
padding: 0.75rem 1rem;
|
padding: 10px;
|
||||||
border: 1px solid rgba(0, 0, 0, 0.1);
|
|
||||||
border-radius: 12px;
|
|
||||||
background: #fff;
|
|
||||||
transition: all 0.3s ease;
|
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
background: rgba(255,255,255,0.05);
|
||||||
|
border: 1px solid rgba(255,255,255,0.2);
|
||||||
|
color: var(--neon-white);
|
||||||
|
border-radius: 5px;
|
||||||
|
outline: none;
|
||||||
|
}
|
||||||
|
.form-group input:focus, .form-group textarea:focus {
|
||||||
|
border-color: var(--neon-white);
|
||||||
|
box-shadow: var(--neon-white-glow);
|
||||||
}
|
}
|
||||||
|
|
||||||
.form-control:focus {
|
.btn-save {
|
||||||
outline: none;
|
background: var(--neon-white);
|
||||||
border-color: #23a6d5;
|
color: var(--bg-color);
|
||||||
box-shadow: 0 0 0 3px rgba(35, 166, 213, 0.1);
|
border: none;
|
||||||
|
padding: 10px 20px;
|
||||||
|
border-radius: 5px;
|
||||||
|
cursor: pointer;
|
||||||
|
font-weight: bold;
|
||||||
|
box-shadow: var(--neon-white-glow);
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.monitor-card {
|
||||||
|
background: rgba(0,0,0,0.2);
|
||||||
|
border-radius: 10px;
|
||||||
|
padding: 15px;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
border: 1px solid rgba(255,255,255,0.1);
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
}
|
||||||
|
|
||||||
|
.monitor-card.error {
|
||||||
|
border-color: var(--neon-pink);
|
||||||
|
box-shadow: var(--neon-pink-glow);
|
||||||
|
color: var(--neon-pink);
|
||||||
|
text-shadow: var(--neon-pink-glow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.monitor-header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items: center;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.url-title {
|
||||||
|
font-size: 1.1rem;
|
||||||
|
font-weight: bold;
|
||||||
|
word-break: break-all;
|
||||||
|
}
|
||||||
|
|
||||||
|
.status-badge {
|
||||||
|
padding: 3px 8px;
|
||||||
|
border-radius: 3px;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
border: 1px solid var(--neon-white);
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
.monitor-card.error .status-badge {
|
||||||
|
border-color: var(--neon-pink);
|
||||||
|
color: var(--neon-pink);
|
||||||
|
}
|
||||||
|
|
||||||
|
.stats {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
font-size: 0.85rem;
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Battery Health Bar - Refined */
|
||||||
|
.battery-wrapper {
|
||||||
|
margin-bottom: 15px;
|
||||||
|
}
|
||||||
|
.battery-container {
|
||||||
|
width: 100%;
|
||||||
|
height: 26px;
|
||||||
|
border: 2px solid var(--neon-white);
|
||||||
|
border-radius: 4px;
|
||||||
|
padding: 2px;
|
||||||
|
box-sizing: border-box;
|
||||||
|
position: relative;
|
||||||
|
background: rgba(0,0,0,0.2);
|
||||||
|
}
|
||||||
|
.battery-container::after {
|
||||||
|
content: '';
|
||||||
|
position: absolute;
|
||||||
|
right: -7px;
|
||||||
|
top: 5px;
|
||||||
|
width: 5px;
|
||||||
|
height: 12px;
|
||||||
|
background: var(--neon-white);
|
||||||
|
border-radius: 0 2px 2px 0;
|
||||||
|
box-shadow: var(--neon-white-glow);
|
||||||
|
}
|
||||||
|
.monitor-card.error .battery-container { border-color: var(--neon-pink); }
|
||||||
|
.monitor-card.error .battery-container::after {
|
||||||
|
background: var(--neon-pink);
|
||||||
|
box-shadow: var(--neon-pink-glow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.battery-level {
|
||||||
|
height: 100%;
|
||||||
|
background: var(--neon-white);
|
||||||
|
width: 100%;
|
||||||
|
transition: width 0.4s cubic-bezier(0.1, 0.7, 0.1, 1);
|
||||||
|
box-shadow: var(--neon-white-glow);
|
||||||
|
border-radius: 1px;
|
||||||
|
}
|
||||||
|
.monitor-card.error .battery-level {
|
||||||
|
background: var(--neon-pink);
|
||||||
|
box-shadow: var(--neon-pink-glow);
|
||||||
|
}
|
||||||
|
|
||||||
|
.battery-text {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
font-size: 0.8rem;
|
||||||
|
font-weight: bold;
|
||||||
|
color: var(--bg-color);
|
||||||
|
text-shadow: none;
|
||||||
|
z-index: 2;
|
||||||
|
mix-blend-mode: screen; /* Inverts color over the filled bar vs empty background */
|
||||||
|
}
|
||||||
|
/* Fallback for mix-blend-mode if unsupported/hard to read */
|
||||||
|
@supports not (mix-blend-mode: screen) {
|
||||||
|
.battery-text {
|
||||||
|
color: #fff;
|
||||||
|
mix-blend-mode: normal;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
.monitor-card.error .battery-text {
|
||||||
|
mix-blend-mode: normal;
|
||||||
|
color: #fff;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Candlestick Chart (simulated) */
|
||||||
|
.chart-container {
|
||||||
|
height: 80px;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
gap: 2px;
|
||||||
|
overflow: hidden;
|
||||||
|
border-bottom: 2px solid rgba(255,255,255,0.4);
|
||||||
|
padding-bottom: 2px;
|
||||||
|
border-radius: 0 0 4px 4px;
|
||||||
|
background: rgba(0,0,0,0.1);
|
||||||
|
padding: 5px;
|
||||||
|
}
|
||||||
|
.monitor-card.error .chart-container {
|
||||||
|
border-bottom-color: rgba(255,51,204,0.6);
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-bar-container {
|
||||||
|
flex: 1;
|
||||||
|
height: 100%;
|
||||||
|
display: flex;
|
||||||
|
align-items: flex-end;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
.chart-bar-container.empty {
|
||||||
|
/* empty placeholder */
|
||||||
|
}
|
||||||
|
|
||||||
|
.chart-bar {
|
||||||
|
width: 80%;
|
||||||
|
background: var(--neon-white);
|
||||||
|
min-height: 2px; /* Minimum visual height even for 0ms */
|
||||||
|
transition: height 0.2s ease-out;
|
||||||
|
box-shadow: var(--neon-white-glow);
|
||||||
|
border-radius: 1px 1px 0 0;
|
||||||
|
}
|
||||||
|
.chart-bar.error {
|
||||||
|
background: var(--neon-pink);
|
||||||
|
box-shadow: var(--neon-pink-glow);
|
||||||
|
}
|
||||||
|
|
||||||
|
@media (min-width: 768px) {
|
||||||
|
.dashboard {
|
||||||
|
display: grid;
|
||||||
|
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
|
||||||
|
gap: 20px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@ -1,39 +1,316 @@
|
|||||||
document.addEventListener('DOMContentLoaded', () => {
|
// Register Service Worker for PWA
|
||||||
const chatForm = document.getElementById('chat-form');
|
if ('serviceWorker' in navigator) {
|
||||||
const chatInput = document.getElementById('chat-input');
|
window.addEventListener('load', () => {
|
||||||
const chatMessages = document.getElementById('chat-messages');
|
navigator.serviceWorker.register('/sw.js').then(reg => {
|
||||||
|
console.log('SW registered!', reg);
|
||||||
const appendMessage = (text, sender) => {
|
}).catch(err => console.log('SW registration failed', err));
|
||||||
const msgDiv = document.createElement('div');
|
|
||||||
msgDiv.classList.add('message', sender);
|
|
||||||
msgDiv.textContent = text;
|
|
||||||
chatMessages.appendChild(msgDiv);
|
|
||||||
chatMessages.scrollTop = chatMessages.scrollHeight;
|
|
||||||
};
|
|
||||||
|
|
||||||
chatForm.addEventListener('submit', async (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
const message = chatInput.value.trim();
|
|
||||||
if (!message) return;
|
|
||||||
|
|
||||||
appendMessage(message, 'visitor');
|
|
||||||
chatInput.value = '';
|
|
||||||
|
|
||||||
try {
|
|
||||||
const response = await fetch('api/chat.php', {
|
|
||||||
method: 'POST',
|
|
||||||
headers: { 'Content-Type': 'application/json' },
|
|
||||||
body: JSON.stringify({ message })
|
|
||||||
});
|
});
|
||||||
const data = await response.json();
|
}
|
||||||
|
|
||||||
// Artificial delay for realism
|
// State
|
||||||
setTimeout(() => {
|
let urls = [];
|
||||||
appendMessage(data.reply, 'bot');
|
let botToken = '';
|
||||||
}, 500);
|
let chatId = '';
|
||||||
} catch (error) {
|
let monitorTimers = {};
|
||||||
console.error('Error:', error);
|
|
||||||
appendMessage("Sorry, something went wrong. Please try again.", 'bot');
|
// URL Data Store
|
||||||
|
const urlData = {};
|
||||||
|
|
||||||
|
// DOM Elements
|
||||||
|
const settingsPanel = document.getElementById('settings-panel');
|
||||||
|
const btnSettings = document.getElementById('btn-settings');
|
||||||
|
const btnSave = document.getElementById('btn-save');
|
||||||
|
const inputUrls = document.getElementById('config-urls');
|
||||||
|
const inputBotToken = document.getElementById('config-bot-token');
|
||||||
|
const inputChatId = document.getElementById('config-chat-id');
|
||||||
|
const btnTestTg = document.getElementById('btn-test-tg');
|
||||||
|
const dashboard = document.getElementById('dashboard');
|
||||||
|
|
||||||
|
// Init
|
||||||
|
function init() {
|
||||||
|
loadConfig();
|
||||||
|
|
||||||
|
// Request Notification Permission
|
||||||
|
if ("Notification" in window && Notification.permission !== "granted") {
|
||||||
|
Notification.requestPermission();
|
||||||
|
}
|
||||||
|
|
||||||
|
btnSettings.addEventListener('click', () => {
|
||||||
|
settingsPanel.classList.toggle('active');
|
||||||
|
});
|
||||||
|
|
||||||
|
btnSave.addEventListener('click', () => {
|
||||||
|
saveConfig();
|
||||||
|
settingsPanel.classList.remove('active');
|
||||||
|
startMonitoring();
|
||||||
|
});
|
||||||
|
|
||||||
|
if (btnTestTg) {
|
||||||
|
btnTestTg.addEventListener('click', async () => {
|
||||||
|
saveConfig();
|
||||||
|
if (!botToken || !chatId) {
|
||||||
|
alert("Isi Bot Token dan Chat ID dulu!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
const res = await sendTelegramMessage("🤖 <b>TEST UPTIME MONITOR</b>\nJika pesan ini masuk, notifikasi sudah berfungsi!");
|
||||||
|
if (res && res.ok) {
|
||||||
|
alert("Test notifikasi terkirim ke Telegram Anda!");
|
||||||
|
} else {
|
||||||
|
const data = await res.json();
|
||||||
|
alert("Gagal: " + (data.description || "Cek Token/ID"));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
alert("Error: " + e.message);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (urls.length > 0) {
|
||||||
|
startMonitoring();
|
||||||
|
} else {
|
||||||
|
settingsPanel.classList.add('active');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function loadConfig() {
|
||||||
|
const savedUrls = localStorage.getItem('uptime_urls');
|
||||||
|
botToken = localStorage.getItem('uptime_bot_token') || '';
|
||||||
|
chatId = localStorage.getItem('uptime_chat_id') || '';
|
||||||
|
|
||||||
|
if (savedUrls) {
|
||||||
|
urls = savedUrls.split('\n').filter(u => u.trim() !== '');
|
||||||
|
inputUrls.value = urls.join('\n');
|
||||||
|
}
|
||||||
|
inputBotToken.value = botToken;
|
||||||
|
inputChatId.value = chatId;
|
||||||
|
}
|
||||||
|
|
||||||
|
function saveConfig() {
|
||||||
|
urls = inputUrls.value.split('\n').filter(u => u.trim() !== '');
|
||||||
|
botToken = inputBotToken.value.trim();
|
||||||
|
chatId = inputChatId.value.trim();
|
||||||
|
|
||||||
|
localStorage.setItem('uptime_urls', urls.join('\n'));
|
||||||
|
localStorage.setItem('uptime_bot_token', botToken);
|
||||||
|
localStorage.setItem('uptime_chat_id', chatId);
|
||||||
|
}
|
||||||
|
|
||||||
|
function sendTelegramMessage(message) {
|
||||||
|
if (!botToken || !chatId) return Promise.resolve(null);
|
||||||
|
const url = `https://api.telegram.org/bot${botToken}/sendMessage`;
|
||||||
|
return fetch(url, {
|
||||||
|
method: 'POST',
|
||||||
|
headers: { 'Content-Type': 'application/json' },
|
||||||
|
body: JSON.stringify({
|
||||||
|
chat_id: chatId,
|
||||||
|
text: message,
|
||||||
|
parse_mode: 'HTML'
|
||||||
|
})
|
||||||
|
}).catch(e => {
|
||||||
|
console.error("Telegram API Error:", e);
|
||||||
|
throw e;
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showNativeNotification(title, body) {
|
||||||
|
if ("Notification" in window && Notification.permission === "granted") {
|
||||||
|
new Notification(title, { body, icon: '/api/icon.php?size=192' });
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function buildDashboard() {
|
||||||
|
dashboard.innerHTML = '';
|
||||||
|
urls.forEach(url => {
|
||||||
|
if (!urlData[url]) {
|
||||||
|
urlData[url] = {
|
||||||
|
history: Array.from({length: 40}).map(() => ({ time: 0, status: 0, isError: false, empty: true })),
|
||||||
|
totalPings: 0,
|
||||||
|
successPings: 0,
|
||||||
|
isDown: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
const safeId = btoa(url).replace(/[^a-zA-Z0-9]/g, '');
|
||||||
|
|
||||||
|
const card = document.createElement('div');
|
||||||
|
card.className = 'monitor-card';
|
||||||
|
card.id = `card-${safeId}`;
|
||||||
|
|
||||||
|
card.innerHTML = `
|
||||||
|
<div class="monitor-header">
|
||||||
|
<div class="url-title">${url}</div>
|
||||||
|
<div class="status-badge" id="badge-${safeId}">WAIT</div>
|
||||||
|
</div>
|
||||||
|
<div class="battery-wrapper">
|
||||||
|
<div class="battery-container" id="battery-box-${safeId}">
|
||||||
|
<div class="battery-level" id="battery-${safeId}" style="width: 100%;"></div>
|
||||||
|
<div class="battery-text" id="battery-txt-${safeId}">100% HEALTH</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<div class="stats">
|
||||||
|
<span>Uptime: <strong id="uptime-${safeId}">100%</strong></span>
|
||||||
|
<span>Ping: <strong id="ping-${safeId}">- ms</strong></span>
|
||||||
|
</div>
|
||||||
|
<div class="chart-container" id="chart-${safeId}">
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
|
dashboard.appendChild(card);
|
||||||
|
|
||||||
|
// Initial empty chart render
|
||||||
|
const chart = document.getElementById(`chart-${safeId}`);
|
||||||
|
urlData[url].history.forEach(() => {
|
||||||
|
const barContainer = document.createElement('div');
|
||||||
|
barContainer.className = 'chart-bar-container empty';
|
||||||
|
chart.appendChild(barContainer);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async function pingUrl(url, retry = 1) {
|
||||||
|
try {
|
||||||
|
const res = await fetch(`/api/ping.php?url=${encodeURIComponent(url)}`);
|
||||||
|
const data = await res.json();
|
||||||
|
if (data.status !== 200 && retry > 0) {
|
||||||
|
return await pingUrl(url, 0); // Retry once
|
||||||
|
}
|
||||||
|
return {
|
||||||
|
status: data.status || 0,
|
||||||
|
time: data.time || 0,
|
||||||
|
isError: data.status !== 200,
|
||||||
|
empty: false
|
||||||
|
};
|
||||||
|
} catch (e) {
|
||||||
|
if (retry > 0) return await pingUrl(url, 0);
|
||||||
|
return { status: 0, time: 0, isError: true, empty: false };
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function updateUI(url, result) {
|
||||||
|
const safeId = btoa(url).replace(/[^a-zA-Z0-9]/g, '');
|
||||||
|
const data = urlData[url];
|
||||||
|
|
||||||
|
data.totalPings++;
|
||||||
|
if (!result.isError) data.successPings++;
|
||||||
|
|
||||||
|
// Update history array
|
||||||
|
data.history.shift();
|
||||||
|
data.history.push(result);
|
||||||
|
|
||||||
|
const uptimePercent = ((data.successPings / data.totalPings) * 100).toFixed(2);
|
||||||
|
|
||||||
|
const card = document.getElementById(`card-${safeId}`);
|
||||||
|
const badge = document.getElementById(`badge-${safeId}`);
|
||||||
|
const uptimeEl = document.getElementById(`uptime-${safeId}`);
|
||||||
|
const pingEl = document.getElementById(`ping-${safeId}`);
|
||||||
|
const battery = document.getElementById(`battery-${safeId}`);
|
||||||
|
const batteryTxt = document.getElementById(`battery-txt-${safeId}`);
|
||||||
|
const chart = document.getElementById(`chart-${safeId}`);
|
||||||
|
|
||||||
|
if (!card) return; // UI not ready
|
||||||
|
|
||||||
|
// Update logic for DOWN status
|
||||||
|
if (result.isError) {
|
||||||
|
if (!data.isDown) {
|
||||||
|
data.isDown = true;
|
||||||
|
card.classList.add('error');
|
||||||
|
badge.textContent = `ERR ${result.status}`;
|
||||||
|
sendTelegramMessage(`🚨 <b>DOWN ALERT</b>\nURL: ${url}\nStatus: ${result.status}\nTime: ${new Date().toLocaleTimeString()}`);
|
||||||
|
showNativeNotification('URL Down', `${url} returned status ${result.status}`);
|
||||||
|
} else {
|
||||||
|
badge.textContent = `ERR ${result.status}`;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (data.isDown) {
|
||||||
|
data.isDown = false;
|
||||||
|
card.classList.remove('error');
|
||||||
|
badge.textContent = '200 OK';
|
||||||
|
sendTelegramMessage(`✅ <b>RECOVERY ALERT</b>\nURL: ${url}\nBack online.\nTime: ${new Date().toLocaleTimeString()}`);
|
||||||
|
showNativeNotification('URL Recovered', `${url} is back online.`);
|
||||||
|
} else {
|
||||||
|
badge.textContent = `${result.status} OK`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
uptimeEl.textContent = `${uptimePercent}%`;
|
||||||
|
pingEl.textContent = `${result.time} ms`;
|
||||||
|
battery.style.width = `${uptimePercent}%`;
|
||||||
|
batteryTxt.textContent = `${uptimePercent}% HEALTH`;
|
||||||
|
|
||||||
|
// Render chart
|
||||||
|
chart.innerHTML = '';
|
||||||
|
data.history.forEach(item => {
|
||||||
|
const barContainer = document.createElement('div');
|
||||||
|
barContainer.className = 'chart-bar-container' + (item.empty ? ' empty' : '');
|
||||||
|
|
||||||
|
if (!item.empty) {
|
||||||
|
const bar = document.createElement('div');
|
||||||
|
bar.className = 'chart-bar' + (item.isError ? ' error' : '');
|
||||||
|
|
||||||
|
let h = 0;
|
||||||
|
if (item.time > 0 || item.isError) {
|
||||||
|
h = Math.max(5, Math.min(100, (item.time / 1000) * 100)); // 1000ms = 100% height
|
||||||
|
}
|
||||||
|
if (item.isError && item.time === 0) h = 100; // Max height for error with 0 time (timeout)
|
||||||
|
|
||||||
|
bar.style.height = `${h}%`;
|
||||||
|
barContainer.appendChild(bar);
|
||||||
|
}
|
||||||
|
|
||||||
|
chart.appendChild(barContainer);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
let activeWakeLock = null;
|
||||||
|
async function requestWakeLock() {
|
||||||
|
try {
|
||||||
|
if ('wakeLock' in navigator) {
|
||||||
|
activeWakeLock = await navigator.wakeLock.request('screen');
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.log('Wake Lock request failed:', err.name, err.message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function schedulePing(url) {
|
||||||
|
if (monitorTimers[url]) clearTimeout(monitorTimers[url]);
|
||||||
|
const startTime = Date.now();
|
||||||
|
|
||||||
|
const result = await pingUrl(url);
|
||||||
|
updateUI(url, result);
|
||||||
|
|
||||||
|
const elapsed = Date.now() - startTime;
|
||||||
|
const nextDelay = Math.max(0, 1000 - elapsed);
|
||||||
|
|
||||||
|
monitorTimers[url] = setTimeout(() => {
|
||||||
|
schedulePing(url);
|
||||||
|
}, nextDelay);
|
||||||
|
}
|
||||||
|
|
||||||
|
function startMonitoring() {
|
||||||
|
// Clear any existing timers
|
||||||
|
Object.values(monitorTimers).forEach(timer => clearTimeout(timer));
|
||||||
|
monitorTimers = {};
|
||||||
|
|
||||||
|
buildDashboard();
|
||||||
|
requestWakeLock();
|
||||||
|
|
||||||
|
if (Notification.permission === "granted") {
|
||||||
|
setTimeout(() => {
|
||||||
|
showNativeNotification('Uptime Monitoring Running', 'App is now monitoring in the background/foreground.');
|
||||||
|
}, 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Start pinging each URL independently per second
|
||||||
|
urls.forEach(url => {
|
||||||
|
schedulePing(url);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('visibilitychange', () => {
|
||||||
|
if (document.visibilityState === 'visible') {
|
||||||
|
requestWakeLock();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
init();
|
||||||
|
|||||||
184
index.php
184
index.php
@ -1,150 +1,48 @@
|
|||||||
<?php
|
<!DOCTYPE html>
|
||||||
declare(strict_types=1);
|
<html lang="id">
|
||||||
@ini_set('display_errors', '1');
|
|
||||||
@error_reporting(E_ALL);
|
|
||||||
@date_default_timezone_set('UTC');
|
|
||||||
|
|
||||||
$phpVersion = PHP_VERSION;
|
|
||||||
$now = date('Y-m-d H:i:s');
|
|
||||||
?>
|
|
||||||
<!doctype html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
<head>
|
||||||
<meta charset="utf-8" />
|
<meta charset="UTF-8">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
|
||||||
<title>New Style</title>
|
<title>Uptime Monitor</title>
|
||||||
<?php
|
<link rel="manifest" href="manifest.json">
|
||||||
// Read project preview data from environment
|
<meta name="theme-color" content="#1a2639">
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
<link rel="stylesheet" href="assets/css/custom.css?v=<?php echo time(); ?>">
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
<link rel="icon" type="image/png" href="api/icon.php?size=192">
|
||||||
?>
|
|
||||||
<?php if ($projectDescription): ?>
|
|
||||||
<!-- Meta description -->
|
|
||||||
<meta name="description" content='<?= htmlspecialchars($projectDescription) ?>' />
|
|
||||||
<!-- Open Graph meta tags -->
|
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<!-- Twitter meta tags -->
|
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($projectImageUrl): ?>
|
|
||||||
<!-- Open Graph image -->
|
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<!-- Twitter image -->
|
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;700&display=swap" rel="stylesheet">
|
|
||||||
<style>
|
|
||||||
:root {
|
|
||||||
--bg-color-start: #6a11cb;
|
|
||||||
--bg-color-end: #2575fc;
|
|
||||||
--text-color: #ffffff;
|
|
||||||
--card-bg-color: rgba(255, 255, 255, 0.01);
|
|
||||||
--card-border-color: rgba(255, 255, 255, 0.1);
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
margin: 0;
|
|
||||||
font-family: 'Inter', sans-serif;
|
|
||||||
background: linear-gradient(45deg, var(--bg-color-start), var(--bg-color-end));
|
|
||||||
color: var(--text-color);
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
text-align: center;
|
|
||||||
overflow: hidden;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
body::before {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
top: 0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-image: url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" width="100" height="100" viewBox="0 0 100 100"><path d="M-10 10L110 10M10 -10L10 110" stroke-width="1" stroke="rgba(255,255,255,0.05)"/></svg>');
|
|
||||||
animation: bg-pan 20s linear infinite;
|
|
||||||
z-index: -1;
|
|
||||||
}
|
|
||||||
@keyframes bg-pan {
|
|
||||||
0% { background-position: 0% 0%; }
|
|
||||||
100% { background-position: 100% 100%; }
|
|
||||||
}
|
|
||||||
main {
|
|
||||||
padding: 2rem;
|
|
||||||
}
|
|
||||||
.card {
|
|
||||||
background: var(--card-bg-color);
|
|
||||||
border: 1px solid var(--card-border-color);
|
|
||||||
border-radius: 16px;
|
|
||||||
padding: 2rem;
|
|
||||||
backdrop-filter: blur(20px);
|
|
||||||
-webkit-backdrop-filter: blur(20px);
|
|
||||||
box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.1);
|
|
||||||
}
|
|
||||||
.loader {
|
|
||||||
margin: 1.25rem auto 1.25rem;
|
|
||||||
width: 48px;
|
|
||||||
height: 48px;
|
|
||||||
border: 3px solid rgba(255, 255, 255, 0.25);
|
|
||||||
border-top-color: #fff;
|
|
||||||
border-radius: 50%;
|
|
||||||
animation: spin 1s linear infinite;
|
|
||||||
}
|
|
||||||
@keyframes spin {
|
|
||||||
from { transform: rotate(0deg); }
|
|
||||||
to { transform: rotate(360deg); }
|
|
||||||
}
|
|
||||||
.hint {
|
|
||||||
opacity: 0.9;
|
|
||||||
}
|
|
||||||
.sr-only {
|
|
||||||
position: absolute;
|
|
||||||
width: 1px; height: 1px;
|
|
||||||
padding: 0; margin: -1px;
|
|
||||||
overflow: hidden;
|
|
||||||
clip: rect(0, 0, 0, 0);
|
|
||||||
white-space: nowrap; border: 0;
|
|
||||||
}
|
|
||||||
h1 {
|
|
||||||
font-size: 3rem;
|
|
||||||
font-weight: 700;
|
|
||||||
margin: 0 0 1rem;
|
|
||||||
letter-spacing: -1px;
|
|
||||||
}
|
|
||||||
p {
|
|
||||||
margin: 0.5rem 0;
|
|
||||||
font-size: 1.1rem;
|
|
||||||
}
|
|
||||||
code {
|
|
||||||
background: rgba(0,0,0,0.2);
|
|
||||||
padding: 2px 6px;
|
|
||||||
border-radius: 4px;
|
|
||||||
font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
||||||
}
|
|
||||||
footer {
|
|
||||||
position: absolute;
|
|
||||||
bottom: 1rem;
|
|
||||||
font-size: 0.8rem;
|
|
||||||
opacity: 0.7;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<main>
|
<div class="container">
|
||||||
<div class="card">
|
<header>
|
||||||
<h1>Analyzing your requirements and generating your website…</h1>
|
<h1>⚡ UPTIME</h1>
|
||||||
<div class="loader" role="status" aria-live="polite" aria-label="Applying initial changes">
|
<button class="settings-btn" id="btn-settings">⚙️ Config</button>
|
||||||
<span class="sr-only">Loading…</span>
|
</header>
|
||||||
|
|
||||||
|
<div class="settings-panel" id="settings-panel">
|
||||||
|
<div class="form-group">
|
||||||
|
<label>URLs to Monitor (one per line):</label>
|
||||||
|
<textarea id="config-urls" rows="4" placeholder="https://example.com http://api.mysite.com"></textarea>
|
||||||
</div>
|
</div>
|
||||||
<p class="hint"><?= ($_SERVER['HTTP_HOST'] ?? '') === 'appwizzy.com' ? 'AppWizzy' : 'Flatlogic' ?> AI is collecting your requirements and applying the first changes.</p>
|
<div class="form-group">
|
||||||
<p class="hint">This page will update automatically as the plan is implemented.</p>
|
<label>Telegram Bot Token:</label>
|
||||||
<p>Runtime: PHP <code><?= htmlspecialchars($phpVersion) ?></code> — UTC <code><?= htmlspecialchars($now) ?></code></p>
|
<input type="text" id="config-bot-token" placeholder="123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11">
|
||||||
</div>
|
</div>
|
||||||
</main>
|
<div class="form-group">
|
||||||
<footer>
|
<label>Telegram Chat ID:</label>
|
||||||
Page updated: <?= htmlspecialchars($now) ?> (UTC)
|
<div style="display: flex; gap: 10px;">
|
||||||
</footer>
|
<input type="text" id="config-chat-id" placeholder="-100123456789" style="flex: 1;">
|
||||||
|
<button id="btn-test-tg" style="padding: 10px; background: rgba(255,255,255,0.1); color: #fff; border: 1px solid rgba(255,255,255,0.3); border-radius: 8px; cursor: pointer;">Test TG</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<button class="btn-save" id="btn-save">SAVE & START</button>
|
||||||
|
<p style="font-size: 0.8rem; margin-top: 15px; color: rgba(255,255,255,0.6);">
|
||||||
|
*Note: Untuk berjalan penuh di background saat layar mati (tanpa dibatasi browser), buka Chrome menu -> Add to Home screen (Install PWA). Kami menggunakan WakeLock API agar layar tidak mati jika aplikasi dibiarkan terbuka.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="dashboard" id="dashboard">
|
||||||
|
<!-- Monitor cards will be injected here -->
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script src="assets/js/main.js?v=<?php echo time(); ?>"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
21
manifest.json
Normal file
21
manifest.json
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
{
|
||||||
|
"name": "Uptime Monitor",
|
||||||
|
"short_name": "UptimeMon",
|
||||||
|
"description": "Realtime Uptime Monitoring with Telegram Alerts",
|
||||||
|
"start_url": "/?source=pwa",
|
||||||
|
"display": "standalone",
|
||||||
|
"background_color": "#1a2639",
|
||||||
|
"theme_color": "#1a2639",
|
||||||
|
"icons": [
|
||||||
|
{
|
||||||
|
"src": "/api/icon.php?size=192",
|
||||||
|
"sizes": "192x192",
|
||||||
|
"type": "image/png"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"src": "/api/icon.php?size=512",
|
||||||
|
"sizes": "512x512",
|
||||||
|
"type": "image/png"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
45
sw.js
Normal file
45
sw.js
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
const CACHE_NAME = 'uptime-monitor-v2';
|
||||||
|
const urlsToCache = [
|
||||||
|
'/',
|
||||||
|
'/index.php',
|
||||||
|
'/assets/css/custom.css',
|
||||||
|
'/assets/js/main.js',
|
||||||
|
'/manifest.json'
|
||||||
|
];
|
||||||
|
|
||||||
|
self.addEventListener('install', event => {
|
||||||
|
event.waitUntil(
|
||||||
|
caches.open(CACHE_NAME)
|
||||||
|
.then(cache => cache.addAll(urlsToCache))
|
||||||
|
);
|
||||||
|
self.skipWaiting();
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener('fetch', event => {
|
||||||
|
// Bypassing API and external calls from cache
|
||||||
|
if (event.request.url.includes('api/ping.php') || event.request.url.includes('api.telegram.org')) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
event.respondWith(
|
||||||
|
caches.match(event.request)
|
||||||
|
.then(response => {
|
||||||
|
if (response) return response;
|
||||||
|
return fetch(event.request);
|
||||||
|
})
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
self.addEventListener('activate', event => {
|
||||||
|
const cacheWhitelist = [CACHE_NAME];
|
||||||
|
event.waitUntil(
|
||||||
|
caches.keys().then(cacheNames => {
|
||||||
|
return Promise.all(
|
||||||
|
cacheNames.map(cacheName => {
|
||||||
|
if (cacheWhitelist.indexOf(cacheName) === -1) {
|
||||||
|
return caches.delete(cacheName);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}).then(() => self.clients.claim())
|
||||||
|
);
|
||||||
|
});
|
||||||
Loading…
x
Reference in New Issue
Block a user