snakeia-server 1.2.4 → 1.2.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.drone.yml +2 -2
- package/README.md +32 -6
- package/config/default.json +4 -1
- package/package.json +7 -7
- package/server.js +32 -10
package/.drone.yml
CHANGED
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@ A server for my [SnakeIA](https://github.com/Eliastik/snakeia) game, written in
|
|
|
8
8
|
|
|
9
9
|
## About this server
|
|
10
10
|
|
|
11
|
-
* Version 1.2.
|
|
11
|
+
* Version 1.2.7 (2/22/2026)
|
|
12
12
|
* Made in France by Eliastik - [eliastiksofts.com](http://eliastiksofts.com) - Contact : [eliastiksofts.com/contact](http://eliastiksofts.com/contact)
|
|
13
13
|
* License: GNU GPLv3 (see LICENCE.txt file)
|
|
14
14
|
|
|
@@ -74,8 +74,11 @@ You can create another configuration file in the **config** directory named **lo
|
|
|
74
74
|
````
|
|
75
75
|
{
|
|
76
76
|
"ServerConfig": {
|
|
77
|
-
"version": "1.2.
|
|
77
|
+
"version": "1.2.7", // The server version
|
|
78
78
|
"port": 3000, // The port where the server runs
|
|
79
|
+
"enableHttps": false, // Enable or disable HTTPS listening on the server. If disabled, the server will only listen on HTTP.
|
|
80
|
+
"httpsCertFile": "path/to/https/cert.pem", // Path to HTTPS certificate file
|
|
81
|
+
"httpsKeyFile": "path/to/https/key.pem", // Path to HTTPS certificate key file
|
|
79
82
|
"proxyMode": false, // Sets this value to true if your server is behind a proxy - defaults to false
|
|
80
83
|
"numberOfProxies": 1, // Sets the number of reverse proxies in front of the server. Default to 1. See: https://expressjs.com/en/guide/behind-proxies.html / https://express-rate-limit.mintlify.app/guides/troubleshooting-proxy-issues
|
|
81
84
|
"enableMultithreading": true, // Enabling the use of different threads for the game engine, improves performance / requires a version of Nodejs that supports Worker Threads
|
|
@@ -123,6 +126,16 @@ You can create another configuration file in the **config** directory named **lo
|
|
|
123
126
|
|
|
124
127
|
## Changelog
|
|
125
128
|
|
|
129
|
+
* Version 1.2.7 (2/22/2026):
|
|
130
|
+
- Update dependencies + SnakeIA to version 3.1.0
|
|
131
|
+
|
|
132
|
+
* Version 1.2.6 (1/26/2026):
|
|
133
|
+
- Added the ability to start the server in HTTPS mode
|
|
134
|
+
- Update dependencies
|
|
135
|
+
|
|
136
|
+
* Version 1.2.5 (1/4/2026):
|
|
137
|
+
- Update dependencies
|
|
138
|
+
|
|
126
139
|
* Version 1.2.4 (12/6/2025):
|
|
127
140
|
- Update dependencies
|
|
128
141
|
|
|
@@ -216,7 +229,7 @@ Un serveur pour mon jeu [SnakeIA](https://github.com/Eliastik/snakeia), écrit e
|
|
|
216
229
|
|
|
217
230
|
## À propos de ce serveur
|
|
218
231
|
|
|
219
|
-
* Version 1.2.
|
|
232
|
+
* Version 1.2.7 (22/02/2026)
|
|
220
233
|
* Made in France by Eliastik - [eliastiksofts.com](http://eliastiksofts.com) - Contact : [eliastiksofts.com/contact](http://eliastiksofts.com/contact)
|
|
221
234
|
* Licence : GNU GPLv3 (voir le fichier LICENCE.txt)
|
|
222
235
|
|
|
@@ -282,8 +295,11 @@ Vous pouvez créer un fichier de configuration **local.json** dans le dossier **
|
|
|
282
295
|
````
|
|
283
296
|
{
|
|
284
297
|
"ServerConfig": {
|
|
285
|
-
"version": "1.2.
|
|
298
|
+
"version": "1.2.7", // La version du serveur
|
|
286
299
|
"port": 3000, // Le port sur lequel lancer le server
|
|
300
|
+
"enableHttps": false, // Activer ou désactiver l'écoute du serveur en HTTPS. Si désactivé, le serveur n'écoutera qu'en HTTP.
|
|
301
|
+
"httpsCertFile": "path/to/https/cert.pem", // Chemin vers le certificat HTTPS
|
|
302
|
+
"httpsKeyFile": "path/to/https/key.pem", // Chemin vers la clé du certificat HTTPS
|
|
287
303
|
"proxyMode": false, // Mettez à true si votre serveur est derrière un proxy - par défaut false
|
|
288
304
|
"numberOfProxies": 1, // Configure le nombre de proxies devant votre serveur. Par défaut 1. Voir : https://expressjs.com/en/guide/behind-proxies.html / https://express-rate-limit.mintlify.app/guides/troubleshooting-proxy-issues
|
|
289
305
|
"enableMultithreading": true, // Activer l'utilisation de threads différents pour le moteur de jeu, améliore les performances / nécessite une version de Nodejs qui supporte les Worker Threads
|
|
@@ -331,6 +347,16 @@ Vous pouvez créer un fichier de configuration **local.json** dans le dossier **
|
|
|
331
347
|
|
|
332
348
|
## Journal des changements
|
|
333
349
|
|
|
350
|
+
* Version 1.2.7 (22/02/2026) :
|
|
351
|
+
- Mise à jour des dépendences + SnakeIA vers 3.1.0
|
|
352
|
+
|
|
353
|
+
* Version 1.2.6 (26/01/2026) :
|
|
354
|
+
- Ajout de la possibilité de démarrer le serveur en HTTPS
|
|
355
|
+
- Mise à jour des dépendences
|
|
356
|
+
|
|
357
|
+
* Version 1.2.5 (04/01/2026) :
|
|
358
|
+
- Mise à jour des dépendences
|
|
359
|
+
|
|
334
360
|
* Version 1.2.4 (06/12/2025) :
|
|
335
361
|
- Mise à jour des dépendances
|
|
336
362
|
|
|
@@ -427,7 +453,7 @@ Vous pouvez créer un fichier de configuration **local.json** dans le dossier **
|
|
|
427
453
|
|
|
428
454
|
## Déclaration de licence
|
|
429
455
|
|
|
430
|
-
Copyright (C) 2020-
|
|
456
|
+
Copyright (C) 2020-2026 Eliastik (eliastiksofts.com)
|
|
431
457
|
|
|
432
458
|
Ce programme est un logiciel libre ; vous pouvez le redistribuer ou le modifier suivant les termes de la GNU General Public License telle que publiée par la Free Software Foundation ; soit la version 3 de la licence, soit (à votre gré) toute version ultérieure.
|
|
433
459
|
|
|
@@ -437,7 +463,7 @@ Vous devez avoir reçu une copie de la GNU General Public License en même temps
|
|
|
437
463
|
|
|
438
464
|
----
|
|
439
465
|
|
|
440
|
-
Copyright (C) 2020-
|
|
466
|
+
Copyright (C) 2020-2026 Eliastik (eliastiksofts.com)
|
|
441
467
|
|
|
442
468
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
443
469
|
|
package/config/default.json
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"ServerConfig": {
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"port": 3000,
|
|
5
|
+
"enableHttps": false,
|
|
6
|
+
"httpsCertFile": "path/to/https/cert.pem",
|
|
7
|
+
"httpsKeyFile": "path/to/https/key.pem",
|
|
5
8
|
"proxyMode": false,
|
|
6
9
|
"numberOfProxies": 1,
|
|
7
10
|
"enableMultithreading": true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "snakeia-server",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "Server for multiplaying in SnakeIA (https://github.com/Eliastik/snakeia)",
|
|
5
5
|
"main": "server.js",
|
|
6
6
|
"scripts": {
|
|
@@ -18,11 +18,11 @@
|
|
|
18
18
|
},
|
|
19
19
|
"homepage": "https://github.com/Eliastik/snakeia-server#readme",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"body-parser": "^2.2.
|
|
22
|
-
"config": "^4.
|
|
21
|
+
"body-parser": "^2.2.2",
|
|
22
|
+
"config": "^4.3.0",
|
|
23
23
|
"cookie-parser": "^1.4.7",
|
|
24
24
|
"csrf-csrf": "^4.0.3",
|
|
25
|
-
"ejs": "^
|
|
25
|
+
"ejs": "^4.0.1",
|
|
26
26
|
"express": "^5.2.1",
|
|
27
27
|
"express-rate-limit": "^8.2.1",
|
|
28
28
|
"html-entities": "^2.6.0",
|
|
@@ -30,9 +30,9 @@
|
|
|
30
30
|
"jsonwebtoken": "^9.0.3",
|
|
31
31
|
"node-fetch": "^3.3.2",
|
|
32
32
|
"seedrandom": "^3.0.5",
|
|
33
|
-
"snakeia": "^3.0
|
|
34
|
-
"socket.io": "^4.8.
|
|
33
|
+
"snakeia": "^3.1.0",
|
|
34
|
+
"socket.io": "^4.8.3",
|
|
35
35
|
"socket.io-cookie-parser": "^1.0.0",
|
|
36
|
-
"winston": "^3.
|
|
36
|
+
"winston": "^3.19.0"
|
|
37
37
|
}
|
|
38
38
|
}
|
package/server.js
CHANGED
|
@@ -17,16 +17,12 @@
|
|
|
17
17
|
* along with "SnakeIA Server". If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
*/
|
|
19
19
|
const express = require("express");
|
|
20
|
-
const app =
|
|
20
|
+
const app = express();
|
|
21
21
|
const fs = require("fs");
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
credentials: true
|
|
27
|
-
},
|
|
28
|
-
allowEIO3: true
|
|
29
|
-
});
|
|
22
|
+
const httpLib = require("http");
|
|
23
|
+
const httpsLib = require("https");
|
|
24
|
+
let server = null;
|
|
25
|
+
let io = null;
|
|
30
26
|
const entities = require("html-entities");
|
|
31
27
|
const ejs = require("ejs");
|
|
32
28
|
const jwt = require("jsonwebtoken");
|
|
@@ -90,6 +86,32 @@ i18n.configure({
|
|
|
90
86
|
cookie: "lang"
|
|
91
87
|
});
|
|
92
88
|
|
|
89
|
+
// Initialize server
|
|
90
|
+
if(config.enableHttps) {
|
|
91
|
+
const certPath = config.httpsCertFile;
|
|
92
|
+
const keyPath = config.httpsKeyFile;
|
|
93
|
+
|
|
94
|
+
try {
|
|
95
|
+
const key = fs.readFileSync(keyPath);
|
|
96
|
+
const cert = fs.readFileSync(certPath);
|
|
97
|
+
|
|
98
|
+
server = httpsLib.createServer({ key, cert }, app);
|
|
99
|
+
} catch(e) {
|
|
100
|
+
logger.error("failed to initialize HTTPS server. Fallback to HTTP server.", e);
|
|
101
|
+
server = httpLib.createServer(app);
|
|
102
|
+
}
|
|
103
|
+
} else {
|
|
104
|
+
server = httpLib.createServer(app);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
io = require("socket.io")(server, {
|
|
108
|
+
cors: {
|
|
109
|
+
origin: true,
|
|
110
|
+
credentials: true
|
|
111
|
+
},
|
|
112
|
+
allowEIO3: true
|
|
113
|
+
});
|
|
114
|
+
|
|
93
115
|
// Game modules
|
|
94
116
|
const snakeia = require("snakeia");
|
|
95
117
|
const { randomUUID } = require("crypto");
|
|
@@ -1563,6 +1585,6 @@ io.on("connection", function(socket) {
|
|
|
1563
1585
|
});
|
|
1564
1586
|
});
|
|
1565
1587
|
|
|
1566
|
-
|
|
1588
|
+
server.listen(config.port, () => {
|
|
1567
1589
|
console.log("listening on *:" + config.port);
|
|
1568
1590
|
});
|