diff --git a/client/src/pages/play.vue b/client/src/pages/play.vue index df60caa..18b1d72 100644 --- a/client/src/pages/play.vue +++ b/client/src/pages/play.vue @@ -1,7 +1,6 @@ @@ -15,9 +14,6 @@ export default { userJson() { return JSON.stringify(this.$store.state.engine.user, null, 2) }, - gameinfoJson() { - return JSON.stringify(this.$store.state.engine.gameinfo, null, 2) - }, engineJson() { return JSON.stringify(this.$store.state.engine.json, null, 2) }, diff --git a/client/src/plugins/engine.js b/client/src/plugins/engine.js index 5dd8008..0b0f8d4 100644 --- a/client/src/plugins/engine.js +++ b/client/src/plugins/engine.js @@ -25,16 +25,6 @@ export default (context, inject) => { }) const response = await $axios.get(url) store.commit('engine/setJson', response.data) - - const role = store.state.engine.user?.role - if (role === "gamemaster" || role === "admin") { - const url = buildUrl($config.serverBaseUrl, { - path: '/api/gameinfo', - queryParams: { g: store.state.engine.user?.game }, - }) - const response = await $axios.get(url) - store.commit('engine/setGameinfo', response.data) - } } catch (e) { const { status, statusText } = e.response if (status != 200) { diff --git a/client/src/store/engine.js b/client/src/store/engine.js index 147a176..8db658e 100644 --- a/client/src/store/engine.js +++ b/client/src/store/engine.js @@ -2,7 +2,6 @@ export const state = () => ({ json: {}, version: -1, user: undefined, - gameinfo: undefined, }) export const mutations = { @@ -16,7 +15,4 @@ export const mutations = { setUser(state, user) { state.user = user }, - setGameinfo(state, gameinfo) { - state.gameinfo = gameinfo - } } diff --git a/server/src/handler/gameinfo.go b/server/src/handler/gameinfo.go deleted file mode 100644 index b2d3546..0000000 --- a/server/src/handler/gameinfo.go +++ /dev/null @@ -1,36 +0,0 @@ -package handler - -import ( - "encoding/json" - "fmt" - "net/http" - "sirlab.de/go/knyt/user" -) - -type gameLight struct { - Players []string `json:"players"` -} - -func (authMux *AuthMux) GetGameInfo(usr *user.User, w http.ResponseWriter, r *http.Request) { - gameRef := r.URL.Query().Get("g") - gm, err := authMux.app.GetGameById(gameRef) - if err != nil { - w.WriteHeader(http.StatusNotFound) - fmt.Fprintf(w, "game not found") - return - } - - if !usr.IsGamemaster() || (usr.GetGameId() != gameRef && !usr.IsAdmin()) { - w.WriteHeader(http.StatusForbidden) - fmt.Fprintf(w, "forbidden") - return - } - - gmLight := gameLight{ - Players: gm.GetActivePlayers(), - } - - w.Header().Add("Content-Type", "application/json") - jsonString, _ := json.Marshal(gmLight) - fmt.Fprintf(w, string(jsonString)) -} diff --git a/server/src/knyt.go b/server/src/knyt.go index bafdb66..dbb74e0 100644 --- a/server/src/knyt.go +++ b/server/src/knyt.go @@ -22,7 +22,6 @@ func main() { mux.PublicHandleFunc("/api/login", mux.Login) mux.PublicHandleFunc("/api/logout", mux.Logout) mux.PrivateHandleFunc("/api/userinfo", mux.GetUserInfo) - mux.PrivateHandleFunc("/api/gameinfo", mux.GetGameInfo) mux.PrivateHandleFunc("/api/sync", app.SyncHandler) // default handler