mirror of https://github.com/yb/uptime-status
new
parent
d617892029
commit
3115d8a324
|
@ -1,4 +1,4 @@
|
|||
node_modules
|
||||
build
|
||||
Status v1.0.rar
|
||||
Status v1.1.rar
|
||||
releases
|
||||
.vs
|
|
@ -4,7 +4,8 @@
|
|||
"license": "MIT",
|
||||
"scripts": {
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build"
|
||||
"build": "react-scripts build",
|
||||
"test": "node test.js"
|
||||
},
|
||||
"dependencies": {
|
||||
"axios": "^0.27.2",
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
window.Config = {
|
||||
// Menu-bar Name
|
||||
SiteName: 'HLP Status',
|
||||
SiteName: 'Hosting Status',
|
||||
|
||||
// UptimeRobot Api Keys
|
||||
// Monitor-Specific Read-Only
|
||||
ApiKeys: [
|
||||
'm793883641-2edcb5af15f7045abf2c2d24',
|
||||
'm793883641-2edcb5af15f7045abf2c2d24',
|
||||
|
@ -25,15 +24,18 @@ window.Config = {
|
|||
Navi: [
|
||||
{
|
||||
text: 'Homepage',
|
||||
url: 'https://status.org.cn/'
|
||||
url: 'https://status.org.cn/',
|
||||
target: '_self'
|
||||
},
|
||||
{
|
||||
text: 'GitHub',
|
||||
url: 'https://github.com/yb/uptime-status'
|
||||
url: 'https://github.com/yb/uptime-status',
|
||||
target: '_blank'
|
||||
},
|
||||
{
|
||||
text: 'Blog',
|
||||
url: 'https://abo.xyz/'
|
||||
url: 'https://abo.xyz/',
|
||||
target: '_self'
|
||||
},
|
||||
],
|
||||
};
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"
|
||||
/>
|
||||
<link rel="shortcut icon" href="./favicon.ico" type="image/x-icon" />
|
||||
<title>HLP Status</title>
|
||||
<title>Hosting Status</title>
|
||||
<script src="./config.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
@ -14,8 +14,8 @@ export function formatDuration(seconds) {
|
|||
m = parseInt(m % 60);
|
||||
}
|
||||
}
|
||||
let text = `${s} s`;
|
||||
if (m > 0) text = `${m} m ${text}`;
|
||||
if (h > 0) text = `${h} h ${text}`;
|
||||
let text = `${s}s`;
|
||||
if (m > 0) text = `${m}m ${text}`;
|
||||
if (h > 0) text = `${h}h ${text}`;
|
||||
return text;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@ function App() {
|
|||
))}
|
||||
</div>
|
||||
<div id='footer'>
|
||||
<p>2023 - <Link to='https://hostlike.pro/' text='HostLikePro' /> - hosting provider.</p>
|
||||
<p>2023 - <Link to='https://hostlike.pro/' text='HostLikePro' /> - hosting provider</p>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
|
|
|
@ -13,7 +13,7 @@ function Header() {
|
|||
<h1 className='logo'>{window.Config.SiteName}</h1>
|
||||
<div className='navi'>
|
||||
{window.Config.Navi.map((item, index) => (
|
||||
<Link key={index} to={item.url} text={item.text} />
|
||||
<Link key={index} to={item.url} tar={item.target} text={item.text} />
|
||||
))}
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
function Link(props = { text, to }) {
|
||||
function Link(props = { text, to, tar }) {
|
||||
return (
|
||||
<a {...props} href={props.to}>
|
||||
<a {...props} href={props.to} target={props.tar}>
|
||||
{props.text}
|
||||
</a>
|
||||
);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import ReactTooltip from 'react-tooltip';
|
||||
import ReactTooltip from 'react-tooltip';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { GetMonitors } from '../common/uptimerobot';
|
||||
import { formatDuration, formatNumber } from '../common/helper';
|
||||
|
@ -7,8 +7,8 @@ import Link from './link';
|
|||
function UptimeRobot({ apikey }) {
|
||||
|
||||
const status = {
|
||||
ok: 'Ok',
|
||||
down: 'Down',
|
||||
ok: 'Online',
|
||||
down: 'Offline',
|
||||
unknow: 'Unknown'
|
||||
};
|
||||
|
||||
|
@ -33,7 +33,7 @@ function UptimeRobot({ apikey }) {
|
|||
let text = data.date.format('YYYY-MM-DD ');
|
||||
if (data.uptime >= 100) {
|
||||
status = 'ok';
|
||||
text += `Uptime ${formatNumber(data.uptime)}%`;
|
||||
text += `| Uptime: ${formatNumber(data.uptime)}%`;
|
||||
}
|
||||
else if (data.uptime <= 0 && data.down.times === 0) {
|
||||
status = 'none';
|
||||
|
@ -41,7 +41,7 @@ function UptimeRobot({ apikey }) {
|
|||
}
|
||||
else {
|
||||
status = 'down';
|
||||
text += `Times Down ${data.down.times} Duration ${formatDuration(data.down.duration)},Uptime ${formatNumber(data.uptime)}%`;
|
||||
text += `| Times Down: ${data.down.times},Duration: ${formatDuration(data.down.duration)},Uptime: ${formatNumber(data.uptime)}%`;
|
||||
}
|
||||
return (<i key={index} className={status} data-tip={text} />)
|
||||
})}
|
||||
|
@ -50,8 +50,8 @@ function UptimeRobot({ apikey }) {
|
|||
<span>Today</span>
|
||||
<span>
|
||||
{site.total.times
|
||||
? `Days ${CountDays} Times ${site.total.times} Duration ${formatDuration(site.total.duration)},Uptime ${site.average}%`
|
||||
: `Days ${CountDays} Uptime ${site.average}%`}
|
||||
? `Times down: ${site.total.times},Duration: ${formatDuration(site.total.duration)},Uptime: ${site.average}%`
|
||||
: `Uptime: ${site.average}%`}
|
||||
</span>
|
||||
<span>{site.daily[site.daily.length - 1].date.format('YYYY-MM-DD')}</span>
|
||||
</div>
|
||||
|
|
|
@ -5,8 +5,3 @@ import './app.scss';
|
|||
|
||||
const root = ReactDOM.createRoot(document.getElementById('app'));
|
||||
root.render(<App />);
|
||||
// root.render(
|
||||
// <React.StrictMode>
|
||||
// <App />
|
||||
// </React.StrictMode>
|
||||
// );
|
||||
|
|
Loading…
Reference in New Issue