This commit is contained in:
2026-04-20 15:57:50 +03:00
parent f3e105bbc8
commit f16a830eb2
9 changed files with 18 additions and 64 deletions

View File

@@ -18,9 +18,10 @@ import io.vertx.ext.web.sstore.SessionStore;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import su.xserver.iikocon.config.AppConfig;
import su.xserver.iikocon.service.DataBaseService;
import su.xserver.iikocon.service.HealthCheckService;
import su.xserver.iikocon.service.RedisService;
import su.xserver.iikocon.handler.AuthHandler;
import su.xserver.iikocon.handler.SecurityHandler;
import su.xserver.iikocon.handler.SetupHandler;
import su.xserver.iikocon.service.*;
import java.util.ArrayList;
import java.util.List;
@@ -119,7 +120,7 @@ public class MainVerticle extends AbstractVerticle {
router.route().handler(BodyHandler.create());
router.route().handler(sessionHandler);
SecurityHandlers securityHandlers = new SecurityHandlers(settingsService);
SecurityHandler securityHandlers = new SecurityHandler(settingsService);
// Обработчики безопасности (порядок важен)
router.route().handler(securityHandlers.hostValidator());

View File

@@ -1,8 +1,9 @@
package su.xserver.iikocon;
package su.xserver.iikocon.handler;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.RoutingContext;
import io.vertx.ext.web.Session;
import su.xserver.iikocon.service.UserService;
public class AuthHandler {
private final UserService userService;

View File

@@ -1,18 +1,19 @@
package su.xserver.iikocon;
package su.xserver.iikocon.handler;
import io.vertx.core.Handler;
import io.vertx.core.http.HttpServerRequest;
import io.vertx.core.net.SocketAddress;
import io.vertx.ext.web.RoutingContext;
import su.xserver.iikocon.service.SettingsService;
import java.util.Arrays;
import java.util.HashSet;
import java.util.Set;
public class SecurityHandlers {
public class SecurityHandler {
private final SettingsService settings;
public SecurityHandlers(SettingsService settings) {
public SecurityHandler(SettingsService settings) {
this.settings = settings;
}

View File

@@ -1,7 +1,8 @@
package su.xserver.iikocon;
package su.xserver.iikocon.handler;
import io.vertx.core.json.JsonObject;
import io.vertx.ext.web.RoutingContext;
import su.xserver.iikocon.service.UserService;
public class SetupHandler {
private final UserService userService;

View File

@@ -1,4 +1,4 @@
package su.xserver.iikocon;
package su.xserver.iikocon.service;
import io.vertx.core.Future;
import io.vertx.core.json.JsonArray;

View File

@@ -1,4 +1,4 @@
package su.xserver.iikocon;
package su.xserver.iikocon.service;
import io.vertx.core.Future;
import io.vertx.core.json.JsonArray;
@@ -30,24 +30,6 @@ public class SettingsService {
.put("type", "textarea")
.put("rows", 2)
);
// meta.add(new JsonObject()
// .put("key", "theme")
// .put("label", "Theme")
// .put("description", "Default color scheme")
// .put("type", "select")
// .put("options", new JsonArray()
// .add(new JsonObject().put("value", "light").put("label", "Light"))
// .add(new JsonObject().put("value", "dark").put("label", "Dark"))
// .add(new JsonObject().put("value", "auto").put("label", "Auto (system preference)"))
// )
// );
// meta.add(new JsonObject()
// .put("key", "items_per_page")
// .put("label", "Items Per Page")
// .put("description", "Number of items shown in tables")
// .put("type", "number")
// .put("required", true)
// );
meta.add(new JsonObject()
.put("key", "enable_registration")
.put("label", "Allow Public Registration")
@@ -60,17 +42,6 @@ public class SettingsService {
.put("description", "When enabled, only admins can access the site")
.put("type", "boolean")
);
// meta.add(new JsonObject()
// .put("key", "default_language")
// .put("label", "Default Language")
// .put("description", "Interface language")
// .put("type", "select")
// .put("options", new JsonArray()
// .add(new JsonObject().put("value", "en").put("label", "English"))
// .add(new JsonObject().put("value", "ru").put("label", "Русский"))
// .add(new JsonObject().put("value", "es").put("label", "Español"))
// )
// );
meta.add(new JsonObject()
.put("key", "session_timeout_minutes")
.put("label", "Session Timeout (minutes)")
@@ -78,12 +49,6 @@ public class SettingsService {
.put("type", "number")
.put("required", true)
);
// meta.add(new JsonObject()
// .put("key", "logo_url")
// .put("label", "Logo URL")
// .put("description", "Path or URL to custom logo image")
// .put("type", "text")
// );
// Безопасность и прокси
meta.add(new JsonObject()
@@ -134,13 +99,9 @@ public class SettingsService {
return switch (key) {
case "site_name" -> "Admin Panel";
case "site_description" -> "";
// case "theme" -> "light";
// case "items_per_page" -> "20";
case "enable_registration" -> "true";
case "maintenance_mode" -> "false";
// case "default_language" -> "en";
case "session_timeout_minutes" -> "60";
// case "logo_url" -> "";
case "use_proxy_headers" -> "true";
case "trusted_proxies" -> "127.0.0.1";
case "enable_csp" -> "true";

View File

@@ -1,4 +1,4 @@
package su.xserver.iikocon;
package su.xserver.iikocon.service;
import io.vertx.core.Future;
import io.vertx.core.json.JsonArray;

View File

@@ -1,4 +1,4 @@
package su.xserver.iikocon;
package su.xserver.iikocon.test;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;

View File

@@ -1,4 +1,4 @@
package su.xserver.iikocon;
package su.xserver.iikocon.test;
import io.vertx.core.AbstractVerticle;
import io.vertx.core.Promise;
@@ -181,14 +181,3 @@ public class ProxyVerticle extends AbstractVerticle {
ctx.response().setStatusCode(status).end(new JsonObject().put("error", message).encode());
}
}
// > GET /api/proxy?server=folk-amber-co.iiko.it&login=4444&password=4444&presetId=7ddc40c3-9d5f-408f-aa1e-652964b36c6c&dateFrom=2026-04-10&dateTo=2026-04-17 HTTP/1.1
// > Host: localhost:8080
// > access-token: ddb4ab653b9194ec1ea5448cee2a8a26282b0866c1d4a86e98e9b0f84bc91944
// > User-Agent: v2raytun/ios
// > X-App-Version: 2.4.3
// > X-Device-Model: iPhone 11 Pro
// > X-Device-OS: iOS
// > X-HWID: HHS8JDJN-F2EB-HFBS-KMWX-234FA7B95JSC
// > X-Ver-OS: 26.0
// > Accept: */*