Add district settings management

This commit is contained in:
Anya Tokugawa committed 2026-07-05 00:01:24 +09:00
1 parent 8a2ac56844
commit b37427535c
5 files changed
+627 -2

No files matched your search

+25 -1
View File
@@ -1,6 +1,10 @@
package server
import "pageswiki/internal/store"
import (
"net/http"
"pageswiki/internal/store"
)
func (s *Server) currentDistrict() *store.District {
@@ -18,3 +22,23 @@ func (s *Server) currentDistrict() *store.District {
return sp
}
func (s *Server) districtForRequest(
r *http.Request,
) *store.District {
if r == nil {
return s.currentDistrict()
}
sp, err :=
s.store.GetDistrictByHost(
r.Host,
)
if err != nil {
return s.currentDistrict()
}
return sp
}