fix: UI overhaul — align all HTMX views with Lumina Design System (46 fixes)
- All 7 pages rewritten: Dashboard, Terminal, Snippets, Keychain, SFTP, Settings, Brief - Apply consistent Lumina glassmorphic theme (rounded-2xl, shadows, borders, tracking) - Fix SVG icons not rendering — return template.HTML instead of string - Fix Alpine x-data scoping: terminal tabs, SFTP modals, snippet tag buttons - Fix dashboard search sending literal ?q=... - Rebuild CSS with all new Tailwind classes (62KB) - Add .air.toml with hot-reload config, docs/PERBAIKANUI.md checklist - Remove unused backup partials
This commit is contained in:
@@ -44,13 +44,16 @@ func (s *KeyStore) Search(q string) []model.Key {
|
||||
func (s *KeyStore) Add(name, username, url, passphrase string) model.Key {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
keyType := guessKeyType(name, passphrase)
|
||||
k := model.Key{
|
||||
ID: randID(),
|
||||
Name: name,
|
||||
Username: username,
|
||||
URL: url,
|
||||
Passphrase: passphrase,
|
||||
Strength: calcStrength(passphrase),
|
||||
Type: keyType,
|
||||
URL: url,
|
||||
KeyFile: "— " + keyType + " credential —",
|
||||
CreatedAt: time.Now().Format("Jan 2, 2006"),
|
||||
}
|
||||
s.keys = append(s.keys, k)
|
||||
@@ -58,6 +61,21 @@ func (s *KeyStore) Add(name, username, url, passphrase string) model.Key {
|
||||
return k
|
||||
}
|
||||
|
||||
func guessKeyType(name, passphrase string) string {
|
||||
switch {
|
||||
case len(passphrase) >= 25:
|
||||
return "ED25519"
|
||||
case contains(name, "aws") || contains(name, "AWS"):
|
||||
return "AWS Key"
|
||||
case contains(name, "token") || contains(name, "bearer") || contains(name, "TOKEN"):
|
||||
return "Bearer Token"
|
||||
case len(passphrase) <= 3:
|
||||
return "PASSWORD"
|
||||
default:
|
||||
return "SSH RSA"
|
||||
}
|
||||
}
|
||||
|
||||
func (s *KeyStore) Delete(id string) {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
|
||||
@@ -26,31 +26,47 @@ func (s *SnippetStore) All() []model.Snippet {
|
||||
return s.snippets
|
||||
}
|
||||
|
||||
func (s *SnippetStore) Search(q string) []model.Snippet {
|
||||
func (s *SnippetStore) Search(q, collection, tag string) []model.Snippet {
|
||||
mu.RLock()
|
||||
defer mu.RUnlock()
|
||||
if q == "" {
|
||||
return s.snippets
|
||||
}
|
||||
var res []model.Snippet
|
||||
for _, sn := range s.snippets {
|
||||
if contains(sn.Name, q) || contains(sn.Content, q) || contains(sn.Language, q) {
|
||||
res = append(res, sn)
|
||||
if q != "" && !contains(sn.Name, q) && !contains(sn.Content, q) && !contains(sn.Language, q) {
|
||||
continue
|
||||
}
|
||||
if collection != "" && sn.Collection != collection {
|
||||
continue
|
||||
}
|
||||
if tag != "" {
|
||||
found := false
|
||||
for _, t := range sn.Tags {
|
||||
if t == tag {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !found {
|
||||
continue
|
||||
}
|
||||
}
|
||||
res = append(res, sn)
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func (s *SnippetStore) Add(name, content, language string, tags []string) model.Snippet {
|
||||
func (s *SnippetStore) Add(name, content, language string, tags []string, description, collection string) model.Snippet {
|
||||
mu.Lock()
|
||||
defer mu.Unlock()
|
||||
sn := model.Snippet{
|
||||
ID: randID(),
|
||||
Name: name,
|
||||
Content: content,
|
||||
Language: language,
|
||||
Tags: tags,
|
||||
CreatedAt: time.Now().Format("Jan 2, 2006"),
|
||||
ID: randID(),
|
||||
Name: name,
|
||||
Content: content,
|
||||
Language: language,
|
||||
Description: description,
|
||||
Collection: collection,
|
||||
Icon: "FileText",
|
||||
Tags: tags,
|
||||
CreatedAt: time.Now().Format("Jan 2, 2006"),
|
||||
}
|
||||
s.snippets = append(s.snippets, sn)
|
||||
writeFile("snippets.json", &s.snippets)
|
||||
|
||||
Reference in New Issue
Block a user