~gitpocket/gitpocket

1

style(profile): round avatars for people

commit
bff19f1cf617d2869f06d2cc1add27ba1523281f browse tree
parent
3e6b98c68fd45f770106cc8797ef6ee93e9e0566
author
obscurejames <354576047+obscurejames@users.noreply.github.com>
signature
Verified ~james signed with a key registered by ~james
date
2026-11-09 21:54 UTC

3 files changed, +11 −8

static/style.css modified

@@ -89,7 +89,7 @@ main{padding-bottom:3rem}
8989 nav.tabs.small{background:var(--raised);align-self:flex-end;margin-bottom:.3rem}
9090 nav.tabs.small a{padding:.1rem .8rem}
9191 nav.tabs.small a.active{background:var(--bar)}
92-.profile .avatar{display:block;width:230px;height:230px;margin-bottom:.9rem;border-radius:6px}
92+.profile .avatar{display:block;width:230px;height:230px;margin-bottom:.9rem;border-radius:50%}
9393 .profile p{margin:.2rem 0}
9494 .profile .name{font-weight:400;font-size:1.3rem;line-height:1.25;margin:0;color:var(--fg)}
9595 .profile .btn.block{display:block;text-align:center;margin-top:.45rem}
@@ -180,7 +180,8 @@ input[type=file]{border:0;padding:0}
180180 .actions{display:flex;justify-content:flex-end;gap:.5rem}
181181 .actions.left{justify-content:flex-start}
182182 .avatarform{display:grid;grid-template-columns:160px 1fr;gap:1.2rem;margin-bottom:1.2rem;align-items:start}
183-.avatarform .avatarbox{width:160px;height:160px;border:1px solid var(--line);background:var(--bg)}
183+.avatarform .avatarbox{width:160px;height:160px;border:1px solid var(--line);background:var(--bg);border-radius:50%;overflow:hidden}
184+.avatarform .avatarbox.org{border-radius:6px}
184185 .avatarform .avatar{width:158px;height:158px;border:0}
185186 .avatarform label{display:block;margin-bottom:.3rem}
186187 .avatarform small{display:block;color:var(--muted);margin-bottom:.5rem}
@@ -389,7 +390,8 @@ pre.rangediff,pre.body{white-space:pre-wrap;overflow-wrap:anywhere}
389390 .hit .tags a{color:var(--muted);text-decoration:underline;margin-right:.6rem;font-size:.85rem}
390391 .hit .meta{display:flex;gap:1.1rem;flex-wrap:wrap;color:var(--muted);font-size:.85rem;margin-top:.35rem}
391392 .hit.user{display:grid;grid-template-columns:3rem 1fr;gap:.9rem;align-items:start}
392-.hitavatar img{display:flex;width:3rem;height:3rem;border-radius:6px;object-fit:cover;border:1px solid var(--line)}
393+.hit.org .hitavatar img{border-radius:6px}
394+.hitavatar img{display:flex;width:3rem;height:3rem;border-radius:50%;object-fit:cover;border:1px solid var(--line)}
393395 .hit .bio{color:var(--fg);overflow:hidden;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
394396 .langbar{display:flex;height:.5rem;border-radius:4px;overflow:hidden;margin:.2rem 0 .5rem;background:var(--line)}
395397 .langbar span{display:block;height:100%}
@@ -419,7 +421,7 @@ pre.rangediff,pre.body{white-space:pre-wrap;overflow-wrap:anywhere}
419421 .orglist h4{font-size:.85rem;color:var(--muted);margin:0 0 .4rem;font-weight:600}
420422 .orgicons{display:flex;flex-wrap:wrap;gap:.4rem}
421423 .orglist a{display:flex}
422-.orglist img{display:flex;width:2rem;height:2rem;border-radius:2px;object-fit:cover;font-size:.8rem}
424+.orglist img{display:flex;width:2rem;height:2rem;border-radius:4px;object-fit:cover;font-size:.8rem}
423425 .memberlist{list-style:none;margin:0 0 .8rem;padding:0;max-width:32rem}
424426 .memberlist li{display:flex;align-items:center;justify-content:space-between;padding:.35rem 0;border-bottom:1px solid var(--line)}
425427 .memberlist form{margin:0}
@@ -432,7 +434,7 @@ pre.rangediff,pre.body{white-space:pre-wrap;overflow-wrap:anywhere}
432434 .people li b{font-weight:400;font-size:.97rem;line-height:1.2}
433435 .people li small{color:var(--muted);line-height:1.2}
434436 .orghead{display:grid;grid-template-columns:auto minmax(0,1fr) auto;gap:1.3rem;align-items:start;margin:-.4rem 0 1.3rem;padding-bottom:1.2rem;border-bottom:1px solid var(--bar)}
435-.orgmark img{display:flex;width:6rem;height:6rem;border-radius:10px;object-fit:cover;border:1px solid var(--line);background:var(--soft)}
437+.orgmark img{display:flex;width:6rem;height:6rem;border-radius:6px;object-fit:cover;border:1px solid var(--line);background:var(--soft)}
436438 .orgident h2{font-size:1.6rem;line-height:1.2;margin:0}
437439 .orgident .handle{color:var(--muted);margin:.1rem 0 .45rem}
438440 .orgident .bio{margin:0 0 .45rem}

templates/orgsettings.html modified

@@ -4,7 +4,7 @@
44 <h3 class="rule">Edit <a href="/~{{$o.Name}}">~{{$o.Name}}</a></h3>
55 <form method="post" action="/settings/avatar" enctype="multipart/form-data" class="avatarform" id="avatarform">
66 <input type="hidden" name="org" value="{{$o.Name}}">
7-<div class="avatarbox"><img class="avatar" src="/~{{$o.Name}}/avatar?v={{$p.Avatar}}" alt=""></div>
7+<div class="avatarbox org"><img class="avatar" src="/~{{$o.Name}}/avatar?v={{$p.Avatar}}" alt=""></div>
88 <div>
99 <label>Choose a picture <input type="file" name="avatar" accept="image/png,image/jpeg,image/gif,image/webp" required></label>
1010 <small>If the image is not square you can pick the crop below. It is resized to 256×256 and stored as PNG.</small>

web.go modified

@@ -792,12 +792,13 @@ func (s *Server) deleteAvatar(w http.ResponseWriter, r *http.Request) {
792792
793793 func (s *Server) serveAvatar(w http.ResponseWriter, r *http.Request, owner User) {
794794 data, err := os.ReadFile(s.avatarPath(owner.ID))
795+ age := "86400"
795796 if err != nil {
796- data = identicon(owner.Name)
797+ data, age = identicon(owner.Name), "3600"
797798 }
798799 w.Header().Set("Content-Type", "image/png")
799800 w.Header().Set("X-Content-Type-Options", "nosniff")
800- w.Header().Set("Cache-Control", "public, max-age=86400")
801+ w.Header().Set("Cache-Control", "public, max-age="+age)
801802 w.Write(data)
802803 }
803804