nandi/gleanpublic⑂ Fork 0
⑂ c5ad568
Commits
⬇ Clone ▾
git clone https://git.rickub.com/nandi/glean.git
git clone ssh://git@rickub.com/nandi/glean.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Allow access to trending page without loginUnverified

Julien Robert committed 2026-04-22T01:01:35+02:00 Browse files
c5ad568 parent: 076805f
modified internal/server/server.go +0 -1
@@ -177,7 +177,6 @@ func (s *Server) setupRoutes() {
177177 })
178178
179179 s.router.Route("/trending", func(r chi.Router) {
180- r.Use(s.requireAuth)
181180 r.Get("/", s.handleTrending)
182181 })
183182
@@ -177,7 +177,6 @@ func (s *Server) setupRoutes() {
177 })177 })
178 178
179 s.router.Route("/trending", func(r chi.Router) {179 s.router.Route("/trending", func(r chi.Router) {
180- r.Use(s.requireAuth)
181 r.Get("/", s.handleTrending)180 r.Get("/", s.handleTrending)
182 })181 })
183 182
modified internal/tmpl/base.html +26 -14
@@ -65,7 +65,7 @@
6565 </div>
6666 <button onclick="document.getElementById('shortcuts-dialog').close()" class="mt-4 w-full text-sm text-spot-secondary hover:text-spot-text px-4 py-2 rounded-pill border border-spot-outline transition">Close</button>
6767 </dialog>
68- {{if .User}}
68+ {{if or .User (eq .ActivePath "/trending")}}
6969 <aside class="hidden lg:flex flex-col w-60 bg-spot-bg h-screen fixed left-0 top-0 px-3 py-4 z-20">
7070 <div class="mb-8 px-3">
7171 {{template "logo-link"}}
@@ -92,17 +92,25 @@
9292 Library
9393 </a>
9494 </nav>
95- <div class="mt-auto pt-4 border-t border-spot-divider-30 flex items-center gap-2 px-1">
96- <a href="/profile/{{.User.DID}}" class="flex items-center gap-2 flex-1 min-w-0 px-2 py-1.5 rounded-md hover:bg-spot-hover-50 transition">
97- {{if .User.AvatarURL.Valid}}<img src="{{.User.AvatarURL.String}}" class="w-7 h-7 rounded-full shrink-0">{{end}}
98- <span class="text-sm font-medium truncate text-spot-text">@{{.User.Handle}}</span>
95+ <div class="mt-auto pt-4 border-t border-spot-divider-30 px-1">
96+ {{if .User}}
97+ <div class="flex items-center gap-2">
98+ <a href="/profile/{{.User.DID}}" class="flex items-center gap-2 flex-1 min-w-0 px-2 py-1.5 rounded-md hover:bg-spot-hover-50 transition">
99+ {{if .User.AvatarURL.Valid}}<img src="{{.User.AvatarURL.String}}" class="w-7 h-7 rounded-full shrink-0">{{end}}
100+ <span class="text-sm font-medium truncate text-spot-text">@{{.User.Handle}}</span>
101+ </a>
102+ <form method="POST" action="/auth/logout" class="shrink-0">
103+ {{csrfInput .CSRFToken}}
104+ <button type="submit" class="text-spot-secondary hover:text-spot-red p-1.5 rounded-md hover:bg-spot-hover-50 transition" title="Logout">
105+ <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="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"/></svg>
106+ </button>
107+ </form>
108+ </div>
109+ {{else}}
110+ <a href="/auth/login" class="flex items-center justify-center gap-2 w-full bg-spot-green text-white rounded-pill px-4 py-2 text-xs font-bold uppercase tracking-button hover:brightness-110 transition">
111+ Sign in
99112 </a>
100- <form method="POST" action="/auth/logout" class="shrink-0">
101- {{csrfInput .CSRFToken}}
102- <button type="submit" class="text-spot-secondary hover:text-spot-red p-1.5 rounded-md hover:bg-spot-hover-50 transition" title="Logout">
103- <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="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"/></svg>
104- </button>
105- </form>
113+ {{end}}
106114 </div>
107115 </aside>
108116
@@ -128,17 +136,21 @@
128136 </nav>
129137 {{end}}
130138
131- <main id="main-content" class="{{if .User}}lg:ml-60 pb-20 lg:pb-0{{end}} flex-1 min-h-screen flex flex-col">
132- {{if .User}}
139+ <main id="main-content" class="{{if or .User (eq .ActivePath "/trending")}}lg:ml-60 pb-20 lg:pb-0{{end}} flex-1 min-h-screen flex flex-col">
140+ {{if or .User (eq .ActivePath "/trending")}}
133141 <div class="lg:hidden bg-spot-surface border-b border-spot-divider px-4 py-3 flex items-center justify-between sticky top-0 z-20">
134142 {{template "logo-text"}}
143+ {{if .User}}
135144 <a href="/profile/{{.User.DID}}" class="flex items-center gap-2">
136145 {{if .User.AvatarURL.Valid}}<img src="{{.User.AvatarURL.String}}" class="w-7 h-7 rounded-full">{{end}}
137146 <span class="text-xs text-spot-secondary">@{{.User.Handle}}</span>
138147 </a>
148+ {{else}}
149+ <a href="/auth/login" class="bg-spot-green text-white rounded-pill px-4 py-1.5 text-xs font-bold uppercase tracking-button hover:brightness-110 transition">Sign in</a>
150+ {{end}}
139151 </div>
140152 {{end}}
141- <div class="{{if not .User}}w-full{{else}}max-w-6xl mx-auto px-4 lg:px-8 py-6{{end}} flex-1">
153+ <div class="{{if not (or .User (eq .ActivePath "/trending"))}}w-full{{else}}max-w-6xl mx-auto px-4 lg:px-8 py-6{{end}} flex-1">
142154 {{.Content}}
143155 </div>
144156 <footer class="mt-auto">
@@ -65,7 +65,7 @@
65 </div>65 </div>
66 <button onclick="document.getElementById('shortcuts-dialog').close()" class="mt-4 w-full text-sm text-spot-secondary hover:text-spot-text px-4 py-2 rounded-pill border border-spot-outline transition">Close</button>66 <button onclick="document.getElementById('shortcuts-dialog').close()" class="mt-4 w-full text-sm text-spot-secondary hover:text-spot-text px-4 py-2 rounded-pill border border-spot-outline transition">Close</button>
67 </dialog>67 </dialog>
68- {{if .User}}68+ {{if or .User (eq .ActivePath "/trending")}}
69 <aside class="hidden lg:flex flex-col w-60 bg-spot-bg h-screen fixed left-0 top-0 px-3 py-4 z-20">69 <aside class="hidden lg:flex flex-col w-60 bg-spot-bg h-screen fixed left-0 top-0 px-3 py-4 z-20">
70 <div class="mb-8 px-3">70 <div class="mb-8 px-3">
71 {{template "logo-link"}}71 {{template "logo-link"}}
@@ -92,17 +92,25 @@
92 Library92 Library
93 </a>93 </a>
94 </nav>94 </nav>
95- <div class="mt-auto pt-4 border-t border-spot-divider-30 flex items-center gap-2 px-1">95+ <div class="mt-auto pt-4 border-t border-spot-divider-30 px-1">
96- <a href="/profile/{{.User.DID}}" class="flex items-center gap-2 flex-1 min-w-0 px-2 py-1.5 rounded-md hover:bg-spot-hover-50 transition">96+ {{if .User}}
97- {{if .User.AvatarURL.Valid}}<img src="{{.User.AvatarURL.String}}" class="w-7 h-7 rounded-full shrink-0">{{end}}97+ <div class="flex items-center gap-2">
98- <span class="text-sm font-medium truncate text-spot-text">@{{.User.Handle}}</span>98+ <a href="/profile/{{.User.DID}}" class="flex items-center gap-2 flex-1 min-w-0 px-2 py-1.5 rounded-md hover:bg-spot-hover-50 transition">
99+ {{if .User.AvatarURL.Valid}}<img src="{{.User.AvatarURL.String}}" class="w-7 h-7 rounded-full shrink-0">{{end}}
100+ <span class="text-sm font-medium truncate text-spot-text">@{{.User.Handle}}</span>
101+ </a>
102+ <form method="POST" action="/auth/logout" class="shrink-0">
103+ {{csrfInput .CSRFToken}}
104+ <button type="submit" class="text-spot-secondary hover:text-spot-red p-1.5 rounded-md hover:bg-spot-hover-50 transition" title="Logout">
105+ <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="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"/></svg>
106+ </button>
107+ </form>
108+ </div>
109+ {{else}}
110+ <a href="/auth/login" class="flex items-center justify-center gap-2 w-full bg-spot-green text-white rounded-pill px-4 py-2 text-xs font-bold uppercase tracking-button hover:brightness-110 transition">
111+ Sign in
99 </a>112 </a>
100- <form method="POST" action="/auth/logout" class="shrink-0">113+ {{end}}
101- {{csrfInput .CSRFToken}}
102- <button type="submit" class="text-spot-secondary hover:text-spot-red p-1.5 rounded-md hover:bg-spot-hover-50 transition" title="Logout">
103- <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="M17 16l4-4m0 0l-4-4m4 4H7m6 4v1a3 3 0 01-3 3H6a3 3 0 01-3-3V7a3 3 0 013-3h4a3 3 0 013 3v1"/></svg>
104- </button>
105- </form>
106 </div>114 </div>
107 </aside>115 </aside>
108 116
@@ -128,17 +136,21 @@
128 </nav>136 </nav>
129 {{end}}137 {{end}}
130 138
131- <main id="main-content" class="{{if .User}}lg:ml-60 pb-20 lg:pb-0{{end}} flex-1 min-h-screen flex flex-col">139+ <main id="main-content" class="{{if or .User (eq .ActivePath "/trending")}}lg:ml-60 pb-20 lg:pb-0{{end}} flex-1 min-h-screen flex flex-col">
132- {{if .User}}140+ {{if or .User (eq .ActivePath "/trending")}}
133 <div class="lg:hidden bg-spot-surface border-b border-spot-divider px-4 py-3 flex items-center justify-between sticky top-0 z-20">141 <div class="lg:hidden bg-spot-surface border-b border-spot-divider px-4 py-3 flex items-center justify-between sticky top-0 z-20">
134 {{template "logo-text"}}142 {{template "logo-text"}}
143+ {{if .User}}
135 <a href="/profile/{{.User.DID}}" class="flex items-center gap-2">144 <a href="/profile/{{.User.DID}}" class="flex items-center gap-2">
136 {{if .User.AvatarURL.Valid}}<img src="{{.User.AvatarURL.String}}" class="w-7 h-7 rounded-full">{{end}}145 {{if .User.AvatarURL.Valid}}<img src="{{.User.AvatarURL.String}}" class="w-7 h-7 rounded-full">{{end}}
137 <span class="text-xs text-spot-secondary">@{{.User.Handle}}</span>146 <span class="text-xs text-spot-secondary">@{{.User.Handle}}</span>
138 </a>147 </a>
148+ {{else}}
149+ <a href="/auth/login" class="bg-spot-green text-white rounded-pill px-4 py-1.5 text-xs font-bold uppercase tracking-button hover:brightness-110 transition">Sign in</a>
150+ {{end}}
139 </div>151 </div>
140 {{end}}152 {{end}}
141- <div class="{{if not .User}}w-full{{else}}max-w-6xl mx-auto px-4 lg:px-8 py-6{{end}} flex-1">153+ <div class="{{if not (or .User (eq .ActivePath "/trending"))}}w-full{{else}}max-w-6xl mx-auto px-4 lg:px-8 py-6{{end}} flex-1">
142 {{.Content}}154 {{.Content}}
143 </div>155 </div>
144 <footer class="mt-auto">156 <footer class="mt-auto">