aboutsummaryrefslogtreecommitdiffstats
path: root/src/server
diff options
context:
space:
mode:
Diffstat (limited to 'src/server')
-rw-r--r--src/server/HttpServer.hx4
-rw-r--r--src/server/Main.hx8
2 files changed, 4 insertions, 8 deletions
diff --git a/src/server/HttpServer.hx b/src/server/HttpServer.hx
index 8e4cf75..4bf16c4 100644
--- a/src/server/HttpServer.hx
+++ b/src/server/HttpServer.hx
@@ -220,9 +220,7 @@ class HttpServer {
}
static function getMimeType(ext:String):String {
- final contentType = mimeTypes[ext];
- if (contentType == null) return "application/octet-stream";
- return contentType;
+ return mimeTypes[ext] ?? return "application/octet-stream";
}
static final ctrlCharacters = ~/[\u0000-\u001F\u007F-\u009F\u2000-\u200D\uFEFF]/g;
diff --git a/src/server/Main.hx b/src/server/Main.hx
index a525f65..2547761 100644
--- a/src/server/Main.hx
+++ b/src/server/Main.hx
@@ -164,9 +164,7 @@ class Main {
}
function generateConfigSalt():String {
- if (userList.salt == null) {
- userList.salt = Sha256.encode('${Math.random()}');
- }
+ userList.salt ??= Sha256.encode('${Math.random()}');
return userList.salt;
}
@@ -222,8 +220,8 @@ class Main {
bans: []
};
final users:UserList = Json.parse(File.getContent(customPath));
- if (users.admins == null) users.admins = [];
- if (users.bans == null) users.bans = [];
+ users.admins ??= [];
+ users.bans ??= [];
for (field in users.bans) {
field.toDate = Date.fromString(cast field.toDate);
}
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage