Chore: touch file for room templ

This commit is contained in:
Grail Finder
2025-05-03 08:20:24 +03:00
parent c8ce2a6727
commit bd4e2431bf
5 changed files with 17 additions and 3 deletions

3
components/room.html Normal file
View File

@ -0,0 +1,3 @@
{{define "room"}}
{{end}}

View File

@ -8,3 +8,9 @@ import (
func createRoom(ctx context.Context, req *models.RoomReq) (*models.RoomPublic, error) {
return nil, nil
}
// context
func getRoomIDFromCtx(ctx context.Context) string {
id, _ := ctx.Value(models.CtxRoomIDKey).(string)
return id
}

View File

@ -45,7 +45,7 @@ func HandleFrontLogin(w http.ResponseWriter, r *http.Request) {
abortWithError(w, err.Error())
return
}
tmpl.ExecuteTemplate(w, "main", nil)
tmpl.ExecuteTemplate(w, "main", roundWords)
}
func makeCookie(username string, remote string) (*http.Cookie, error) {
@ -79,8 +79,6 @@ func makeCookie(username string, remote string) (*http.Cookie, error) {
log.Info("check remote addr for cookie set",
"remote", remote, "session", session)
if strings.Contains(remote, "192.168.0") {
// no idea what is going on
// cookie.Domain = "192.168.0.15"
cookie.Domain = "home.host"
log.Info("changing cookie domain", "domain", cookie.Domain)
}

View File

@ -42,5 +42,7 @@ func HandleHome(w http.ResponseWriter, r *http.Request) {
abortWithError(w, err.Error())
return
}
// check if user in a room
roomID := getRoomIDFromCtx(r.Context())
tmpl.ExecuteTemplate(w, "main", roundWords)
}

5
models/keys.go Normal file
View File

@ -0,0 +1,5 @@
package models
var (
CtxRoomIDKey = "current_room"
)