Fix: buildable

This commit is contained in:
Grail Finder
2025-07-02 15:51:14 +03:00
parent 9973546aad
commit 3e0d24f5f8
7 changed files with 110 additions and 105 deletions

View File

@ -7,6 +7,7 @@ import (
"encoding/json"
"fmt"
"gralias/models"
"gralias/pkg/cache"
"gralias/utils"
"html/template"
"net/http"
@ -36,7 +37,12 @@ func HandleNameCheck(w http.ResponseWriter, r *http.Request) {
return
}
cleanName := utils.RemoveSpacesFromStr(username)
allNames := getAllNames()
// allNames := getAllNames()
allNames, err := repo.PlayerListNames()
if err != nil {
abortWithError(w, err.Error())
return
}
log.Info("names check", "taken_names", allNames, "trying_name", cleanName)
tmpl, err := template.ParseGlob("components/*.html")
if err != nil {
@ -175,7 +181,7 @@ func makeCookie(username string, remote string) (*http.Cookie, error) {
}
func cacheGetSession(key string) (*models.Session, error) {
userSessionB, err := memcache.Get(key)
userSessionB, err := cache.MemCache.Get(key)
if err != nil {
return nil, err
}
@ -191,7 +197,7 @@ func cacheSetSession(key string, session *models.Session) error {
if err != nil {
return err
}
memcache.Set(key, sesb)
memcache.Expire(key, cfg.SessionLifetime)
cache.MemCache.Set(key, sesb)
cache.MemCache.Expire(key, cfg.SessionLifetime)
return nil
}