56eaf57649
- Fix modal scroll: restructure overlay with scroll/centering wrapper - Add SSH key textarea + file upload to host modal (authType='key') - Fix textarea reset on new host (clear via DOM) - SSH username placeholder instead of default 'root' - Nav uses plain <a href> instead of HTMX for full-page navigation - /hosts route returns full page; /hosts/list for HTMX partials - Remove OS and Provider from host modal, grid card, and list card - Fix key modal x-data scope for Alpine $dispatch - Update key_grid to display multi-line key content properly - Simplify SSH key placeholder format
144 lines
9.7 KiB
HTML
144 lines
9.7 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Keychain · Hostkeeper V2</title>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@300;400;500;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="/static/css/output.css">
|
|
<link rel="stylesheet" href="/static/css/custom.css">
|
|
<script src="/static/js/htmx.min.js"></script>
|
|
<script src="/static/js/alpine.min.js" defer></script>
|
|
<script src="/static/js/clipboard.js"></script>
|
|
<script src="/static/js/utils.js"></script>
|
|
</head>
|
|
<body class="bg-surface text-on-surface antialiased dot-grid min-h-screen">
|
|
<div class="flex min-h-screen">
|
|
{{template "nav" .}}
|
|
<div class="flex-1 flex flex-col overflow-hidden">
|
|
<header class="h-14 border-b border-outline-variant/30 flex items-center px-6 bg-white/70 backdrop-blur-md">
|
|
<h1 class="text-lg font-semibold text-on-surface">{{.Title}}</h1>
|
|
</header>
|
|
<main id="main-content" class="flex-1 overflow-auto p-6" x-data>
|
|
<div class="max-w-7xl mx-auto space-y-8">
|
|
<!-- Header Panel -->
|
|
<div class="flex flex-col sm:flex-row sm:items-center justify-between gap-4 border-b border-outline-variant/30 pb-4">
|
|
<div>
|
|
<h2 class="text-xl font-bold text-on-surface tracking-tight">Keychain & Credentials</h2>
|
|
<p class="text-xs text-on-surface-variant mt-0.5">Secure sandbox containing cluster credentials, private SSH keys, and tokens</p>
|
|
</div>
|
|
<div class="flex items-center gap-3">
|
|
<div class="relative">
|
|
<svg class="absolute left-3 top-1/2 -translate-y-1/2 text-outline w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z"/></svg>
|
|
<input type="search" name="q" placeholder="Search credentials..."
|
|
hx-get="/keys/grid" hx-trigger="keyup delay:200ms" hx-target="#key-grid"
|
|
class="pl-9 pr-4 py-1.5 rounded-full bg-surface-container-low border border-outline-variant/30 text-sm focus:border-primary focus:bg-white focus:outline-none focus:ring-1 focus:ring-primary w-48 sm:w-60 transition-all">
|
|
</div>
|
|
<button @click="$dispatch('open-key-modal')"
|
|
class="flex items-center gap-1.5 bg-primary text-white hover:bg-primary/90 font-bold text-xs py-2 px-4 rounded-xl shadow-md transition-all">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 4v16m8-8H4"/></svg>
|
|
Add Key
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Grid List -->
|
|
<div class="grid grid-cols-1 md:grid-cols-2 gap-6" id="key-grid">
|
|
{{template "credential_grid" .}}
|
|
</div>
|
|
|
|
<!-- Security Advisory Bento -->
|
|
<div class="p-5 border border-outline-variant/60 rounded-2xl bg-white/40 flex items-start gap-4 text-xs text-on-surface">
|
|
<svg class="w-5 h-5 text-primary shrink-0 mt-0.5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
|
|
<div class="space-y-1">
|
|
<h4 class="font-bold text-on-surface">HostKeeper Security Policy & Local Sandbox</h4>
|
|
<p class="text-on-surface-variant leading-relaxed">
|
|
Keys are parsed locally inside your isolated browser environment and transmitted strictly within cryptographically verified SSH tunnels. Passphrases are hashed with Argon2id instantly and never touch intermediate telemetry systems.
|
|
</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Add Credential Modal -->
|
|
<div id="key-modal" class="fixed inset-0 z-50" x-show="open" x-cloak
|
|
x-data="{ open: false, readFile($event) {
|
|
const file = $event.target.files[0];
|
|
if (!file) return;
|
|
const reader = new FileReader();
|
|
reader.onload = (e) => {
|
|
document.querySelector('textarea[name=passphrase]').value = e.target.result;
|
|
document.querySelector('textarea[name=passphrase]').dispatchEvent(new Event('input'));
|
|
};
|
|
reader.readAsText(file);
|
|
}}"
|
|
@open-key-modal.window="open = true" @keydown.escape.window="open = false">
|
|
<div class="absolute inset-0 bg-black/40 backdrop-blur-sm" @click="open = false"></div>
|
|
<div class="absolute inset-0 flex items-center justify-center p-4" x-show="open" x-transition>
|
|
<div class="bg-white rounded-2xl max-w-lg w-full border border-outline-variant/30 shadow-2xl max-h-[90vh] overflow-y-auto">
|
|
|
|
<div class="flex justify-between items-center border-b border-outline-variant/30 p-6 pb-4">
|
|
<h3 class="font-bold text-lg text-on-surface">Register Secure Credential</h3>
|
|
<button @click="open = false" class="text-outline hover:text-primary cursor-pointer p-1 rounded-lg">
|
|
<svg class="w-5 h-5" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M6 18L18 6M6 6l12 12"/></svg>
|
|
</button>
|
|
</div>
|
|
|
|
<form hx-post="/keys" hx-target="#key-grid" hx-swap="innerHTML"
|
|
@submit="open = false" class="p-6 space-y-4 text-sm">
|
|
<div class="flex flex-col gap-1.5">
|
|
<label class="text-xs font-bold text-on-surface-variant uppercase">Credential Name / Label</label>
|
|
<input type="text" name="name" required placeholder="e.g. key_aws_alex"
|
|
class="w-full bg-surface-container-low border border-outline-variant/40 rounded-lg py-2.5 px-4 focus:ring-2 focus:ring-primary/20 focus:border-primary focus:outline-none transition-all font-medium text-on-surface">
|
|
</div>
|
|
|
|
<div class="grid grid-cols-2 gap-4">
|
|
<div class="flex flex-col gap-1.5">
|
|
<label class="text-xs font-bold text-on-surface-variant uppercase">Credential Type</label>
|
|
<select name="type"
|
|
class="bg-surface-container-low border border-outline-variant/40 rounded-lg py-2 px-3 focus:outline-none focus:border-primary text-sm text-on-surface">
|
|
<option value="ED25519">ED25519 (Modern)</option>
|
|
<option value="SSH RSA">SSH RSA (Legacy)</option>
|
|
<option value="PASSWORD">Master Password</option>
|
|
<option value="Bearer Token">Bearer Token</option>
|
|
<option value="AWS Key">AWS Access Key</option>
|
|
</select>
|
|
</div>
|
|
<div class="flex flex-col gap-1.5">
|
|
<label class="text-xs font-bold text-on-surface-variant uppercase">Login Username</label>
|
|
<input type="text" name="username" required placeholder="e.g. root or ubuntu"
|
|
class="w-full bg-surface-container-low border border-outline-variant/40 rounded-lg py-2.5 px-3 focus:outline-none focus:border-primary text-on-surface">
|
|
</div>
|
|
</div>
|
|
|
|
<div class="flex flex-col gap-1.5">
|
|
<label class="text-xs font-bold text-on-surface-variant uppercase">Key / Secret Value</label>
|
|
<textarea name="passphrase" required rows="5"
|
|
placeholder="Paste your key or secret here... Example SSH key: -----BEGIN OPENSSH PRIVATE KEY----- b3BlbnNzaC1rZXktdjEAAAAIA... -----END OPENSSH PRIVATE KEY-----"
|
|
class="w-full bg-surface-container-low border border-outline-variant/40 rounded-lg py-2.5 px-4 focus:ring-2 focus:ring-primary/20 focus:border-primary focus:outline-none transition-all font-mono text-on-surface text-xs resize-none leading-relaxed"></textarea>
|
|
<div class="flex items-center gap-3 mt-1">
|
|
<label class="flex items-center gap-1.5 text-xs text-on-surface-variant cursor-pointer hover:text-primary transition-colors">
|
|
<svg class="w-4 h-4" fill="none" stroke="currentColor" viewBox="0 0 24 24"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12"/></svg>
|
|
Or upload a key file
|
|
</label>
|
|
<input type="file" class="hidden" accept=".pem,.key,.pub,.txt,.ppk,.p12,.pfx" @change="readFile($event)">
|
|
<span class="text-[10px] text-outline">.pem .key .ppk .pub .txt</span>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="pt-4 flex justify-end gap-3 border-t border-outline-variant/20">
|
|
<button type="button" @click="open = false"
|
|
class="px-4 py-2 text-xs font-bold text-outline hover:text-on-surface transition-colors">Cancel</button>
|
|
<button type="submit"
|
|
class="bg-primary text-white py-2 px-5 rounded-lg font-bold text-xs shadow-md hover:bg-primary-container hover:text-on-primary-container transition-all">Save Credential</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|