package me.totalfreedom.totalfreedommod.httpd.module; import java.io.File; import me.totalfreedom.totalfreedommod.TotalFreedomMod; import me.totalfreedom.totalfreedommod.config.ConfigEntry; import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD; import me.totalfreedom.totalfreedommod.util.FLog; public class Module_logs extends Module_file { public Module_logs(TotalFreedomMod plugin, NanoHTTPD.HTTPSession session) { super(plugin, session); } @Override public NanoHTTPD.Response getResponse() { if (ConfigEntry.LOGS_SECRET.getString().equals(params.get("password"))) { FLog.info(session.getSocket().getInetAddress() + " is downloading latest.log."); return serveFile("latest.log", params, new File("./logs")); } else { return new NanoHTTPD.Response(NanoHTTPD.Response.Status.FORBIDDEN, NanoHTTPD.MIME_PLAINTEXT, "Incorrect password."); } } }