Compare commits
15 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1542906edf | ||
| cf1854976a | |||
|
|
723a4be33f | ||
| 2f89951c25 | |||
|
|
f330c5f3d8 | ||
| 4a5af36ae0 | |||
|
|
edcab594a7 | ||
| 26157076d6 | |||
|
|
103b341488 | ||
| 6ef7401443 | |||
|
|
bbbbf33c41 | ||
| dbad818fda | |||
|
|
5f8afbf236 | ||
| 3b7a1e3c64 | |||
|
|
5af5785fa0 |
36
CHANGELOG.md
36
CHANGELOG.md
@@ -276,3 +276,39 @@
|
|||||||
* Update Dockerfile for multi-platform support and add nginx configuration ([ccf993b](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/ccf993bff25b4551a70c1f0263695f828df15a02))
|
* Update Dockerfile for multi-platform support and add nginx configuration ([ccf993b](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/ccf993bff25b4551a70c1f0263695f828df15a02))
|
||||||
* Update Dockerfile for multi-platform support and add nginx configuration ([3e06734](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/3e067346ffe3bdc62dc936ea8e79ae9293d86351))
|
* Update Dockerfile for multi-platform support and add nginx configuration ([3e06734](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/3e067346ffe3bdc62dc936ea8e79ae9293d86351))
|
||||||
* Update Dockerfile for multi-platform support and add nginx configuration ([b2527ed](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/b2527ed041568d20f880515b406fe0b0e10c12c1))
|
* Update Dockerfile for multi-platform support and add nginx configuration ([b2527ed](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/b2527ed041568d20f880515b406fe0b0e10c12c1))
|
||||||
|
## (2026-01-07)
|
||||||
|
## (2026-01-07)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Update configuration files for CORS settings and add production environment ([3b7a1e3](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/3b7a1e3c646d870134d8d06b4962498b0e282cbd))
|
||||||
|
## (2026-01-07)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add caching headers for env.js in Nginx configuration ([dbad818](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/dbad818fdaeb237a05f583e5402773a4339e7aa1))
|
||||||
|
## (2026-01-07)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add logging to Gateway for pod synchronization and startup events ([6ef7401](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/6ef74014430673e725245bf37e44c5b90b81abb3))
|
||||||
|
## (2026-01-07)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add logging to Gateway for pod synchronization and startup events ([2615707](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/26157076d686a5dd3f8157ec2b2d1ae9d9e9eedf))
|
||||||
|
## (2026-01-07)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Add Health and Login endpoints with updated Redis configuration ([4a5af36](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/4a5af36ae0dcb540e02b7a1cd042e54cc6342c78))
|
||||||
|
## (2026-01-07)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Update Gateway to use ArrayList for game IDs and bound users ([2f89951](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/2f89951c25484d6bc412536a83019ee6d0b7f780))
|
||||||
|
## (2026-01-07)
|
||||||
|
|
||||||
|
### Features
|
||||||
|
|
||||||
|
* Update joinGame endpoint to accept gameId as a path parameter ([cf18549](https://git.janis-eccarius.de/KnockOutWhist/KnockOutWhist-Web/commit/cf1854976a51eb4931d50cf93640498ed18686fc))
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
meta {
|
meta {
|
||||||
name: Game
|
name: Game
|
||||||
seq: 3
|
seq: 2
|
||||||
}
|
}
|
||||||
|
|
||||||
auth {
|
auth {
|
||||||
|
|||||||
16
bruno/KnockOutWhist/Health.bru
Normal file
16
bruno/KnockOutWhist/Health.bru
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
meta {
|
||||||
|
name: Health
|
||||||
|
type: http
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{host}}/health/simple
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
timeout: 0
|
||||||
|
}
|
||||||
15
bruno/KnockOutWhist/Login/Request Status.bru
Normal file
15
bruno/KnockOutWhist/Login/Request Status.bru
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
meta {
|
||||||
|
name: Request Status
|
||||||
|
type: http
|
||||||
|
seq: 1
|
||||||
|
}
|
||||||
|
|
||||||
|
get {
|
||||||
|
url: {{host}}/status
|
||||||
|
body: none
|
||||||
|
auth: inherit
|
||||||
|
}
|
||||||
|
|
||||||
|
settings {
|
||||||
|
encodeUrl: true
|
||||||
|
}
|
||||||
8
bruno/KnockOutWhist/Login/folder.bru
Normal file
8
bruno/KnockOutWhist/Login/folder.bru
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
meta {
|
||||||
|
name: Login
|
||||||
|
seq: 3
|
||||||
|
}
|
||||||
|
|
||||||
|
auth {
|
||||||
|
mode: inherit
|
||||||
|
}
|
||||||
3
bruno/KnockOutWhist/environments/Prod.bru
Normal file
3
bruno/KnockOutWhist/environments/Prod.bru
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
vars {
|
||||||
|
host: https://knockout.janis-eccarius.de/api
|
||||||
|
}
|
||||||
3
bruno/KnockOutWhist/environments/Staging.bru
Normal file
3
bruno/KnockOutWhist/environments/Staging.bru
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
vars {
|
||||||
|
host: https://st.knockout.janis-eccarius.de/api
|
||||||
|
}
|
||||||
Submodule knockoutwhistfrontend updated: e972f1c432...92a7bc0586
30
knockoutwhistweb/app/controllers/HealthController.scala
Normal file
30
knockoutwhistweb/app/controllers/HealthController.scala
Normal file
@@ -0,0 +1,30 @@
|
|||||||
|
package controllers
|
||||||
|
|
||||||
|
import auth.{AuthAction, AuthenticatedRequest}
|
||||||
|
import dto.subDTO.UserDTO
|
||||||
|
import logic.user.{SessionManager, UserManager}
|
||||||
|
import model.users.User
|
||||||
|
import play.api.*
|
||||||
|
import play.api.libs.json.Json
|
||||||
|
import play.api.mvc.*
|
||||||
|
import play.api.mvc.Cookie.SameSite.{Lax, None, Strict}
|
||||||
|
|
||||||
|
import javax.inject.*
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This controller creates an `Action` to handle HTTP requests to the
|
||||||
|
* application's home page.
|
||||||
|
*/
|
||||||
|
@Singleton
|
||||||
|
class HealthController @Inject()(
|
||||||
|
val controllerComponents: ControllerComponents,
|
||||||
|
) extends BaseController {
|
||||||
|
|
||||||
|
def simple(): Action[AnyContent] = {
|
||||||
|
Action { implicit request =>
|
||||||
|
Ok("OK")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -55,13 +55,8 @@ class MainMenuController @Inject()(
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def joinGame(): Action[AnyContent] = authAction { implicit request: AuthenticatedRequest[AnyContent] =>
|
def joinGame(gameId: String): Action[AnyContent] = authAction { implicit request: AuthenticatedRequest[AnyContent] =>
|
||||||
val jsonBody = request.body.asJson
|
val game = PodManager.getGame(gameId)
|
||||||
val gameId: Option[String] = jsonBody.flatMap { jsValue =>
|
|
||||||
(jsValue \ "gameId").asOpt[String]
|
|
||||||
}
|
|
||||||
if (gameId.isDefined) {
|
|
||||||
val game = PodManager.getGame(gameId.get)
|
|
||||||
game match {
|
game match {
|
||||||
case Some(g) =>
|
case Some(g) =>
|
||||||
g.addUser(request.user)
|
g.addUser(request.user)
|
||||||
@@ -76,12 +71,6 @@ class MainMenuController @Inject()(
|
|||||||
"errorMessage" -> "No Game found"
|
"errorMessage" -> "No Game found"
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
BadRequest(Json.obj(
|
|
||||||
"status" -> "failure",
|
|
||||||
"errorMessage" -> "Invalid form submission"
|
|
||||||
))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
def rules(): Action[AnyContent] = authAction { implicit request: AuthenticatedRequest[AnyContent] =>
|
def rules(): Action[AnyContent] = authAction { implicit request: AuthenticatedRequest[AnyContent] =>
|
||||||
|
|||||||
@@ -4,8 +4,10 @@ import de.knockoutwhist.data.Pod
|
|||||||
import de.knockoutwhist.data.redis.RedisManager
|
import de.knockoutwhist.data.redis.RedisManager
|
||||||
import org.apache.pekko.actor.ActorSystem
|
import org.apache.pekko.actor.ActorSystem
|
||||||
import org.redisson.config.Config
|
import org.redisson.config.Config
|
||||||
|
import play.api.Logger
|
||||||
import play.api.inject.ApplicationLifecycle
|
import play.api.inject.ApplicationLifecycle
|
||||||
|
|
||||||
|
import java.util
|
||||||
import java.util.UUID
|
import java.util.UUID
|
||||||
import javax.inject.*
|
import javax.inject.*
|
||||||
import scala.concurrent.ExecutionContext
|
import scala.concurrent.ExecutionContext
|
||||||
@@ -17,16 +19,23 @@ class Gateway @Inject()(
|
|||||||
actorSystem: ActorSystem
|
actorSystem: ActorSystem
|
||||||
)(implicit ec: ExecutionContext) {
|
)(implicit ec: ExecutionContext) {
|
||||||
|
|
||||||
|
private val logger = Logger(getClass.getName)
|
||||||
|
|
||||||
val redis: RedisManager = {
|
val redis: RedisManager = {
|
||||||
val config: Config = Config()
|
val config: Config = Config()
|
||||||
config.useSingleServer.setAddress("valkey://" + sys.env.getOrElse("VALKEY_HOST", "localhost") + ":" + sys.env.getOrElse("VALKEY_PORT", "6379"))
|
val url = "redis://" + sys.env.getOrElse("REDIS_HOST", "localhost") + ":" + sys.env.getOrElse("REDIS_PORT", "6379")
|
||||||
|
logger.info(s"Connecting to Redis at $url")
|
||||||
|
config.useSingleServer.setAddress(url)
|
||||||
RedisManager(config)
|
RedisManager(config)
|
||||||
}
|
}
|
||||||
|
|
||||||
redis.continuousSyncPod(() => {
|
redis.continuousSyncPod(() => {
|
||||||
|
logger.info("Syncing pod with Redis")
|
||||||
createPod()
|
createPod()
|
||||||
})
|
})
|
||||||
|
|
||||||
|
logger.info("Gateway started")
|
||||||
|
|
||||||
def syncPod(): Unit = {
|
def syncPod(): Unit = {
|
||||||
redis.syncPod(createPod())
|
redis.syncPod(createPod())
|
||||||
}
|
}
|
||||||
@@ -37,8 +46,8 @@ class Gateway @Inject()(
|
|||||||
PodManager.podName,
|
PodManager.podName,
|
||||||
PodManager.podIp,
|
PodManager.podIp,
|
||||||
9000,
|
9000,
|
||||||
PodManager.getAllGameIds().asJava,
|
new util.ArrayList[String](PodManager.getAllGameIds().asJava),
|
||||||
PodManager.allBoundUsers().asJava
|
new util.ArrayList[String](PodManager.allBoundUsers().asJava)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
package modules
|
package modules
|
||||||
|
|
||||||
import com.google.inject.AbstractModule
|
import com.google.inject.AbstractModule
|
||||||
|
import logic.Gateway
|
||||||
|
|
||||||
class GatewayModule extends AbstractModule {
|
class GatewayModule extends AbstractModule {
|
||||||
override def configure(): Unit = {
|
override def configure(): Unit = {
|
||||||
bind(classOf[GatewayModule]).asEagerSingleton()
|
bind(classOf[Gateway]).asEagerSingleton()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,14 +14,10 @@ auth {
|
|||||||
publicKeyPem = ${?PUBLIC_KEY_PEM}
|
publicKeyPem = ${?PUBLIC_KEY_PEM}
|
||||||
}
|
}
|
||||||
|
|
||||||
play.http.context="/api"
|
|
||||||
|
|
||||||
play.modules.enabled += "modules.GatewayModule"
|
|
||||||
|
|
||||||
play.filters.enabled += "play.filters.cors.CORSFilter"
|
play.filters.enabled += "play.filters.cors.CORSFilter"
|
||||||
|
|
||||||
play.filters.cors {
|
play.filters.cors {
|
||||||
allowedOrigins = ["http://localhost:5173", "http://localhost:3000", "http://localhost:8081"]
|
allowedOrigins = ["http://localhost:5173"]
|
||||||
allowedCredentials = true
|
allowedCredentials = true
|
||||||
allowedHttpMethods = ["GET", "POST", "PUT", "DELETE", "OPTIONS"]
|
allowedHttpMethods = ["GET", "POST", "PUT", "DELETE", "OPTIONS"]
|
||||||
allowedHttpHeaders = ["Accept", "Content-Type", "Origin", "X-Requested-With"]
|
allowedHttpHeaders = ["Accept", "Content-Type", "Origin", "X-Requested-With"]
|
||||||
|
|||||||
14
knockoutwhistweb/conf/prod.conf
Normal file
14
knockoutwhistweb/conf/prod.conf
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
include "application.conf"
|
||||||
|
|
||||||
|
play.http.secret.key="zg8^v0R*:7-m.>^8T2B1q)sE3MV_9=M{K9zx8,<3}"
|
||||||
|
|
||||||
|
play.http.context="/api"
|
||||||
|
|
||||||
|
play.modules.enabled += "modules.GatewayModule"
|
||||||
|
|
||||||
|
play.filters.cors {
|
||||||
|
allowedOrigins = ["https://knockout.janis-eccarius.de"]
|
||||||
|
allowedCredentials = true
|
||||||
|
allowedHttpMethods = ["GET", "POST", "PUT", "DELETE", "OPTIONS"]
|
||||||
|
allowedHttpHeaders = ["Accept", "Content-Type", "Origin", "X-Requested-With"]
|
||||||
|
}
|
||||||
@@ -15,7 +15,7 @@ GET /rules controllers.MainMenuController.rules()
|
|||||||
GET /navSPA/:pType controllers.MainMenuController.navSPA(pType)
|
GET /navSPA/:pType controllers.MainMenuController.navSPA(pType)
|
||||||
|
|
||||||
POST /createGame controllers.MainMenuController.createGame()
|
POST /createGame controllers.MainMenuController.createGame()
|
||||||
POST /joinGame controllers.MainMenuController.joinGame()
|
POST /joinGame/:gameId controllers.MainMenuController.joinGame(gameId: String)
|
||||||
|
|
||||||
# User authentication routes
|
# User authentication routes
|
||||||
POST /login controllers.UserController.login_Post()
|
POST /login controllers.UserController.login_Post()
|
||||||
@@ -31,3 +31,6 @@ GET /websocket controllers.WebsocketController.socket()
|
|||||||
# Status
|
# Status
|
||||||
GET /status controllers.StatusController.requestStatus()
|
GET /status controllers.StatusController.requestStatus()
|
||||||
GET /status/:gameId controllers.StatusController.game(gameId: String)
|
GET /status/:gameId controllers.StatusController.game(gameId: String)
|
||||||
|
|
||||||
|
# Health
|
||||||
|
GET /health/simple controllers.HealthController.simple()
|
||||||
12
knockoutwhistweb/conf/staging.conf
Normal file
12
knockoutwhistweb/conf/staging.conf
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
include "application.conf"
|
||||||
|
|
||||||
|
play.http.context="/api"
|
||||||
|
|
||||||
|
play.modules.enabled += "modules.GatewayModule"
|
||||||
|
|
||||||
|
play.filters.cors {
|
||||||
|
allowedOrigins = ["https://st.knockout.janis-eccarius.de"]
|
||||||
|
allowedCredentials = true
|
||||||
|
allowedHttpMethods = ["GET", "POST", "PUT", "DELETE", "OPTIONS"]
|
||||||
|
allowedHttpHeaders = ["Accept", "Content-Type", "Origin", "X-Requested-With"]
|
||||||
|
}
|
||||||
@@ -1,3 +1,3 @@
|
|||||||
MAJOR=4
|
MAJOR=4
|
||||||
MINOR=18
|
MINOR=25
|
||||||
PATCH=0
|
PATCH=0
|
||||||
|
|||||||
Reference in New Issue
Block a user