summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-10-26 10:55:07 +0200
committerTor Andersson <tor@ccxvii.net>2024-10-26 10:55:07 +0200
commit79c2358ceb2b915a49ed210a8a592c8a295b398c (patch)
tree172aec1aa9dc48625e2ffbdc122ef2fcf3963bdb
parentcfcc9d74367beff6181ad27c8da73940abfdf4a9 (diff)
downloadserver-79c2358ceb2b915a49ed210a8a592c8a295b398c.tar.gz
Remove join limits.
-rw-r--r--server.js16
1 files changed, 0 insertions, 16 deletions
diff --git a/server.js b/server.js
index fdc4b2c..9c34019 100644
--- a/server.js
+++ b/server.js
@@ -21,8 +21,6 @@ const SITE_NAME = process.env.SITE_NAME || "Localhost"
const SITE_URL = process.env.SITE_URL || "http://" + HTTP_HOST + ":" + HTTP_PORT
const LIMIT_WAITING_GAMES = (process.env.LIMIT_WAITING_GAMES | 0) || 3
-const LIMIT_OPEN_GAMES = (process.env.LIMIT_OPEN_GAMES | 0) || 7
-const LIMIT_ACTIVE_GAMES = (process.env.LIMIT_ACTIVE_GAMES | 0) || 29
const REGEX_MAIL = /^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\.[a-zA-Z0-9-]+)*$/
const REGEX_NAME = /^[\p{Alpha}\p{Number}'_-]+( [\p{Alpha}\p{Number}'_-]+)*$/u
@@ -1386,14 +1384,6 @@ const SQL_DELETE_PLAYER_ROLE = SQL("DELETE FROM players WHERE game_id=? AND role
const SQL_SELECT_PLAYER_VIEW = SQL("select * from player_view where game_id = ?")
-const SQL_COUNT_OPEN_GAMES = SQL(`SELECT COUNT(*) FROM games WHERE owner_id=? AND status=${STATUS_OPEN} and not is_match`).pluck()
-const SQL_COUNT_ACTIVE_GAMES = SQL(`
- select count(*) from games
- where status < 2 and exists (
- select 1 from players where players.user_id=? and players.game_id=games.game_id
- )
-`).pluck()
-
const SQL_SELECT_REMATCH = SQL(`SELECT game_id FROM games WHERE status < ${STATUS_FINISHED} AND notice=?`).pluck()
const SQL_INSERT_REMATCH = SQL(`
insert or ignore into games
@@ -1511,18 +1501,12 @@ const QUERY_LIST_FINISHED_GAMES_OF_USER = SQL(`
function check_create_game_limit(user) {
if (user.waiting > LIMIT_WAITING_GAMES)
return "You have too many games waiting!"
- if (SQL_COUNT_OPEN_GAMES.get(user.user_id) >= LIMIT_OPEN_GAMES)
- return "You have too many open games!"
- if (SQL_COUNT_ACTIVE_GAMES.get(user.user_id) >= LIMIT_ACTIVE_GAMES)
- return "You cannot join any more games!"
return null
}
function check_join_game_limit(user) {
if (user.waiting > LIMIT_WAITING_GAMES + 1)
return "You have too many games waiting!"
- if (SQL_COUNT_ACTIVE_GAMES.get(user.user_id) >= LIMIT_ACTIVE_GAMES)
- return "You cannot join any more games!"
return null
}