Better README.
Added images and checkboxes to the features section.
This commit is contained in:
parent
46b82a18b5
commit
98cd823999
11 changed files with 33 additions and 12 deletions
|
|
@ -32,7 +32,7 @@ public class AppConfig {
|
|||
}
|
||||
|
||||
public void hashPlaintextPasswords() {
|
||||
if (users == null) return; // safety check
|
||||
if (users == null) return;
|
||||
for (Map.Entry<String, UserConfig> entry : users.entrySet()) {
|
||||
Logger.info("Hashing user password for %s.".formatted(entry.getKey()));
|
||||
UserConfig user = entry.getValue();
|
||||
|
|
@ -42,7 +42,7 @@ public class AppConfig {
|
|||
|
||||
user.setSalt(salt);
|
||||
user.setHash(hash);
|
||||
user.setPassword(null); // clear plaintext
|
||||
user.setPassword(null);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@ public class ConfigLoader {
|
|||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static AppConfig load(String path) throws Exception {
|
||||
if (config != null) return config; // singleton
|
||||
if (config != null) return config;
|
||||
|
||||
File file = new File(path);
|
||||
AppConfig appConfig;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package org.adrianvictor.livingroom.http;
|
||||
|
||||
import org.adrianvictor.livingroom.http.handlers.*;
|
||||
import org.adrianvictor.livingroom.web.pages.Remove;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class UserService {
|
|||
Role role;
|
||||
|
||||
try {
|
||||
role = Role.valueOf(raw.getRole());
|
||||
role = Role.valueOf(raw.getRole().toUpperCase());
|
||||
} catch (IllegalArgumentException e) {
|
||||
role = Role.USER;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,7 @@ public class Pages {
|
|||
map.put("game", new Game());
|
||||
map.put("logout", new Logout());
|
||||
map.put("scan", new Scan());
|
||||
map.put("remove", new Remove());
|
||||
}
|
||||
|
||||
public static HashMap<String, Page> getAll() {
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package org.adrianvictor.livingroom.web.pages;
|
|||
|
||||
import com.sun.net.httpserver.HttpExchange;
|
||||
import freemarker.template.Configuration;
|
||||
import org.adrianvictor.livingroom.Logger;
|
||||
import org.adrianvictor.livingroom.Main;
|
||||
import org.adrianvictor.livingroom.data.Database;
|
||||
import org.adrianvictor.livingroom.data.Indexer;
|
||||
|
|
@ -17,12 +18,14 @@ public class Remove implements Page {
|
|||
public String result(Configuration cfg, String baseAddress, String path, Map<String, Object> data, HttpExchange exchange) {
|
||||
String arg = path.split("/")[0];
|
||||
if (arg == null) {
|
||||
Logger.info("Arg is null");
|
||||
return QuickResponses.notFound();
|
||||
}
|
||||
int id;
|
||||
try {
|
||||
id = Integer.parseInt(arg);
|
||||
} catch (NumberFormatException e) {
|
||||
Logger.info("Cannot parse number");
|
||||
return QuickResponses.notFound();
|
||||
}
|
||||
Database.getInstance().remove(String.valueOf(id));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue