summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTor Andersson <tor@ccxvii.net>2024-10-21 12:29:28 +0200
committerTor Andersson <tor@ccxvii.net>2024-10-21 12:29:28 +0200
commit419b6653b5177e599558991aaa6dbe71803a0f87 (patch)
tree5bdae749f1b44e1525c122fb983fe78aa0cacecb
parent2d1c2728bece17648328aa7de4e74b369edd792c (diff)
downloadserver-419b6653b5177e599558991aaa6dbe71803a0f87.tar.gz
Use env to control presence of tournaments.
-rw-r--r--public/join.js2
-rw-r--r--server.js7
-rw-r--r--views/games_active.pug13
-rw-r--r--views/header.pug3
-rw-r--r--views/user.pug3
5 files changed, 17 insertions, 11 deletions
diff --git a/public/join.js b/public/join.js
index b2c667f..9228481 100644
--- a/public/join.js
+++ b/public/join.js
@@ -128,7 +128,7 @@ function format_time_left(time) {
return "no time left"
if (time <= 2 / 24)
return Math.floor(time * 24 * 60) + " minutes left"
- if (time <= 2)
+ if (time <= 3)
return Math.floor(time * 24) + " hours left"
return Math.floor(time) + " days left"
}
diff --git a/server.js b/server.js
index 21a6daa..10eafc0 100644
--- a/server.js
+++ b/server.js
@@ -198,6 +198,7 @@ app.locals.SITE_IMPRINT = process.env.SITE_IMPRINT
app.locals.ENABLE_MAIL = !!mailer
app.locals.ENABLE_WEBHOOKS = !!WEBHOOKS
app.locals.ENABLE_FORUM = process.env.FORUM | 0
+app.locals.ENABLE_TOURNAMENTS = process.env.TOURNAMENTS | 0
app.locals.EMOJI_PRIVATE = "\u{1F512}" // or 512
app.locals.EMOJI_MATCH = "\u{1f3c6}"
@@ -3361,8 +3362,10 @@ function tournament_ticker() {
}
}
-setTimeout(tournament_ticker, 19 * 1000)
-setInterval(tournament_ticker, 97 * 1000)
+if (app.locals.ENABLE_TOURNAMENTS) {
+ setTimeout(tournament_ticker, 19 * 1000)
+ setInterval(tournament_ticker, 97 * 1000)
+}
/*
* GAME SERVER
diff --git a/views/games_active.pug b/views/games_active.pug
index 7da3b26..ee9687f 100644
--- a/views/games_active.pug
+++ b/views/games_active.pug
@@ -26,10 +26,10 @@ html
p
a(href="/create") Create a new game
- +tourlist(seeds, active_pools, finished_pools)
-
- p
- a(href="/tm/list") Join a tournament
+ if ENABLE_TOURNAMENTS
+ +tourlist(seeds, active_pools, finished_pools)
+ p
+ a(href="/tm/list") Join a tournament
if move_games.length > 0
h2 Move
@@ -53,5 +53,6 @@ html
p
a(href="/games/finished") All your finished games
- br
- a(href="/tm/finished") All your finished tournaments
+ if ENABLE_TOURNAMENTS
+ br
+ a(href="/tm/finished") All your finished tournaments
diff --git a/views/header.pug b/views/header.pug
index 6df51e6..e6cdeeb 100644
--- a/views/header.pug
+++ b/views/header.pug
@@ -9,7 +9,8 @@ header
if user
if ENABLE_FORUM
a(href="/forum") Forum
- a(href="/tm/list") Tournaments
+ if ENABLE_TOURNAMENTS
+ a(href="/tm/list") Tournaments
a(href="/games/public") Public
if user.waiting > 0
a(href="/games/active") Games (#{user.waiting})
diff --git a/views/user.pug b/views/user.pug
index f3a30f0..fc55b42 100644
--- a/views/user.pug
+++ b/views/user.pug
@@ -65,7 +65,8 @@ html
+gamelist(finished_games)
p <a href="/games/finished/#{who.name}">All #{who.name}'s finished games</a>
- p <a href="/tm/finished/#{who.name}">All #{who.name}'s finished tournaments</a>
+ if ENABLE_TOURNAMENTS
+ p <a href="/tm/finished/#{who.name}">All #{who.name}'s finished tournaments</a>
if user && user.user_id === 1
if who.is_banned