mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2024-11-05 02:09:50 +01:00
Fixed Forbidden response being shown on all HTTP responses
This commit is contained in:
parent
66e3f61203
commit
b572955e23
@ -7,6 +7,7 @@ package com.djrapitops.plan.system;
|
||||
import com.djrapitops.plan.Plan;
|
||||
import com.djrapitops.plan.ShutdownHook;
|
||||
import com.djrapitops.plan.api.BukkitAPI;
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.data.plugin.HookHandler;
|
||||
import com.djrapitops.plan.system.database.BukkitDBSystem;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
@ -15,6 +16,7 @@ import com.djrapitops.plan.system.info.server.BukkitServerInfo;
|
||||
import com.djrapitops.plan.system.listeners.BukkitListenerSystem;
|
||||
import com.djrapitops.plan.system.settings.PlanErrorManager;
|
||||
import com.djrapitops.plan.system.settings.config.BukkitConfigSystem;
|
||||
import com.djrapitops.plan.system.settings.network.NetworkSettings;
|
||||
import com.djrapitops.plan.system.tasks.BukkitTaskSystem;
|
||||
import com.djrapitops.plan.system.update.VersionCheckSystem;
|
||||
import com.djrapitops.plugin.StaticHolder;
|
||||
@ -52,4 +54,10 @@ public class BukkitSystem extends PlanSystem {
|
||||
public static BukkitSystem getInstance() {
|
||||
return Plan.getInstance().getSystem();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable() throws EnableException {
|
||||
super.enable();
|
||||
NetworkSettings.loadSettingsFromDB();
|
||||
}
|
||||
}
|
@ -6,6 +6,7 @@ package com.djrapitops.plan.system;
|
||||
|
||||
import com.djrapitops.plan.PlanBungee;
|
||||
import com.djrapitops.plan.api.BungeeAPI;
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.data.plugin.HookHandler;
|
||||
import com.djrapitops.plan.system.database.BungeeDBSystem;
|
||||
import com.djrapitops.plan.system.database.DBSystem;
|
||||
@ -15,6 +16,7 @@ import com.djrapitops.plan.system.info.server.BungeeServerInfo;
|
||||
import com.djrapitops.plan.system.listeners.BungeeListenerSystem;
|
||||
import com.djrapitops.plan.system.settings.PlanErrorManager;
|
||||
import com.djrapitops.plan.system.settings.config.BungeeConfigSystem;
|
||||
import com.djrapitops.plan.system.settings.network.NetworkSettings;
|
||||
import com.djrapitops.plan.system.tasks.BungeeTaskSystem;
|
||||
import com.djrapitops.plan.system.update.VersionCheckSystem;
|
||||
import com.djrapitops.plugin.api.utility.log.Log;
|
||||
@ -52,4 +54,10 @@ public class BungeeSystem extends PlanSystem {
|
||||
public void setDatabaseSystem(DBSystem dbSystem) {
|
||||
this.databaseSystem = dbSystem;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable() throws EnableException {
|
||||
super.enable();
|
||||
NetworkSettings.placeSettingsToDB();
|
||||
}
|
||||
}
|
@ -94,7 +94,7 @@ class ProcessConsumer extends Consumer<Processor> {
|
||||
process.process();
|
||||
Benchmark.stop(benchName);
|
||||
} catch (Exception | NoClassDefFoundError | NoSuchFieldError | NoSuchMethodError e) {
|
||||
Log.toLog(this.getTaskName() + ":" + process.getClass().getSimpleName(), e);
|
||||
Log.toLog(process.getClass(), e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,7 @@
|
||||
*/
|
||||
package com.djrapitops.plan.system.settings.config;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.settings.network.NetworkSettings;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -23,10 +21,4 @@ public class BukkitConfigSystem extends ConfigSystem {
|
||||
protected void copyDefaults() throws IOException {
|
||||
config.copyDefaults(FileSystem.readFromResource("config.yml"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable() throws EnableException {
|
||||
super.enable();
|
||||
NetworkSettings.loadSettingsFromDB();
|
||||
}
|
||||
}
|
@ -4,9 +4,7 @@
|
||||
*/
|
||||
package com.djrapitops.plan.system.settings.config;
|
||||
|
||||
import com.djrapitops.plan.api.exceptions.EnableException;
|
||||
import com.djrapitops.plan.system.file.FileSystem;
|
||||
import com.djrapitops.plan.system.settings.network.NetworkSettings;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
@ -23,10 +21,4 @@ public class BungeeConfigSystem extends ConfigSystem {
|
||||
protected void copyDefaults() throws IOException {
|
||||
config.copyDefaults(FileSystem.readFromResource("bungeeconfig.yml"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void enable() throws EnableException {
|
||||
super.enable();
|
||||
NetworkSettings.placeSettingsToDB();
|
||||
}
|
||||
}
|
@ -108,7 +108,9 @@ public class ResponseHandler extends TreePageHandler {
|
||||
if (pageHandler == null) {
|
||||
return DefaultResponses.NOT_FOUND.get();
|
||||
} else {
|
||||
if (authentication.isPresent() && pageHandler.isAuthorized(authentication.get(), target)) {
|
||||
boolean noAuthRequired = !webServer.isAuthRequired();
|
||||
boolean isAuthorized = authentication.isPresent() && pageHandler.isAuthorized(authentication.get(), target);
|
||||
if (noAuthRequired || isAuthorized) {
|
||||
return pageHandler.getResponse(request, target);
|
||||
}
|
||||
return forbiddenResponse();
|
||||
|
Loading…
Reference in New Issue
Block a user