210 lines
No EOL
9.1 KiB
HTML
210 lines
No EOL
9.1 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
|
|
<head>
|
|
<meta charset="UTF-8" />
|
|
<title></title>
|
|
<meta charset="UTF-8" />
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Montserrat" />
|
|
<link rel="stylesheet" href="css/styles.css" />
|
|
<link rel="stylesheet" href="css/status.css" />
|
|
<!-- HTML Meta Tags -->
|
|
<title>Lightning.Pub</title>
|
|
<meta name="description" content="Lightning for Everyone" />
|
|
<link rel="icon" type="image/png" href="img/pub_logo.png" />
|
|
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<header>
|
|
<img src="img/pub_logo.png" width="38px" height="auto" alt="Lightning Pub logo" />
|
|
<img src="img/LightningPub.png" height="26px" alt="Lightning Pub logo" />
|
|
</header>
|
|
|
|
<main>
|
|
<section class="setup-header">
|
|
<h2>Node Status</h2>
|
|
<p class="header-title"></p>
|
|
</section>
|
|
|
|
<div class="line" style="width: 100%;"></div>
|
|
|
|
<section class="node-status">
|
|
<p id="errorText" style="color:red"></p>
|
|
<div>
|
|
<div class="status-element" style="margin-top: 15px;">
|
|
<div style="text-align: left;">Public Node Name:</div>
|
|
<div class="fc-grey editable-content">
|
|
<div class="show-nodey" style="display: flex; flex-direction: column; display: none;">
|
|
<input type="text" value="" name="show-nodey" placeholder="" />
|
|
<div style="display: flex;justify-content: end;">
|
|
<button class="small-btn" id="cancel-show-nodey">Cancel</button>
|
|
<button class="small-btn" id="save-show-nodey">Save</button>
|
|
</div>
|
|
</div>
|
|
<div id="show-nodey-text">Nodey McNodeFace</div>
|
|
<div class="question-box">
|
|
<button class="icon-button" id="show-nodey">
|
|
<img src="img/pencil.svg" style="cursor: pointer;" />
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="status-element" style="margin-top: 15px;">
|
|
<div style="text-align: left;">Nostr Relay:</div>
|
|
<div class="fc-grey editable-content">
|
|
<div class="show-nostr" style="display: flex; flex-direction: column; display: none;">
|
|
<input type="text" value="" name="show-nostr" placeholder="wss://relay.lightning.pub" />
|
|
<div style="display: flex;justify-content: end;">
|
|
<button class="small-btn" id="cancel-show-nostr">Cancel</button>
|
|
<button class="small-btn" id="save-show-nostr">Save</button>
|
|
</div>
|
|
</div>
|
|
<div id="show-nostr-text">wss://relay.lightning.pub</div>
|
|
<div class="question-box">
|
|
<button class="icon-button" id="show-nostr">
|
|
<img src="img/pencil.svg" style="cursor: pointer;" />
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="status-element" style="margin-top: 15px;">
|
|
<div style="text-align: left;">Avatar:</div>
|
|
<div class="fc-grey editable-content">
|
|
<div class="show-avatar" style="display: flex; flex-direction: column; display: none;">
|
|
<input type="text" value="" name="show-avatar" placeholder="" />
|
|
<div style="display: flex;justify-content: end;">
|
|
<button class="small-btn" id="cancel-show-avatar">Cancel</button>
|
|
<button class="small-btn" id="save-show-avatar">Save</button>
|
|
</div>
|
|
</div>
|
|
<div style="display:flex;align-items:center;gap:12px;">
|
|
<img id="avatarImg" src="" alt="avatar" style="width:48px;height:48px;border-radius:6px;object-fit:cover;box-shadow:0 0 2px rgba(0,0,0,1);" />
|
|
<div class="question-box">
|
|
<button class="icon-button" id="show-avatar">
|
|
<img src="img/pencil.svg" style="cursor: pointer;" />
|
|
</button>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="status-element" style="margin-top: 15px;">
|
|
<div>Administrator:</div>
|
|
<div id="adminNpub" style="line-break: anywhere;">
|
|
Loading...
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div style="display: flex; justify-content: end;padding-right: 12px;">
|
|
<div class="marked" id="show-reset" style="text-decoration: underline; margin-top: 5px;position: relative; display: none;">
|
|
Reset
|
|
<div class="watchdog-status">
|
|
<a href="https://docs.shock.network/pub/watchdog" target="_blank">
|
|
<button class="icon-button" id="show-question">
|
|
<img src="img/question.svg" />
|
|
</button>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div id="reset-box">
|
|
<div style="width: 100%;height: 100%;position: relative;">
|
|
<button class="icon-button close-button" id="close-reset-box">
|
|
<img src="img/close.svg" alt="">
|
|
</button>
|
|
<div class="reset-box-content" id="reset-content">
|
|
</div>
|
|
<div class="continue-button-container">
|
|
<div class="continue-button" id="">Continue</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div style="margin-top: 40px;">
|
|
<div class="status-element">
|
|
<div>Relay Status:</div>
|
|
<div id="relayStatus">
|
|
<span class="yellow-dot">●</span> Loading...
|
|
</div>
|
|
</div>
|
|
<div class="status-element">
|
|
<div>Lightning Status:</div>
|
|
<div id="lndStatus">
|
|
<span class="yellow-dot">●</span> Loading...
|
|
</div>
|
|
</div>
|
|
<div class="status-element">
|
|
<div style="position: relative;">
|
|
Watchdog Status:
|
|
<div class="watchdog-status">
|
|
<a href="https://docs.shock.network/pub/watchdog" target="_blank">
|
|
<button class="icon-button" id="show-question">
|
|
<img src="img/question.svg" />
|
|
</button>
|
|
</a>
|
|
</div>
|
|
</div>
|
|
<div id="watchdog-status">
|
|
<span class="green-dot">●</span> Loading...
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div style="margin-top: 20px;">
|
|
<div style="font-size: 13px; text-align: left;">Guest Invitation Link:</div>
|
|
<a href="https://my.shockwallet.app/invite/nprofile12345678899988" target="_blank"
|
|
style="font-size: 11px;line-break: anywhere;" id="inviteLinkHttp" class="invite-link">
|
|
https://my.shockwallet.app/invite/nprofile12345678899988
|
|
</div>
|
|
</div>
|
|
</section>
|
|
</main>
|
|
|
|
<footer>
|
|
<div class="footer-text" style="width: 80%">
|
|
<div class="line"></div>
|
|
<a href="https://docs.shock.network" class="marked need-help">Need Help?</a>
|
|
</footer>
|
|
|
|
<script src="js/status.js"></script>
|
|
<script>
|
|
const fetchInfo = async () => {
|
|
console.log("fetching...")
|
|
const res = await fetch("/wizard/service_state")
|
|
console.log(res)
|
|
if (res.status !== 200) {
|
|
document.getElementById('errorText').innerText = "failed to get state info"
|
|
return
|
|
}
|
|
const j = await res.json()
|
|
console.log(j)
|
|
// Map fields from service state
|
|
const name = j.source_name || j.provider_name || 'Unknown'
|
|
const relayUrl = j.relay_url || (j.relays && j.relays[0]) || ''
|
|
const admin = j.admin_npub || ''
|
|
// lnd_state may arrive as enum number or string; normalize to text
|
|
const lndText = (typeof j.lnd_state === 'string')
|
|
? j.lnd_state
|
|
: (j.lnd_state === 2 ? 'ONLINE' : (j.lnd_state === 1 ? 'SYNCING' : 'OFFLINE'))
|
|
const lndDot = (lndText === 'ONLINE') ? 'green-dot' : (lndText === 'SYNCING' ? 'yellow-dot' : 'red-dot')
|
|
// use actual relay_connected flag from backend
|
|
const relayConnected = !!j.relay_connected
|
|
const avatar = j.avatar_url || (j.app_id ? `https://robohash.org/${encodeURIComponent(j.app_id)}.png?size=128x128&set=set3` : '')
|
|
document.getElementById("show-nodey-text").innerHTML = name
|
|
document.getElementById("show-nostr-text").innerHTML = relayUrl || '—'
|
|
if (avatar) { document.getElementById("avatarImg").src = avatar }
|
|
document.getElementById("adminNpub").innerText = admin
|
|
document.getElementById("relayStatus").innerHTML = `<span class="${relayConnected ? 'green-dot' : 'red-dot'}">●</span> ${relayConnected ? 'Connected' : 'Disconnected'}`
|
|
document.getElementById("lndStatus").innerHTML = `<span class="${lndDot}">●</span> ${lndText}`
|
|
document.getElementById("watchdog-status").innerHTML = `<span class="${j.watchdog_ok ? 'green-dot' : 'red-dot'}">●</span> ${j.watchdog_ok ? 'No Alerts' : 'ALERT!!'}`
|
|
document.getElementById("inviteLinkHttp").href = `https://my.shockwallet.app/#/sources?addSource=${j.nprofile}`
|
|
document.getElementById("inviteLinkHttp").innerHTML = `https://my.shockwallet.app/#/sources?addSource=${j.nprofile}`
|
|
document.querySelector('input[name="show-nodey"]').placeholder = name;
|
|
document.title = name;
|
|
}
|
|
try {
|
|
fetchInfo()
|
|
} catch (e) { console.log({ e }) }
|
|
</script>
|
|
</body>
|
|
|
|
</html> |