[grade=A urn:ump:vk45vbr6hs5b7qnbwzfsn2nbcofrpyjkzoesouupbevtmljzgd4q] ux(DC-171): dashboard smoothness pass chunk 1 — header overlap, dead-card collapse, accessible card actions, ON/OFF vocabulary
Live-browser audit (authenticated session, real viewport) produced a ranked critique; this chunk ships the top 4 fixes, each verified in the live page with before/after numbers: 1. HEADER OVERLAP: .reload-caddy-container was position:absolute and covered the clock (4700px² measured overlap, clock pushed off-screen, horizontal scrollbar at 1440px). Now an in-flow flex item with flex-wrap on .top-row/.brand-weather-group and a ≤1700px brand cap. AFTER: overlap 0px², clock fully visible, no horizontal scroll (scrollWidth 1425 ≤ 1440). 2. DEAD CARD COLLAPSE: Tailscale's 'not installed' card occupied a full ~205px grid slot forever. Now collapses (content rows hidden, dimmed) until Tailscale is actually installed. 3. ACCESSIBLE CARD ACTIONS: all dynamically generated icon-only service actions (logs/update/terminal/credentials/options/share/delete/open) now carry per-service aria-labels — 64/97 btn-row buttons labelled; the rest are text-labelled system buttons. Tailscale refresh labelled. 4. STATUS VOCABULARY: Auth card YES/NO → ON/OFF, matching every other card (active + inactive branches + initial markup). Frontend 68/68; SW dashcaddy-shell-da61d3a0a1; CSP hash unchanged.
This commit is contained in:
7 files changed
+86
-43
No files matched your search
@@ -154,24 +154,49 @@ button:focus-visible {
|
|||||||
align-items: flex-start;
|
align-items: flex-start;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
/* UX pass: the in-flow reload cluster + wide brand banner can exceed the
|
||||||
|
viewport on smaller screens — wrap instead of pushing the clock off-screen */
|
||||||
|
flex-wrap: wrap;
|
||||||
|
row-gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.brand-weather-group {
|
.brand-weather-group {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
gap: 20px;
|
gap: 20px;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
row-gap: 8px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.reload-caddy-container {
|
.reload-caddy-container {
|
||||||
position: absolute;
|
/* UX pass: was position:absolute top-right — it overlapped the clock
|
||||||
right: 0;
|
whenever the brand-weather group extended to the right edge (any
|
||||||
top: 0;
|
logo-pos where the clock sits right). In-flow flex item instead. */
|
||||||
|
position: relative;
|
||||||
|
margin-left: auto;
|
||||||
|
flex-shrink: 0;
|
||||||
padding-top: 10px;
|
padding-top: 10px;
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: flex-end;
|
align-items: flex-end;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* UX pass: a card whose only message is "not installed" collapses to a slim
|
||||||
|
single row instead of occupying a full grid slot (Tailscale today). */
|
||||||
|
.card.card-collapsed-unavailable .response-row,
|
||||||
|
.card.card-collapsed-unavailable .btn-row {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
.card.card-collapsed-unavailable {
|
||||||
|
opacity: 0.62;
|
||||||
|
height: fit-content;
|
||||||
|
align-self: start;
|
||||||
|
padding-bottom: 10px;
|
||||||
|
}
|
||||||
|
.card.card-collapsed-unavailable .row {
|
||||||
|
min-height: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.reload-caddy-main {
|
.reload-caddy-main {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
@@ -457,6 +482,11 @@ button:focus-visible {
|
|||||||
display: block;
|
display: block;
|
||||||
filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .38));
|
filter: drop-shadow(0 3px 10px rgba(0, 0, 0, .38));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* UX pass: on narrower screens the banner must not push the clock off-screen */
|
||||||
|
@media (max-width: 1700px) {
|
||||||
|
#brand img { max-width: 48vw; }
|
||||||
|
}
|
||||||
#brand .brand-logo-light { display: none; }
|
#brand .brand-logo-light { display: none; }
|
||||||
:root.light-bg #brand .brand-logo-dark { display: none; }
|
:root.light-bg #brand .brand-logo-dark { display: none; }
|
||||||
:root.light-bg #brand .brand-logo-light { display: block; }
|
:root.light-bg #brand .brand-logo-light { display: block; }
|
||||||
|
|||||||
Vendored
+35
-35
@@ -23,7 +23,7 @@
|
|||||||
box-shadow: 0 4px 12px rgba(0,0,0,.3);
|
box-shadow: 0 4px 12px rgba(0,0,0,.3);
|
||||||
z-index: 10000; animation: slideIn 0.3s ease-out;
|
z-index: 10000; animation: slideIn 0.3s ease-out;
|
||||||
max-width: 400px; white-space: pre-line; font-size: 14px;
|
max-width: 400px; white-space: pre-line; font-size: 14px;
|
||||||
`,document.body.appendChild(v),p>0&&setTimeout(()=>v.remove(),p)}function timeAgo(l){const a=Date.now()-new Date(l).getTime();return a<6e4?"just now":a<36e5?Math.floor(a/6e4)+"m ago":a<864e5?Math.floor(a/36e5)+"h ago":Math.floor(a/864e5)+"d ago"}function safeGet(l,a=null){try{const p=localStorage.getItem(l);return p!==null?p:a}catch{return a}}function safeSet(l,a){try{localStorage.setItem(l,a)}catch{}}function safeRemove(l){try{localStorage.removeItem(l)}catch{}}function safeSessionGet(l,a=null){try{const p=sessionStorage.getItem(l);return p!==null?p:a}catch{return a}}function safeSessionSet(l,a){try{sessionStorage.setItem(l,a)}catch{}}function safeGetJSON(l,a=null){try{const p=localStorage.getItem(l);return p?JSON.parse(p):a}catch{return a}}function escapeHtml(l){return String(l??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function injectModal(l,a){document.getElementById(l)||document.body.insertAdjacentHTML("beforeend",a)}const DC_BUS={_handlers:{},on(l,a){var p;((p=this._handlers)[l]||(p[l]=[])).push(a)},off(l,a){this._handlers[l]=this._handlers[l]?.filter(p=>p!==a)},emit(l,a){this._handlers[l]?.forEach(p=>p(a))}},AppState={_apps:[],getApps(){return this._apps},setApps(l){this._apps=l,window.APPS=l,DC_BUS.emit("apps:changed",l)},findApp(l){return this._apps.find(a=>a.id===l)},addApp(l){this._apps.push(l),window.APPS=this._apps,DC_BUS.emit("apps:changed",this._apps)},removeApp(l){const a=this._apps.findIndex(p=>p.id===l);return a>-1&&(this._apps.splice(a,1),window.APPS=this._apps,DC_BUS.emit("apps:changed",this._apps)),a>-1},updateApp(l,a){const p=this._apps.find(h=>h.id===l);if(p){for(const[h,b]of Object.entries(a))h!=="__proto__"&&h!=="constructor"&&h!=="prototype"&&(p[h]=b);DC_BUS.emit("apps:changed",this._apps)}return p}};(function(){function l(){const h=document.createElement("div");return h.className="skeleton-card",h.innerHTML='<div style="display:flex;align-items:center;gap:12px;margin-bottom:12px"><div class="skeleton-bar" style="width:48px;height:48px;border-radius:8px;flex-shrink:0"></div><div style="flex:1"><div class="skeleton-bar" style="width:60%;height:14px;margin-bottom:6px"></div><div class="skeleton-bar" style="width:35%;height:10px"></div></div><div class="skeleton-bar" style="width:42px;height:22px;border-radius:11px"></div></div><div class="skeleton-bar" style="width:45%;height:12px;margin-bottom:10px"></div><div style="display:flex;gap:8px;margin-top:auto"><div class="skeleton-bar" style="width:64px;height:28px;border-radius:8px"></div><div class="skeleton-bar" style="width:64px;height:28px;border-radius:8px"></div></div>',h}function a(h){const b=document.getElementById("cards");if(!(!b||b.querySelector(".card"))){h=h||6;for(let g=0;g<h;g++){const v=l();b.appendChild(v),setTimeout(function(){v.classList.add("loaded")},g*60)}}}function p(){const h=document.getElementById("cards");if(h){var b=h.querySelectorAll(".skeleton-card");b.length&&(b.forEach(function(g,v){setTimeout(function(){g.style.opacity="0",g.style.transform="translateY(-10px)"},v*25)}),setTimeout(function(){b.forEach(function(g){g.parentNode&&g.remove()})},b.length*25+300))}}window.SkeletonLoader={show:a,hide:p}})(),(function(){var l="theme",a="user-themes",p="custom-theme",h=["dark","light","blue","black","nord","dracula","solarized-dark","solarized-light","taxi","ocean"],b=h.slice(),g=["bg","fg","muted","fg-muted","card-base","card-bg","border","hover","card-hover","base","ok-bg","ok-fg","bad-bg","bad-fg","dot-ok","dot-bad","uptime","success","error","warning","accent","accent-strong"],v=["bg","fg","muted","card-base","card-bg","border","ok-bg","ok-fg","bad-bg","bad-fg","dot-ok","dot-bad","uptime","accent","accent-strong"],f=["fg-muted","hover","card-hover","base","success","error","warning"],d={dark:{bg:"#0b0f1a",fg:"#e8ecf5",muted:"#9aa6bf","fg-muted":"#6b7a94","card-base":"#121826","card-bg":"#121826",border:"#263552",hover:"#1a2235","card-hover":"#161e2e",base:"#151c2b","ok-bg":"#0c2430","ok-fg":"#7ef2ff","bad-bg":"#2a121a","bad-fg":"#ff9aa3","dot-ok":"#35d1ff","dot-bad":"#ff5f7a",uptime:"#35d1ff",success:"#4caf50",error:"#e74c3c",warning:"#f39c12",accent:"#8FD6FF","accent-strong":"#1F7BFF"},light:{bg:"#f6f7fb",fg:"#0f1115",muted:"#5f6b7a","fg-muted":"#8993a4","card-base":"#ffffff","card-bg":"#ffffff",border:"#e2e7ef",hover:"#eef1f6","card-hover":"#f5f6fa",base:"#ebeef3","ok-bg":"#eafff1","ok-fg":"#0a7c3a","bad-bg":"#ffefef","bad-fg":"#b00020","dot-ok":"#0fb15a","dot-bad":"#d93b3b",uptime:"#0fb15a",success:"#0a7c3a",error:"#b00020",warning:"#d68a00",accent:"#4a90d9","accent-strong":"#2563eb",lightBg:!0},blue:{bg:"#1908AC",fg:"#e8f1ff",muted:"#d6e2ff","fg-muted":"#9eafdb","card-base":"#0d1533","card-bg":"#0d1533",border:"#1c2d6a",hover:"#141f4a","card-hover":"#111a3e",base:"#0f1840","ok-bg":"#162040","ok-fg":"#edffff","bad-bg":"#0a0e24","bad-fg":"#ffb3c0","dot-ok":"#c7e5ff","dot-bad":"#ffd6dc",uptime:"#7ec8ff",success:"#7ec8ff",error:"#ffb3c0",
Line truncated
|
`,document.body.appendChild(v),p>0&&setTimeout(()=>v.remove(),p)}function timeAgo(l){const a=Date.now()-new Date(l).getTime();return a<6e4?"just now":a<36e5?Math.floor(a/6e4)+"m ago":a<864e5?Math.floor(a/36e5)+"h ago":Math.floor(a/864e5)+"d ago"}function safeGet(l,a=null){try{const p=localStorage.getItem(l);return p!==null?p:a}catch{return a}}function safeSet(l,a){try{localStorage.setItem(l,a)}catch{}}function safeRemove(l){try{localStorage.removeItem(l)}catch{}}function safeSessionGet(l,a=null){try{const p=sessionStorage.getItem(l);return p!==null?p:a}catch{return a}}function safeSessionSet(l,a){try{sessionStorage.setItem(l,a)}catch{}}function safeGetJSON(l,a=null){try{const p=localStorage.getItem(l);return p?JSON.parse(p):a}catch{return a}}function escapeHtml(l){return String(l??"").replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function injectModal(l,a){document.getElementById(l)||document.body.insertAdjacentHTML("beforeend",a)}const DC_BUS={_handlers:{},on(l,a){var p;((p=this._handlers)[l]||(p[l]=[])).push(a)},off(l,a){this._handlers[l]=this._handlers[l]?.filter(p=>p!==a)},emit(l,a){this._handlers[l]?.forEach(p=>p(a))}},AppState={_apps:[],getApps(){return this._apps},setApps(l){this._apps=l,window.APPS=l,DC_BUS.emit("apps:changed",l)},findApp(l){return this._apps.find(a=>a.id===l)},addApp(l){this._apps.push(l),window.APPS=this._apps,DC_BUS.emit("apps:changed",this._apps)},removeApp(l){const a=this._apps.findIndex(p=>p.id===l);return a>-1&&(this._apps.splice(a,1),window.APPS=this._apps,DC_BUS.emit("apps:changed",this._apps)),a>-1},updateApp(l,a){const p=this._apps.find(h=>h.id===l);if(p){for(const[h,b]of Object.entries(a))h!=="__proto__"&&h!=="constructor"&&h!=="prototype"&&(p[h]=b);DC_BUS.emit("apps:changed",this._apps)}return p}};(function(){function l(){const h=document.createElement("div");return h.className="skeleton-card",h.innerHTML='<div style="display:flex;align-items:center;gap:12px;margin-bottom:12px"><div class="skeleton-bar" style="width:48px;height:48px;border-radius:8px;flex-shrink:0"></div><div style="flex:1"><div class="skeleton-bar" style="width:60%;height:14px;margin-bottom:6px"></div><div class="skeleton-bar" style="width:35%;height:10px"></div></div><div class="skeleton-bar" style="width:42px;height:22px;border-radius:11px"></div></div><div class="skeleton-bar" style="width:45%;height:12px;margin-bottom:10px"></div><div style="display:flex;gap:8px;margin-top:auto"><div class="skeleton-bar" style="width:64px;height:28px;border-radius:8px"></div><div class="skeleton-bar" style="width:64px;height:28px;border-radius:8px"></div></div>',h}function a(h){const b=document.getElementById("cards");if(!(!b||b.querySelector(".card"))){h=h||6;for(let g=0;g<h;g++){const v=l();b.appendChild(v),setTimeout(function(){v.classList.add("loaded")},g*60)}}}function p(){const h=document.getElementById("cards");if(h){var b=h.querySelectorAll(".skeleton-card");b.length&&(b.forEach(function(g,v){setTimeout(function(){g.style.opacity="0",g.style.transform="translateY(-10px)"},v*25)}),setTimeout(function(){b.forEach(function(g){g.parentNode&&g.remove()})},b.length*25+300))}}window.SkeletonLoader={show:a,hide:p}})(),(function(){var l="theme",a="user-themes",p="custom-theme",h=["dark","light","blue","black","nord","dracula","solarized-dark","solarized-light","taxi","ocean"],b=h.slice(),g=["bg","fg","muted","fg-muted","card-base","card-bg","border","hover","card-hover","base","ok-bg","ok-fg","bad-bg","bad-fg","dot-ok","dot-bad","uptime","success","error","warning","accent","accent-strong"],v=["bg","fg","muted","card-base","card-bg","border","ok-bg","ok-fg","bad-bg","bad-fg","dot-ok","dot-bad","uptime","accent","accent-strong"],f=["fg-muted","hover","card-hover","base","success","error","warning"],d={dark:{bg:"#0b0f1a",fg:"#e8ecf5",muted:"#9aa6bf","fg-muted":"#6b7a94","card-base":"#121826","card-bg":"#121826",border:"#263552",hover:"#1a2235","card-hover":"#161e2e",base:"#151c2b","ok-bg":"#0c2430","ok-fg":"#7ef2ff","bad-bg":"#2a121a","bad-fg":"#ff9aa3","dot-ok":"#35d1ff","dot-bad":"#ff5f7a",uptime:"#35d1ff",success:"#4caf50",error:"#e74c3c",warning:"#f39c12",accent:"#8FD6FF","accent-strong":"#1F7BFF"},light:{bg:"#f6f7fb",fg:"#0f1115",muted:"#5f6b7a","fg-muted":"#8993a4","card-base":"#ffffff","card-bg":"#ffffff",border:"#e2e7ef",hover:"#eef1f6","card-hover":"#f5f6fa",base:"#ebeef3","ok-bg":"#eafff1","ok-fg":"#0a7c3a","bad-bg":"#ffefef","bad-fg":"#b00020","dot-ok":"#0fb15a","dot-bad":"#d93b3b",uptime:"#0fb15a",success:"#0a7c3a",error:"#b00020",warning:"#d68a00",accent:"#4a90d9","accent-strong":"#2563eb",lightBg:!0},blue:{bg:"#1908AC",fg:"#e8f1ff",muted:"#d6e2ff","fg-muted":"#9eafdb","card-base":"#0d1533","card-bg":"#0d1533",border:"#1c2d6a",hover:"#141f4a","card-hover":"#111a3e",base:"#0f1840","ok-bg":"#162040","ok-fg":"#edffff","bad-bg":"#0a0e24","bad-fg":"#ffb3c0","dot-ok":"#c7e5ff","dot-bad":"#ffd6dc",uptime:"#7ec8ff",success:"#7ec8ff",error:"#ffb3c0",
Line truncated
|
||||||
background:
|
background:
|
||||||
radial-gradient(1200px 800px at 10% -10%, rgba(`+C.r+","+C.g+","+C.b+`, .08), transparent 60%),
|
radial-gradient(1200px 800px at 10% -10%, rgba(`+C.r+","+C.g+","+C.b+`, .08), transparent 60%),
|
||||||
radial-gradient(1000px 700px at 110% 10%, rgba(`+C.r+","+C.g+","+C.b+`, .05), transparent 55%),
|
radial-gradient(1000px 700px at 110% 10%, rgba(`+C.r+","+C.g+","+C.b+`, .05), transparent 55%),
|
||||||
@@ -35,7 +35,7 @@
|
|||||||
radial-gradient(1000px 700px at 110% -10%, rgba(`+C.r+","+C.g+","+C.b+`, .07), transparent 55%),
|
radial-gradient(1000px 700px at 110% -10%, rgba(`+C.r+","+C.g+","+C.b+`, .07), transparent 55%),
|
||||||
var(--bg);
|
var(--bg);
|
||||||
}
|
}
|
||||||
`}function n(x,B){var A=B.lightBg||B.bg&&s(B.bg)>.4;return A?":root."+x+` button:hover {
|
`}function n(x,B){var P=B.lightBg||B.bg&&r(B.bg)>.4;return P?":root."+x+` button:hover {
|
||||||
background: color-mix(in srgb, var(--accent-strong) 12%, white 88%);
|
background: color-mix(in srgb, var(--accent-strong) 12%, white 88%);
|
||||||
border-color: rgba(0, 0, 0, .15);
|
border-color: rgba(0, 0, 0, .15);
|
||||||
box-shadow: 0 1px 6px rgba(0, 0, 0, .08), inset 0 1px 0 rgba(255, 255, 255, .8);
|
box-shadow: 0 1px 6px rgba(0, 0, 0, .08), inset 0 1px 0 rgba(255, 255, 255, .8);
|
||||||
@@ -44,10 +44,10 @@
|
|||||||
background: color-mix(in srgb, var(--accent) 18%, transparent);
|
background: color-mix(in srgb, var(--accent) 18%, transparent);
|
||||||
border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
|
border-color: color-mix(in srgb, var(--accent) 35%, var(--border));
|
||||||
}
|
}
|
||||||
`}function u(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function o(){g.forEach(function(x){document.documentElement.style.removeProperty("--"+x)})}function r(x,B){var A=x.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");A||(A="custom"),h.indexOf(A)!==-1&&(A=A+"-custom");for(var E=safeGetJSON(a,{}),C=A,T=2;E[A]&&A!==B;)A=C+"-"+T++;return A}function c(x){var B=document.getElementById("user-theme-styles");B&&B.remove(),b.length=h.length,Object.keys(d).forEach(function($){h.indexOf($)===-1&&delete d[$]});var A=x||safeGetJSON(a,{}),E=Object.keys(A);if(E=E.filter(function($){return h.indexOf($)===-1}),!!E.length){var C="";E.forEach(function($){var I=A[$];b.indexOf($)===-1&&b.push($);var P={};g.forEach(function(O){I[O]&&(P[O]=I[O])}),P["card-bg"]=I["card-base"]||I.bg,I.lightBg&&(P.lightBg=!0);var D=t(P);f.forEach(function(O){!P[O]&&D[O]&&(P[O]=D[O])}),d[$]=P,C+=":root."+$+` {
|
`}function u(){return window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}function o(){g.forEach(function(x){document.documentElement.style.removeProperty("--"+x)})}function s(x,B){var P=x.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"");P||(P="custom"),h.indexOf(P)!==-1&&(P=P+"-custom");for(var E=safeGetJSON(a,{}),C=P,T=2;E[P]&&P!==B;)P=C+"-"+T++;return P}function c(x){var B=document.getElementById("user-theme-styles");B&&B.remove(),b.length=h.length,Object.keys(d).forEach(function(L){h.indexOf(L)===-1&&delete d[L]});var P=x||safeGetJSON(a,{}),E=Object.keys(P);if(E=E.filter(function(L){return h.indexOf(L)===-1}),!!E.length){var C="";E.forEach(function(L){var I=P[L];b.indexOf(L)===-1&&b.push(L);var A={};g.forEach(function(O){I[O]&&(A[O]=I[O])}),A["card-bg"]=I["card-base"]||I.bg,I.lightBg&&(A.lightBg=!0);var D=t(A);f.forEach(function(O){!A[O]&&D[O]&&(A[O]=D[O])}),d[L]=A,C+=":root."+L+` {
|
||||||
`,g.forEach(function(O){P[O]&&(C+=" --"+O+": "+P[O]+`;
|
`,g.forEach(function(O){A[O]&&(C+=" --"+O+": "+A[O]+`;
|
||||||
`)}),C+=`}
|
`)}),C+=`}
|
||||||
`,C+=e($,P),C+=n($,P)});var T=document.createElement("style");T.id="user-theme-styles",T.textContent=C,document.head.appendChild(T)}}function y(){secureFetch("/api/v1/themes").then(function(x){return x.json()}).then(function(x){if(!(!x.success||!x.themes)){var B=x.themes,A=safeGetJSON(a,{});if(JSON.stringify(B)!==JSON.stringify(A)){safeSet(a,JSON.stringify(B)),c(B);var E=safeGet(l);E&&b.indexOf(E)!==-1&&k(E)}}}).catch(function(){})}function S(){var x=safeGetJSON(p);if(x){var B=x.name||"Custom",A=r(B),E={name:B};g.forEach(function($){x[$]&&(E[$]=x[$])});var C=safeGetJSON(a,{});C[A]=E,safeSet(a,JSON.stringify(C)),safeGet(l)==="custom"&&safeSet(l,A),safeRemove(p);var T={};g.forEach(function($){E[$]&&(T[$]=E[$])}),fetch("/api/v1/themes/"+A,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:B,colors:T})}).catch(function(){})}}function k(x){document.documentElement.classList.add("theme-transitioning"),b.forEach(function(C){C!=="dark"&&document.documentElement.classList.remove(C)}),o(),x!=="dark"&&document.documentElement.classList.add(x),safeSet(l,x);var B=d[x],A=document.querySelector('meta[name="theme-color"]');A&&B&&A.setAttribute("content",B.bg);var E=B&&B.lightBg;!E&&B&&B.bg&&(E=s(B.bg)>.4),E?document.documentElement.classList.add("light-bg"):document.documentElement.classList.remove("light-bg"),setTimeout(function(){document.documentElement.classList.remove("theme-transitioning")},300)}S(),c();var L=safeGet(l);L==="red"&&(L="black",safeSet(l,"black")),L&&L!=="dark"&&b.indexOf(L)===-1&&(L=null),k(L||u()),y(),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(x){safeGet(l)||k(x.matches?"dark":"light")}),window.THEMES=b,window.BUILTIN_THEMES=h,window.THEME_COLORS=d,window.THEME_PROPS=g,window.BASE_PROPS=v,window.DERIVED_PROPS=f,window.USER_THEMES_KEY=a,window.applyTheme=k,window.clearCustomProperties=o,window.injectUserThemeStyles=c,window.syncThemesFromServer=y,window.slugifyThemeName=r,window.getActiveTheme=function(){return safeGet(l)||u()},window.deriveExtendedColors=t,window.hexToRgb=i,window.rgbToHex=m,window.blendColors=w})(),(function(){let l=null;async function a(){if(l)return l;try{const w=await fetch("/api/v1/auth/login/methods",{cache:"no-store"});if(!w.ok)throw new Error(`methods HTTP ${w.status}`);const s=await w.json();return l=Array.isArray(s.providers)?s.providers:[],l}catch(w){return console.warn("[auth-gate] methods fetch failed; falling back to TOTP-only",w),[]}}function p(w){const s=document.getElementById("totp-overlay");if(!s)return;const t=s.querySelector(".totp-card");if(!t)return;const e=t.innerHTML;t.dataset.originalBody||(t.dataset.originalBody=e);const n=w.map(u=>{const o=u.config&&(u.config.label||u.name)||u.name;return`<button class="provider-btn" data-provider="${u.name}"
|
`,C+=e(L,A),C+=n(L,A)});var T=document.createElement("style");T.id="user-theme-styles",T.textContent=C,document.head.appendChild(T)}}function y(){secureFetch("/api/v1/themes").then(function(x){return x.json()}).then(function(x){if(!(!x.success||!x.themes)){var B=x.themes,P=safeGetJSON(a,{});if(JSON.stringify(B)!==JSON.stringify(P)){safeSet(a,JSON.stringify(B)),c(B);var E=safeGet(l);E&&b.indexOf(E)!==-1&&k(E)}}}).catch(function(){})}function S(){var x=safeGetJSON(p);if(x){var B=x.name||"Custom",P=s(B),E={name:B};g.forEach(function(L){x[L]&&(E[L]=x[L])});var C=safeGetJSON(a,{});C[P]=E,safeSet(a,JSON.stringify(C)),safeGet(l)==="custom"&&safeSet(l,P),safeRemove(p);var T={};g.forEach(function(L){E[L]&&(T[L]=E[L])}),fetch("/api/v1/themes/"+P,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({name:B,colors:T})}).catch(function(){})}}function k(x){document.documentElement.classList.add("theme-transitioning"),b.forEach(function(C){C!=="dark"&&document.documentElement.classList.remove(C)}),o(),x!=="dark"&&document.documentElement.classList.add(x),safeSet(l,x);var B=d[x],P=document.querySelector('meta[name="theme-color"]');P&&B&&P.setAttribute("content",B.bg);var E=B&&B.lightBg;!E&&B&&B.bg&&(E=r(B.bg)>.4),E?document.documentElement.classList.add("light-bg"):document.documentElement.classList.remove("light-bg"),setTimeout(function(){document.documentElement.classList.remove("theme-transitioning")},300)}S(),c();var $=safeGet(l);$==="red"&&($="black",safeSet(l,"black")),$&&$!=="dark"&&b.indexOf($)===-1&&($=null),k($||u()),y(),window.matchMedia("(prefers-color-scheme: dark)").addEventListener("change",function(x){safeGet(l)||k(x.matches?"dark":"light")}),window.THEMES=b,window.BUILTIN_THEMES=h,window.THEME_COLORS=d,window.THEME_PROPS=g,window.BASE_PROPS=v,window.DERIVED_PROPS=f,window.USER_THEMES_KEY=a,window.applyTheme=k,window.clearCustomProperties=o,window.injectUserThemeStyles=c,window.syncThemesFromServer=y,window.slugifyThemeName=s,window.getActiveTheme=function(){return safeGet(l)||u()},window.deriveExtendedColors=t,window.hexToRgb=i,window.rgbToHex=m,window.blendColors=w})(),(function(){let l=null;async function a(){if(l)return l;try{const w=await fetch("/api/v1/auth/login/methods",{cache:"no-store"});if(!w.ok)throw new Error(`methods HTTP ${w.status}`);const r=await w.json();return l=Array.isArray(r.providers)?r.providers:[],l}catch(w){return console.warn("[auth-gate] methods fetch failed; falling back to TOTP-only",w),[]}}function p(w){const r=document.getElementById("totp-overlay");if(!r)return;const t=r.querySelector(".totp-card");if(!t)return;const e=t.innerHTML;t.dataset.originalBody||(t.dataset.originalBody=e);const n=w.map(u=>{const o=u.config&&(u.config.label||u.name)||u.name;return`<button class="provider-btn" data-provider="${u.name}"
|
||||||
style="margin: 6px 4px; padding: 10px 16px; background: var(--accent); color: white; border: 0; border-radius: 6px; cursor: pointer; font-size: 0.95rem;">
|
style="margin: 6px 4px; padding: 10px 16px; background: var(--accent); color: white; border: 0; border-radius: 6px; cursor: pointer; font-size: 0.95rem;">
|
||||||
Sign in with ${o}
|
Sign in with ${o}
|
||||||
</button>`}).join(`
|
</button>`}).join(`
|
||||||
@@ -57,7 +57,7 @@
|
|||||||
<p class="subtitle">Choose how to sign in</p>
|
<p class="subtitle">Choose how to sign in</p>
|
||||||
<div id="auth-gate-providers" style="margin: 14px 0 10px;">${n}</div>
|
<div id="auth-gate-providers" style="margin: 14px 0 10px;">${n}</div>
|
||||||
<div id="auth-gate-message" style="margin-top: 8px; color: var(--muted); font-size: 0.8rem;"></div>
|
<div id="auth-gate-message" style="margin-top: 8px; color: var(--muted); font-size: 0.8rem;"></div>
|
||||||
`,s.classList.add("show"),t.querySelectorAll(".provider-btn").forEach(u=>{u.addEventListener("click",()=>{const o=u.dataset.provider,r=w.find(c=>c.name===o);b(r)})})}function h(){const w=document.getElementById("totp-overlay");if(!w)return;const s=w.querySelector(".totp-card");!s||!s.dataset.originalBody||(s.innerHTML=s.dataset.originalBody,window.location.reload())}function b(w){const s=document.getElementById("totp-overlay");if(!s)return;const t=s.querySelector(".totp-card");if(t){if(w.name==="totp"){window.location.reload();return}if(w.name==="email"){t.innerHTML=`
|
`,r.classList.add("show"),t.querySelectorAll(".provider-btn").forEach(u=>{u.addEventListener("click",()=>{const o=u.dataset.provider,s=w.find(c=>c.name===o);b(s)})})}function h(){const w=document.getElementById("totp-overlay");if(!w)return;const r=w.querySelector(".totp-card");!r||!r.dataset.originalBody||(r.innerHTML=r.dataset.originalBody,window.location.reload())}function b(w){const r=document.getElementById("totp-overlay");if(!r)return;const t=r.querySelector(".totp-card");if(t){if(w.name==="totp"){window.location.reload();return}if(w.name==="email"){t.innerHTML=`
|
||||||
<img class="totp-logo totp-logo-dark" src="/assets/dashcaddy-logo-dark.png" alt="DashCaddy">
|
<img class="totp-logo totp-logo-dark" src="/assets/dashcaddy-logo-dark.png" alt="DashCaddy">
|
||||||
<img class="totp-logo totp-logo-light" src="/assets/dashcaddy-logo-light.png" alt="DashCaddy">
|
<img class="totp-logo totp-logo-light" src="/assets/dashcaddy-logo-light.png" alt="DashCaddy">
|
||||||
<p class="subtitle">Sign in with email</p>
|
<p class="subtitle">Sign in with email</p>
|
||||||
@@ -75,13 +75,13 @@
|
|||||||
<div style="margin-top: 16px;">
|
<div style="margin-top: 16px;">
|
||||||
<a href="#" id="auth-gate-back" style="color: var(--muted); font-size: 0.8rem;">\u2190 Back</a>
|
<a href="#" id="auth-gate-back" style="color: var(--muted); font-size: 0.8rem;">\u2190 Back</a>
|
||||||
</div>
|
</div>
|
||||||
`,s.classList.add("show");const e=t.querySelector("#auth-gate-email-input"),n=t.querySelector("#auth-gate-email-submit"),u=t.querySelector("#auth-gate-email-status"),o=t.querySelector("#auth-gate-back");n.addEventListener("click",async()=>{const r=(e.value||"").trim();if(!r||!r.includes("@")){u.textContent="Enter a valid email address.",u.style.color="var(--error, #d33)";return}n.disabled=!0,u.textContent="Sending\u2026",u.style.color="";try{const y=await(await fetch("/api/v1/auth/login/email/initiate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:r})})).json();if(y.success){const S=y.deliveredVia||"email",k=y.maskedEmail||r;S==="dev-console"?u.innerHTML=`
|
`,r.classList.add("show");const e=t.querySelector("#auth-gate-email-input"),n=t.querySelector("#auth-gate-email-submit"),u=t.querySelector("#auth-gate-email-status"),o=t.querySelector("#auth-gate-back");n.addEventListener("click",async()=>{const s=(e.value||"").trim();if(!s||!s.includes("@")){u.textContent="Enter a valid email address.",u.style.color="var(--error, #d33)";return}n.disabled=!0,u.textContent="Sending\u2026",u.style.color="";try{const y=await(await fetch("/api/v1/auth/login/email/initiate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:s})})).json();if(y.success){const S=y.deliveredVia||"email",k=y.maskedEmail||s;S==="dev-console"?u.innerHTML=`
|
||||||
Check the server logs for your one-time link.
|
Check the server logs for your one-time link.
|
||||||
(Dev mode: no SMTP configured. In production this would email <strong>${k}</strong>.)`:u.innerHTML=`Sign-in link sent to <strong>${k}</strong>.
|
(Dev mode: no SMTP configured. In production this would email <strong>${k}</strong>.)`:u.innerHTML=`Sign-in link sent to <strong>${k}</strong>.
|
||||||
Check your inbox (and spam folder).`,u.style.color="var(--success, #2a7)"}else u.textContent=y.error||"Could not send link.",u.style.color="var(--error, #d33)",n.disabled=!1}catch{u.textContent="Connection error. Try again.",u.style.color="var(--error, #d33)",n.disabled=!1}}),e.addEventListener("keydown",r=>{r.key==="Enter"&&n.click()}),o.addEventListener("click",r=>{r.preventDefault(),p(providers)});return}console.warn("[auth-gate] unknown provider",w.name),window.location.reload()}}async function g(){if(!document.getElementById("totp-overlay"))return;const s=await a();if(s.length===0){typeof window._showTotpOverlay=="function"&&window._showTotpOverlay();return}if(s.length===1&&s[0].name==="totp"){v(s[0]);return}p(s)}function v(w){const s=l&&l.find(u=>u.name==="email");if(!s){typeof window._showTotpOverlay=="function"&&window._showTotpOverlay();return}const t=document.getElementById("totp-overlay"),e=t.querySelector(".totp-card");if(!e)return;if(e.dataset.originalBody||(e.dataset.originalBody=e.innerHTML),!e.querySelector("#auth-gate-email-alt")){const u=document.createElement("div");u.id="auth-gate-email-alt",u.style.cssText="margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 0.85rem;",u.innerHTML=`<a href="#" id="auth-gate-email-alt-link"
|
Check your inbox (and spam folder).`,u.style.color="var(--success, #2a7)"}else u.textContent=y.error||"Could not send link.",u.style.color="var(--error, #d33)",n.disabled=!1}catch{u.textContent="Connection error. Try again.",u.style.color="var(--error, #d33)",n.disabled=!1}}),e.addEventListener("keydown",s=>{s.key==="Enter"&&n.click()}),o.addEventListener("click",s=>{s.preventDefault(),p(providers)});return}console.warn("[auth-gate] unknown provider",w.name),window.location.reload()}}async function g(){if(!document.getElementById("totp-overlay"))return;const r=await a();if(r.length===0){typeof window._showTotpOverlay=="function"&&window._showTotpOverlay();return}if(r.length===1&&r[0].name==="totp"){v(r[0]);return}p(r)}function v(w){const r=l&&l.find(u=>u.name==="email");if(!r){typeof window._showTotpOverlay=="function"&&window._showTotpOverlay();return}const t=document.getElementById("totp-overlay"),e=t.querySelector(".totp-card");if(!e)return;if(e.dataset.originalBody||(e.dataset.originalBody=e.innerHTML),!e.querySelector("#auth-gate-email-alt")){const u=document.createElement("div");u.id="auth-gate-email-alt",u.style.cssText="margin-top: 18px; padding-top: 14px; border-top: 1px solid var(--border); font-size: 0.85rem;",u.innerHTML=`<a href="#" id="auth-gate-email-alt-link"
|
||||||
style="color: var(--accent); text-decoration: none;">
|
style="color: var(--accent); text-decoration: none;">
|
||||||
Or sign in with email instead \u2192
|
Or sign in with email instead \u2192
|
||||||
</a>`,e.appendChild(u),u.querySelector("#auth-gate-email-alt-link").addEventListener("click",o=>{o.preventDefault(),b(s)})}t.classList.add("show")}window.__dc_049_handled=!0;function f(w){try{const s=new URL(w,window.location.origin);if(!["http:","https:"].includes(s.protocol))return!1;if(s.origin===window.location.origin)return!0;if(s.protocol!=="https:")return!1;const t=SITE.tld.startsWith(".")?SITE.tld:`.${SITE.tld}`;return s.hostname===t.slice(1)||s.hostname.endsWith(t)}catch{return!1}}function d(w,s){const t=new URL(w,window.location.origin);if(t.origin===window.location.origin)return t.toString();const e=SITE.tld.startsWith(".")?SITE.tld:`.${SITE.tld}`,n=t.hostname===e.slice(1)||t.hostname.endsWith(e);if(t.protocol!=="https:"||!n||!s)return null;const u=`${t.pathname}${t.search}${t.hash}`;return t.pathname="/dashcaddy-sso",t.search="",t.hash="",t.searchParams.set("token",s),t.searchParams.set("return",u),t.toString()}async function i(w){if(!w||!f(w))return!1;try{const s=new URL(w,window.location.origin),t=SITE.tld.startsWith(".")?SITE.tld:`.${SITE.tld}`,e=s.hostname.slice(0,-t.length);if(!/^[a-z0-9][a-z0-9-]*$/.test(e))return!1;const n=await fetch(`/api/v1/auth/sso-handoff?serviceId=${encodeURIComponent(e)}`,{credentials:"include",cache:"no-store"});if(!n.ok)return!1;const u=await n.json(),o=u.success&&d(w,u.ssoToken);if(!o)return!1;try{sessionStorage.removeItem("totp_redirect")}catch{}return window.location.replace(o),!0}catch{return!1}}const m=new URLSearchParams(window.location.search);if(m.get("auth")==="required"){const w=m.get("return");if(w&&f(w))try{sessionStorage.setItem("totp_redirect",w)}catch{}window.history.replaceState({},"",window.location.pathname),setTimeout(async()=>{await i(w)||await g()},0)}window._showAuthGate=g,window._authGateMethods=a})(),(function(){const l=new WeakSet;document.addEventListener("error",d=>{const i=d.target;i&&i.tagName==="IMG"&&i.classList.contains("totp-logo")&&(l.add(i),i.style.display="none")},!0),document.querySelectorAll(".totp-logo").forEach(d=>{d.complete&&d.naturalWidth===0&&(l.add(d),d.style.display="none")});function a(){const d=document.querySelector(".totp-card");if(!d)return;const m=getComputedStyle(d).backgroundColor.match(/\d+/g);if(!m)return;const w=(.299*+m[0]+.587*+m[1]+.114*+m[2])/255,s=d.querySelector(".totp-logo-dark"),t=d.querySelector(".totp-logo-light");s&&(s.style.display=w>.5||l.has(s)?"none":""),t&&(t.style.display=w<=.5||l.has(t)?"none":"")}function p(){const d=document.getElementById("totp-overlay");if(d){d.classList.add("show"),setTimeout(a,50);const i=d.querySelector(".totp-digits input");i&&setTimeout(()=>i.focus(),100)}typeof window._refreshRecoveryLink=="function"&&window._refreshRecoveryLink()}function h(){const d=document.getElementById("totp-overlay");d&&d.classList.remove("show")}function b(d,i){const m=new URL(d,window.location.origin);if(m.origin===window.location.origin)return m.toString();const w=SITE.tld.startsWith(".")?SITE.tld:`.${SITE.tld}`,s=m.hostname===w.slice(1)||m.hostname.endsWith(w);if(m.protocol!=="https:"||!s)return null;if(!i)return m.toString();const t=`${m.pathname}${m.search}${m.hash}`;return m.pathname="/dashcaddy-sso",m.search="",m.hash="",m.searchParams.set("token",i),m.searchParams.set("return",t),m.toString()}const g=document.getElementById("totp-digits");if(g){const d=g.querySelectorAll("input");d.forEach((i,m)=>{i.addEventListener("input",w=>{const s=w.target.value.replace(/\D/g,"");w.target.value=s.slice(0,1),s&&m<d.length-1&&d[m+1].focus();const t=Array.from(d).map(e=>e.value).join("");t.length===6&&v(t)}),i.addEventListener("keydown",w=>{w.key==="Backspace"&&!w.target.value&&m>0&&(d[m-1].focus(),d[m-1].value="")}),i.addEventListener("paste",w=>{w.preventDefault();const s=(w.clipboardData.getData("text")||"").replace(/\D/g,"");s.length>=6&&(d.forEach((t,e)=>{t.value=s[e]||""}),d[5].focus(),v(s.slice(0,6)))})})}async function v(d){const i=document.getElementById("totp-error");i.textContent="Verifying...",i.className="totp-error verifying";const m=safeSessionGet("totp_redirect");let w=null;if(m)try{const s=new URL(m,window.location.origin),t=SITE.tld.startsWith(".")?SITE.tld:`.${SITE.tld}`,e=s.hostname.slice(0,-t.length);s.hostname.endsWith(t)&&/^[a-z0-9][a-z0-9-]*$/.test(e)&&(w=e)}catch{}try{const t=await(await secureFetch("/api/v1/totp/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,serviceId:w})})).json();if(t.success){if(i.textContent="",t.csrfToken&&(csrfToken=t.csrfToken),h(),m){try{sessionStorage.removeItem("totp_redirect")}catch{}const e=b(m,t.ssoToken);if(!e)return;window.location.href=e;return}typeof window.initializeDashboard=="function"&&window.initializeDashboard(),window._dcAuthLost=!1,typeof window._sseResume=="function"?window._sseResume():typeof window._sseReconnect=="function"&&window._sseReconnect(),typeof window.refreshAll=="function"&&window.refreshAll()}else{i.textContent=t.error||"Invalid code",i.className="totp-error";Line truncated
|
</a>`,e.appendChild(u),u.querySelector("#auth-gate-email-alt-link").addEventListener("click",o=>{o.preventDefault(),b(r)})}t.classList.add("show")}window.__dc_049_handled=!0;function f(w){try{const r=new URL(w,window.location.origin);if(!["http:","https:"].includes(r.protocol))return!1;if(r.origin===window.location.origin)return!0;if(r.protocol!=="https:")return!1;const t=SITE.tld.startsWith(".")?SITE.tld:`.${SITE.tld}`;return r.hostname===t.slice(1)||r.hostname.endsWith(t)}catch{return!1}}function d(w,r){const t=new URL(w,window.location.origin);if(t.origin===window.location.origin)return t.toString();const e=SITE.tld.startsWith(".")?SITE.tld:`.${SITE.tld}`,n=t.hostname===e.slice(1)||t.hostname.endsWith(e);if(t.protocol!=="https:"||!n||!r)return null;const u=`${t.pathname}${t.search}${t.hash}`;return t.pathname="/dashcaddy-sso",t.search="",t.hash="",t.searchParams.set("token",r),t.searchParams.set("return",u),t.toString()}async function i(w){if(!w||!f(w))return!1;try{const r=new URL(w,window.location.origin),t=SITE.tld.startsWith(".")?SITE.tld:`.${SITE.tld}`,e=r.hostname.slice(0,-t.length);if(!/^[a-z0-9][a-z0-9-]*$/.test(e))return!1;const n=await fetch(`/api/v1/auth/sso-handoff?serviceId=${encodeURIComponent(e)}`,{credentials:"include",cache:"no-store"});if(!n.ok)return!1;const u=await n.json(),o=u.success&&d(w,u.ssoToken);if(!o)return!1;try{sessionStorage.removeItem("totp_redirect")}catch{}return window.location.replace(o),!0}catch{return!1}}const m=new URLSearchParams(window.location.search);if(m.get("auth")==="required"){const w=m.get("return");if(w&&f(w))try{sessionStorage.setItem("totp_redirect",w)}catch{}window.history.replaceState({},"",window.location.pathname),setTimeout(async()=>{await i(w)||await g()},0)}window._showAuthGate=g,window._authGateMethods=a})(),(function(){const l=new WeakSet;document.addEventListener("error",d=>{const i=d.target;i&&i.tagName==="IMG"&&i.classList.contains("totp-logo")&&(l.add(i),i.style.display="none")},!0),document.querySelectorAll(".totp-logo").forEach(d=>{d.complete&&d.naturalWidth===0&&(l.add(d),d.style.display="none")});function a(){const d=document.querySelector(".totp-card");if(!d)return;const m=getComputedStyle(d).backgroundColor.match(/\d+/g);if(!m)return;const w=(.299*+m[0]+.587*+m[1]+.114*+m[2])/255,r=d.querySelector(".totp-logo-dark"),t=d.querySelector(".totp-logo-light");r&&(r.style.display=w>.5||l.has(r)?"none":""),t&&(t.style.display=w<=.5||l.has(t)?"none":"")}function p(){const d=document.getElementById("totp-overlay");if(d){d.classList.add("show"),setTimeout(a,50);const i=d.querySelector(".totp-digits input");i&&setTimeout(()=>i.focus(),100)}typeof window._refreshRecoveryLink=="function"&&window._refreshRecoveryLink()}function h(){const d=document.getElementById("totp-overlay");d&&d.classList.remove("show")}function b(d,i){const m=new URL(d,window.location.origin);if(m.origin===window.location.origin)return m.toString();const w=SITE.tld.startsWith(".")?SITE.tld:`.${SITE.tld}`,r=m.hostname===w.slice(1)||m.hostname.endsWith(w);if(m.protocol!=="https:"||!r)return null;if(!i)return m.toString();const t=`${m.pathname}${m.search}${m.hash}`;return m.pathname="/dashcaddy-sso",m.search="",m.hash="",m.searchParams.set("token",i),m.searchParams.set("return",t),m.toString()}const g=document.getElementById("totp-digits");if(g){const d=g.querySelectorAll("input");d.forEach((i,m)=>{i.addEventListener("input",w=>{const r=w.target.value.replace(/\D/g,"");w.target.value=r.slice(0,1),r&&m<d.length-1&&d[m+1].focus();const t=Array.from(d).map(e=>e.value).join("");t.length===6&&v(t)}),i.addEventListener("keydown",w=>{w.key==="Backspace"&&!w.target.value&&m>0&&(d[m-1].focus(),d[m-1].value="")}),i.addEventListener("paste",w=>{w.preventDefault();const r=(w.clipboardData.getData("text")||"").replace(/\D/g,"");r.length>=6&&(d.forEach((t,e)=>{t.value=r[e]||""}),d[5].focus(),v(r.slice(0,6)))})})}async function v(d){const i=document.getElementById("totp-error");i.textContent="Verifying...",i.className="totp-error verifying";const m=safeSessionGet("totp_redirect");let w=null;if(m)try{const r=new URL(m,window.location.origin),t=SITE.tld.startsWith(".")?SITE.tld:`.${SITE.tld}`,e=r.hostname.slice(0,-t.length);r.hostname.endsWith(t)&&/^[a-z0-9][a-z0-9-]*$/.test(e)&&(w=e)}catch{}try{const t=await(await secureFetch("/api/v1/totp/verify",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({code:d,serviceId:w})})).json();if(t.success){if(i.textContent="",t.csrfToken&&(csrfToken=t.csrfToken),h(),m){try{sessionStorage.removeItem("totp_redirect")}catch{}const e=b(m,t.ssoToken);if(!e)return;window.location.href=e;return}typeof window.initializeDashboard=="function"&&window.initializeDashboard(),window._dcAuthLost=!1,typeof window._sseResume=="function"?window._sseResume():typeof window._sseReconnect=="function"&&window._sseReconnect(),typeof window.refreshAll=="function"&&window.refreshAll()}else{i.textContent=t.error||"Invalid code",i.className="totp-error";Line truncated
|
||||||
<div class="weather-modal-content" style="min-width: 500px; max-width: 700px; max-height: 80vh;">
|
<div class="weather-modal-content" style="min-width: 500px; max-width: 700px; max-height: 80vh;">
|
||||||
<h3>\u{1F4C2} Browse for Media Folders</h3>
|
<h3>\u{1F4C2} Browse for Media Folders</h3>
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>`);const a=document.getElementById("service-creds-modal");let p=null,h=null,b=!1;const g=["sonarr","radarr","prowlarr","overseerr"],v=["sonarr","radarr"];function f(e){return e.externalUrl||e.url||""}function d(e){const n=document.getElementById("svc-creds-error");n.textContent=e,n.style.display=""}function i(){const e=document.getElementById("svc-creds-error");e.textContent="",e.style.display="none"}async function m(e,n){if(!e)throw new Error(`${n} failed: no response`);let u;try{u=await e.json()}catch{throw new Error(`${n} failed: invalid server response`)}if(!e.ok||u?.success!==!0)throw new Error(u?.error||`${n} failed (${e.status||"unknown status"})`);return u}function w(e,n){return!!window.DCCredentialVault?.isAllowedReturnUrl(e,n)}window.openServiceCredsModal=async function(e,n={}){p=e,h=w(n.returnUrl,e.id)?n.returnUrl:null,b=!1,i();const u=document.getElementById("svc-creds-title"),o=document.getElementById("svc-creds-desc"),r=document.getElementById("svc-creds-seedhost"),c=document.getElementById("svc-creds-apikey"),y=document.getElementById("svc-creds-basic"),S=document.getElementById("svc-creds-quality");u.textContent=e.name+" \u2014 Encrypted Vault",document.getElementById("svc-creds-save").textContent=h?"Save to vault & open service":"Save to encrypted vault";const k=!!e.isExternal,L=g.includes(e.id)||g.includes(e.appTemplate),x=v.includes(e.id)||v.includes(e.appTemplate);r.style.display=k?"":"none",c.style.display=L?"":"none",S.style.display=x?"":"none",y.style.display=k?"none":"";const B=document.getElementById("svc-quality-select");B.innerHTML='<option value="">-- Enter API key first --</option>',document.getElementById("svc-quality-status").textContent="",k?(o.textContent="Seedhost credentials auto-login past the HTTP prompt. API key bypasses the app login.",document.getElementById("svc-seedhost-pass").placeholder=`Password for ${e.name}`):L?o.textContent="API key bypasses the app login screen automatically.":o.textContent="Credentials are injected automatically when accessing this service.",await s(e),a.classList.add("show")};async function s(e){const n=document.getElementById("svc-creds-dot"),u=document.getElementById("svc-creds-status"),o=document.getElementById("svc-creds-clear");let r=!1;if(e.isExternal){try{const S=await(await fetch(`/api/v1/seedhost-creds?serviceId=${e.id}`)).json();S.success?(document.getElementById("svc-seedhost-user").value=S.username||"",S.hasCredentials&&(r=!0)):document.getElementById("svc-seedhost-user").value=""}catch{}document.getElementById("svc-seedhost-pass").value=""}try{const S=await(await fetch(`/api/v1/services/${e.id}/credentials`)).json();S.success&&(S.hasApiKey?(document.getElementById("svc-apikey-input").value="\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",r=!0):document.getElementById("svc-apikey-input").value="",S.hasBasicAuth&&!e.isExternal?(document.getElementById("svc-basic-user").value=S.username||"",r=!0):document.getElementById("svc-basic-user").value="")}catch{}document.getElementById("svc-basic-pass")&&(document.getElementById("svc-basic-pass").value="");const c=e.id||e.appTemplate;if(v.includes(c)&&await t(e),r){b=!0,n.style.background="var(--ok-fg, #74dfc4)",u.style.color="var(--ok-fg, #74dfc4)",u.textContent="Credentials stored",o.style.display="";const y=document.getElementById(`creds-btn-${e.id}`);y&&y.classList.add("has-creds")}else n.style.background="var(--muted)",u.style.color="var(--muted)",u.textContent="No credentials stored",o.style.display="none"}async function t(e){const n=document.getElementById("svc-quality-select"),u=document.getElementById("svc-quality-status"),o=e.id||e.appTemplate,r=f(e);if(!r){n.innerHTML='<option value="">-- No service URL --</option>';return}n.innerHTML='<option value="">Loading...</option>',u.textContent="";try{const c=new URLSearchParams({service:o,url:r}),S=await(await fetch(`/api/v1/arr/quality-profiles?${c}`)).json();if(!S.success||!S.profiles?.length){n.innerHTML='<option value="">-- No profiles found (enter API key and click Fetch) --</option>';return}n.innerHTML="";for(const k of S.profiles){const L=document.createElement("option");L.value=k.id,L.textContent=k.name,n.appendChild(L)}if(S.storedProfileId&&(n.value=String(S.storedProfileId)),!n.value){const k=S.profiles.find(L=>/720/i.test(L.name));k&&(n.value=String(k.id))}!n.value&&S.profiles.length&&(n.value=String(S.profiles[0].id)),u.innerHTML=`<span style="color: var(--ok-fg);">${S.profiles.length} profiles loaded</span>`}catch(c){n.innerHTML='<option value="">-- Failed to load --</option>',u.innerHTML=`<span style="color: var(--error, #c62828);">Error: ${c.message}</span>`}}document.getElementById("svc-quality-fetch")?.addEventListener("click",async()=>{if(!p)return;const e=p.id||p.appTemplate,n=f(p),o=document.getElementById("svc-apikey-input")?.value.trim(),r=document.getElementById("svc-quality-select"),c=document.getElementById("svc-quality-status");if(!n){c.innerHTML='<span style="color: var(--error, #c62828);">No servLine truncated
|
</div>`);const a=document.getElementById("service-creds-modal");let p=null,h=null,b=!1;const g=["sonarr","radarr","prowlarr","overseerr"],v=["sonarr","radarr"];function f(e){return e.externalUrl||e.url||""}function d(e){const n=document.getElementById("svc-creds-error");n.textContent=e,n.style.display=""}function i(){const e=document.getElementById("svc-creds-error");e.textContent="",e.style.display="none"}async function m(e,n){if(!e)throw new Error(`${n} failed: no response`);let u;try{u=await e.json()}catch{throw new Error(`${n} failed: invalid server response`)}if(!e.ok||u?.success!==!0)throw new Error(u?.error||`${n} failed (${e.status||"unknown status"})`);return u}function w(e,n){return!!window.DCCredentialVault?.isAllowedReturnUrl(e,n)}window.openServiceCredsModal=async function(e,n={}){p=e,h=w(n.returnUrl,e.id)?n.returnUrl:null,b=!1,i();const u=document.getElementById("svc-creds-title"),o=document.getElementById("svc-creds-desc"),s=document.getElementById("svc-creds-seedhost"),c=document.getElementById("svc-creds-apikey"),y=document.getElementById("svc-creds-basic"),S=document.getElementById("svc-creds-quality");u.textContent=e.name+" \u2014 Encrypted Vault",document.getElementById("svc-creds-save").textContent=h?"Save to vault & open service":"Save to encrypted vault";const k=!!e.isExternal,$=g.includes(e.id)||g.includes(e.appTemplate),x=v.includes(e.id)||v.includes(e.appTemplate);s.style.display=k?"":"none",c.style.display=$?"":"none",S.style.display=x?"":"none",y.style.display=k?"none":"";const B=document.getElementById("svc-quality-select");B.innerHTML='<option value="">-- Enter API key first --</option>',document.getElementById("svc-quality-status").textContent="",k?(o.textContent="Seedhost credentials auto-login past the HTTP prompt. API key bypasses the app login.",document.getElementById("svc-seedhost-pass").placeholder=`Password for ${e.name}`):$?o.textContent="API key bypasses the app login screen automatically.":o.textContent="Credentials are injected automatically when accessing this service.",await r(e),a.classList.add("show")};async function r(e){const n=document.getElementById("svc-creds-dot"),u=document.getElementById("svc-creds-status"),o=document.getElementById("svc-creds-clear");let s=!1;if(e.isExternal){try{const S=await(await fetch(`/api/v1/seedhost-creds?serviceId=${e.id}`)).json();S.success?(document.getElementById("svc-seedhost-user").value=S.username||"",S.hasCredentials&&(s=!0)):document.getElementById("svc-seedhost-user").value=""}catch{}document.getElementById("svc-seedhost-pass").value=""}try{const S=await(await fetch(`/api/v1/services/${e.id}/credentials`)).json();S.success&&(S.hasApiKey?(document.getElementById("svc-apikey-input").value="\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022",s=!0):document.getElementById("svc-apikey-input").value="",S.hasBasicAuth&&!e.isExternal?(document.getElementById("svc-basic-user").value=S.username||"",s=!0):document.getElementById("svc-basic-user").value="")}catch{}document.getElementById("svc-basic-pass")&&(document.getElementById("svc-basic-pass").value="");const c=e.id||e.appTemplate;if(v.includes(c)&&await t(e),s){b=!0,n.style.background="var(--ok-fg, #74dfc4)",u.style.color="var(--ok-fg, #74dfc4)",u.textContent="Credentials stored",o.style.display="";const y=document.getElementById(`creds-btn-${e.id}`);y&&y.classList.add("has-creds")}else n.style.background="var(--muted)",u.style.color="var(--muted)",u.textContent="No credentials stored",o.style.display="none"}async function t(e){const n=document.getElementById("svc-quality-select"),u=document.getElementById("svc-quality-status"),o=e.id||e.appTemplate,s=f(e);if(!s){n.innerHTML='<option value="">-- No service URL --</option>';return}n.innerHTML='<option value="">Loading...</option>',u.textContent="";try{const c=new URLSearchParams({service:o,url:s}),S=await(await fetch(`/api/v1/arr/quality-profiles?${c}`)).json();if(!S.success||!S.profiles?.length){n.innerHTML='<option value="">-- No profiles found (enter API key and click Fetch) --</option>';return}n.innerHTML="";for(const k of S.profiles){const $=document.createElement("option");$.value=k.id,$.textContent=k.name,n.appendChild($)}if(S.storedProfileId&&(n.value=String(S.storedProfileId)),!n.value){const k=S.profiles.find($=>/720/i.test($.name));k&&(n.value=String(k.id))}!n.value&&S.profiles.length&&(n.value=String(S.profiles[0].id)),u.innerHTML=`<span style="color: var(--ok-fg);">${S.profiles.length} profiles loaded</span>`}catch(c){n.innerHTML='<option value="">-- Failed to load --</option>',u.innerHTML=`<span style="color: var(--error, #c62828);">Error: ${c.message}</span>`}}document.getElementById("svc-quality-fetch")?.addEventListener("click",async()=>{if(!p)return;const e=p.id||p.appTemplate,n=f(p),o=document.getElementById("svc-apikey-input")?.value.trim(),s=document.getElementById("svc-quality-select"),c=document.getElementById("svc-quality-status");if(!n){c.innerHTML='<span style="color: var(--error, #c62828);">No servLine truncated
|
||||||
<div class="weather-modal-content" style="min-width: 420px; max-width: 520px;">
|
<div class="weather-modal-content" style="min-width: 420px; max-width: 520px;">
|
||||||
<h3 style="margin: 0 0 16px; font-size: 1.1rem;">Authentication Settings</h3>
|
<h3 style="margin: 0 0 16px; font-size: 1.1rem;">Authentication Settings</h3>
|
||||||
|
|
||||||
@@ -288,7 +288,7 @@
|
|||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>`);async function a(){try{const v=await(await fetch("/api/v1/totp/config")).json();if(!v.success)return;const{enabled:f,sessionDuration:d,isSetUp:i}=v.config,m=document.getElementById("totp-status-dot"),w=document.getElementById("totp-status-text"),s=document.getElementById("totp-status-banner"),t=document.getElementById("totp-setup-section"),e=document.getElementById("totp-qr-section"),n=document.getElementById("totp-duration-section"),u=document.getElementById("totp-disable-section");if(f&&i){m.style.background="var(--ok-fg, #7ef2ff)",s.style.borderColor="var(--ok-fg, #7ef2ff)",s.style.background="color-mix(in srgb, var(--ok-fg) 8%, transparent)",w.textContent="TOTP is active",w.style.color="var(--ok-fg, #7ef2ff)",t.style.display="block";const o=document.getElementById("totp-setup-btn");o&&(o.textContent="Generate New Secret"),e.style.display="none",n.style.display="block",u.style.display="block",document.getElementById("totp-duration-select").value=d}else m.style.background="var(--muted)",s.style.borderColor="var(--border)",s.style.background="transparent",w.textContent="TOTP is not configured",w.style.color="var(--muted)",t.style.display="block",e.style.display="none",n.style.display="none",u.style.display="none";b(f&&i,d)}catch(g){console.warn("Failed to load TOTP settings:",g)}}const p={"15m":"15 min","30m":"30 min","1h":"1 hour","2h":"2 hours","4h":"4 hours","8h":"8 hours","12h":"12 hours","24h":"24 hours",never:"Disabled"};function h(g,v){const f=window.DCI18n;return f&&f.isLoaded()?f.t(g):v}function b(g,v){const f=document.getElementById("auth-card"),d=document.getElementById("auth-pill"),i=document.getElementById("auth-dot"),m=document.getElementById("auth-status-text");f&&(g?(f.setAttribute("data-status","on"),d.className="badge on",d.textContent=h("card.status.yes","YES"),i.className="dot ok at-bl",m.textContent="Session: "+(p[v]||v)):(f.setAttribute("data-status","off"),d.className="badge off",d.textContent=h("card.status.no","NO"),i.className="dot bad at-bl",m.textContent=h("card.auth.not_configured","Not configured")))}document.getElementById("totp-setup-btn")?.addEventListener("click",async()=>{try{const v=await(await secureFetch("/api/v1/totp/setup",{method:"POST"})).json();v.success&&(document.getElementById("totp-qr-image").src=v.qrCode,document.getElementById("totp-manual-key").textContent=v.manualKey,document.getElementById("totp-setup-section").style.display="none",document.getElementById("totp-qr-section").style.display="block",document.getElementById("totp-setup-code").value="",document.getElementById("totp-setup-error").textContent="",document.getElementById("totp-setup-code").focus())}catch(g){l.logError("[TOTP] Setup Failed",g,{function:"setupTOTP"})}}),document.getElementById("totp-import-btn")?.addEventListener("click",async()=>{const g=document.getElementById("totp-import-key").value.trim(),v=document.getElementById("totp-import-error");if(v.textContent="",!g){v.textContent="Paste a Base32 secret key first";return}try{const d=await(await secureFetch("/api/v1/totp/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({secret:g})})).json();d.success?(v.textContent="",document.getElementById("totp-qr-image").src=d.qrCode,document.getElementById("totp-manual-key").textContent=d.manualKey,document.getElementById("totp-setup-section").style.display="none",document.getElementById("totp-qr-section").style.display="block",document.getElementById("totp-setup-code").value="",document.getElementById("totp-setup-error").textContent="",document.getElementById("totp-setup-code").focus()):v.textContent=d.error||d.message||"Import failed"}catch{v.textContent="Connection error \u2014 try refreshing the page"}}),document.getElementById("totp-copy-key")?.addEventListener("click",()=>{const g=document.getElementById("totp-manual-key").textContent;navigator.clipboard.writeText(g).then(()=>{const v=document.getElementById("totp-copy-key");v.textContent="\u2705",setTimeout(()=>{v.textContent="\u{1F4CB}"},2e3)})}),document.getElementById("totp-download-backup")?.addEventListener("click",()=>{const g=document.getElementById("totp-manual-key").textContent.trim();if(!g)return;const v={service:"DashCaddy",type:"totp-secret",secret:g,issuer:"DashCaddy",algorithm:"SHA1",digits:6,period:30,issued:new Date().toISOString(),recovery_url:`${window.location.origin}/ (login screen \u2192 "Lost access?")`,note:'Keep this file somewhere safe. Anyone with this secret can generate your login codes. Use it ONLY to recover TOTP access via the "Lost access?" link on the DashCaddy login screen.'},f=new Blob([JSON.stringify(v,null,2)],{type:"application/json"}),d=URL.createObjectURL(f),i=document.createElement("a");i.href=d,i.download=`dashcaddy-totp-backup-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(d);const m=document.getElementById("totp-download-backup");m.textContent="\u2705 Saved",setTimeLine truncated
|
</div>`);async function a(){try{const v=await(await fetch("/api/v1/totp/config")).json();if(!v.success)return;const{enabled:f,sessionDuration:d,isSetUp:i}=v.config,m=document.getElementById("totp-status-dot"),w=document.getElementById("totp-status-text"),r=document.getElementById("totp-status-banner"),t=document.getElementById("totp-setup-section"),e=document.getElementById("totp-qr-section"),n=document.getElementById("totp-duration-section"),u=document.getElementById("totp-disable-section");if(f&&i){m.style.background="var(--ok-fg, #7ef2ff)",r.style.borderColor="var(--ok-fg, #7ef2ff)",r.style.background="color-mix(in srgb, var(--ok-fg) 8%, transparent)",w.textContent="TOTP is active",w.style.color="var(--ok-fg, #7ef2ff)",t.style.display="block";const o=document.getElementById("totp-setup-btn");o&&(o.textContent="Generate New Secret"),e.style.display="none",n.style.display="block",u.style.display="block",document.getElementById("totp-duration-select").value=d}else m.style.background="var(--muted)",r.style.borderColor="var(--border)",r.style.background="transparent",w.textContent="TOTP is not configured",w.style.color="var(--muted)",t.style.display="block",e.style.display="none",n.style.display="none",u.style.display="none";b(f&&i,d)}catch(g){console.warn("Failed to load TOTP settings:",g)}}const p={"15m":"15 min","30m":"30 min","1h":"1 hour","2h":"2 hours","4h":"4 hours","8h":"8 hours","12h":"12 hours","24h":"24 hours",never:"Disabled"};function h(g,v){const f=window.DCI18n;return f&&f.isLoaded()?f.t(g):v}function b(g,v){const f=document.getElementById("auth-card"),d=document.getElementById("auth-pill"),i=document.getElementById("auth-dot"),m=document.getElementById("auth-status-text");f&&(g?(f.setAttribute("data-status","on"),d.className="badge on",d.textContent=h("card.status.on","ON"),i.className="dot ok at-bl",m.textContent="Session: "+(p[v]||v)):(f.setAttribute("data-status","off"),d.className="badge off",d.textContent=h("card.status.off","OFF"),i.className="dot bad at-bl",m.textContent=h("card.auth.not_configured","Not configured")))}document.getElementById("totp-setup-btn")?.addEventListener("click",async()=>{try{const v=await(await secureFetch("/api/v1/totp/setup",{method:"POST"})).json();v.success&&(document.getElementById("totp-qr-image").src=v.qrCode,document.getElementById("totp-manual-key").textContent=v.manualKey,document.getElementById("totp-setup-section").style.display="none",document.getElementById("totp-qr-section").style.display="block",document.getElementById("totp-setup-code").value="",document.getElementById("totp-setup-error").textContent="",document.getElementById("totp-setup-code").focus())}catch(g){l.logError("[TOTP] Setup Failed",g,{function:"setupTOTP"})}}),document.getElementById("totp-import-btn")?.addEventListener("click",async()=>{const g=document.getElementById("totp-import-key").value.trim(),v=document.getElementById("totp-import-error");if(v.textContent="",!g){v.textContent="Paste a Base32 secret key first";return}try{const d=await(await secureFetch("/api/v1/totp/setup",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({secret:g})})).json();d.success?(v.textContent="",document.getElementById("totp-qr-image").src=d.qrCode,document.getElementById("totp-manual-key").textContent=d.manualKey,document.getElementById("totp-setup-section").style.display="none",document.getElementById("totp-qr-section").style.display="block",document.getElementById("totp-setup-code").value="",document.getElementById("totp-setup-error").textContent="",document.getElementById("totp-setup-code").focus()):v.textContent=d.error||d.message||"Import failed"}catch{v.textContent="Connection error \u2014 try refreshing the page"}}),document.getElementById("totp-copy-key")?.addEventListener("click",()=>{const g=document.getElementById("totp-manual-key").textContent;navigator.clipboard.writeText(g).then(()=>{const v=document.getElementById("totp-copy-key");v.textContent="\u2705",setTimeout(()=>{v.textContent="\u{1F4CB}"},2e3)})}),document.getElementById("totp-download-backup")?.addEventListener("click",()=>{const g=document.getElementById("totp-manual-key").textContent.trim();if(!g)return;const v={service:"DashCaddy",type:"totp-secret",secret:g,issuer:"DashCaddy",algorithm:"SHA1",digits:6,period:30,issued:new Date().toISOString(),recovery_url:`${window.location.origin}/ (login screen \u2192 "Lost access?")`,note:'Keep this file somewhere safe. Anyone with this secret can generate your login codes. Use it ONLY to recover TOTP access via the "Lost access?" link on the DashCaddy login screen.'},f=new Blob([JSON.stringify(v,null,2)],{type:"application/json"}),d=URL.createObjectURL(f),i=document.createElement("a");i.href=d,i.download=`dashcaddy-totp-backup-${new Date().toISOString().slice(0,10)}.json`,document.body.appendChild(i),i.click(),document.body.removeChild(i),URL.revokeObjectURL(d);const m=document.getElementById("totp-download-backup");m.textContent="\u2705 Saved",setTimeLine truncated
|
||||||
<div id="token-management-modal" class="weather-modal">
|
<div id="token-management-modal" class="weather-modal">
|
||||||
<div class="weather-modal-content" style="min-width: 500px; max-width: 600px;">
|
<div class="weather-modal-content" style="min-width: 500px; max-width: 600px;">
|
||||||
<h3>\u{1F511} DNS Credentials</h3>
|
<h3>\u{1F511} DNS Credentials</h3>
|
||||||
@@ -306,7 +306,7 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`);function l(){return Object.keys(SITE.dnsServers||{})}function a(o){return(SITE.dnsServers||{})[o]?.name||o.toUpperCase()}async function p(o,r){if(!o)throw new Error(`${r} failed: no response`);let c;try{c=await o.json()}catch{throw new Error(`${r} failed: invalid server response`)}if(!o.ok||c?.success!==!0)throw new Error(c?.error||`${r} failed (${o.status||"unknown status"})`);return c}function h(){const o=document.getElementById("dns-cred-sections");if(!o)return;o.innerHTML="";const r=l();if(r.length===0){o.innerHTML='<p style="color: var(--muted); text-align: center; padding: 20px;">No DNS servers configured.</p>';return}for(const c of r)o.insertAdjacentHTML("beforeend",`
|
`);function l(){return Object.keys(SITE.dnsServers||{})}function a(o){return(SITE.dnsServers||{})[o]?.name||o.toUpperCase()}async function p(o,s){if(!o)throw new Error(`${s} failed: no response`);let c;try{c=await o.json()}catch{throw new Error(`${s} failed: invalid server response`)}if(!o.ok||c?.success!==!0)throw new Error(c?.error||`${s} failed (${o.status||"unknown status"})`);return c}function h(){const o=document.getElementById("dns-cred-sections");if(!o)return;o.innerHTML="";const s=l();if(s.length===0){o.innerHTML='<p style="color: var(--muted); text-align: center; padding: 20px;">No DNS servers configured.</p>';return}for(const c of s)o.insertAdjacentHTML("beforeend",`
|
||||||
<div class="token-section">
|
<div class="token-section">
|
||||||
<h4 class="token-section-title">${a(c)}</h4>
|
<h4 class="token-section-title">${a(c)}</h4>
|
||||||
<div class="token-grid">
|
<div class="token-grid">
|
||||||
@@ -329,12 +329,12 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="token-status" id="${c}-token-status"></div>
|
<div class="token-status" id="${c}-token-status"></div>
|
||||||
</div>
|
</div>
|
||||||
`)}function b(){let o=safeSessionGet("dashcaddy-encryption-key");if(o)return o;const r=safeGet("dashcaddy-encryption-key");if(r)return safeSessionSet("dashcaddy-encryption-key",r),safeRemove("dashcaddy-encryption-key"),r;const c=new Uint8Array(32);return crypto.getRandomValues(c),o=Array.from(c,y=>y.toString(16).padStart(2,"0")).join(""),safeSessionSet("dashcaddy-encryption-key",o),o}const g=b();function v(o,r){if(!o)return"";const c=crypto.getRandomValues(new Uint8Array(8)),y=Array.from(c,L=>L.toString(16).padStart(2,"0")).join(""),S=new TextEncoder().encode(r+y);let k="";for(let L=0;L<o.length;L++){const x=o.charCodeAt(L)^S[L%S.length]^c[L%c.length]^L*31+17&255;k+=String.fromCharCode(x)}return y+":"+btoa(k)}function f(o,r){if(!o)return"";try{if(o.indexOf(":")===16){const k=o.substring(0,16),L=new Uint8Array(k.match(/.{2}/g).map(E=>parseInt(E,16))),x=atob(o.substring(17)),B=new TextEncoder().encode(r+k);let A="";for(let E=0;E<x.length;E++){const C=x.charCodeAt(E)^B[E%B.length]^L[E%L.length]^E*31+17&255;A+=String.fromCharCode(C)}return A}const y=atob(o);let S="";for(let k=0;k<y.length;k++){const L=y.charCodeAt(k)^r.charCodeAt(k%r.length);S+=String.fromCharCode(L)}return S}catch{return""}}function d(o,r,c){const y=safeGet(`${o}-${r}-${c}-enc`);return f(y,g)}function i(o,r,c,y){const S=`${o}-${r}-${c}-enc`;y?safeSet(S,v(y,g)):safeRemove(S)}function m(o,r){return d(o,r,"token")}function w(o,r){return d(o,r,"username")}function s(o,r,c){i(o,r,"token",c)}function t(o,r,c){i(o,r,"username",c)}function e(){const o={};for(const r of l())o[r]={readonly:{username:w(r,"readonly"),token:m(r,"readonly")},admin:{username:w(r,"admin"),token:m(r,"admin")}};return o}function n(){l().forEach(o=>{["readonly","admin"].forEach(r=>{["token","username"].forEach(c=>{safeRemove(`${o}-${r}-${c}-enc`)})}),safeRemove(`${o}-token-enc`),safeRemove(`${o}-username-enc`)})}function u(o){const r=m(o,"readonly"),c=w(o,"readonly"),y=m(o,"admin"),S=w(o,"admin"),k=f(safeGet(`${o}-token-enc`),g),L=f(safeGet(`${o}-username-enc`),g);return{username:S||c||L,token:y||r||k,readonlyToken:r||k,readonlyUsername:c||L,adminToken:y||k,adminUsername:S||L}}document.getElementById("manage-tokens")?.addEventListener("click",()=>{h();const o=document.getElementById("token-management-modal"),r=e();l().forEach(c=>{const y=r[c];document.getElementById(`${c}-readonly-username`).value=y.readonly.username,document.getElementById(`${c}-readonly-token`).value=y.readonly.token,document.getElementById(`${c}-admin-username`).value=y.admin.username,document.getElementById(`${c}-admin-token`).value=y.admin.token,document.getElementById(`${c}-token-status`).textContent=""}),o.classList.add("show")}),document.getElementById("token-management-modal")?.addEventListener("click",o=>{const r=o.target.closest(".token-toggle");if(r){const c=r.dataset.target,y=document.getElementById(c);y.type==="password"?(y.type="text",r.textContent="\u{1F648}"):(y.type="password",r.textContent="\u{1F441}");return}o.target.id==="token-management-modal"&&o.target.classList.remove("show")}),document.getElementById("token-save")?.addEventListener("click",async()=>{const o=l(),r={};let c=!1;if(o.forEach(y=>{const S={},k=document.getElementById(`${y}-readonly-username`).value.trim(),L=document.getElementById(`${y}-readonly-token`).value.trim(),x=document.getElementById(`${y}-admin-username`).value.trim(),B=document.getElementById(`${y}-admin-token`).value.trim();k&&L&&(S.readonly={username:k,password:L},c=!0),x&&B&&(S.admin={username:x,password:B},c=!0),Object.keys(S).length>0&&(r[y]=S)}),c){o.forEach(y=>{r[y]&&(document.getElementById(`${y}-token-status`).textContent="Verifying...",document.getElementById(`${y}-token-status`).className="token-status")});try{const y=await secureFetch("/api/v1/dns/credentials",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({servers:r})}),S=await p(y,"DNS credential save");if(S.results){const k=Object.keys(r).filter(L=>S.results[L]?.success!==!0);if(k.length){const L=k.map(x=>S.results[x]?.error||`${x} failed`).join("; ");throw new Error(L)}}o.forEach(k=>{t(k,"readonly",document.getElementById(`${k}-readonly-username`).value.trim()),s(k,"readonly",document.getElementById(`${k}-readonly-token`).value.trim()),t(k,"admin",document.getElementById(`${k}-admin-username`).value.trim()),s(k,"admin",document.getElementById(`${k}-admin-token`).value.trim())}),o.forEach(k=>{const L=document.getElementById(`${k}-token-status`);if(!r[k]){L.textContent="";return}const x=S.results?.[k];L.textContent=x?.partial?"\u2713 "+x.partial:"\u2713 Verified & saved",L.className="token-status success"})}catch(y){console.error("Failed to sync DNS credentials to backend:",y),o.forEach(S=>{r[S]&&(document.getElementById(`${S}-token-status`).textContent="\u2717 "+(y.message||"Save failed"),document.getElementById(`${S}-token-status`).className="token-status error")})}}else o.forEach(y=>{document.getElementById(`${y}-token-status`).textContent=""});setTimeout(()=>{
Line truncated
|
`)}function b(){let o=safeSessionGet("dashcaddy-encryption-key");if(o)return o;const s=safeGet("dashcaddy-encryption-key");if(s)return safeSessionSet("dashcaddy-encryption-key",s),safeRemove("dashcaddy-encryption-key"),s;const c=new Uint8Array(32);return crypto.getRandomValues(c),o=Array.from(c,y=>y.toString(16).padStart(2,"0")).join(""),safeSessionSet("dashcaddy-encryption-key",o),o}const g=b();function v(o,s){if(!o)return"";const c=crypto.getRandomValues(new Uint8Array(8)),y=Array.from(c,$=>$.toString(16).padStart(2,"0")).join(""),S=new TextEncoder().encode(s+y);let k="";for(let $=0;$<o.length;$++){const x=o.charCodeAt($)^S[$%S.length]^c[$%c.length]^$*31+17&255;k+=String.fromCharCode(x)}return y+":"+btoa(k)}function f(o,s){if(!o)return"";try{if(o.indexOf(":")===16){const k=o.substring(0,16),$=new Uint8Array(k.match(/.{2}/g).map(E=>parseInt(E,16))),x=atob(o.substring(17)),B=new TextEncoder().encode(s+k);let P="";for(let E=0;E<x.length;E++){const C=x.charCodeAt(E)^B[E%B.length]^$[E%$.length]^E*31+17&255;P+=String.fromCharCode(C)}return P}const y=atob(o);let S="";for(let k=0;k<y.length;k++){const $=y.charCodeAt(k)^s.charCodeAt(k%s.length);S+=String.fromCharCode($)}return S}catch{return""}}function d(o,s,c){const y=safeGet(`${o}-${s}-${c}-enc`);return f(y,g)}function i(o,s,c,y){const S=`${o}-${s}-${c}-enc`;y?safeSet(S,v(y,g)):safeRemove(S)}function m(o,s){return d(o,s,"token")}function w(o,s){return d(o,s,"username")}function r(o,s,c){i(o,s,"token",c)}function t(o,s,c){i(o,s,"username",c)}function e(){const o={};for(const s of l())o[s]={readonly:{username:w(s,"readonly"),token:m(s,"readonly")},admin:{username:w(s,"admin"),token:m(s,"admin")}};return o}function n(){l().forEach(o=>{["readonly","admin"].forEach(s=>{["token","username"].forEach(c=>{safeRemove(`${o}-${s}-${c}-enc`)})}),safeRemove(`${o}-token-enc`),safeRemove(`${o}-username-enc`)})}function u(o){const s=m(o,"readonly"),c=w(o,"readonly"),y=m(o,"admin"),S=w(o,"admin"),k=f(safeGet(`${o}-token-enc`),g),$=f(safeGet(`${o}-username-enc`),g);return{username:S||c||$,token:y||s||k,readonlyToken:s||k,readonlyUsername:c||$,adminToken:y||k,adminUsername:S||$}}document.getElementById("manage-tokens")?.addEventListener("click",()=>{h();const o=document.getElementById("token-management-modal"),s=e();l().forEach(c=>{const y=s[c];document.getElementById(`${c}-readonly-username`).value=y.readonly.username,document.getElementById(`${c}-readonly-token`).value=y.readonly.token,document.getElementById(`${c}-admin-username`).value=y.admin.username,document.getElementById(`${c}-admin-token`).value=y.admin.token,document.getElementById(`${c}-token-status`).textContent=""}),o.classList.add("show")}),document.getElementById("token-management-modal")?.addEventListener("click",o=>{const s=o.target.closest(".token-toggle");if(s){const c=s.dataset.target,y=document.getElementById(c);y.type==="password"?(y.type="text",s.textContent="\u{1F648}"):(y.type="password",s.textContent="\u{1F441}");return}o.target.id==="token-management-modal"&&o.target.classList.remove("show")}),document.getElementById("token-save")?.addEventListener("click",async()=>{const o=l(),s={};let c=!1;if(o.forEach(y=>{const S={},k=document.getElementById(`${y}-readonly-username`).value.trim(),$=document.getElementById(`${y}-readonly-token`).value.trim(),x=document.getElementById(`${y}-admin-username`).value.trim(),B=document.getElementById(`${y}-admin-token`).value.trim();k&&$&&(S.readonly={username:k,password:$},c=!0),x&&B&&(S.admin={username:x,password:B},c=!0),Object.keys(S).length>0&&(s[y]=S)}),c){o.forEach(y=>{s[y]&&(document.getElementById(`${y}-token-status`).textContent="Verifying...",document.getElementById(`${y}-token-status`).className="token-status")});try{const y=await secureFetch("/api/v1/dns/credentials",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({servers:s})}),S=await p(y,"DNS credential save");if(S.results){const k=Object.keys(s).filter($=>S.results[$]?.success!==!0);if(k.length){const $=k.map(x=>S.results[x]?.error||`${x} failed`).join("; ");throw new Error($)}}o.forEach(k=>{t(k,"readonly",document.getElementById(`${k}-readonly-username`).value.trim()),r(k,"readonly",document.getElementById(`${k}-readonly-token`).value.trim()),t(k,"admin",document.getElementById(`${k}-admin-username`).value.trim()),r(k,"admin",document.getElementById(`${k}-admin-token`).value.trim())}),o.forEach(k=>{const $=document.getElementById(`${k}-token-status`);if(!s[k]){$.textContent="";return}const x=S.results?.[k];$.textContent=x?.partial?"\u2713 "+x.partial:"\u2713 Verified & saved",$.className="token-status success"})}catch(y){console.error("Failed to sync DNS credentials to backend:",y),o.forEach(S=>{s[S]&&(document.getElementById(`${S}-token-status`).textContent="\u2717 "+(y.message||"Save failed"),document.getElementById(`${S}-token-status`).className="token-status error")})}}else o.forEach(y=>{document.getElementById(`${y}-token-status`).textContent=""});setTimeout(()=>{
Line truncated
|
||||||
|
|
||||||
Current: ${s.currentVersion}
|
Current: ${r.currentVersion}
|
||||||
New: ${s.updateVersion}
|
New: ${r.updateVersion}
|
||||||
|
|
||||||
`+(s.updateTitle?`${s.updateTitle}
|
`+(r.updateTitle?`${r.updateTitle}
|
||||||
|
|
||||||
`:"")+`The DNS server will restart during the update.
|
`:"")+`The DNS server will restart during the update.
|
||||||
Proceed?`)){i.textContent=m,i.disabled=!1,i.title="Update DNS server";return}i.textContent="\u{1F504}",i.title="Updating...";const n=await(await secureFetch(`/api/v1/dns/update?server=${encodeURIComponent(d)}`,{method:"POST"})).json();if(!n.success)throw new Error(n.error||"Update failed");if(n.manualUpdateRequired){i.textContent="\u2B06\uFE0F",i.title=`Update available: ${n.newVersion}`;const u=n.downloadLink?`
|
Proceed?`)){i.textContent=m,i.disabled=!1,i.title="Update DNS server";return}i.textContent="\u{1F504}",i.title="Updating...";const n=await(await secureFetch(`/api/v1/dns/update?server=${encodeURIComponent(d)}`,{method:"POST"})).json();if(!n.success)throw new Error(n.error||"Update failed");if(n.manualUpdateRequired){i.textContent="\u2B06\uFE0F",i.title=`Update available: ${n.newVersion}`;const u=n.downloadLink?`
|
||||||
@@ -366,7 +366,7 @@ Instructions: ${n.instructionsLink}`:"";showNotification(`${f.toUpperCase()} upd
|
|||||||
<button id="dns-settings-save" class="btn-accent">Save</button>
|
<button id="dns-settings-save" class="btn-accent">Save</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>`);let p=null;function h(f){p=f;const d=SITE.dnsServers[f]||{},i=document.getElementById("dns-settings-modal");document.getElementById("dns-settings-title").textContent=`${(d.name||f).toUpperCase()} Settings`,document.getElementById("dns-edit-ip").value=d.ip||"",document.getElementById("dns-edit-port").value=d.port||DC.DEFAULTS.DNS_PORT,document.getElementById("dns-edit-name").value=d.name||"",i.classList.add("show")}async function b(){if(!p)return;const f=document.getElementById("dns-edit-ip").value.trim(),d=document.getElementById("dns-edit-port").value.trim()||DC.DEFAULTS.DNS_PORT,i=document.getElementById("dns-edit-name").value.trim();if(!f){showNotification("Server IP is required","warning");return}const m={dnsServers:{}};m.dnsServers[p]={ip:f,port:String(d)},i&&(m.dnsServers[p].name=i);try{const s=await(await secureFetch("/api/v1/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)})).json();s.success?(SITE.dnsServers[p]=m.dnsServers[p],showNotification(`${p.toUpperCase()} settings saved`,"success"),v(),window.refreshAll()):showNotification(s.error||"Failed to save settings","error")}catch(w){showNotification("Failed to save: "+w.message,"error")}}async function g(){if(p&&confirm(`Remove ${p.toUpperCase()} from dashboard? This won't affect the actual DNS server.`))try{const d=await(await secureFetch("/api/v1/config")).json();d.dnsServers&&delete d.dnsServers[p];const m=await(await secureFetch("/api/v1/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dnsServers:d.dnsServers||{}})})).json();if(m.success){delete SITE.dnsServers[p];const w=document.querySelector(`.top [data-app="${p}"]`);w&&w.remove(),showNotification(`${p.toUpperCase()} removed from dashboard`,"success"),v()}else showNotification(m.error||"Failed to remove","error")}catch(f){showNotification("Failed to remove: "+f.message,"error")}}function v(){closeModal("dns-settings-modal"),p=null}document.getElementById("dns-settings-cancel")?.addEventListener("click",v),document.getElementById("dns-settings-save")?.addEventListener("click",b),document.getElementById("dns-settings-delete")?.addEventListener("click",g),document.getElementById("dns-settings-modal")?.addEventListener("click",f=>{f.target.id==="dns-settings-modal"&&v()}),document.querySelector(".top")?.addEventListener("click",f=>{const d=f.target.closest('[id$="-settings"]');if(!d)return;const i=d.id.replace("-settings","");SITE.dnsServers[i]&&(f.stopPropagation(),h(i))}),document.getElementById("refresh")?.addEventListener("click",window.refreshAll)})(),(function(){injectModal("logs-modal",`
|
</div>`);let p=null;function h(f){p=f;const d=SITE.dnsServers[f]||{},i=document.getElementById("dns-settings-modal");document.getElementById("dns-settings-title").textContent=`${(d.name||f).toUpperCase()} Settings`,document.getElementById("dns-edit-ip").value=d.ip||"",document.getElementById("dns-edit-port").value=d.port||DC.DEFAULTS.DNS_PORT,document.getElementById("dns-edit-name").value=d.name||"",i.classList.add("show")}async function b(){if(!p)return;const f=document.getElementById("dns-edit-ip").value.trim(),d=document.getElementById("dns-edit-port").value.trim()||DC.DEFAULTS.DNS_PORT,i=document.getElementById("dns-edit-name").value.trim();if(!f){showNotification("Server IP is required","warning");return}const m={dnsServers:{}};m.dnsServers[p]={ip:f,port:String(d)},i&&(m.dnsServers[p].name=i);try{const r=await(await secureFetch("/api/v1/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(m)})).json();r.success?(SITE.dnsServers[p]=m.dnsServers[p],showNotification(`${p.toUpperCase()} settings saved`,"success"),v(),window.refreshAll()):showNotification(r.error||"Failed to save settings","error")}catch(w){showNotification("Failed to save: "+w.message,"error")}}async function g(){if(p&&confirm(`Remove ${p.toUpperCase()} from dashboard? This won't affect the actual DNS server.`))try{const d=await(await secureFetch("/api/v1/config")).json();d.dnsServers&&delete d.dnsServers[p];const m=await(await secureFetch("/api/v1/config",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({dnsServers:d.dnsServers||{}})})).json();if(m.success){delete SITE.dnsServers[p];const w=document.querySelector(`.top [data-app="${p}"]`);w&&w.remove(),showNotification(`${p.toUpperCase()} removed from dashboard`,"success"),v()}else showNotification(m.error||"Failed to remove","error")}catch(f){showNotification("Failed to remove: "+f.message,"error")}}function v(){closeModal("dns-settings-modal"),p=null}document.getElementById("dns-settings-cancel")?.addEventListener("click",v),document.getElementById("dns-settings-save")?.addEventListener("click",b),document.getElementById("dns-settings-delete")?.addEventListener("click",g),document.getElementById("dns-settings-modal")?.addEventListener("click",f=>{f.target.id==="dns-settings-modal"&&v()}),document.querySelector(".top")?.addEventListener("click",f=>{const d=f.target.closest('[id$="-settings"]');if(!d)return;const i=d.id.replace("-settings","");SITE.dnsServers[i]&&(f.stopPropagation(),h(i))}),document.getElementById("refresh")?.addEventListener("click",window.refreshAll)})(),(function(){injectModal("logs-modal",`
|
||||||
<div id="logs-modal" class="logs-modal">
|
<div id="logs-modal" class="logs-modal">
|
||||||
<div class="logs-modal-content" style="min-width: 800px; max-width: 1000px;">
|
<div class="logs-modal-content" style="min-width: 800px; max-width: 1000px;">
|
||||||
<div class="logs-header">
|
<div class="logs-header">
|
||||||
@@ -390,10 +390,10 @@ Instructions: ${n.instructionsLink}`:"";showNotification(`${f.toUpperCase()} upd
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>`);let l=null,a=null,p=!1,h=null,b=null,g=!1,v=null,f=null,d=!1,i=null,m=!1;async function w(E,C=25){try{const T=getDnsServerAddr(E),$=await fetch(`/api/v1/dns/logs?server=${T}&limit=${C}`,{cache:"no-store",headers:{Accept:"application/json","Cache-Control":"no-cache"}});if($.ok){const I=await $.json();return I.success&&I.logs?{logs:I.logs,count:I.count,server:I.server}:{error:I.error||"Failed to fetch logs"}}else return $.status===401?{error:"DNS auto-auth failed - check credentials in settings"}:{error:`HTTP ${$.status}`}}catch(T){return console.error("DNS logs fetch failed:",T),{error:T.message}}}function s(E){return{NoError:"var(--ok-fg)",NOERROR:"var(--ok-fg)",NxDomain:"var(--muted)",NXDOMAIN:"var(--muted)",Refused:"var(--bad-fg)",REFUSED:"var(--bad-fg)",ServerFailure:"#f39c12",SERVFAIL:"#f39c12"}[E]||"var(--fg)"}function t(E){const C=document.createElement("div");if(C.className="log-entry",C.style.cssText="display: grid; grid-template-columns: 140px 110px 1fr 70px 80px; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 0.8rem; align-items: center;",E.parsed===!1)return C.style.gridTemplateColumns="1fr",C.innerHTML=`<span style="color: var(--muted); font-family: monospace; font-size: 0.75rem;">${escapeHtml(E.raw)}</span>`,C;const T=s(E.rcode),$=E.rcode==="Refused"||E.rcode==="REFUSED";return C.innerHTML=`
|
</div>`);let l=null,a=null,p=!1,h=null,b=null,g=!1,v=null,f=null,d=!1,i=null,m=!1;async function w(E,C=25){try{const T=getDnsServerAddr(E),L=await fetch(`/api/v1/dns/logs?server=${T}&limit=${C}`,{cache:"no-store",headers:{Accept:"application/json","Cache-Control":"no-cache"}});if(L.ok){const I=await L.json();return I.success&&I.logs?{logs:I.logs,count:I.count,server:I.server}:{error:I.error||"Failed to fetch logs"}}else return L.status===401?{error:"DNS auto-auth failed - check credentials in settings"}:{error:`HTTP ${L.status}`}}catch(T){return console.error("DNS logs fetch failed:",T),{error:T.message}}}function r(E){return{NoError:"var(--ok-fg)",NOERROR:"var(--ok-fg)",NxDomain:"var(--muted)",NXDOMAIN:"var(--muted)",Refused:"var(--bad-fg)",REFUSED:"var(--bad-fg)",ServerFailure:"#f39c12",SERVFAIL:"#f39c12"}[E]||"var(--fg)"}function t(E){const C=document.createElement("div");if(C.className="log-entry",C.style.cssText="display: grid; grid-template-columns: 140px 110px 1fr 70px 80px; gap: 8px; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 0.8rem; align-items: center;",E.parsed===!1)return C.style.gridTemplateColumns="1fr",C.innerHTML=`<span style="color: var(--muted); font-family: monospace; font-size: 0.75rem;">${escapeHtml(E.raw)}</span>`,C;const T=r(E.rcode),L=E.rcode==="Refused"||E.rcode==="REFUSED";return C.innerHTML=`
|
||||||
<span style="color: var(--muted); font-size: 0.75rem;">${escapeHtml(E.timestamp)}</span>
|
<span style="color: var(--muted); font-size: 0.75rem;">${escapeHtml(E.timestamp)}</span>
|
||||||
<span style="color: var(--accent); font-size: 0.75rem;" title="${escapeHtml(E.client)}">${escapeHtml(E.client)}</span>
|
<span style="color: var(--accent); font-size: 0.75rem;" title="${escapeHtml(E.client)}">${escapeHtml(E.client)}</span>
|
||||||
<span style="font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; ${$?"text-decoration: line-through; opacity: 0.6;":""}" title="${escapeHtml(E.domain)}">${escapeHtml(E.domain)}</span>
|
<span style="font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; ${L?"text-decoration: line-through; opacity: 0.6;":""}" title="${escapeHtml(E.domain)}">${escapeHtml(E.domain)}</span>
|
||||||
<span style="color: var(--muted); font-size: 0.75rem;">${escapeHtml(E.type)}</span>
|
<span style="color: var(--muted); font-size: 0.75rem;">${escapeHtml(E.type)}</span>
|
||||||
<span style="color: ${T}; font-weight: 500; font-size: 0.75rem;">${escapeHtml(E.rcode)}</span>
|
<span style="color: ${T}; font-weight: 500; font-size: 0.75rem;">${escapeHtml(E.rcode)}</span>
|
||||||
`,C}async function e(){if(d){await B();return}if(g){await S();return}if(p||!l)return;const E=parseInt(document.getElementById("log-lines").value),C=document.getElementById("logs-content");try{const T=await w(l,E);if(T.error){C.innerHTML=`
|
`,C}async function e(){if(d){await B();return}if(g){await S();return}if(p||!l)return;const E=parseInt(document.getElementById("log-lines").value),C=document.getElementById("logs-content");try{const T=await w(l,E);if(T.error){C.innerHTML=`
|
||||||
@@ -407,17 +407,17 @@ Instructions: ${n.instructionsLink}`:"";showNotification(`${f.toUpperCase()} upd
|
|||||||
<span>Domain</span>
|
<span>Domain</span>
|
||||||
<span>Type</span>
|
<span>Type</span>
|
||||||
<span>Status</span>
|
<span>Status</span>
|
||||||
</div>`,T.logs&&T.logs.length>0?T.logs.forEach($=>{const I=t($);C.appendChild(I)}):C.innerHTML+=`
|
</div>`,T.logs&&T.logs.length>0?T.logs.forEach(L=>{const I=t(L);C.appendChild(I)}):C.innerHTML+=`
|
||||||
<div style="padding: 20px; text-align: center; color: var(--muted);">
|
<div style="padding: 20px; text-align: center; color: var(--muted);">
|
||||||
No DNS queries logged yet
|
No DNS queries logged yet
|
||||||
</div>`}catch(T){C.innerHTML=`
|
</div>`}catch(T){C.innerHTML=`
|
||||||
<div style="padding: 20px; text-align: center; color: var(--bad-fg);">
|
<div style="padding: 20px; text-align: center; color: var(--bad-fg);">
|
||||||
Failed to fetch logs: ${escapeHtml(T.message)}
|
Failed to fetch logs: ${escapeHtml(T.message)}
|
||||||
</div>`}}function n(E){l=E,p=!1,g=!1;const C=document.getElementById("logs-modal"),T=document.getElementById("logs-title"),$=document.getElementById("logs-pause"),I=document.getElementById("logs-stream");T.textContent=`${E.toUpperCase()} DNS Logs`,$.textContent="\u23F8\uFE0F Pause",$.classList.remove("paused"),I&&(I.style.display="none"),C.classList.add("show"),e(),a=setInterval(e,DC.POLL.LOGS)}function u(){document.getElementById("logs-modal").classList.remove("show"),a&&(clearInterval(a),a=null),r(),l=null,g=!1,h=null,b=null,d=!1,v=null,f=null,p=!1}function o(E){i&&r();const C=document.getElementById("logs-stream"),T=document.getElementById("logs-pause"),$=document.getElementById("logs-content");a&&(clearInterval(a),a=null);try{i=new EventSource(`/api/v1/logs/stream/${E}`),m=!0,C.classList.add("active"),C.textContent="\u{1F534} Live",C.title="Streaming - click to stop",T.style.display="none";const I=document.getElementById("logs-title");I.textContent.includes("\u{1F534}")||(I.innerHTML=I.textContent.replace("\u{1F4CB}","\u{1F4CB} \u{1F534}")),i.onmessage=P=>{try{const D=JSON.parse(P.data);if(D.error){console.error("Stream error:",D.error),r();return}const O=document.createElement("div");O.className="log-entry",O.style.cssText="display: flex; gap: 12px; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 0.8rem; align-items: flex-start; font-family: monospace;";const _=(D.stream||"stdout")==="stderr",R=_?"var(--bad-fg)":"var(--fg)",M=`<span style="background: ${_?"var(--bad-bg)":"var(--ok-bg)"}; color: ${R}; padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 600; min-width: 50px; text-align: center;">${_?"STDERR":"STDOUT"}</span>`;for(O.innerHTML=`
|
</div>`}}function n(E){l=E,p=!1,g=!1;const C=document.getElementById("logs-modal"),T=document.getElementById("logs-title"),L=document.getElementById("logs-pause"),I=document.getElementById("logs-stream");T.textContent=`${E.toUpperCase()} DNS Logs`,L.textContent="\u23F8\uFE0F Pause",L.classList.remove("paused"),I&&(I.style.display="none"),C.classList.add("show"),e(),a=setInterval(e,DC.POLL.LOGS)}function u(){document.getElementById("logs-modal").classList.remove("show"),a&&(clearInterval(a),a=null),s(),l=null,g=!1,h=null,b=null,d=!1,v=null,f=null,p=!1}function o(E){i&&s();const C=document.getElementById("logs-stream"),T=document.getElementById("logs-pause"),L=document.getElementById("logs-content");a&&(clearInterval(a),a=null);try{i=new EventSource(`/api/v1/logs/stream/${E}`),m=!0,C.classList.add("active"),C.textContent="\u{1F534} Live",C.title="Streaming - click to stop",T.style.display="none";const I=document.getElementById("logs-title");I.textContent.includes("\u{1F534}")||(I.innerHTML=I.textContent.replace("\u{1F4CB}","\u{1F4CB} \u{1F534}")),i.onmessage=A=>{try{const D=JSON.parse(A.data);if(D.error){console.error("Stream error:",D.error),s();return}const O=document.createElement("div");O.className="log-entry",O.style.cssText="display: flex; gap: 12px; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 0.8rem; align-items: flex-start; font-family: monospace;";const _=(D.stream||"stdout")==="stderr",R=_?"var(--bad-fg)":"var(--fg)",M=`<span style="background: ${_?"var(--bad-bg)":"var(--ok-bg)"}; color: ${R}; padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 600; min-width: 50px; text-align: center;">${_?"STDERR":"STDOUT"}</span>`;for(O.innerHTML=`
|
||||||
<div style="flex-shrink: 0;">${M}</div>
|
<div style="flex-shrink: 0;">${M}</div>
|
||||||
<div style="flex: 1; color: ${R}; word-break: break-all; white-space: pre-wrap;">${escapeHtml(D.text)}</div>
|
<div style="flex: 1; color: ${R}; word-break: break-all; white-space: pre-wrap;">${escapeHtml(D.text)}</div>
|
||||||
`,$.appendChild(O),$.scrollTop=$.scrollHeight;$.children.length>500;)$.removeChild($.firstChild)}catch(D){console.error("Error parsing stream data:",D)}},i.onerror=P=>{console.error("EventSource error:",P),r()}}catch(I){console.error("Failed to start streaming:",I),r()}}function r(){i&&(i.close(),i=null),m=!1;const E=document.getElementById("logs-stream"),C=document.getElementById("logs-pause"),T=document.getElementById("logs-title");E&&(E.classList.remove("active"),E.textContent="\u{1F4E1} Live",E.title="Enable real-time streaming"),C&&(C.style.display=""),T&&(T.textContent=T.textContent.replace(" \u{1F534}","")),g&&h&&!a&&(a=setInterval(S,DC.POLL.LOGS))}async function c(E,C=100){try{const T=`/api/v1/logs/container/${E}?tail=${C}×tamps=true`,$=await fetch(T,{cache:"no-store",headers:{Accept:"application/json","Cache-Control":"no-cache"}});if($.ok){const I=await $.json();return I.success&&I.logs?{logs:I.logs,count:I.count,containerName:I.containerName,containerId:I.containerId}:{error:I.error||"Failed to fetch container logs"}}else return{error:`HTTP ${$.status}: ${$.statusText}`}}catch(T){return console.error("Container logs fetch failed:",T),{error:T.message}}}function y(E){const C=document.createElement("div");C.className="log-entry",C.style.cssText="display: flex; gap: 12px; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 0.8rem; align-items: flex-start; font-family: monospace;";const T=E.stream==="stderr"?"var(--bad-fg)":"var(--fg)",$=E.stream==="stderr"?'<span style="background: var(--bad-bg); color: var(--bad-fg); padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 600;">STDERR</span>':'<span style="background: var(--ok-bg); color: var(--ok-fg); padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 600;">STDOUT</span>';return C.innerHTML=`
|
`,L.appendChild(O),L.scrollTop=L.scrollHeight;L.children.length>500;)L.removeChild(L.firstChild)}catch(D){console.error("Error parsing stream data:",D)}},i.onerror=A=>{console.error("EventSource error:",A),s()}}catch(I){console.error("Failed to start streaming:",I),s()}}function s(){i&&(i.close(),i=null),m=!1;const E=document.getElementById("logs-stream"),C=document.getElementById("logs-pause"),T=document.getElementById("logs-title");E&&(E.classList.remove("active"),E.textContent="\u{1F4E1} Live",E.title="Enable real-time streaming"),C&&(C.style.display=""),T&&(T.textContent=T.textContent.replace(" \u{1F534}","")),g&&h&&!a&&(a=setInterval(S,DC.POLL.LOGS))}async function c(E,C=100){try{const T=`/api/v1/logs/container/${E}?tail=${C}×tamps=true`,L=await fetch(T,{cache:"no-store",headers:{Accept:"application/json","Cache-Control":"no-cache"}});if(L.ok){const I=await L.json();return I.success&&I.logs?{logs:I.logs,count:I.count,containerName:I.containerName,containerId:I.containerId}:{error:I.error||"Failed to fetch container logs"}}else return{error:`HTTP ${L.status}: ${L.statusText}`}}catch(T){return console.error("Container logs fetch failed:",T),{error:T.message}}}function y(E){const C=document.createElement("div");C.className="log-entry",C.style.cssText="display: flex; gap: 12px; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 0.8rem; align-items: flex-start; font-family: monospace;";const T=E.stream==="stderr"?"var(--bad-fg)":"var(--fg)",L=E.stream==="stderr"?'<span style="background: var(--bad-bg); color: var(--bad-fg); padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 600;">STDERR</span>':'<span style="background: var(--ok-bg); color: var(--ok-fg); padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 600;">STDOUT</span>';return C.innerHTML=`
|
||||||
<div style="flex-shrink: 0;">${$}</div>
|
<div style="flex-shrink: 0;">${L}</div>
|
||||||
<div style="flex: 1; color: ${T}; word-break: break-all; white-space: pre-wrap;">${escapeHtml(E.text)}</div>
|
<div style="flex: 1; color: ${T}; word-break: break-all; white-space: pre-wrap;">${escapeHtml(E.text)}</div>
|
||||||
`,C}async function S(){if(p||!h||!g)return;const E=parseInt(document.getElementById("log-lines").value),C=document.getElementById("logs-content");try{const T=await c(h,E);if(T.error){C.innerHTML=`
|
`,C}async function S(){if(p||!h||!g)return;const E=parseInt(document.getElementById("log-lines").value),C=document.getElementById("logs-content");try{const T=await c(h,E);if(T.error){C.innerHTML=`
|
||||||
<div style="padding: 20px; text-align: center; color: var(--bad-fg);">
|
<div style="padding: 20px; text-align: center; color: var(--bad-fg);">
|
||||||
@@ -427,29 +427,29 @@ Instructions: ${n.instructionsLink}`:"";showNotification(`${f.toUpperCase()} upd
|
|||||||
<div style="display: flex; gap: 12px; padding: 8px 10px; background: var(--card-base); border-bottom: 2px solid var(--border); font-size: 0.75rem; font-weight: 600; color: var(--muted); position: sticky; top: 0;">
|
<div style="display: flex; gap: 12px; padding: 8px 10px; background: var(--card-base); border-bottom: 2px solid var(--border); font-size: 0.75rem; font-weight: 600; color: var(--muted); position: sticky; top: 0;">
|
||||||
<span style="flex-shrink: 0; width: 80px;">Stream</span>
|
<span style="flex-shrink: 0; width: 80px;">Stream</span>
|
||||||
<span style="flex: 1;">Log Output</span>
|
<span style="flex: 1;">Log Output</span>
|
||||||
</div>`,T.logs&&T.logs.length>0?(T.logs.forEach($=>{const I=y($);C.appendChild(I)}),C.scrollTop=C.scrollHeight):C.innerHTML+=`
|
</div>`,T.logs&&T.logs.length>0?(T.logs.forEach(L=>{const I=y(L);C.appendChild(I)}),C.scrollTop=C.scrollHeight):C.innerHTML+=`
|
||||||
<div style="padding: 20px; text-align: center; color: var(--muted);">
|
<div style="padding: 20px; text-align: center; color: var(--muted);">
|
||||||
No logs available for this container
|
No logs available for this container
|
||||||
</div>`}catch(T){C.innerHTML=`
|
</div>`}catch(T){C.innerHTML=`
|
||||||
<div style="padding: 20px; text-align: center; color: var(--bad-fg);">
|
<div style="padding: 20px; text-align: center; color: var(--bad-fg);">
|
||||||
Failed to fetch logs: ${escapeHtml(T.message)}
|
Failed to fetch logs: ${escapeHtml(T.message)}
|
||||||
</div>`}}function k(E,C){h=E,b=C,g=!0,d=!1,p=!1,r();const T=document.getElementById("logs-modal"),$=document.getElementById("logs-title"),I=document.getElementById("logs-pause"),P=document.getElementById("logs-stream");$.textContent=`\u{1F4CB} ${C} - Container Logs`,I.textContent="\u23F8\uFE0F Pause",I.classList.remove("paused"),P&&(P.style.display=""),T.classList.add("show"),S(),a=setInterval(S,DC.POLL.LOGS)}async function L(E,C=100){try{const T=`/api/v1/logs/file?path=${encodeURIComponent(E)}&tail=${C}`,$=await fetch(T,{cache:"no-store",headers:{Accept:"application/json","Cache-Control":"no-cache"}});if($.ok){const I=await $.json();return I.success&&I.logs?{logs:I.logs,count:I.count,logPath:I.logPath,totalLines:I.totalLines}:{error:I.error||"Failed to fetch file logs"}}else return{error:(await $.json().catch(()=>({}))).error||`HTTP ${$.status}`}}catch(T){return console.error("File logs fetch failed:",T),{error:T.message}}}function x(E){const C=document.createElement("div");C.className="log-entry",C.style.cssText="display: flex; gap: 12px; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 0.8rem; align-items: flex-start; font-family: monospace;";const T=E.text;let $="INFO",I="var(--fg)";T.match(/ERROR|FATAL|CRITICAL/i)?($="ERROR",I="var(--bad-fg)"):T.match(/WARN|WARNING/i)?($="WARN",I="#f39c12"):T.match(/DEBUG/i)&&($="DEBUG",I="var(--muted)");const D=`<span style="background: ${I==="var(--bad-fg)"?"var(--bad-bg)":"var(--ok-bg)"}; color: ${I}; padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 600; min-width: 50px; text-align: center;">${$}</span>`;return C.innerHTML=`
|
</div>`}}function k(E,C){h=E,b=C,g=!0,d=!1,p=!1,s();const T=document.getElementById("logs-modal"),L=document.getElementById("logs-title"),I=document.getElementById("logs-pause"),A=document.getElementById("logs-stream");L.textContent=`\u{1F4CB} ${C} - Container Logs`,I.textContent="\u23F8\uFE0F Pause",I.classList.remove("paused"),A&&(A.style.display=""),T.classList.add("show"),S(),a=setInterval(S,DC.POLL.LOGS)}async function $(E,C=100){try{const T=`/api/v1/logs/file?path=${encodeURIComponent(E)}&tail=${C}`,L=await fetch(T,{cache:"no-store",headers:{Accept:"application/json","Cache-Control":"no-cache"}});if(L.ok){const I=await L.json();return I.success&&I.logs?{logs:I.logs,count:I.count,logPath:I.logPath,totalLines:I.totalLines}:{error:I.error||"Failed to fetch file logs"}}else return{error:(await L.json().catch(()=>({}))).error||`HTTP ${L.status}`}}catch(T){return console.error("File logs fetch failed:",T),{error:T.message}}}function x(E){const C=document.createElement("div");C.className="log-entry",C.style.cssText="display: flex; gap: 12px; padding: 6px 10px; border-bottom: 1px solid var(--border); font-size: 0.8rem; align-items: flex-start; font-family: monospace;";const T=E.text;let L="INFO",I="var(--fg)";T.match(/ERROR|FATAL|CRITICAL/i)?(L="ERROR",I="var(--bad-fg)"):T.match(/WARN|WARNING/i)?(L="WARN",I="#f39c12"):T.match(/DEBUG/i)&&(L="DEBUG",I="var(--muted)");const D=`<span style="background: ${I==="var(--bad-fg)"?"var(--bad-bg)":"var(--ok-bg)"}; color: ${I}; padding: 2px 6px; border-radius: 4px; font-size: 0.7rem; font-weight: 600; min-width: 50px; text-align: center;">${L}</span>`;return C.innerHTML=`
|
||||||
<div style="flex-shrink: 0;">${D}</div>
|
<div style="flex-shrink: 0;">${D}</div>
|
||||||
<div style="flex: 1; color: ${I}; word-break: break-all; white-space: pre-wrap;">${escapeHtml(T)}</div>
|
<div style="flex: 1; color: ${I}; word-break: break-all; white-space: pre-wrap;">${escapeHtml(T)}</div>
|
||||||
`,C}async function B(){if(p||!v||!d)return;const E=parseInt(document.getElementById("log-lines").value),C=document.getElementById("logs-content");try{const T=await L(v,E);if(T.error){C.innerHTML=`
|
`,C}async function B(){if(p||!v||!d)return;const E=parseInt(document.getElementById("log-lines").value),C=document.getElementById("logs-content");try{const T=await $(v,E);if(T.error){C.innerHTML=`
|
||||||
<div style="padding: 20px; text-align: center; color: var(--bad-fg);">
|
<div style="padding: 20px; text-align: center; color: var(--bad-fg);">
|
||||||
<div style="font-size: 1.2rem; margin-bottom: 8px;">\u26A0\uFE0F Error</div>
|
<div style="font-size: 1.2rem; margin-bottom: 8px;">\u26A0\uFE0F Error</div>
|
||||||
<div>${escapeHtml(T.error)}</div>
|
<div>${escapeHtml(T.error)}</div>
|
||||||
</div>`;return}C.innerHTML=`
|
</div>`;return}C.innerHTML=`
|
||||||
<div style="display: flex; gap: 12px; padding: 8px 10px; background: var(--card-base); border-bottom: 2px solid var(--border); font-size: 0.75rem; font-weight: 600; color: var(--muted); position: sticky; top: 0;">
|
<div style="display: flex; gap: 12px; padding: 8px 10px; background: var(--card-base); border-bottom: 2px solid var(--border); font-size: 0.75rem; font-weight: 600; color: var(--muted); position: sticky; top: 0;">
|
||||||
<span style="flex: 1;">Log Output (${T.count} of ${T.totalLines} lines)</span>
|
<span style="flex: 1;">Log Output (${T.count} of ${T.totalLines} lines)</span>
|
||||||
</div>`,T.logs&&T.logs.length>0?(T.logs.forEach($=>{const I=x($);C.appendChild(I)}),C.scrollTop=C.scrollHeight):C.innerHTML+=`
|
</div>`,T.logs&&T.logs.length>0?(T.logs.forEach(L=>{const I=x(L);C.appendChild(I)}),C.scrollTop=C.scrollHeight):C.innerHTML+=`
|
||||||
<div style="padding: 20px; text-align: center; color: var(--muted);">
|
<div style="padding: 20px; text-align: center; color: var(--muted);">
|
||||||
No logs available in this file
|
No logs available in this file
|
||||||
</div>`}catch(T){C.innerHTML=`
|
</div>`}catch(T){C.innerHTML=`
|
||||||
<div style="padding: 20px; text-align: center; color: var(--bad-fg);">
|
<div style="padding: 20px; text-align: center; color: var(--bad-fg);">
|
||||||
Failed to fetch logs: ${escapeHtml(T.message)}
|
Failed to fetch logs: ${escapeHtml(T.message)}
|
||||||
</div>`}}function A(E,C){v=E,f=C,d=!0,g=!1,p=!1;const T=document.getElementById("logs-modal"),$=document.getElementById("logs-title"),I=document.getElementById("logs-pause"),P=document.getElementById("logs-stream");$.textContent=`\u{1F4CB} ${C} - Application Logs`,I.textContent="\u23F8\uFE0F Pause",I.classList.remove("paused"),P&&(P.style.display="none"),T.classList.add("show"),B(),a=setInterval(B,DC.POLL.LOGS)}document.querySelector(".top")?.addEventListener("click",E=>{const C=E.target.closest('[id$="-logs"]');if(!C)return;const T=C.id.replace("-logs","");SITE.dnsServers[T]&&n(T)}),document.getElementById("logs-close")?.addEventListener("click",u),document.getElementById("logs-pause")?.addEventListener("click",()=>{p=!p;const E=document.getElementById("logs-pause");p?(E.textContent="\u25B6\uFE0F Resume",E.classList.add("paused")):(E.textContent="\u23F8\uFE0F Pause",E.classList.remove("paused"),e())}),document.getElementById("log-lines")?.addEventListener("change",()=>{p||e()}),document.getElementById("logs-stream")?.addEventListener("click",()=>{!g||!h||(m?r():o(h))}),document.getElementById("logs-modal")?.addEventListener("click",E=>{E.target.id==="logs-modal"&&u()}),document.addEventListener("keydown",E=>{E.key==="Escape"&&document.getElementById("logs-modal")?.classList.contains("show")&&u()}),window.openContainerLogsModal=k,window.openFileLogsModal=A,window.openLogsModal=n})(),(function(){injectModal("service-edit-modal",`
|
</div>`}}function P(E,C){v=E,f=C,d=!0,g=!1,p=!1;const T=document.getElementById("logs-modal"),L=document.getElementById("logs-title"),I=document.getElementById("logs-pause"),A=document.getElementById("logs-stream");L.textContent=`\u{1F4CB} ${C} - Application Logs`,I.textContent="\u23F8\uFE0F Pause",I.classList.remove("paused"),A&&(A.style.display="none"),T.classList.add("show"),B(),a=setInterval(B,DC.POLL.LOGS)}document.querySelector(".top")?.addEventListener("click",E=>{const C=E.target.closest('[id$="-logs"]');if(!C)return;const T=C.id.replace("-logs","");SITE.dnsServers[T]&&n(T)}),document.getElementById("logs-close")?.addEventListener("click",u),document.getElementById("logs-pause")?.addEventListener("click",()=>{p=!p;const E=document.getElementById("logs-pause");p?(E.textContent="\u25B6\uFE0F Resume",E.classList.add("paused")):(E.textContent="\u23F8\uFE0F Pause",E.classList.remove("paused"),e())}),document.getElementById("log-lines")?.addEventListener("change",()=>{p||e()}),document.getElementById("logs-stream")?.addEventListener("click",()=>{!g||!h||(m?s():o(h))}),document.getElementById("logs-modal")?.addEventListener("click",E=>{E.target.id==="logs-modal"&&u()}),document.addEventListener("keydown",E=>{E.key==="Escape"&&document.getElementById("logs-modal")?.classList.contains("show")&&u()}),window.openContainerLogsModal=k,window.openFileLogsModal=P,window.openLogsModal=n})(),(function(){injectModal("service-edit-modal",`
|
||||||
<div id="service-edit-modal" class="weather-modal">
|
<div id="service-edit-modal" class="weather-modal">
|
||||||
<div class="weather-modal-content" style="min-width: 500px; max-width: 600px;">
|
<div class="weather-modal-content" style="min-width: 500px; max-width: 600px;">
|
||||||
<h3 id="service-edit-title">Edit Service</h3>
|
<h3 id="service-edit-title">Edit Service</h3>
|
||||||
@@ -805,8 +805,8 @@ Instructions: ${n.instructionsLink}`:"";showNotification(`${f.toUpperCase()} upd
|
|||||||
<button id="add-service-create" class="btn-accent">Create Service</button>
|
<button id="add-service-create" class="btn-accent">Create Service</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>`)})(),(function(){async function l(g){try{const v=await fetch(`/api/v1/caddy/cas?caddyfilePath=${encodeURIComponent(g)}`);if(!v.ok)throw new Error(`Failed to load CAs: ${v.status}`);const f=await v.json();if(f.success){const d=document.getElementById("existing-ca-select");return d.innerHTML="",f.cas.length===0?d.innerHTML='<option value="">No CAs found in Caddyfile</option>':(d.innerHTML='<option value="">Select existing CA...</option>',f.cas.forEach(i=>{const m=document.createElement("option");typeof i=="object"?(m.value=i.id,m.textContent=i.displayName||i.name):(m.value=i,m.textContent=i),d.appendChild(m)})),f.data.cas}else throw new Error(f.message)}catch(v){console.error("Error loading CAs:",v);const f=document.getElementById("existing-ca-select");return f.innerHTML='<option value="">Error loading CAs</option>',[]}}function a(g){const{subdomain:v,port:f,ip:d,sslType:i,caName:m,existingCa:w,enableAuth:s,enableCors:t,customHeaders:e,upstreamPath:n,healthCheck:u,timeout:o,tailscaleOnly:r}=g;let c=`${buildDomain(v)} {
|
</div>`)})(),(function(){async function l(g){try{const v=await fetch(`/api/v1/caddy/cas?caddyfilePath=${encodeURIComponent(g)}`);if(!v.ok)throw new Error(`Failed to load CAs: ${v.status}`);const f=await v.json();if(f.success){const d=document.getElementById("existing-ca-select");return d.innerHTML="",f.cas.length===0?d.innerHTML='<option value="">No CAs found in Caddyfile</option>':(d.innerHTML='<option value="">Select existing CA...</option>',f.cas.forEach(i=>{const m=document.createElement("option");typeof i=="object"?(m.value=i.id,m.textContent=i.displayName||i.name):(m.value=i,m.textContent=i),d.appendChild(m)})),f.data.cas}else throw new Error(f.message)}catch(v){console.error("Error loading CAs:",v);const f=document.getElementById("existing-ca-select");return f.innerHTML='<option value="">Error loading CAs</option>',[]}}function a(g){const{subdomain:v,port:f,ip:d,sslType:i,caName:m,existingCa:w,enableAuth:r,enableCors:t,customHeaders:e,upstreamPath:n,healthCheck:u,timeout:o,tailscaleOnly:s}=g;let c=`${buildDomain(v)} {
|
||||||
`;switch(r&&(c+=` @blocked not remote_ip 100.64.0.0/10
|
`;switch(s&&(c+=` @blocked not remote_ip 100.64.0.0/10
|
||||||
`,c+=` respond @blocked "Access denied. Tailscale connection required." 403
|
`,c+=` respond @blocked "Access denied. Tailscale connection required." 403
|
||||||
`),i){case"letsencrypt":break;case"caddy-managed":c+=` tls internal
|
`),i){case"letsencrypt":break;case"caddy-managed":c+=` tls internal
|
||||||
`;break;case"existing-ca":w&&(c+=` tls {
|
`;break;case"existing-ca":w&&(c+=` tls {
|
||||||
@@ -815,7 +815,7 @@ Instructions: ${n.instructionsLink}`:"";showNotification(`${f.toUpperCase()} upd
|
|||||||
`);break;case"custom-ca":m&&(c+=` tls {
|
`);break;case"custom-ca":m&&(c+=` tls {
|
||||||
ca ${m}
|
ca ${m}
|
||||||
}
|
}
|
||||||
`);break}if(s&&(c+=` basicauth {
|
`);break}if(r&&(c+=` basicauth {
|
||||||
admin $2a$14$hashed_password_here
|
admin $2a$14$hashed_password_here
|
||||||
}
|
}
|
||||||
`),t&&(c+=` header {
|
`),t&&(c+=` header {
|
||||||
@@ -835,15 +835,15 @@ Instructions: ${n.instructionsLink}`:"";showNotification(`${f.toUpperCase()} upd
|
|||||||
`,c+=` }
|
`,c+=` }
|
||||||
`),c+=` }
|
`),c+=` }
|
||||||
`,c+=`}
|
`,c+=`}
|
||||||
`,c}async function p(g,v,f=DC.DEFAULTS.TTL){const d=window.getToken(getPrimaryDnsId(),"admin");if(!d)throw new Error("DNS admin token not configured. Please set it in the Tokens menu.");const i=buildDomain(g),m=await secureFetch("/api/v1/dns/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:i,ip:v,ttl:f,token:d,server:SITE.dnsIp})});if(!m.ok){const s=await m.text();throw new Error(`DNS API Error: ${m.status} - ${s}`)}const w=await m.json();if(!w.success)throw new Error(`DNS Error: ${w.error||"Unknown error"}`);return w}async function h(g){const v={id:g.subdomain,name:g.name,logo:g.logo||`/assets/${g.subdomain}.png`};g.category&&(v.category=g.category),g.containerId&&(v.containerId=g.containerId);try{const f=await secureFetch("/api/v1/services",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)});if(!f.ok){const d=await f.json();throw new Error(d.error||"Failed to save service")}return await window.loadServices(),window.buildGrid(),v}catch(f){throw console.error("Failed to add service to config:",f),f}}async function b(g){const v=document.getElementById("service-subdomain-input").value.trim(),f=document.getElementById("service-ip-input").value.trim()||"localhost",d=document.getElementById("service-port-input").value.trim()||"80",i=await secureFetch("/api/v1/site",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:buildDomain(v),upstream:`${f}:${d}`,config:g})}),m=await i.json();if(!i.ok||!m.success)throw new Error(m.error||`Caddy API Error: ${i.status}`);return m}window.loadExistingCAs=l,window.generateCaddyConfig=a,window.createDnsRecord=p,window.addServiceToConfig=h,window.addToCaddyfile=b})(),(function(){let l=null;function a(f){l=f;const d=document.getElementById("service-edit-modal");document.getElementById("service-edit-title").textContent=`Edit ${f.name}`,document.getElementById("edit-service-name").value=f.name,document.getElementById("edit-service-url-display").textContent=f.url||buildServiceUrl(f.id),document.getElementById("edit-service-logo-preview").src=f.logo||`/assets/${f.id}.png`,document.getElementById("edit-subdomain").value=f.id,document.getElementById("edit-port").value=f.port||"",document.getElementById("edit-ip").value=f.ip||"localhost",document.getElementById("edit-tailscale-only").checked=f.tailscaleOnly||!1,document.getElementById("edit-logo-url").value=f.logo||"";const i=document.getElementById("edit-service-category");i&&(i.dataset.current=f.category||"",typeof window.populateCategorySelects=="function"&&window.populateCategorySelects()),d.classList.add("show")}function p(){closeModal("service-edit-modal"),l=null}async function h(){if(!l)return;const f=document.getElementById("edit-subdomain").value.trim().toLowerCase(),d=document.getElementById("edit-service-name").value.trim(),i=document.getElementById("edit-port").value.trim(),m=document.getElementById("edit-ip").value.trim()||"localhost",w=document.getElementById("edit-tailscale-only").checked,s=document.getElementById("edit-logo-url").value.trim(),t=document.getElementById("edit-service-category")?.value||"";if(!f){showNotification("Subdomain is required","warning");return}const e=l.id,n=[];if(f!==e&&n.push("subdomain"),d&&d!==l.name&&n.push("name"),i&&i!==String(l.port)&&n.push("port"),m!==l.ip&&n.push("ip"),w!==(l.tailscaleOnly||!1)&&n.push("tailscale"),s&&s!==l.logo&&n.push("logo"),t!==(l.category||"")&&n.push("category"),n.length===0){p();return}const u=document.getElementById("service-edit-save");u.textContent="Saving...",u.disabled=!0;try{const r=await(await secureFetch("/api/v1/services/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldSubdomain:e,newSubdomain:f,name:d||l.name,port:i||l.port,ip:m,tailscaleOnly:w,logo:s||void 0,category:t})})).json();if(!r.success)throw new Error(r.error||"Failed to update service");const c=window.APPS.findIndex(y=>y.id===e);c!==-1&&(window.APPS[c]={...window.APPS[c],id:f,name:d||window.APPS[c].name,port:i||window.APPS[c].port,ip:m,tailscaleOnly:w,logo:s||window.APPS[c].logo,category:t||void 0}),p(),window.buildGrid(),window.refreshAll()}catch(o){console.error("Error saving service changes:",o),showNotification(`Error saving changes: ${o.message}`,"error")}finally{u.textContent="Save Changes",u.disabled=!1}}document.getElementById("edit-logo-file")?.addEventListener("change",async f=>{const d=f.target.files[0];if(!d)return;if(!d.type.startsWith("image/")){showNotification("Please select an image file","warning");return}const i=new FileReader;i.onload=async m=>{const w=m.target.result;if(document.getElementById("edit-service-logo-preview").src=w,document.getElementById("edit-logo-url").value=w,l)try{const t=await(await secureFetch("/api/v1/assets/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:`${l.id}.png`,data:w})})).json();t.success&&t.path&&(document.getElementById("edit-logo-url").val
Line truncated
|
`,c}async function p(g,v,f=DC.DEFAULTS.TTL){const d=window.getToken(getPrimaryDnsId(),"admin");if(!d)throw new Error("DNS admin token not configured. Please set it in the Tokens menu.");const i=buildDomain(g),m=await secureFetch("/api/v1/dns/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:i,ip:v,ttl:f,token:d,server:SITE.dnsIp})});if(!m.ok){const r=await m.text();throw new Error(`DNS API Error: ${m.status} - ${r}`)}const w=await m.json();if(!w.success)throw new Error(`DNS Error: ${w.error||"Unknown error"}`);return w}async function h(g){const v={id:g.subdomain,name:g.name,logo:g.logo||`/assets/${g.subdomain}.png`};g.category&&(v.category=g.category),g.containerId&&(v.containerId=g.containerId);try{const f=await secureFetch("/api/v1/services",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(v)});if(!f.ok){const d=await f.json();throw new Error(d.error||"Failed to save service")}return await window.loadServices(),window.buildGrid(),v}catch(f){throw console.error("Failed to add service to config:",f),f}}async function b(g){const v=document.getElementById("service-subdomain-input").value.trim(),f=document.getElementById("service-ip-input").value.trim()||"localhost",d=document.getElementById("service-port-input").value.trim()||"80",i=await secureFetch("/api/v1/site",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:buildDomain(v),upstream:`${f}:${d}`,config:g})}),m=await i.json();if(!i.ok||!m.success)throw new Error(m.error||`Caddy API Error: ${i.status}`);return m}window.loadExistingCAs=l,window.generateCaddyConfig=a,window.createDnsRecord=p,window.addServiceToConfig=h,window.addToCaddyfile=b})(),(function(){let l=null;function a(f){l=f;const d=document.getElementById("service-edit-modal");document.getElementById("service-edit-title").textContent=`Edit ${f.name}`,document.getElementById("edit-service-name").value=f.name,document.getElementById("edit-service-url-display").textContent=f.url||buildServiceUrl(f.id),document.getElementById("edit-service-logo-preview").src=f.logo||`/assets/${f.id}.png`,document.getElementById("edit-subdomain").value=f.id,document.getElementById("edit-port").value=f.port||"",document.getElementById("edit-ip").value=f.ip||"localhost",document.getElementById("edit-tailscale-only").checked=f.tailscaleOnly||!1,document.getElementById("edit-logo-url").value=f.logo||"";const i=document.getElementById("edit-service-category");i&&(i.dataset.current=f.category||"",typeof window.populateCategorySelects=="function"&&window.populateCategorySelects()),d.classList.add("show")}function p(){closeModal("service-edit-modal"),l=null}async function h(){if(!l)return;const f=document.getElementById("edit-subdomain").value.trim().toLowerCase(),d=document.getElementById("edit-service-name").value.trim(),i=document.getElementById("edit-port").value.trim(),m=document.getElementById("edit-ip").value.trim()||"localhost",w=document.getElementById("edit-tailscale-only").checked,r=document.getElementById("edit-logo-url").value.trim(),t=document.getElementById("edit-service-category")?.value||"";if(!f){showNotification("Subdomain is required","warning");return}const e=l.id,n=[];if(f!==e&&n.push("subdomain"),d&&d!==l.name&&n.push("name"),i&&i!==String(l.port)&&n.push("port"),m!==l.ip&&n.push("ip"),w!==(l.tailscaleOnly||!1)&&n.push("tailscale"),r&&r!==l.logo&&n.push("logo"),t!==(l.category||"")&&n.push("category"),n.length===0){p();return}const u=document.getElementById("service-edit-save");u.textContent="Saving...",u.disabled=!0;try{const s=await(await secureFetch("/api/v1/services/update",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({oldSubdomain:e,newSubdomain:f,name:d||l.name,port:i||l.port,ip:m,tailscaleOnly:w,logo:r||void 0,category:t})})).json();if(!s.success)throw new Error(s.error||"Failed to update service");const c=window.APPS.findIndex(y=>y.id===e);c!==-1&&(window.APPS[c]={...window.APPS[c],id:f,name:d||window.APPS[c].name,port:i||window.APPS[c].port,ip:m,tailscaleOnly:w,logo:r||window.APPS[c].logo,category:t||void 0}),p(),window.buildGrid(),window.refreshAll()}catch(o){console.error("Error saving service changes:",o),showNotification(`Error saving changes: ${o.message}`,"error")}finally{u.textContent="Save Changes",u.disabled=!1}}document.getElementById("edit-logo-file")?.addEventListener("change",async f=>{const d=f.target.files[0];if(!d)return;if(!d.type.startsWith("image/")){showNotification("Please select an image file","warning");return}const i=new FileReader;i.onload=async m=>{const w=m.target.result;if(document.getElementById("edit-service-logo-preview").src=w,document.getElementById("edit-logo-url").value=w,l)try{const t=await(await secureFetch("/api/v1/assets/upload",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({filename:`${l.id}.png`,data:w})})).json();t.success&&t.path&&(document.getElementById("edit-logo-url").val
Line truncated
|
||||||
|
|
||||||
This will:
|
This will:
|
||||||
1. Pull the latest image
|
1. Pull the latest image
|
||||||
2. Stop the container
|
2. Stop the container
|
||||||
3. Recreate with same settings
|
3. Recreate with same settings
|
||||||
|
|
||||||
The service will be briefly unavailable.`))try{m&&(m.textContent="\u{1F504}",m.disabled=!0,m.title="Updating...");const t=await(await secureFetch(`/api/v1/containers/${f}/update`,{method:"POST"})).json();if(t.success){const e=window.APPS.find(n=>n.id===i);e&&t.newContainerId&&(e.containerId=t.newContainerId),m&&(m.textContent="\u2705",m.title="Updated successfully!",setTimeout(()=>{m.textContent=w,m.disabled=!1,m.title="Update container to latest version"},3e3)),setTimeout(()=>window.refreshAll(),2e3),showNotification(`${d} updated successfully!`,"success")}else throw new Error(t.error||"Update failed")}catch(s){console.error("Update error:",s),m&&(m.textContent="\u274C",m.title="Update failed",setTimeout(()=>{m.textContent=w,m.disabled=!1,m.title="Update container to latest version"},3e3)),showNotification(`Failed to update ${d}: ${s.message}`,"error")}}async function v(f,d){const i=window.APPS.find(c=>c.id===f),m=i?buildDomain(i.id):null,w=i?.containerId,s=await b(d||f,w,i?.containerId);if(s===null)return;let t={dashboard:!1,container:null,dns:null,caddy:null,service:null};if(s&&w)try{const c=new URLSearchParams({containerId:i.containerId,subdomain:i.id,ip:i.ip||"localhost",deleteContainer:"true"}),S=await(await secureFetch(`/api/v1/apps/${encodeURIComponent(i.id)}?${c.toString()}`,{method:"DELETE"})).json();S.success?t={...t,...S.results,dashboard:!1}:console.error("App removal failed:",S.error)}catch(c){console.error("App removal error:",c)}else if(s&&m){try{const c=i?.ip||"localhost",S=await(await secureFetch(`/api/v1/dns/record?domain=${encodeURIComponent(m)}&type=A&ipAddress=${encodeURIComponent(c)}&server=${SITE.dnsIp}`,{method:"DELETE"})).json();t.dns=S.success?"deleted":S.error||"failed"}catch(c){t.dns=c.message}try{const y=await(await secureFetch(`/api/v1/site/${encodeURIComponent(m)}`,{method:"DELETE"})).json();t.caddy=y.success||y.error&&y.error.includes("not found")?"removed":y.error||"failed"}catch(c){t.caddy=c.message}}const e=window.APPS.findIndex(c=>c.id===f);e>-1&&(window.APPS.splice(e,1),t.dashboard=!0);try{const c=safeGetJSON("custom-apps",[]),y=c.findIndex(S=>S.id===f);y>-1&&(c.splice(y,1),safeSet("custom-apps",JSON.stringify(c)))}catch{}try{const y=await(await secureFetch(`/api/v1/services/${encodeURIComponent(f)}`,{method:"DELETE"})).json();t.service=y.success?"removed":y.error||"failed"}catch(c){t.service=c.message}window.buildGrid(),window.refreshAll();let n=!1,u=[];t.dashboard||(n=!0,u.push("\u2717 Failed to remove from dashboard"));const o=["removed","already removed","not found","deleted","kept (user choice)","skipped","no such record","does not exist"],r=c=>!c||o.some(y=>c.toLowerCase().includes(y.toLowerCase()));t.container&&!r(t.container)&&(n=!0,u.push(`\u26A0 Container: ${t.container}`)),t.dns&&!r(t.dns)&&(n=!0,u.push(`\u26A0 DNS Record: ${t.dns}`)),t.caddy&&!r(t.caddy)&&(n=!0,u.push(`\u26A0 Caddy Config: ${t.caddy}`)),t.service&&!r(t.service)&&(n=!0,u.push(`\u26A0 Service File: ${t.service}`)),n&&showNotification(`Error deleting "${d||f}": ${u.join(", ")}`,"error",6e3)}window.openServiceEditModal=a,window.showDeleteModal=b,window.updateContainer=g,window.deleteService=v})(),(function(){function l(t){return t.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function a(){return SITE.defaults?.sslType||(SITE.configurationType==="public"?"letsencrypt":"caddy-managed")}function p(){const t=document.getElementById("service-subdomain-input").value||"subdomain",e=document.getElementById("service-ip-input").value||h.lan||"localhost",n=document.getElementById("service-port-input").value||DC.DEFAULTS.SERVICE_PORT,u=document.getElementById("ssl-type-select").value,o=document.getElementById("ca-name-input").value||"sami-ca",r=document.getElementById("existing-ca-select").value,c=document.getElementById("enable-auth").checked,y=document.getElementById("enable-cors").checked,S=document.getElementById("custom-headers-input").value,k=document.getElementById("upstream-path-input").value||"/",L=document.getElementById("health-check-input").value,x=document.getElementById("timeout-input").value||30,B=document.getElementById("dns-preview");B&&(B.textContent=`${buildDomain(t)} \u2192 ${e}`);const A=document.getElementById("url-preview");A&&(A.textContent=buildServiceUrl(t));const E={subdomain:t,port:n,ip:e,sslType:u,caName:o,existingCa:r,enableAuth:c,enableCors:y,customHeaders:S,upstreamPath:k,healthCheck:L,timeout:x},C=window.generateCaddyConfig(E),T=document.getElementById("caddy-config-preview");T&&(T.value=C)}const h={localhost:"127.0.0.1",lan:"",tailscale:""};async function b(){try{const u=await fetch("/api/v1/network/ips",{signal:AbortSignal.timeout(2e3)});if(u.ok){const o=await u.json();o.lan&&(h.lan=o.lan),o.tailscale&&(h.tailscale=o.tailscale)}}catch{}const t=document.getElementById("quick-ip-lan"),e=document.getElementById("quick-ip-tailscale");t&&(h.lan?(t.dataset.ip=h.lan,t.textContent=`LAN (${h.lan})`,t.title=`LAN IP: ${h.lan}`):t
Line truncated
|
The service will be briefly unavailable.`))try{m&&(m.textContent="\u{1F504}",m.disabled=!0,m.title="Updating...");const t=await(await secureFetch(`/api/v1/containers/${f}/update`,{method:"POST"})).json();if(t.success){const e=window.APPS.find(n=>n.id===i);e&&t.newContainerId&&(e.containerId=t.newContainerId),m&&(m.textContent="\u2705",m.title="Updated successfully!",setTimeout(()=>{m.textContent=w,m.disabled=!1,m.title="Update container to latest version"},3e3)),setTimeout(()=>window.refreshAll(),2e3),showNotification(`${d} updated successfully!`,"success")}else throw new Error(t.error||"Update failed")}catch(r){console.error("Update error:",r),m&&(m.textContent="\u274C",m.title="Update failed",setTimeout(()=>{m.textContent=w,m.disabled=!1,m.title="Update container to latest version"},3e3)),showNotification(`Failed to update ${d}: ${r.message}`,"error")}}async function v(f,d){const i=window.APPS.find(c=>c.id===f),m=i?buildDomain(i.id):null,w=i?.containerId,r=await b(d||f,w,i?.containerId);if(r===null)return;let t={dashboard:!1,container:null,dns:null,caddy:null,service:null};if(r&&w)try{const c=new URLSearchParams({containerId:i.containerId,subdomain:i.id,ip:i.ip||"localhost",deleteContainer:"true"}),S=await(await secureFetch(`/api/v1/apps/${encodeURIComponent(i.id)}?${c.toString()}`,{method:"DELETE"})).json();S.success?t={...t,...S.results,dashboard:!1}:console.error("App removal failed:",S.error)}catch(c){console.error("App removal error:",c)}else if(r&&m){try{const c=i?.ip||"localhost",S=await(await secureFetch(`/api/v1/dns/record?domain=${encodeURIComponent(m)}&type=A&ipAddress=${encodeURIComponent(c)}&server=${SITE.dnsIp}`,{method:"DELETE"})).json();t.dns=S.success?"deleted":S.error||"failed"}catch(c){t.dns=c.message}try{const y=await(await secureFetch(`/api/v1/site/${encodeURIComponent(m)}`,{method:"DELETE"})).json();t.caddy=y.success||y.error&&y.error.includes("not found")?"removed":y.error||"failed"}catch(c){t.caddy=c.message}}const e=window.APPS.findIndex(c=>c.id===f);e>-1&&(window.APPS.splice(e,1),t.dashboard=!0);try{const c=safeGetJSON("custom-apps",[]),y=c.findIndex(S=>S.id===f);y>-1&&(c.splice(y,1),safeSet("custom-apps",JSON.stringify(c)))}catch{}try{const y=await(await secureFetch(`/api/v1/services/${encodeURIComponent(f)}`,{method:"DELETE"})).json();t.service=y.success?"removed":y.error||"failed"}catch(c){t.service=c.message}window.buildGrid(),window.refreshAll();let n=!1,u=[];t.dashboard||(n=!0,u.push("\u2717 Failed to remove from dashboard"));const o=["removed","already removed","not found","deleted","kept (user choice)","skipped","no such record","does not exist"],s=c=>!c||o.some(y=>c.toLowerCase().includes(y.toLowerCase()));t.container&&!s(t.container)&&(n=!0,u.push(`\u26A0 Container: ${t.container}`)),t.dns&&!s(t.dns)&&(n=!0,u.push(`\u26A0 DNS Record: ${t.dns}`)),t.caddy&&!s(t.caddy)&&(n=!0,u.push(`\u26A0 Caddy Config: ${t.caddy}`)),t.service&&!s(t.service)&&(n=!0,u.push(`\u26A0 Service File: ${t.service}`)),n&&showNotification(`Error deleting "${d||f}": ${u.join(", ")}`,"error",6e3)}window.openServiceEditModal=a,window.showDeleteModal=b,window.updateContainer=g,window.deleteService=v})(),(function(){function l(t){return t.toLowerCase().replace(/\s+/g,"-").replace(/[^a-z0-9-]/g,"").replace(/-+/g,"-").replace(/^-|-$/g,"")}function a(){return SITE.defaults?.sslType||(SITE.configurationType==="public"?"letsencrypt":"caddy-managed")}function p(){const t=document.getElementById("service-subdomain-input").value||"subdomain",e=document.getElementById("service-ip-input").value||h.lan||"localhost",n=document.getElementById("service-port-input").value||DC.DEFAULTS.SERVICE_PORT,u=document.getElementById("ssl-type-select").value,o=document.getElementById("ca-name-input").value||"sami-ca",s=document.getElementById("existing-ca-select").value,c=document.getElementById("enable-auth").checked,y=document.getElementById("enable-cors").checked,S=document.getElementById("custom-headers-input").value,k=document.getElementById("upstream-path-input").value||"/",$=document.getElementById("health-check-input").value,x=document.getElementById("timeout-input").value||30,B=document.getElementById("dns-preview");B&&(B.textContent=`${buildDomain(t)} \u2192 ${e}`);const P=document.getElementById("url-preview");P&&(P.textContent=buildServiceUrl(t));const E={subdomain:t,port:n,ip:e,sslType:u,caName:o,existingCa:s,enableAuth:c,enableCors:y,customHeaders:S,upstreamPath:k,healthCheck:$,timeout:x},C=window.generateCaddyConfig(E),T=document.getElementById("caddy-config-preview");T&&(T.value=C)}const h={localhost:"127.0.0.1",lan:"",tailscale:""};async function b(){try{const u=await fetch("/api/v1/network/ips",{signal:AbortSignal.timeout(2e3)});if(u.ok){const o=await u.json();o.lan&&(h.lan=o.lan),o.tailscale&&(h.tailscale=o.tailscale)}}catch{}const t=document.getElementById("quick-ip-lan"),e=document.getElementById("quick-ip-tailscale");t&&(h.lan?(t.dataset.ip=h.lan,t.textContent=`LAN (${h.lan})`,t.title=`LAN IP: ${h.lan}`):t
Line truncated
|
||||||
<span style="color: #4caf50;">\u2713 Connected</span>
|
<span style="color: #4caf50;">\u2713 Connected</span>
|
||||||
<span style="color: var(--muted); margin-left: 6px;">${y.self?.hostname} (${y.self?.ip})</span>
|
<span style="color: var(--muted); margin-left: 6px;">${y.self?.hostname} (${y.self?.ip})</span>
|
||||||
`,r.disabled=!1):y.installed?(o.innerHTML='<span style="color: #ff9800;">\u26A0 Not connected</span>',r.disabled=!0):(o.innerHTML='<span style="color: var(--muted);">Not available</span>',r.disabled=!0)}catch{o.innerHTML='<span style="color: var(--muted);">Could not check</span>',r.disabled=!0}r.checked=!1,p()}function f(){const t=document.getElementById("service-type-local"),e=document.getElementById("service-type-external"),n=document.getElementById("local-service-config"),u=document.getElementById("external-service-config"),o=document.getElementById("tab-local"),r=document.getElementById("tab-external");function c(){t.checked?(n.style.display="grid",u.style.display="none",o&&(o.style.background="var(--accent)",o.style.color="var(--bg)"),r&&(r.style.background="transparent",r.style.color="var(--muted)")):(n.style.display="none",u.style.display="block",r&&(r.style.background="var(--accent)",r.style.color="var(--bg)"),o&&(o.style.background="transparent",o.style.color="var(--muted)"))}t?.addEventListener("change",c),e?.addEventListener("change",c)}function d(){const t=document.getElementById("service-name-input"),e=document.getElementById("service-subdomain-input"),n=document.getElementById("subdomain-preview");let u=!1;t?.addEventListener("input",()=>{const k=l(t.value);!u&&e&&(e.value=k),n&&(n.textContent=k?`\u2192 ${buildDomain(k)}`:""),p()}),e?.addEventListener("input",()=>{u=e.value!==l(t?.value||"");const k=e.value.trim()||l(t?.value||"");n&&(n.textContent=k?`\u2192 ${buildDomain(k)}`:""),p()});const o=document.getElementById("external-service-name"),r=document.getElementById("external-service-subdomain"),c=document.getElementById("external-subdomain-preview"),y=document.getElementById("external-domain-preview");let S=!1;o?.addEventListener("input",()=>{const k=l(o.value);!S&&r&&(r.value=k);const L=r?.value||k;c&&(c.textContent=L?`\u2192 ${buildDomain(L)}`:""),y&&(y.textContent=L?buildDomain(L):"")}),r?.addEventListener("input",()=>{S=r.value!==l(o?.value||"");const k=r.value.trim()||l(o?.value||"");c&&(c.textContent=k?`\u2192 ${buildDomain(k)}`:""),y&&(y.textContent=k?buildDomain(k):"")})}async function i(){const t=document.getElementById("external-service-name").value.trim(),e=document.getElementById("external-service-url").value.trim(),n=(document.getElementById("external-service-subdomain").value.trim()||l(t)).toLowerCase(),u=document.getElementById("external-service-logo").value.trim(),o=document.getElementById("external-service-icon").value.trim(),r=document.getElementById("external-create-dns").checked,c=document.getElementById("external-create-caddy").checked,y=document.getElementById("external-proxy-ip").value.trim()||SITE.dnsIp||"localhost",S=document.getElementById("external-preserve-host").checked,k=document.getElementById("external-follow-redirects").checked,L=document.getElementById("external-service-category")?.value||"";if(!t||!e){showNotification("Please fill in Name and External URL","warning");return}if(!n){showNotification("Could not derive subdomain from name. Please set one in Options.","warning");return}if(!e.startsWith("http://")&&!e.startsWith("https://")){showNotification("External URL must start with http:// or https://","warning");return}const x=buildDomain(n);try{const B={dns:null,caddy:null,dashboard:!1};if(r)if(window.getToken(getPrimaryDnsId(),"admin"))try{const P=await(await secureFetch("/api/v1/dns/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:x,ip:y,ttl:DC.DEFAULTS.TTL,server:SITE.dnsIp})})).json();B.dns=P.success?"created":P.error||"failed"}catch(I){B.dns=I.message}else B.dns="no admin token (configure in \u{1F511} Tokens)";if(c)try{const $={subdomain:n,externalUrl:e,preserveHost:S,followRedirects:k,sslType:"caddy-managed",caddyfilePath:DC.DEFAULTS.CADDYFILE,reloadCaddy:!0},P=await(await secureFetch("/api/v1/site/external",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify($)})).json();B.caddy=P.success?"created":P.error||"failed"}catch($){B.caddy=$.message}const A={id:n,name:t,url:`https://${x}`,externalUrl:e,logo:u||o||"\u{1F310}",isExternal:!0,isCustom:!0};L&&(A.category=L),window.APPS.push(A),B.dashboard=!0;const E=["plex","router","chat","sync","torrent","radarr","sonarr","prowlarr","portainer","requests","jellyfin","emby"],C=window.APPS.filter($=>!E.includes($.id));safeSet("custom-services",JSON.stringify(C));try{await secureFetch("/api/v1/services",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(window.APPS)})}catch($){console.warn("Failed to save to services.json:",$)}window.buildGrid(),window.refreshAll(),m();const T=[`External service "${t}" added!`];r&&T.push(`DNS: ${B.dns==="created"?"\u2713":"\u26A0 "+B.dns}`),c&&T.push(`Caddy: ${B.caddy==="created"?"\u2713":"\u26A0 "+B.caddy}`),T.push(`Access at: https://${x}`),showNotification(T.join(" | "),"success",6e3)}catch(B){console.error("Failed to create external service:",B),showNotification(`F
Line truncated
|
`,s.disabled=!1):y.installed?(o.innerHTML='<span style="color: #ff9800;">\u26A0 Not connected</span>',s.disabled=!0):(o.innerHTML='<span style="color: var(--muted);">Not available</span>',s.disabled=!0)}catch{o.innerHTML='<span style="color: var(--muted);">Could not check</span>',s.disabled=!0}s.checked=!1,p()}function f(){const t=document.getElementById("service-type-local"),e=document.getElementById("service-type-external"),n=document.getElementById("local-service-config"),u=document.getElementById("external-service-config"),o=document.getElementById("tab-local"),s=document.getElementById("tab-external");function c(){t.checked?(n.style.display="grid",u.style.display="none",o&&(o.style.background="var(--accent)",o.style.color="var(--bg)"),s&&(s.style.background="transparent",s.style.color="var(--muted)")):(n.style.display="none",u.style.display="block",s&&(s.style.background="var(--accent)",s.style.color="var(--bg)"),o&&(o.style.background="transparent",o.style.color="var(--muted)"))}t?.addEventListener("change",c),e?.addEventListener("change",c)}function d(){const t=document.getElementById("service-name-input"),e=document.getElementById("service-subdomain-input"),n=document.getElementById("subdomain-preview");let u=!1;t?.addEventListener("input",()=>{const k=l(t.value);!u&&e&&(e.value=k),n&&(n.textContent=k?`\u2192 ${buildDomain(k)}`:""),p()}),e?.addEventListener("input",()=>{u=e.value!==l(t?.value||"");const k=e.value.trim()||l(t?.value||"");n&&(n.textContent=k?`\u2192 ${buildDomain(k)}`:""),p()});const o=document.getElementById("external-service-name"),s=document.getElementById("external-service-subdomain"),c=document.getElementById("external-subdomain-preview"),y=document.getElementById("external-domain-preview");let S=!1;o?.addEventListener("input",()=>{const k=l(o.value);!S&&s&&(s.value=k);const $=s?.value||k;c&&(c.textContent=$?`\u2192 ${buildDomain($)}`:""),y&&(y.textContent=$?buildDomain($):"")}),s?.addEventListener("input",()=>{S=s.value!==l(o?.value||"");const k=s.value.trim()||l(o?.value||"");c&&(c.textContent=k?`\u2192 ${buildDomain(k)}`:""),y&&(y.textContent=k?buildDomain(k):"")})}async function i(){const t=document.getElementById("external-service-name").value.trim(),e=document.getElementById("external-service-url").value.trim(),n=(document.getElementById("external-service-subdomain").value.trim()||l(t)).toLowerCase(),u=document.getElementById("external-service-logo").value.trim(),o=document.getElementById("external-service-icon").value.trim(),s=document.getElementById("external-create-dns").checked,c=document.getElementById("external-create-caddy").checked,y=document.getElementById("external-proxy-ip").value.trim()||SITE.dnsIp||"localhost",S=document.getElementById("external-preserve-host").checked,k=document.getElementById("external-follow-redirects").checked,$=document.getElementById("external-service-category")?.value||"";if(!t||!e){showNotification("Please fill in Name and External URL","warning");return}if(!n){showNotification("Could not derive subdomain from name. Please set one in Options.","warning");return}if(!e.startsWith("http://")&&!e.startsWith("https://")){showNotification("External URL must start with http:// or https://","warning");return}const x=buildDomain(n);try{const B={dns:null,caddy:null,dashboard:!1};if(s)if(window.getToken(getPrimaryDnsId(),"admin"))try{const A=await(await secureFetch("/api/v1/dns/record",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({domain:x,ip:y,ttl:DC.DEFAULTS.TTL,server:SITE.dnsIp})})).json();B.dns=A.success?"created":A.error||"failed"}catch(I){B.dns=I.message}else B.dns="no admin token (configure in \u{1F511} Tokens)";if(c)try{const L={subdomain:n,externalUrl:e,preserveHost:S,followRedirects:k,sslType:"caddy-managed",caddyfilePath:DC.DEFAULTS.CADDYFILE,reloadCaddy:!0},A=await(await secureFetch("/api/v1/site/external",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(L)})).json();B.caddy=A.success?"created":A.error||"failed"}catch(L){B.caddy=L.message}const P={id:n,name:t,url:`https://${x}`,externalUrl:e,logo:u||o||"\u{1F310}",isExternal:!0,isCustom:!0};$&&(P.category=$),window.APPS.push(P),B.dashboard=!0;const E=["plex","router","chat","sync","torrent","radarr","sonarr","prowlarr","portainer","requests","jellyfin","emby"],C=window.APPS.filter(L=>!E.includes(L.id));safeSet("custom-services",JSON.stringify(C));try{await secureFetch("/api/v1/services",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(window.APPS)})}catch(L){console.warn("Failed to save to services.json:",L)}window.buildGrid(),window.refreshAll(),m();const T=[`External service "${t}" added!`];s&&T.push(`DNS: ${B.dns==="created"?"\u2713":"\u26A0 "+B.dns}`),c&&T.push(`Caddy: ${B.caddy==="created"?"\u2713":"\u26A0 "+B.caddy}`),T.push(`Access at: https://${x}`),showNotification(T.join(" | "),"success",6e3)}catch(B){console.error("Failed to create external service:",B),showNotification(`F
Line truncated
|
||||||
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiPHN0ZGluPiJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiLyoqXG4gKiBFcnJvciBIYW5kbGVyXG4gKiBIYW5kbGVzIGVycm9ycyBncmFjZWZ1bGx5IHdpdGhvdXQgYnJlYWtpbmcgdGhlIG9uYm9hcmRpbmcgdG91clxuICovXG5cbihmdW5jdGlvbih3aW5kb3cpIHtcbiAgJ3VzZSBzdHJpY3QnO1xuXG4gIGNsYXNzIEVycm9ySGFuZGxlciB7XG4gICAgY29uc3RydWN0b3IoKSB7XG4gICAgICB0aGlzLmVycm9ycyA9IFtdO1xuICAgICAgdGhpcy5tYXhFcnJvcnMgPSA1MDsgLy8gS2VlcCBsYXN0IDUwIGVycm9yc1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIExvZyBhbiBlcnJvciB3aXRob3V0IGJyZWFraW5nIHRoZSB0b3VyXG4gICAgICogQHBhcmFtIHtzdHJpbmd9IGNvbnRleHQgLSBDb250ZXh0IHdoZXJlIGVycm9yIG9jY3VycmVkXG4gICAgICogQHBhcmFtIHtFcnJvcnxzdHJpbmd9IGVycm9yIC0gVGhlIGVycm9yIG9iamVjdCBvciBtZXNzYWdlXG4gICAgICogQHBhcmFtIHtPYmplY3R9IG1ldGFkYXRhIC0gQWRkaXRpb25hbCBtZXRhZGF0YVxuICAgICAqL1xuICAgIGxvZ0Vycm9yKGNvbnRleHQsIGVycm9yLCBtZXRhZGF0YSA9IHt9KSB7XG4gICAgICBjb25zdCBlcnJvckVudHJ5ID0ge1xuICAgICAgICB0aW1lc3RhbXA6IG5ldyBEYXRlKCkudG9JU09TdHJpbmcoKSxcbiAgICAgICAgY29udGV4dCxcbiAgICAgICAgbWVzc2FnZTogZXJyb3IgaW5zdGFuY2VvZiBFcnJvciA/IGVycm9yLm1lc3NhZ2UgOiBlcnJvcixcbiAgICAgICAgc3RhY2s6IGVycm9yIGluc3RhbmNlb2YgRXJyb3IgPyBlcnJvci5zdGFjayA6IG51bGwsXG4gICAgICAgIG1ldGFkYXRhXG4gICAgICB9O1xuXG4gICAgICAvLyBBZGQgdG8gZXJyb3JzIGFycmF5XG4gICAgICB0aGlzLmVycm9ycy5wdXNoKGVycm9yRW50cnkpO1xuXG4gICAgICAvLyBLZWVwIG9ubHkgbGFzdCBtYXhFcnJvcnNcbiAgICAgIGlmICh0aGlzLmVycm9ycy5sZW5ndGggPiB0aGlzLm1heEVycm9ycykge1xuICAgICAgICB0aGlzLmVycm9ycy5zaGlmdCgpO1xuICAgICAgfVxuXG4gICAgICAvLyBMb2cgdG8gY29uc29sZVxuICAgICAgY29uc29sZS5lcnJvcihgW09uYm9hcmRpbmcgRXJyb3JdICR7Y29udGV4dH06YCwgZXJyb3IsIG1ldGFkYXRhKTtcblxuICAgICAgLy8gT3B0aW9uYWxseSBzZW5kIHRvIGVycm9yIHRyYWNraW5nIHNlcnZpY2VcbiAgICAgIC8vIHRoaXMuc2VuZFRvRXJyb3JUcmFja2luZyhlcnJvckVudHJ5KTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBBdHRlbXB0IHRvIHJlY292ZXIgZnJvbSBhbiBlcnJvciBhbmQgY29udGludWUgdG91clxuICAgICAqIEBwYXJhbSB7RXJyb3J9IGVycm9yIC0gVGhlIGVycm9yIG9iamVjdFxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBjdXJyZW50U3RlcCAtIEN1cnJlbnQgc3RlcCBpbmRleFxuICAgICAqIEByZXR1cm5zIHtPYmplY3R9IFJlY292ZXJ5IGFjdGlvblxuICAgICAqL1xuICAgIHJlY292ZXJGcm9tRXJyb3IoZXJyb3IsIGN1cnJlbnRTdGVwKSB7XG4gICAgICBjb25zdCBlcnJvclR5cGUgPSB0aGlzLmNsYXNzaWZ5RXJyb3IoZXJyb3IpO1xuXG4gICAgICBzd2l0Y2ggKGVycm9yVHlwZSkge1xuICAgICAgICBjYXNlICdFTEVNRU5UX05PVF9GT1VORCc6XG4gICAgICAgICAgdGhpcy5sb2dFcnJvcignRWxlbWVudCBOb3QgRm91bmQnLCBlcnJvciwgeyBjdXJyZW50U3RlcCB9KTtcbiAgICAgICAgICByZXR1cm4geyBcbiAgICAgICAgICAgIGFjdGlvbjogJ1NLSVBfU1RFUCcsIFxuICAgICAgICAgICAgbmV4dFN0ZXA6IGN1cnJlbnRTdGVwICsgMSxcbiAgICAgICAgICAgIG1lc3NhZ2U6ICdUYXJnZXQgZWxlbWVudCBub3QgZm91bmQsIHNraXBwaW5nIHRvIG5leHQgc3RlcCdcbiAgICAgICAgICB9O1xuXG4gICAgICAgIGNhc2UgJ1NUT1JBR0VfVU5BVkFJTEFCTEUnOlxuICAgICAgICAgIHRoaXMubG9nRXJyb3IoJ1N0b3JhZ2UgVW5hdmFpbGFibGUnLCBlcnJvcik7XG4gICAgICAgICAgcmV0dXJuIHsgXG4gICAgICAgICAgICBhY3Rpb246ICdVU0VfTUVNT1JZX1NUT1JBR0UnLFxuICAgICAgICAgICAgbWVzc2FnZTogJ0xvY2FsIHN0b3JhZ2UgdW5hdmFpbGFibGUsIHVzaW5nIGluLW1lbW9yeSBzdG9yYWdlJ1xuICAgICAgICAgIH07XG5cbiAgICAgICAgY2FzZSAnRFJJVkVSX05PVF9MT0FERUQnOlxuICAgICAgICAgIHRoaXMubG9nRXJyb3IoJ0RyaXZlci5qcyBOb3QgTG9hZGVkJywgZXJyb3IpO1xuICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICBhY3Rpb246ICdBQk9SVF9UT1VSJyxcbiAgICAgICAgICAgIG1lc3NhZ2U6ICdEcml2ZXIuanMgbGlicmFyeSBub3QgbG9hZGVkLCBjYW5ub3Qgc3RhcnQgdG91cidcbiAgICAgICAgICB9O1xuXG4gICAgICAgIGNhc2UgJ0lOVkFMSURfVE9PTFRJUCc6XG4gICAgICAgICAgdGhpcy5sb2dFcnJvcignSW52YWxpZCBUb29sdGlwIENvbmZpZ3VyYXRpb24nLCBlcnJvciwgeyBjdXJyZW50U3RlcCB9KTtcbiAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgYWN0aW9uOiAnU0tJUF9TVEVQJyxcbiAgICAgICAgICAgIG5leHRTdGVwOiBjdXJyZW50U3RlcCArIDEsXG4gICAgICAgICAgICBtZXNzYWdlOiAnSW52YWxpZCB0b29sdGlwIGNvbmZpZ3VyYXRpb24sIHNraXBwaW5nJ1xuICAgICAgICAgIH07XG5cbiAgICAgICAgY2FzZSAnVEhFTUVfREVURUNUSU9OX0ZBSUxFRCc6XG4gICAgICAgICAgdGhpcy5sb2dFcnJvcignVGhlbWUgRGV0ZWN0aW9uIEZhaWxlZCcsIGVycm9yKTtcbiAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgYWN0aW9uOiAnVVNFX0RFRkFVTFRfVEhFTUUnLFxuICAgICAgICAgICAgbWVzc2FnZTogJ1VzaW5nIGRlZmF1bHQgZGFyayB0aGVtZSdcbiAgICAgICAgICB9O1xuXG4gICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgdGhpcy5sb2dFcnJvcignVW5rbm93biBFcnJvcicsIGVycm9yLCB7IGN1cnJlbnRTdGVwIH0pO1xuICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICBhY3Rpb246ICdBQk9SVF9UT1VSJyxcbiAgICAgICAgICAgIG1lc3NhZ2U6ICdVbmV4cGVjdGVkIGVycm9yIG9jY3VycmVkLCBhYm9ydGluZyB0b3VyJ1xuICAgICAgICAgIH07XG4gICAgICB9XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQ2xhc3NpZnkgZXJyb3IgdHlwZVxuICAgICAqIEBwcml2YXRlXG4gICAgICogQHBhcmFtIHtFcnJvcn0gZXJyb3IgLSBUaGUgZXJyb3Igb2JqZWN0XG4gICAgICogQHJldHVybnMge3N0cmluZ30gRXJyb3IgdHlwZVxuICAgICAqL1xuICAgIGNsYXNzaWZ5RXJyb3IoZXJyb3IpIHtcbiAgICAgIGNvbnN0IG1lc3NhZ2UgPSBlcnJvci5tZXNzYWdlIHx8IGVycm9yLnRvU3RyaW5nKCk7XG5cbiAgICAgIGlmIChtZXNzYWdlLmluY2x1ZGVzKCdlbGVtZW50JykgJiYgbWVzc2FnZS5pbmNsdWRlcygnbm90IGZvdW5kJykpIHtcbiAgICAgICAgcmV0dXJuICdFTEVNRU5UX05PVF9GT1VORCc7XG4gICAgICB9XG4gICAgICBpZiAobWVzc2FnZS5pbmNsdWRlcygnc3RvcmFnZScpIHx8IG1lc3NhZ2UuaW5jbHVkZXMoJ3F1b3RhJykpIHtcbiAgICAgICAgcmV0dXJuICdTVE9SQUdFX1VOQVZBSUxBQkxFJztcbiAgICAgIH1cbiAgICAgIGlmIChtZXNzYWdlLmluY2x1ZGVzKCdkcml2ZXInKSB8fCBtZXNzYWdlLmluY2x1ZGVzKCd1bmRlZmluZWQnKSkge1xuICAgI
Line truncated
|
//# sourceMappingURL=data:application/json;base64,ewogICJ2ZXJzaW9uIjogMywKICAic291cmNlcyI6IFsiPHN0ZGluPiJdLAogICJzb3VyY2VzQ29udGVudCI6IFsiLyoqXG4gKiBFcnJvciBIYW5kbGVyXG4gKiBIYW5kbGVzIGVycm9ycyBncmFjZWZ1bGx5IHdpdGhvdXQgYnJlYWtpbmcgdGhlIG9uYm9hcmRpbmcgdG91clxuICovXG5cbihmdW5jdGlvbih3aW5kb3cpIHtcbiAgJ3VzZSBzdHJpY3QnO1xuXG4gIGNsYXNzIEVycm9ySGFuZGxlciB7XG4gICAgY29uc3RydWN0b3IoKSB7XG4gICAgICB0aGlzLmVycm9ycyA9IFtdO1xuICAgICAgdGhpcy5tYXhFcnJvcnMgPSA1MDsgLy8gS2VlcCBsYXN0IDUwIGVycm9yc1xuICAgIH1cblxuICAgIC8qKlxuICAgICAqIExvZyBhbiBlcnJvciB3aXRob3V0IGJyZWFraW5nIHRoZSB0b3VyXG4gICAgICogQHBhcmFtIHtzdHJpbmd9IGNvbnRleHQgLSBDb250ZXh0IHdoZXJlIGVycm9yIG9jY3VycmVkXG4gICAgICogQHBhcmFtIHtFcnJvcnxzdHJpbmd9IGVycm9yIC0gVGhlIGVycm9yIG9iamVjdCBvciBtZXNzYWdlXG4gICAgICogQHBhcmFtIHtPYmplY3R9IG1ldGFkYXRhIC0gQWRkaXRpb25hbCBtZXRhZGF0YVxuICAgICAqL1xuICAgIGxvZ0Vycm9yKGNvbnRleHQsIGVycm9yLCBtZXRhZGF0YSA9IHt9KSB7XG4gICAgICBjb25zdCBlcnJvckVudHJ5ID0ge1xuICAgICAgICB0aW1lc3RhbXA6IG5ldyBEYXRlKCkudG9JU09TdHJpbmcoKSxcbiAgICAgICAgY29udGV4dCxcbiAgICAgICAgbWVzc2FnZTogZXJyb3IgaW5zdGFuY2VvZiBFcnJvciA/IGVycm9yLm1lc3NhZ2UgOiBlcnJvcixcbiAgICAgICAgc3RhY2s6IGVycm9yIGluc3RhbmNlb2YgRXJyb3IgPyBlcnJvci5zdGFjayA6IG51bGwsXG4gICAgICAgIG1ldGFkYXRhXG4gICAgICB9O1xuXG4gICAgICAvLyBBZGQgdG8gZXJyb3JzIGFycmF5XG4gICAgICB0aGlzLmVycm9ycy5wdXNoKGVycm9yRW50cnkpO1xuXG4gICAgICAvLyBLZWVwIG9ubHkgbGFzdCBtYXhFcnJvcnNcbiAgICAgIGlmICh0aGlzLmVycm9ycy5sZW5ndGggPiB0aGlzLm1heEVycm9ycykge1xuICAgICAgICB0aGlzLmVycm9ycy5zaGlmdCgpO1xuICAgICAgfVxuXG4gICAgICAvLyBMb2cgdG8gY29uc29sZVxuICAgICAgY29uc29sZS5lcnJvcihgW09uYm9hcmRpbmcgRXJyb3JdICR7Y29udGV4dH06YCwgZXJyb3IsIG1ldGFkYXRhKTtcblxuICAgICAgLy8gT3B0aW9uYWxseSBzZW5kIHRvIGVycm9yIHRyYWNraW5nIHNlcnZpY2VcbiAgICAgIC8vIHRoaXMuc2VuZFRvRXJyb3JUcmFja2luZyhlcnJvckVudHJ5KTtcbiAgICB9XG5cbiAgICAvKipcbiAgICAgKiBBdHRlbXB0IHRvIHJlY292ZXIgZnJvbSBhbiBlcnJvciBhbmQgY29udGludWUgdG91clxuICAgICAqIEBwYXJhbSB7RXJyb3J9IGVycm9yIC0gVGhlIGVycm9yIG9iamVjdFxuICAgICAqIEBwYXJhbSB7bnVtYmVyfSBjdXJyZW50U3RlcCAtIEN1cnJlbnQgc3RlcCBpbmRleFxuICAgICAqIEByZXR1cm5zIHtPYmplY3R9IFJlY292ZXJ5IGFjdGlvblxuICAgICAqL1xuICAgIHJlY292ZXJGcm9tRXJyb3IoZXJyb3IsIGN1cnJlbnRTdGVwKSB7XG4gICAgICBjb25zdCBlcnJvclR5cGUgPSB0aGlzLmNsYXNzaWZ5RXJyb3IoZXJyb3IpO1xuXG4gICAgICBzd2l0Y2ggKGVycm9yVHlwZSkge1xuICAgICAgICBjYXNlICdFTEVNRU5UX05PVF9GT1VORCc6XG4gICAgICAgICAgdGhpcy5sb2dFcnJvcignRWxlbWVudCBOb3QgRm91bmQnLCBlcnJvciwgeyBjdXJyZW50U3RlcCB9KTtcbiAgICAgICAgICByZXR1cm4geyBcbiAgICAgICAgICAgIGFjdGlvbjogJ1NLSVBfU1RFUCcsIFxuICAgICAgICAgICAgbmV4dFN0ZXA6IGN1cnJlbnRTdGVwICsgMSxcbiAgICAgICAgICAgIG1lc3NhZ2U6ICdUYXJnZXQgZWxlbWVudCBub3QgZm91bmQsIHNraXBwaW5nIHRvIG5leHQgc3RlcCdcbiAgICAgICAgICB9O1xuXG4gICAgICAgIGNhc2UgJ1NUT1JBR0VfVU5BVkFJTEFCTEUnOlxuICAgICAgICAgIHRoaXMubG9nRXJyb3IoJ1N0b3JhZ2UgVW5hdmFpbGFibGUnLCBlcnJvcik7XG4gICAgICAgICAgcmV0dXJuIHsgXG4gICAgICAgICAgICBhY3Rpb246ICdVU0VfTUVNT1JZX1NUT1JBR0UnLFxuICAgICAgICAgICAgbWVzc2FnZTogJ0xvY2FsIHN0b3JhZ2UgdW5hdmFpbGFibGUsIHVzaW5nIGluLW1lbW9yeSBzdG9yYWdlJ1xuICAgICAgICAgIH07XG5cbiAgICAgICAgY2FzZSAnRFJJVkVSX05PVF9MT0FERUQnOlxuICAgICAgICAgIHRoaXMubG9nRXJyb3IoJ0RyaXZlci5qcyBOb3QgTG9hZGVkJywgZXJyb3IpO1xuICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICBhY3Rpb246ICdBQk9SVF9UT1VSJyxcbiAgICAgICAgICAgIG1lc3NhZ2U6ICdEcml2ZXIuanMgbGlicmFyeSBub3QgbG9hZGVkLCBjYW5ub3Qgc3RhcnQgdG91cidcbiAgICAgICAgICB9O1xuXG4gICAgICAgIGNhc2UgJ0lOVkFMSURfVE9PTFRJUCc6XG4gICAgICAgICAgdGhpcy5sb2dFcnJvcignSW52YWxpZCBUb29sdGlwIENvbmZpZ3VyYXRpb24nLCBlcnJvciwgeyBjdXJyZW50U3RlcCB9KTtcbiAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgYWN0aW9uOiAnU0tJUF9TVEVQJyxcbiAgICAgICAgICAgIG5leHRTdGVwOiBjdXJyZW50U3RlcCArIDEsXG4gICAgICAgICAgICBtZXNzYWdlOiAnSW52YWxpZCB0b29sdGlwIGNvbmZpZ3VyYXRpb24sIHNraXBwaW5nJ1xuICAgICAgICAgIH07XG5cbiAgICAgICAgY2FzZSAnVEhFTUVfREVURUNUSU9OX0ZBSUxFRCc6XG4gICAgICAgICAgdGhpcy5sb2dFcnJvcignVGhlbWUgRGV0ZWN0aW9uIEZhaWxlZCcsIGVycm9yKTtcbiAgICAgICAgICByZXR1cm4ge1xuICAgICAgICAgICAgYWN0aW9uOiAnVVNFX0RFRkFVTFRfVEhFTUUnLFxuICAgICAgICAgICAgbWVzc2FnZTogJ1VzaW5nIGRlZmF1bHQgZGFyayB0aGVtZSdcbiAgICAgICAgICB9O1xuXG4gICAgICAgIGRlZmF1bHQ6XG4gICAgICAgICAgdGhpcy5sb2dFcnJvcignVW5rbm93biBFcnJvcicsIGVycm9yLCB7IGN1cnJlbnRTdGVwIH0pO1xuICAgICAgICAgIHJldHVybiB7XG4gICAgICAgICAgICBhY3Rpb246ICdBQk9SVF9UT1VSJyxcbiAgICAgICAgICAgIG1lc3NhZ2U6ICdVbmV4cGVjdGVkIGVycm9yIG9jY3VycmVkLCBhYm9ydGluZyB0b3VyJ1xuICAgICAgICAgIH07XG4gICAgICB9XG4gICAgfVxuXG4gICAgLyoqXG4gICAgICogQ2xhc3NpZnkgZXJyb3IgdHlwZVxuICAgICAqIEBwcml2YXRlXG4gICAgICogQHBhcmFtIHtFcnJvcn0gZXJyb3IgLSBUaGUgZXJyb3Igb2JqZWN0XG4gICAgICogQHJldHVybnMge3N0cmluZ30gRXJyb3IgdHlwZVxuICAgICAqL1xuICAgIGNsYXNzaWZ5RXJyb3IoZXJyb3IpIHtcbiAgICAgIGNvbnN0IG1lc3NhZ2UgPSBlcnJvci5tZXNzYWdlIHx8IGVycm9yLnRvU3RyaW5nKCk7XG5cbiAgICAgIGlmIChtZXNzYWdlLmluY2x1ZGVzKCdlbGVtZW50JykgJiYgbWVzc2FnZS5pbmNsdWRlcygnbm90IGZvdW5kJykpIHtcbiAgICAgICAgcmV0dXJuICdFTEVNRU5UX05PVF9GT1VORCc7XG4gICAgICB9XG4gICAgICBpZiAobWVzc2FnZS5pbmNsdWRlcygnc3RvcmFnZScpIHx8IG1lc3NhZ2UuaW5jbHVkZXMoJ3F1b3RhJykpIHtcbiAgICAgICAgcmV0dXJuICdTVE9SQUdFX1VOQVZBSUxBQkxFJztcbiAgICAgIH1cbiAgICAgIGlmIChtZXNzYWdlLmluY2x1ZGVzKCdkcml2ZXInKSB8fCBtZXNzYWdlLmluY2x1ZGVzKCd1bmRlZmluZWQnKSkge1xuICAgI
Line truncated
|
||||||
+2
-2
@@ -282,7 +282,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<span class="name" data-i18n="card.auth">Auth</span>
|
<span class="name" data-i18n="card.auth">Auth</span>
|
||||||
<span class="spacer"></span>
|
<span class="spacer"></span>
|
||||||
<span id="auth-pill" class="badge off" data-i18n-live-status="yesno">NO</span>
|
<span id="auth-pill" class="badge off" data-i18n-live-status="onoff">OFF</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="response-row">
|
<div class="response-row">
|
||||||
<span id="auth-status-text" class="response-time" style="font-size: 0.7rem;" data-i18n="card.auth.not_configured">Not configured</span>
|
<span id="auth-status-text" class="response-time" style="font-size: 0.7rem;" data-i18n="card.auth.not_configured">Not configured</span>
|
||||||
@@ -311,7 +311,7 @@
|
|||||||
<span id="tailscale-summary" class="response-time" style="font-size: 0.7rem;">Loading…</span>
|
<span id="tailscale-summary" class="response-time" style="font-size: 0.7rem;">Loading…</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="btn-row">
|
<div class="btn-row">
|
||||||
<button id="tailscale-refresh-btn" title="Refresh device list">↻</button>
|
<button id="tailscale-refresh-btn" title="Refresh device list" aria-label="Refresh Tailscale device list">↻</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
@@ -219,6 +219,7 @@
|
|||||||
if (s.containerId) {
|
if (s.containerId) {
|
||||||
const logsBtn = el('button', 'logs-btn', '📋');
|
const logsBtn = el('button', 'logs-btn', '📋');
|
||||||
logsBtn.title = 'View container logs';
|
logsBtn.title = 'View container logs';
|
||||||
|
logsBtn.setAttribute('aria-label', `View container logs for ${s.name}`);
|
||||||
logsBtn.onclick = (e) => {
|
logsBtn.onclick = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
window.openContainerLogsModal(s.containerId, s.name);
|
window.openContainerLogsModal(s.containerId, s.name);
|
||||||
@@ -229,6 +230,7 @@
|
|||||||
const updateBtn = el('button', 'update-btn', '⬆️');
|
const updateBtn = el('button', 'update-btn', '⬆️');
|
||||||
updateBtn.title = 'Update container to latest version';
|
updateBtn.title = 'Update container to latest version';
|
||||||
updateBtn.id = `update-btn-${s.id}`;
|
updateBtn.id = `update-btn-${s.id}`;
|
||||||
|
updateBtn.setAttribute('aria-label', `Update ${s.name} container`);
|
||||||
updateBtn.onclick = (e) => {
|
updateBtn.onclick = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
window.updateContainer(s.containerId, s.name, s.id);
|
window.updateContainer(s.containerId, s.name, s.id);
|
||||||
@@ -238,6 +240,7 @@
|
|||||||
// Terminal exec button (subtle — visible on hover)
|
// Terminal exec button (subtle — visible on hover)
|
||||||
const execBtn = el('button', 'exec-btn', '>_');
|
const execBtn = el('button', 'exec-btn', '>_');
|
||||||
execBtn.title = 'Open terminal';
|
execBtn.title = 'Open terminal';
|
||||||
|
execBtn.setAttribute('aria-label', `Open terminal for ${s.name}`);
|
||||||
execBtn.onclick = (e) => {
|
execBtn.onclick = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (window.openExecModal) window.openExecModal(s.containerId, s.name);
|
if (window.openExecModal) window.openExecModal(s.containerId, s.name);
|
||||||
@@ -249,6 +252,7 @@
|
|||||||
if (s.logPath && !s.containerId) {
|
if (s.logPath && !s.containerId) {
|
||||||
const logsBtn = el('button', 'logs-btn', '📋');
|
const logsBtn = el('button', 'logs-btn', '📋');
|
||||||
logsBtn.title = 'View application logs';
|
logsBtn.title = 'View application logs';
|
||||||
|
logsBtn.setAttribute('aria-label', `View application logs for ${s.name}`);
|
||||||
logsBtn.onclick = (e) => {
|
logsBtn.onclick = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
window.openFileLogsModal(s.logPath, s.name);
|
window.openFileLogsModal(s.logPath, s.name);
|
||||||
@@ -261,6 +265,7 @@
|
|||||||
const credsBtn = el('button', 'creds-btn', '🔑');
|
const credsBtn = el('button', 'creds-btn', '🔑');
|
||||||
credsBtn.title = 'Auto-login credentials';
|
credsBtn.title = 'Auto-login credentials';
|
||||||
credsBtn.id = `creds-btn-${s.id}`;
|
credsBtn.id = `creds-btn-${s.id}`;
|
||||||
|
credsBtn.setAttribute('aria-label', `Manage auto-login credentials for ${s.name}`);
|
||||||
credsBtn.onclick = (e) => {
|
credsBtn.onclick = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
window.openServiceCredsModal(s);
|
window.openServiceCredsModal(s);
|
||||||
@@ -272,6 +277,7 @@
|
|||||||
if (s.id !== 'internet') {
|
if (s.id !== 'internet') {
|
||||||
const optBtn = el('button', 'options-btn', '⚙️');
|
const optBtn = el('button', 'options-btn', '⚙️');
|
||||||
optBtn.title = 'Edit service settings';
|
optBtn.title = 'Edit service settings';
|
||||||
|
optBtn.setAttribute('aria-label', `Edit settings for ${s.name}`);
|
||||||
optBtn.onclick = (e) => {
|
optBtn.onclick = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
window.openServiceEditModal(s);
|
window.openServiceEditModal(s);
|
||||||
@@ -287,6 +293,7 @@
|
|||||||
if (s.id !== 'internet') {
|
if (s.id !== 'internet') {
|
||||||
const shareBtn = el('button', 'share-btn', '🔗');
|
const shareBtn = el('button', 'share-btn', '🔗');
|
||||||
shareBtn.title = 'Share this service (Pro)';
|
shareBtn.title = 'Share this service (Pro)';
|
||||||
|
shareBtn.setAttribute('aria-label', `Share ${s.name} (Pro)`);
|
||||||
shareBtn.onclick = (e) => {
|
shareBtn.onclick = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (typeof window.openShareModal === 'function') {
|
if (typeof window.openShareModal === 'function') {
|
||||||
@@ -302,6 +309,7 @@
|
|||||||
if (s.id !== 'internet') {
|
if (s.id !== 'internet') {
|
||||||
const delBtn = el('button', 'delete-btn', '🗑️');
|
const delBtn = el('button', 'delete-btn', '🗑️');
|
||||||
delBtn.title = 'Delete this service';
|
delBtn.title = 'Delete this service';
|
||||||
|
delBtn.setAttribute('aria-label', `Delete ${s.name}`);
|
||||||
delBtn.onclick = (e) => {
|
delBtn.onclick = (e) => {
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
window.deleteService(s.id, s.name);
|
window.deleteService(s.id, s.name);
|
||||||
@@ -310,6 +318,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const btn = el('button', null, 'Open');
|
const btn = el('button', null, 'Open');
|
||||||
|
btn.setAttribute('aria-label', `Open ${s.name}`);
|
||||||
btn.setAttribute('data-i18n', 'action.open');
|
btn.setAttribute('data-i18n', 'action.open');
|
||||||
btn.onclick = () => window.open(serviceUrl(s.id), '_blank', 'noopener');
|
btn.onclick = () => window.open(serviceUrl(s.id), '_blank', 'noopener');
|
||||||
btnRow.appendChild(btn);
|
btnRow.appendChild(btn);
|
||||||
|
|||||||
@@ -56,12 +56,16 @@
|
|||||||
|
|
||||||
if (!installed) {
|
if (!installed) {
|
||||||
card.setAttribute('data-status', 'off');
|
card.setAttribute('data-status', 'off');
|
||||||
|
// DC-171-UX: collapse the dead card to a slim single row — a full grid
|
||||||
|
// slot saying "not installed" is noise on every load
|
||||||
|
card.classList.add('card-collapsed-unavailable');
|
||||||
dot.className = 'dot bad at-bl';
|
dot.className = 'dot bad at-bl';
|
||||||
pill.className = 'badge off';
|
pill.className = 'badge off';
|
||||||
pill.textContent = 'N/A';
|
pill.textContent = 'N/A';
|
||||||
summary.textContent = 'Tailscale not installed';
|
summary.textContent = 'Tailscale not installed';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
card.classList.remove('card-collapsed-unavailable');
|
||||||
if (!connected) {
|
if (!connected) {
|
||||||
card.setAttribute('data-status', 'off');
|
card.setAttribute('data-status', 'off');
|
||||||
dot.className = 'dot bad at-bl';
|
dot.className = 'dot bad at-bl';
|
||||||
|
|||||||
@@ -184,13 +184,13 @@
|
|||||||
if (active) {
|
if (active) {
|
||||||
card.setAttribute('data-status', 'on');
|
card.setAttribute('data-status', 'on');
|
||||||
pill.className = 'badge on';
|
pill.className = 'badge on';
|
||||||
pill.textContent = translated('card.status.yes', 'YES');
|
pill.textContent = translated('card.status.on', 'ON');
|
||||||
dot.className = 'dot ok at-bl';
|
dot.className = 'dot ok at-bl';
|
||||||
statusText.textContent = 'Session: ' + (DURATION_LABELS[duration] || duration);
|
statusText.textContent = 'Session: ' + (DURATION_LABELS[duration] || duration);
|
||||||
} else {
|
} else {
|
||||||
card.setAttribute('data-status', 'off');
|
card.setAttribute('data-status', 'off');
|
||||||
pill.className = 'badge off';
|
pill.className = 'badge off';
|
||||||
pill.textContent = translated('card.status.no', 'NO');
|
pill.textContent = translated('card.status.off', 'OFF');
|
||||||
dot.className = 'dot bad at-bl';
|
dot.className = 'dot bad at-bl';
|
||||||
statusText.textContent = translated('card.auth.not_configured', 'Not configured');
|
statusText.textContent = translated('card.auth.not_configured', 'Not configured');
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
const CACHE = 'dashcaddy-shell-e90de1c239';
|
const CACHE = 'dashcaddy-shell-da61d3a0a1';
|
||||||
const PRECACHE = [
|
const PRECACHE = [
|
||||||
'/',
|
'/',
|
||||||
'/index.html',
|
'/index.html',
|
||||||
|
|||||||
Reference in new issue
Block a user