mirror of
https://github.com/AtlasMediaGroup/TotalFreedomMod.git
synced 2025-06-12 13:53:54 +00:00
SQL DB is a WIP
This commit is contained in:
@ -24,7 +24,6 @@ import me.totalfreedom.totalfreedommod.httpd.module.Module_permbans;
|
||||
import me.totalfreedom.totalfreedommod.httpd.module.Module_players;
|
||||
import me.totalfreedom.totalfreedommod.httpd.module.Module_punishments;
|
||||
import me.totalfreedom.totalfreedommod.httpd.module.Module_schematic;
|
||||
import me.totalfreedom.totalfreedommod.httpd.module.Module_vpnbans;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@ -70,7 +69,6 @@ public class HTTPDaemon extends FreedomService
|
||||
module("players", Module_players.class, false);
|
||||
module("punishments", Module_punishments.class, true);
|
||||
module("schematic", Module_schematic.class, true);
|
||||
module("vpnbans", Module_vpnbans.class, true);
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -17,7 +17,10 @@ public class Module_admins extends HTTPDModule
|
||||
@Override
|
||||
public NanoHTTPD.Response getResponse()
|
||||
{
|
||||
File adminFile = new File(plugin.getDataFolder(), Admin.CONFIG_FILENAME);
|
||||
|
||||
return new NanoHTTPD.Response(NanoHTTPD.Response.Status.NOT_FOUND, NanoHTTPD.MIME_PLAINTEXT,
|
||||
"Error 404: Not Found - i have to re-work this");
|
||||
/*File adminFile = new File(plugin.getDataFolder(), Admin.CONFIG_FILENAME);
|
||||
if (adminFile.exists())
|
||||
{
|
||||
final String remoteAddress = socket.getInetAddress().getHostAddress();
|
||||
@ -36,7 +39,7 @@ public class Module_admins extends HTTPDModule
|
||||
{
|
||||
return new NanoHTTPD.Response(NanoHTTPD.Response.Status.NOT_FOUND, NanoHTTPD.MIME_PLAINTEXT,
|
||||
"Error 404: Not Found - The requested resource was not found on this server.");
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private boolean isAuthorized(String remoteAddress)
|
||||
|
@ -18,7 +18,9 @@ public class Module_bans extends HTTPDModule
|
||||
@Override
|
||||
public NanoHTTPD.Response getResponse()
|
||||
{
|
||||
File banFile = new File(plugin.getDataFolder(), BanManager.CONFIG_FILENAME);
|
||||
return new NanoHTTPD.Response(NanoHTTPD.Response.Status.NOT_FOUND, NanoHTTPD.MIME_PLAINTEXT,
|
||||
"Error 404: Not Found - i have to re-work this");
|
||||
/*File banFile = new File(plugin.getDataFolder(), BanManager.CONFIG_FILENAME);
|
||||
if (banFile.exists())
|
||||
{
|
||||
final String remoteAddress = socket.getInetAddress().getHostAddress();
|
||||
@ -37,7 +39,7 @@ public class Module_bans extends HTTPDModule
|
||||
{
|
||||
return new NanoHTTPD.Response(NanoHTTPD.Response.Status.NOT_FOUND, NanoHTTPD.MIME_PLAINTEXT,
|
||||
"Error 404: Not Found - The requested resource was not found on this server.");
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
private boolean isAuthorized(String remoteAddress)
|
||||
|
@ -21,6 +21,7 @@ import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
|
||||
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
|
||||
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD.Method;
|
||||
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD.Response;
|
||||
import me.totalfreedom.totalfreedommod.masterbuilder.MasterBuilder;
|
||||
import me.totalfreedom.totalfreedommod.util.FLog;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.commons.lang3.StringEscapeUtils;
|
||||
@ -269,8 +270,9 @@ public class Module_schematic extends HTTPDModule
|
||||
|
||||
private boolean isAuthorized(String remoteAddress)
|
||||
{
|
||||
Admin entry = plugin.al.getEntryByIp(remoteAddress);
|
||||
return entry != null && entry.isActive();
|
||||
Admin adminEntry = plugin.al.getEntryByIp(remoteAddress);
|
||||
MasterBuilder masterBuilderEntry = plugin.mbl.getEntryByIp(remoteAddress);
|
||||
return ((adminEntry != null && adminEntry.isActive()) || masterBuilderEntry != null);
|
||||
}
|
||||
|
||||
private static class SchematicTransferException extends Exception
|
||||
|
@ -1,32 +0,0 @@
|
||||
package me.totalfreedom.totalfreedommod.httpd.module;
|
||||
|
||||
import java.io.File;
|
||||
import me.totalfreedom.totalfreedommod.TotalFreedomMod;
|
||||
import me.totalfreedom.totalfreedommod.banning.VPNBanList;
|
||||
import me.totalfreedom.totalfreedommod.httpd.HTTPDaemon;
|
||||
import me.totalfreedom.totalfreedommod.httpd.NanoHTTPD;
|
||||
|
||||
public class Module_vpnbans extends HTTPDModule
|
||||
{
|
||||
|
||||
public Module_vpnbans(TotalFreedomMod plugin, NanoHTTPD.HTTPSession session)
|
||||
{
|
||||
super(plugin, session);
|
||||
}
|
||||
|
||||
@Override
|
||||
public NanoHTTPD.Response getResponse()
|
||||
{
|
||||
File vpnbanFile = new File(plugin.getDataFolder(), VPNBanList.CONFIG_FILENAME);
|
||||
|
||||
if (vpnbanFile.exists())
|
||||
{
|
||||
return HTTPDaemon.serveFileBasic(new File(plugin.getDataFolder(), VPNBanList.CONFIG_FILENAME));
|
||||
}
|
||||
else
|
||||
{
|
||||
return new NanoHTTPD.Response(NanoHTTPD.Response.Status.NOT_FOUND, NanoHTTPD.MIME_PLAINTEXT,
|
||||
"Error 404: Not Found - The requested resource was not found on this server.");
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user