diff --git a/components/room.html b/components/room.html
new file mode 100644
index 0000000..8a0ed38
--- /dev/null
+++ b/components/room.html
@@ -0,0 +1,3 @@
+{{define "room"}}
+
+{{end}}
diff --git a/handlers/actions.go b/handlers/actions.go
index bd4706d..3cdd177 100644
--- a/handlers/actions.go
+++ b/handlers/actions.go
@@ -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
+}
diff --git a/handlers/auth.go b/handlers/auth.go
index 3274e68..3458e6f 100644
--- a/handlers/auth.go
+++ b/handlers/auth.go
@@ -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)
}
diff --git a/handlers/handlers.go b/handlers/handlers.go
index b6053d7..b1ea3f1 100644
--- a/handlers/handlers.go
+++ b/handlers/handlers.go
@@ -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)
}
diff --git a/models/keys.go b/models/keys.go
new file mode 100644
index 0000000..5fae370
--- /dev/null
+++ b/models/keys.go
@@ -0,0 +1,5 @@
+package models
+
+var (
+ CtxRoomIDKey = "current_room"
+)