Преглед изворни кода

fix: skip the login gate when guests do not need to log in, and correct GitHub latest guidance

- The login gate could never deny a request when guests are not required
  to log in, but still authenticated every call before the handler did it
  again. It now returns early.
- The 2k to 3k upgrade page said GitHub "latest" sometimes points to 2k.
  2k releases are no longer marked as latest, so it always points to 3k.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jamesread пре 15 часа
родитељ
комит
ded4259074
2 измењених фајлова са 6 додато и 1 уклоњено
  1. 1 1
      docs/modules/ROOT/pages/upgrade/2k3k.adoc
  2. 5 0
      service/internal/api/api_login_gate.go

+ 1 - 1
docs/modules/ROOT/pages/upgrade/2k3k.adoc

@@ -106,7 +106,7 @@ xref:install/container.adoc[More information about installing OliveTin in contai
 
 === What does GitHub "latest" point to?
 
-GitHub's "latest" release tag isn't super helpful. It currently points to the "release that was pushed last". So sometimes this will be 2k, and sometimes this will be 3k. We're trying to find a way to fix this.
+GitHub's "latest" release always points to the latest 3k release, because 2k releases are not marked as "latest". If you need the final 2k version in a script, see xref:upgrade/github_latest.adoc[Warning - GitHub Latest].
 
 == What are the changes I need to make to upgrade from OliveTin 2k to 3k?
 

+ 5 - 0
service/internal/api/api_login_gate.go

@@ -62,6 +62,11 @@ func (interceptor *loginRequiredInterceptor) checkLoginRequired(procedure string
 	}
 
 	cfg := interceptor.api.cfg
+
+	if !cfg.AuthRequireGuestsToLogin {
+		return nil
+	}
+
 	user := auth.UserFromHeaders(header, procedure, cfg)
 
 	if user.MustLogIn(cfg) {