generated from sendnrw/template_golang
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 59d8fb3e5d | |||
| a2cb8450e2 |
173
main.go
173
main.go
@@ -359,25 +359,99 @@ var page = template.Must(template.New("index").Parse(`<!doctype html>
|
||||
<meta name="viewport" content="width=device-width,initial-scale=1">
|
||||
<title>Windows Systeminfo</title>
|
||||
<style>
|
||||
:root { --bg:#000000; --fg:#e7eefc; --muted:#a3b1cc; --card:#111a2e; --accent:#5aa9ff; }
|
||||
:root {
|
||||
--bg: #f5f6f8;
|
||||
--fg: #121826;
|
||||
--muted: #5d6b82;
|
||||
--card: #ffffff;
|
||||
--accent: #0066ff;
|
||||
--border: rgba(12, 21, 37, 0.08);
|
||||
}
|
||||
*{box-sizing:border-box}
|
||||
body{max-width:980px;margin:0 auto;padding:24px;font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif;background:var(--bg);color:var(--fg)}
|
||||
h1{font-size:22px;margin:0 0 16px 0}
|
||||
body{
|
||||
max-width:1200px;
|
||||
margin:0 auto;
|
||||
padding:24px;
|
||||
font-family:system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif;
|
||||
background:var(--bg);
|
||||
color:var(--fg);
|
||||
}
|
||||
h1{font-size:22px;margin:0 0 6px 0}
|
||||
h2{margin:0 0 16px 0}
|
||||
.grid{display:flex;flex-direction:column;gap:12px}
|
||||
.card{width:100%}
|
||||
.k{font-size:16px;color:var(--muted);text-transform:uppercase;letter-spacing:.06em}
|
||||
.card{
|
||||
width:100%;
|
||||
background:var(--card);
|
||||
border:1px solid var(--border);
|
||||
border-radius:16px;
|
||||
padding:14px 16px 10px 16px;
|
||||
box-shadow:0 10px 30px rgba(15,23,42,0.03);
|
||||
}
|
||||
.k{font-size:13px;color:var(--muted);text-transform:uppercase;letter-spacing:.06em;margin-bottom:4px}
|
||||
.v{font-weight:600}
|
||||
.row{display:flex;justify-content:space-between;gap:8px;align-items:center;margin:6px 0}
|
||||
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace}
|
||||
.stereo{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;color: #ffd500ff}
|
||||
.pill{display:inline-block;background: #0b2547;color: #00ff2aff;border-radius:999px;padding:2px 8px;margin:2px 6px 0 0;font-size:14px}
|
||||
.pill2{display:inline-block;background: #ffe100ff;color: #282828ff;border-radius:999px;padding:2px 8px;margin:2px 6px 0 0;font-size:14px}
|
||||
.bar{height:10px;background:#091428;border-radius:999px;overflow:hidden}
|
||||
.fill{height:100%;background:var(--accent);width:0%}
|
||||
.stereo{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;color: #ff0000ff}
|
||||
.pill{
|
||||
display:inline-block;
|
||||
background:#e8f1ff;
|
||||
color:#0047cc;
|
||||
border-radius:999px;
|
||||
padding:2px 8px;
|
||||
margin:2px 6px 0 0;
|
||||
font-size:14px;
|
||||
}
|
||||
.pill2{
|
||||
display:inline-block;
|
||||
background:#ffe480;
|
||||
color:#3e3e3e;
|
||||
border-radius:999px;
|
||||
padding:2px 8px;
|
||||
margin:2px 6px 0 0;
|
||||
font-size:14px;
|
||||
}
|
||||
.bar{
|
||||
height:10px;
|
||||
background:#edf0f5;
|
||||
border-radius:999px;
|
||||
overflow:hidden;
|
||||
}
|
||||
.fill{
|
||||
height:100%;
|
||||
background:var(--accent);
|
||||
width:0%;
|
||||
transition:width .3s ease-out;
|
||||
}
|
||||
footer{margin-top:18px;color:var(--muted);font-size:12px}
|
||||
.disks table{width:100%;border-collapse:collapse}
|
||||
.disks th,.disks td{padding:8px;border-bottom:1px solid #1b2a4a;text-align:left;font-size:14px}
|
||||
|
||||
.disks th,.disks td{
|
||||
padding:8px;
|
||||
border-bottom:1px solid #e5e9f2;
|
||||
text-align:left;
|
||||
font-size:14px
|
||||
}
|
||||
.disks th{background:#f5f6f8;font-weight:500}
|
||||
button#btnLoadApps{
|
||||
border:none;
|
||||
background:#e8f1ff;
|
||||
color:#0047cc;
|
||||
font-weight:500;
|
||||
}
|
||||
input#appsFilter{
|
||||
background:#ffffff;
|
||||
color:var(--fg);
|
||||
border:1px solid #d0d7e2;
|
||||
border-radius:8px;
|
||||
}
|
||||
table thead th{font-size:13px;color:#3b4560}
|
||||
@media (prefers-color-scheme: dark) {
|
||||
/* optional: falls Host dunkles Theme erzwingt */
|
||||
:root {
|
||||
--bg:#f5f6f8;
|
||||
--fg:#121826;
|
||||
--card:#ffffff;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
@@ -429,28 +503,28 @@ var page = template.Must(template.New("index").Parse(`<!doctype html>
|
||||
<tbody id="disks"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="k">Installierte Programme</div>
|
||||
<div class="row" style="gap:8px;align-items:center;">
|
||||
<button id="btnLoadApps" class="pill" style="cursor:pointer;">Laden</button>
|
||||
<input id="appsFilter" type="text" placeholder="Suchen …"
|
||||
style="flex:1;padding:6px 10px;border-radius:8px;border:1px solid #1b2a4a;background:#0b1220;color:var(--fg)">
|
||||
<span class="k" id="appsCount"></span>
|
||||
</div>
|
||||
<div class="apps">
|
||||
<table style="width:100%;border-collapse:collapse">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align:left;padding:8px;border-bottom:1px solid #1b2a4a">Name</th>
|
||||
<th style="text-align:left;padding:8px;border-bottom:1px solid #1b2a4a">Version</th>
|
||||
<th style="text-align:left;padding:8px;border-bottom:1px solid #1b2a4a">Publisher</th>
|
||||
<th style="text-align:left;padding:8px;border-bottom:1px solid #1b2a4a">Quelle</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="apps"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card">
|
||||
<div class="k">Installierte Programme</div>
|
||||
<div class="row" style="gap:8px;align-items:center;">
|
||||
<button id="btnLoadApps" class="pill" style="cursor:pointer;">Laden</button>
|
||||
<input id="appsFilter" type="text" placeholder="Suchen …"
|
||||
style="flex:1;padding:6px 10px;">
|
||||
<span class="k" id="appsCount"></span>
|
||||
</div>
|
||||
<div class="apps">
|
||||
<table style="width:100%;border-collapse:collapse">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="text-align:left;padding:8px;border-bottom:1px solid #e5e9f2">Name</th>
|
||||
<th style="text-align:left;padding:8px;border-bottom:1px solid #e5e9f2">Version</th>
|
||||
<th style="text-align:left;padding:8px;border-bottom:1px solid #e5e9f2">Publisher</th>
|
||||
<th style="text-align:left;padding:8px;border-bottom:1px solid #e5e9f2">Quelle</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="apps"></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<footer>Aktualisiert alle 2s</footer>
|
||||
@@ -466,7 +540,7 @@ async function load(){
|
||||
const j = await r.json();
|
||||
|
||||
document.getElementById('hostname').textContent = j.hostname || '-';
|
||||
document.getElementById('hostname2').textContent = j.hostname || '-';
|
||||
document.getElementById('hostname2').textContent = j.hostname || '-';
|
||||
document.getElementById('username').textContent = j.username || '-';
|
||||
document.getElementById('uptime').textContent = hms(j.uptime_seconds);
|
||||
document.getElementById('boottime').textContent = j.boot_time ? new Date(j.boot_time).toLocaleString() : '-';
|
||||
@@ -492,14 +566,13 @@ async function load(){
|
||||
(j.interfaces||[]).forEach(n=>{
|
||||
const div = document.createElement('div');
|
||||
div.innerHTML = '<div class="row"><div>'+n.name+'</div><div class="mono">'+(n.mac||'-')+'</div></div>';
|
||||
if (n.profile) {
|
||||
const p = document.createElement('span');
|
||||
p.className = 'pill2';
|
||||
p.textContent = n.profile;
|
||||
div.appendChild(p);
|
||||
}
|
||||
if (n.profile) {
|
||||
const p = document.createElement('span');
|
||||
p.className = 'pill2';
|
||||
p.textContent = n.profile;
|
||||
div.appendChild(p);
|
||||
}
|
||||
(n.addresses||[]).forEach(ip=>{ const span=document.createElement('span'); span.className='pill mono'; span.textContent=ip; div.appendChild(span); });
|
||||
|
||||
wrap.appendChild(div);
|
||||
});
|
||||
|
||||
@@ -523,10 +596,10 @@ function renderApps(list){
|
||||
(list||[]).forEach(a=>{
|
||||
const tr = document.createElement('tr');
|
||||
tr.innerHTML =
|
||||
'<td class="mono" style="padding:6px 8px;border-bottom:1px solid #1b2a4a">'+(a.name||'-')+'</td>'+
|
||||
'<td style="padding:6px 8px;border-bottom:1px solid #1b2a4a">'+(a.version||'')+'</td>'+
|
||||
'<td style="padding:6px 8px;border-bottom:1px solid #1b2a4a">'+(a.publisher||'')+'</td>'+
|
||||
'<td style="padding:6px 8px;border-bottom:1px solid #1b2a4a">'+(a.source||'')+'</td>';
|
||||
'<td class="mono" style="padding:6px 8px;border-bottom:1px solid #e5e9f2">'+(a.name||'-')+'</td>'+
|
||||
'<td style="padding:6px 8px;border-bottom:1px solid #e5e9f2">'+(a.version||'')+'</td>'+
|
||||
'<td style="padding:6px 8px;border-bottom:1px solid #e5e9f2">'+(a.publisher||'')+'</td>'+
|
||||
'<td style="padding:6px 8px;border-bottom:1px solid #e5e9f2">'+(a.source||'')+'</td>';
|
||||
tbody.appendChild(tr);
|
||||
});
|
||||
const c = document.getElementById('appsCount');
|
||||
@@ -534,7 +607,7 @@ function renderApps(list){
|
||||
}
|
||||
|
||||
async function loadAppsOnce(){
|
||||
if(appsCache) return; // schon geladen
|
||||
if(appsCache) return;
|
||||
try{
|
||||
const r = await fetch('/api/apps');
|
||||
appsCache = await r.json();
|
||||
@@ -562,10 +635,10 @@ document.addEventListener('DOMContentLoaded', ()=>{
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>`))
|
||||
</html>
|
||||
`))
|
||||
|
||||
func indexHandler(w http.ResponseWriter, r *http.Request) {
|
||||
w.Header().Set("Content-Type", "text/html; charset=utf-8")
|
||||
@@ -595,7 +668,7 @@ func runHTTP(ctx context.Context) error {
|
||||
mux.HandleFunc("/api/apps", appsHandler)
|
||||
mux.HandleFunc("/api/summary", apiHandler)
|
||||
|
||||
addr := ":24000"
|
||||
addr := "127.0.0.1:24000"
|
||||
|
||||
srv := &http.Server{
|
||||
Addr: addr,
|
||||
|
||||
BIN
pcinfo.exe
BIN
pcinfo.exe
Binary file not shown.
Reference in New Issue
Block a user