Fixed CSS and removed some TODOs

This commit is contained in:
Norbi Peti 2016-07-25 13:14:06 +02:00
parent 120f792ddf
commit 4ea179ed91
5 changed files with 7 additions and 5 deletions

View file

@ -2,6 +2,6 @@ body {
background-color: #8888; background-color: #8888;
} }
.loginbox, .userbox, .errormsg, .successmsg { #loginbox, #userbox, #errormsg, #successmsg {
display: none; display: none;
} }

View file

@ -110,7 +110,7 @@ public class IOHelper {
public static HashMap<String, String> GetCookies(HttpExchange exchange) { public static HashMap<String, String> GetCookies(HttpExchange exchange) {
if (!exchange.getRequestHeaders().containsKey("Cookie")) if (!exchange.getRequestHeaders().containsKey("Cookie"))
return new HashMap<>(); return new HashMap<>();
HashMap<String, String> map = new HashMap<>(); // TODO HashMap<String, String> map = new HashMap<>();
for (String cheader : exchange.getRequestHeaders().get("Cookie")) { for (String cheader : exchange.getRequestHeaders().get("Cookie")) {
String[] spl = cheader.split("\\;\\S"); String[] spl = cheader.split("\\;\\S");
for (String s : spl) { for (String s : spl) {

View file

@ -9,7 +9,7 @@ import io.github.norbipeti.chat.server.db.domain.User;
public class IndexPage extends Page { public class IndexPage extends Page {
@Override @Override
public void handlePage(HttpExchange exchange) throws IOException { //TODO: Make a base HTML and insert all pages into that public void handlePage(HttpExchange exchange) throws IOException {
User user = IOHelper.GetLoggedInUser(exchange); User user = IOHelper.GetLoggedInUser(exchange);
if (user == null) if (user == null)
IOHelper.SendModifiedPage(200, this, IOHelper.SendModifiedPage(200, this,

View file

@ -47,7 +47,7 @@ public class RegisterPage extends Page {
IOHelper.LoginUser(exchange, user); IOHelper.LoginUser(exchange, user);
IOHelper.Redirect("/", exchange); IOHelper.Redirect("/", exchange);
} }
return; // TODO: Only show tag when needed return;
} }
IOHelper.SendPage(200, this, exchange); IOHelper.SendPage(200, this, exchange);
} }

View file

@ -25,8 +25,10 @@ public class StylePage extends Page {
File cssfile = new File("pages", exchange.getRequestURI().getPath()); File cssfile = new File("pages", exchange.getRequestURI().getPath());
if (!cssfile.exists()) if (!cssfile.exists())
IOHelper.SendResponse(404, "<h1>CSS file not found</h1>", exchange); IOHelper.SendResponse(404, "<h1>CSS file not found</h1>", exchange);
else else {
exchange.getResponseHeaders().add("Content-Type", "text/css");
IOHelper.SendResponse(200, IOHelper.ReadFile(cssfile), exchange); IOHelper.SendResponse(200, IOHelper.ReadFile(cssfile), exchange);
}
} else } else
System.out.println(exchange.getRequestURI().getPath()); System.out.println(exchange.getRequestURI().getPath());
} }