mirror of
https://github.com/Kizuren/statusPage.git
synced 2026-01-08 23:49:46 +01:00
Added link icon for each endpoint
This commit is contained in:
parent
1b7384afbe
commit
f62e171411
5 changed files with 43 additions and 11 deletions
16
config.js
16
config.js
|
|
@ -35,16 +35,16 @@ export default {
|
|||
endpoints : [
|
||||
{
|
||||
id : 'homepage', // optional
|
||||
name : 'Homepage',
|
||||
link : 'https://www.google.com', // optional (for notifications and dashboard only), [defaults to endpoint.url]
|
||||
url : 'https://www.google.com',
|
||||
request : { // fetch options
|
||||
name : 'Homepage', // optional
|
||||
link : 'https://www.google.com', // optional, for notifications and dashboard only, [defaults to endpoint.url], can be disabled by settig it to false
|
||||
url : 'https://www.google.com', // required
|
||||
request : { // optional, fetch options
|
||||
method: 'GET',
|
||||
},
|
||||
mustFind : 'Feeling Lucky', // String | Array | Regex | Function | AsyncFunction
|
||||
mustNotFind : /Page not found/i, // String | Array | Regex | Function | AsyncFunction
|
||||
customCheck : async (content, response)=>{return true;}, // Function | AsyncFunction -> Run your own custom checks return false in case of errors
|
||||
validStatus : [200], // Which http status should be considered non errors [defaults to 200-299]
|
||||
mustFind : 'Feeling Lucky', // optional, String | Array | Regex | Function | AsyncFunction
|
||||
mustNotFind : /Page not found/i, // optional, String | Array | Regex | Function | AsyncFunction
|
||||
customCheck : async (content, response)=>{return true;}, // optional, Function | AsyncFunction -> Run your own custom checks return false in case of errors
|
||||
validStatus : [200], // optional, Which http status should be considered non errors [defaults to 200-299]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,13 @@ document.addEventListener("DOMContentLoaded", async () => {
|
|||
|
||||
$endpointName = document.createElement('h3');
|
||||
$endpointName.innerText = endpoint.name;
|
||||
if(endpoint.link) {
|
||||
let $link = document.createElement('a');
|
||||
$link.href = endpoint.link;
|
||||
$link.target = '_blank';
|
||||
$link.innerHTML = '<span class="icon">open_in_new</span>';
|
||||
$endpointName.append($link);
|
||||
}
|
||||
$endpoint.append($endpointName);
|
||||
|
||||
let $statusBarEndpoint = document.createElement('status-bar');
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
<link href="style.css" rel="stylesheet" />
|
||||
<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=Fira+Sans+Condensed:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Fira+Sans+Condensed:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,200,0,0&display=swap" rel="stylesheet">
|
||||
<script src="client.js" type="text/javascript"></script>
|
||||
</head>
|
||||
<body>
|
||||
|
|
|
|||
|
|
@ -18,6 +18,29 @@ body {
|
|||
padding:40px 20px;
|
||||
min-height:100vh;
|
||||
}
|
||||
.icon {
|
||||
font-family: 'Material Symbols Outlined';
|
||||
font-weight: normal;
|
||||
font-style: normal;
|
||||
line-height: 1;
|
||||
letter-spacing: normal;
|
||||
text-transform: none;
|
||||
display: inline-block;
|
||||
white-space: nowrap;
|
||||
word-wrap: normal;
|
||||
direction: ltr;
|
||||
-webkit-font-feature-settings: 'liga';
|
||||
-webkit-font-smoothing: antialiased;
|
||||
font-variation-settings: 'FILL' 0, 'wght' 200, 'GRAD' 0, 'opsz' 24;
|
||||
|
||||
font-size:0.85em;
|
||||
margin:0px 4px;
|
||||
}
|
||||
|
||||
a:has(>.icon:only-child) {
|
||||
display:inline-flex;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
a {
|
||||
color:inherit;
|
||||
|
|
|
|||
|
|
@ -175,6 +175,8 @@ while(true) {
|
|||
site_.endpoints[endpointId] = site_.endpoints[endpointId] || {};
|
||||
let endpoint_ = site_.endpoints[endpointId]; // shortcut ref
|
||||
endpoint_.name = endpoint.name || endpoint_.name;
|
||||
if(endpoint.link!==false)
|
||||
endpoint_.link = endpoint.link || endpoint.url;
|
||||
endpoint_.logs = endpoint_.logs || [];
|
||||
let start;
|
||||
|
||||
|
|
@ -243,7 +245,7 @@ while(true) {
|
|||
`🔥 ERROR\n`+
|
||||
`${site.name || siteId} — ${endpoint.name || endpointId} [${endpointStatus.ttfb.toFixed(2)}ms]\n`+
|
||||
`→ ${endpointStatus.err}`+
|
||||
`\n→ ${endpoint.link || endpoint.url}\n`
|
||||
(endpoint.link!==false?`\n→ ${endpoint.link || endpoint.url}`:'')
|
||||
);
|
||||
}
|
||||
} catch(e) {console.error(e);}
|
||||
|
|
@ -264,7 +266,7 @@ while(true) {
|
|||
/*await*/ sendNotification( // Don't await to prevent blocking/delaying next pulse
|
||||
`🟥 High Latency\n`+
|
||||
`${site.name || siteId} — ${endpoint.name || endpointId} [${endpointStatus.ttfb.toFixed(2)}ms]\n`+
|
||||
`\n→ ${endpoint.link || endpoint.url}\n`
|
||||
(endpoint.link!==false?`\n→ ${endpoint.link || endpoint.url}`:'')
|
||||
);
|
||||
}
|
||||
} catch(e) {console.error(e);}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue