Chore: touch file for room templ
This commit is contained in:
3
components/room.html
Normal file
3
components/room.html
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
{{define "room"}}
|
||||||
|
|
||||||
|
{{end}}
|
@ -8,3 +8,9 @@ import (
|
|||||||
func createRoom(ctx context.Context, req *models.RoomReq) (*models.RoomPublic, error) {
|
func createRoom(ctx context.Context, req *models.RoomReq) (*models.RoomPublic, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// context
|
||||||
|
func getRoomIDFromCtx(ctx context.Context) string {
|
||||||
|
id, _ := ctx.Value(models.CtxRoomIDKey).(string)
|
||||||
|
return id
|
||||||
|
}
|
||||||
|
@ -45,7 +45,7 @@ func HandleFrontLogin(w http.ResponseWriter, r *http.Request) {
|
|||||||
abortWithError(w, err.Error())
|
abortWithError(w, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
tmpl.ExecuteTemplate(w, "main", nil)
|
tmpl.ExecuteTemplate(w, "main", roundWords)
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeCookie(username string, remote string) (*http.Cookie, error) {
|
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",
|
log.Info("check remote addr for cookie set",
|
||||||
"remote", remote, "session", session)
|
"remote", remote, "session", session)
|
||||||
if strings.Contains(remote, "192.168.0") {
|
if strings.Contains(remote, "192.168.0") {
|
||||||
// no idea what is going on
|
|
||||||
// cookie.Domain = "192.168.0.15"
|
|
||||||
cookie.Domain = "home.host"
|
cookie.Domain = "home.host"
|
||||||
log.Info("changing cookie domain", "domain", cookie.Domain)
|
log.Info("changing cookie domain", "domain", cookie.Domain)
|
||||||
}
|
}
|
||||||
|
@ -42,5 +42,7 @@ func HandleHome(w http.ResponseWriter, r *http.Request) {
|
|||||||
abortWithError(w, err.Error())
|
abortWithError(w, err.Error())
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
// check if user in a room
|
||||||
|
roomID := getRoomIDFromCtx(r.Context())
|
||||||
tmpl.ExecuteTemplate(w, "main", roundWords)
|
tmpl.ExecuteTemplate(w, "main", roundWords)
|
||||||
}
|
}
|
||||||
|
5
models/keys.go
Normal file
5
models/keys.go
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
package models
|
||||||
|
|
||||||
|
var (
|
||||||
|
CtxRoomIDKey = "current_room"
|
||||||
|
)
|
Reference in New Issue
Block a user