- Live job card widget (progress bar, in-widget cancel via widget_query) and live invoice widget (QR drawn from a bitmap, countdown, paid state), Bot API 10.4 sendWidget, private chats only - Automatic fallback to the ordinary message when sendWidget fails, with a breaker that pauses widgets after repeated failures or on servers without the method; TELEGRAM_WIDGETS - Prometheus metrics on the core (/metrics) and on every worker: queue depth and wait, slots, heartbeats, job outcomes, errors per site, deliveries, cache, invoices, Lightning, ledger check, widgets - Example Prometheus config and alert rules, Caddyfile, dashboard notes - Load test: cmd/loadtest and deploy/loadtest (make loadtest) - Browser check of the widgets' HTML, including decoding a drawn QR - docs/DEPLOY.md (production in under an hour) and docs/MONITORING.md Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
31 lines
1.5 KiB
HTML
31 lines
1.5 KiB
HTML
<style>
|
|
body{margin:0;padding:10px 12px 0}
|
|
#m{font-weight:600;white-space:pre-wrap}
|
|
#d{color:var(--tg-theme-hint-color);font-size:13px;margin-top:2px;min-height:17px}
|
|
#t{height:6px;margin:8px 0 2px;border-radius:3px;background:var(--tg-theme-section-separator-color,rgba(128,128,128,.25));overflow:hidden}
|
|
#f{height:100%;width:0;border-radius:3px;background:var(--tg-theme-button-color,#2481cc);transition:width .5s}
|
|
.busy #f{width:35%;animation:s 1.2s ease-in-out infinite alternate}
|
|
@keyframes s{from{transform:translateX(0)}to{transform:translateX(186%)}}
|
|
#x{margin:10px 0 0;width:100%}
|
|
.end #t,.end #x{display:none}
|
|
#e{padding-bottom:max(10px,env(safe-area-inset-bottom))}
|
|
</style>
|
|
<div id="m"></div><div id="d"></div><div id="t"><div id="f"></div></div><button id="x"></button><div id="e"></div>
|
|
<script>
|
|
var W=window.TelegramWidget,$=function(i){return document.getElementById(i)},s={};
|
|
function draw(){
|
|
try{s=JSON.parse(W.chatData)||{}}catch(e){s={}}
|
|
document.documentElement.dir=s.r?"rtl":"ltr";
|
|
$("m").textContent=s.m||"";$("d").textContent=s.d||"";
|
|
var b=document.body;b.className=s.k==="end"?"end":(s.p<0?"busy":"");
|
|
$("f").style.width=s.p>0?Math.round(s.p*100)+"%":"";
|
|
$("t").style.display=s.k==="queued"?"none":"";
|
|
var x=$("x");x.textContent=s.x||"";x.style.display=s.x&&s.k!=="end"?"":"none";x.disabled=false;
|
|
}
|
|
$("x").addEventListener("click",function(){
|
|
var x=$("x");x.disabled=true;
|
|
W.request("cx").then(function(a){if(a&&a.result){$("d").textContent=a.result}},function(){x.disabled=false});
|
|
});
|
|
W.onEvent("chatDataChanged",draw);draw();W.ready();
|
|
</script>
|