fixing bugs
This commit is contained in:
		
							
								
								
									
										67
									
								
								bootstrap/dependency-reduced-pom.xml
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										67
									
								
								bootstrap/dependency-reduced-pom.xml
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,67 @@ | ||||
| <?xml version="1.0" encoding="UTF-8"?> | ||||
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||||
|   <parent> | ||||
|     <artifactId>miarma-ecosystem</artifactId> | ||||
|     <groupId>net.miarma.api</groupId> | ||||
|     <version>1.2.0</version> | ||||
|   </parent> | ||||
|   <modelVersion>4.0.0</modelVersion> | ||||
|   <artifactId>bootstrap</artifactId> | ||||
|   <build> | ||||
|     <finalName>MiarmaEcosystem</finalName> | ||||
|     <plugins> | ||||
|       <plugin> | ||||
|         <artifactId>maven-shade-plugin</artifactId> | ||||
|         <version>3.5.3</version> | ||||
|         <executions> | ||||
|           <execution> | ||||
|             <phase>package</phase> | ||||
|             <goals> | ||||
|               <goal>shade</goal> | ||||
|             </goals> | ||||
|             <configuration> | ||||
|               <createDependencyReducedPom>true</createDependencyReducedPom> | ||||
|               <filters> | ||||
|                 <filter> | ||||
|                   <artifact>*:*</artifact> | ||||
|                   <excludes> | ||||
|                     <exclude>META-INF/*.SF</exclude> | ||||
|                     <exclude>META-INF/*.DSA</exclude> | ||||
|                     <exclude>META-INF/*.RSA</exclude> | ||||
|                   </excludes> | ||||
|                 </filter> | ||||
|               </filters> | ||||
|               <artifactSet> | ||||
|                 <excludes> | ||||
|                   <exclude>io.vertx:*</exclude> | ||||
|                   <exclude>io.netty:*</exclude> | ||||
|                   <exclude>com.fasterxml.jackson.core:*</exclude> | ||||
|                   <exclude>com.google.code.gson:gson</exclude> | ||||
|                 </excludes> | ||||
|               </artifactSet> | ||||
|               <transformers> | ||||
|                 <transformer> | ||||
|                   <mainClass>net.miarma.api.AppInitializer</mainClass> | ||||
|                 </transformer> | ||||
|               </transformers> | ||||
|             </configuration> | ||||
|           </execution> | ||||
|         </executions> | ||||
|       </plugin> | ||||
|     </plugins> | ||||
|   </build> | ||||
|   <repositories> | ||||
|     <repository> | ||||
|       <id>jitpack.io</id> | ||||
|       <url>https://jitpack.io</url> | ||||
|     </repository> | ||||
|     <repository> | ||||
|       <id>MiarmaGit</id> | ||||
|       <url>https://git.miarma.net/api/packages/Gallardo7761/maven</url> | ||||
|     </repository> | ||||
|   </repositories> | ||||
|   <properties> | ||||
|     <maven.compiler.target>23</maven.compiler.target> | ||||
|     <maven.compiler.source>23</maven.compiler.source> | ||||
|   </properties> | ||||
| </project> | ||||
| @@ -3,45 +3,68 @@ package net.miarma.api; | ||||
| import java.util.Set; | ||||
|  | ||||
| import io.vertx.core.AbstractVerticle; | ||||
| import io.vertx.core.Future; | ||||
| import io.vertx.core.Promise; | ||||
| import io.vertx.core.Verticle; | ||||
| import net.miarma.api.backlib.Constants; | ||||
| import net.miarma.api.backlib.LogAccumulator; | ||||
| import net.miarma.api.backlib.util.DeploymentUtil; | ||||
| import net.miarma.api.microservices.core.verticles.CoreMainVerticle; | ||||
| import net.miarma.api.microservices.huertos.verticles.HuertosMainVerticle; | ||||
| import net.miarma.api.microservices.huertosdecine.verticles.CineMainVerticle; | ||||
| import net.miarma.api.microservices.miarmacraft.verticles.MMCMainVerticle; | ||||
| import net.miarma.api.microservices.mpaste.verticles.MPasteMainVerticle; | ||||
|  | ||||
| public class MasterVerticle extends AbstractVerticle { | ||||
| 	private static final Set<String> VERTICLE_SET = Set.of( | ||||
|         "net.miarma.api.microservices.core.verticles.CoreMainVerticle", | ||||
|         "net.miarma.api.microservices.huertos.verticles.HuertosMainVerticle", | ||||
|         "net.miarma.api.microservices.huertosdecine.verticles.CineMainVerticle", | ||||
|         "net.miarma.api.microservices.miarmacraft.verticles.MMCMainVerticle", | ||||
|         "net.miarma.api.microservices.mpaste.verticles.MPasteMainVerticle" | ||||
|     ); | ||||
| 	 | ||||
| public class MasterVerticle extends AbstractVerticle {	 | ||||
| 	@Override | ||||
|     public void start(Promise<Void> startPromise) { | ||||
|         try { | ||||
|             for (String verticleClassName : VERTICLE_SET) { | ||||
|                 Verticle verticleInstance = (Verticle) Class | ||||
|                         .forName(verticleClassName) | ||||
|                         .getConstructor() | ||||
|                         .newInstance(); | ||||
|                 vertx.deployVerticle(verticleInstance, result -> { | ||||
|         			if (result.succeeded()) { | ||||
|         				String message = DeploymentUtil.successMessage(verticleInstance.getClass()); | ||||
|         				LogAccumulator.add(message); | ||||
|         			} else { | ||||
|         				LogAccumulator.add(DeploymentUtil.failMessage(verticleInstance.getClass(), result.cause())); | ||||
|         			} | ||||
|         		}); | ||||
|             } | ||||
|             startPromise.complete(); | ||||
|         } catch (Exception e) { | ||||
|             startPromise.fail(e); | ||||
|         } | ||||
| 		vertx.exceptionHandler(err -> { | ||||
| 		    err.printStackTrace(); | ||||
| 		}); | ||||
|  | ||||
| 		deploy() | ||||
| 		.onSuccess(v -> { | ||||
| 			vertx.setTimer(300, id -> { | ||||
| 				LogAccumulator.flushToLogger(Constants.LOGGER); | ||||
| 				startPromise.complete(); | ||||
| 			}); | ||||
| 		}) | ||||
| 		.onFailure(startPromise::fail); | ||||
|     } | ||||
| 	 | ||||
| 	private Future<Void> deploy() { | ||||
| 		Promise<Void> promise = Promise.promise(); | ||||
|  | ||||
| 		Future<String> core = vertx.deployVerticle(new CoreMainVerticle()) | ||||
| 				.onSuccess(id -> LogAccumulator.add(DeploymentUtil.successMessage(CoreMainVerticle.class))) | ||||
| 				.onFailure(err -> LogAccumulator.add(DeploymentUtil.failMessage(CoreMainVerticle.class, err))); | ||||
|  | ||||
| 		Future<String> huertos = vertx.deployVerticle(new HuertosMainVerticle()) | ||||
| 				.onSuccess(id -> LogAccumulator.add(DeploymentUtil.successMessage(HuertosMainVerticle.class))) | ||||
| 				.onFailure(err -> LogAccumulator.add(DeploymentUtil.failMessage(HuertosMainVerticle.class, err))); | ||||
|  | ||||
| 		Future<String> mmc = vertx.deployVerticle(new MMCMainVerticle()) | ||||
| 				.onSuccess(id -> LogAccumulator.add(DeploymentUtil.successMessage(MMCMainVerticle.class))) | ||||
| 				.onFailure(err -> LogAccumulator.add(DeploymentUtil.failMessage(MMCMainVerticle.class, err))); | ||||
|  | ||||
| 		Future<String> cine = vertx.deployVerticle(new CineMainVerticle()) | ||||
| 				.onSuccess(id -> LogAccumulator.add(DeploymentUtil.successMessage(CineMainVerticle.class))) | ||||
| 				.onFailure(err -> LogAccumulator.add(DeploymentUtil.failMessage(CineMainVerticle.class, err))); | ||||
|  | ||||
| 		Future<String> mpaste = vertx.deployVerticle(new MPasteMainVerticle()) | ||||
| 				.onSuccess(id -> LogAccumulator.add(DeploymentUtil.successMessage(MPasteMainVerticle.class))) | ||||
| 				.onFailure(err -> LogAccumulator.add(DeploymentUtil.failMessage(MPasteMainVerticle.class, err))); | ||||
| 		 | ||||
| 		Future.all(core, huertos, mmc, cine, mpaste) | ||||
| 				.onSuccess(_ -> promise.complete()) | ||||
| 				.onFailure(promise::fail); | ||||
|  | ||||
| 		return promise.future(); | ||||
| 	} | ||||
|  | ||||
|  | ||||
|     @Override | ||||
|     public void stop(Promise<Void> stopPromise) { | ||||
|         stopPromise.complete(); | ||||
|     	vertx.deploymentIDs().forEach(id -> vertx.undeploy(id)); | ||||
| 		stopPromise.complete(); | ||||
|     } | ||||
| } | ||||
|   | ||||
| @@ -1,13 +1,15 @@ | ||||
| package net.miarma.api.microservices.huertos.handlers; | ||||
|  | ||||
| import com.google.gson.Gson; | ||||
|  | ||||
| import io.vertx.core.Vertx; | ||||
| import io.vertx.core.json.JsonObject; | ||||
| import io.vertx.ext.web.RoutingContext; | ||||
| import net.miarma.api.backlib.Constants; | ||||
| import net.miarma.api.backlib.http.ApiStatus; | ||||
| import net.miarma.api.microservices.huertos.entities.PreUserEntity; | ||||
| import net.miarma.api.backlib.util.EventBusUtil; | ||||
| import net.miarma.api.backlib.util.JsonUtil; | ||||
| import net.miarma.api.microservices.huertos.entities.PreUserEntity; | ||||
|  | ||||
| public class MemberLogicHandler { | ||||
|     private final Vertx vertx; | ||||
| @@ -17,13 +19,14 @@ public class MemberLogicHandler { | ||||
|     } | ||||
|  | ||||
|     public void login(RoutingContext ctx) { | ||||
|         JsonObject body = ctx.body().asJsonObject(); | ||||
| 		String body = ctx.body().asString(); | ||||
| 		JsonObject bodyJson = new Gson().fromJson(body, JsonObject.class); | ||||
|         JsonObject request = new JsonObject() | ||||
|             .put("action", "login") | ||||
|             .put("email", body.getString("email", null)) | ||||
|             .put("userName", body.getString("userName", null)) | ||||
|             .put("password", body.getString("password")) | ||||
|             .put("keepLoggedIn", body.getBoolean("keepLoggedIn", false)); | ||||
|             .put("email", bodyJson.getString("email", null)) | ||||
|             .put("userName", bodyJson.getString("userName", null)) | ||||
|             .put("password", bodyJson.getString("password")) | ||||
|             .put("keepLoggedIn", bodyJson.getBoolean("keepLoggedIn", false)); | ||||
|  | ||||
|         vertx.eventBus().request(Constants.HUERTOS_EVENT_BUS, request, ar -> { | ||||
|             if (ar.succeeded()) { | ||||
|   | ||||
| @@ -1,15 +1,18 @@ | ||||
| package net.miarma.api.microservices.huertos.routing; | ||||
|  | ||||
| import io.vertx.core.Vertx; | ||||
| import io.vertx.core.json.JsonObject; | ||||
| import io.vertx.ext.web.Router; | ||||
| import io.vertx.ext.web.handler.BodyHandler; | ||||
| import io.vertx.sqlclient.Pool; | ||||
| import net.miarma.api.backlib.Constants.HuertosUserRole; | ||||
| import net.miarma.api.backlib.http.ApiResponse; | ||||
| import net.miarma.api.backlib.http.ApiStatus; | ||||
| import net.miarma.api.backlib.security.SusPather; | ||||
| import net.miarma.api.microservices.huertos.handlers.*; | ||||
| import net.miarma.api.backlib.util.RouterUtil; | ||||
| import net.miarma.api.microservices.huertos.handlers.AnnouncementDataHandler; | ||||
| import net.miarma.api.microservices.huertos.handlers.BalanceDataHandler; | ||||
| import net.miarma.api.microservices.huertos.handlers.ExpenseDataHandler; | ||||
| import net.miarma.api.microservices.huertos.handlers.IncomeDataHandler; | ||||
| import net.miarma.api.microservices.huertos.handlers.MemberDataHandler; | ||||
| import net.miarma.api.microservices.huertos.handlers.PreUserDataHandler; | ||||
| import net.miarma.api.microservices.huertos.handlers.RequestDataHandler; | ||||
| import net.miarma.api.microservices.huertos.routing.middlewares.HuertosAuthGuard; | ||||
| import net.miarma.api.microservices.huertos.services.MemberService; | ||||
|  | ||||
|   | ||||
| @@ -1,13 +1,10 @@ | ||||
|  package net.miarma.api.microservices.huertos.routing; | ||||
|  | ||||
| import io.vertx.core.Vertx; | ||||
| import io.vertx.core.json.JsonObject; | ||||
| import io.vertx.ext.web.Router; | ||||
| import io.vertx.ext.web.handler.BodyHandler; | ||||
| import io.vertx.sqlclient.Pool; | ||||
| import net.miarma.api.backlib.http.ApiResponse; | ||||
| import net.miarma.api.backlib.http.ApiStatus; | ||||
| import net.miarma.api.backlib.security.SusPather; | ||||
| import net.miarma.api.backlib.util.RouterUtil; | ||||
| import net.miarma.api.microservices.huertos.handlers.BalanceLogicHandler; | ||||
| import net.miarma.api.microservices.huertos.handlers.IncomeLogicHandler; | ||||
| import net.miarma.api.microservices.huertos.handlers.MailHandler; | ||||
|   | ||||
| @@ -48,8 +48,8 @@ public class HuertosDataVerticle extends AbstractVerticle { | ||||
|         profileService = new ProfileService(pool); | ||||
|          | ||||
|         Router router = Router.router(vertx); | ||||
|         RouterUtil.attachLogger(router); | ||||
|         HuertosDataRouter.mount(router, vertx, pool); | ||||
|         RouterUtil.attachLogger(router); | ||||
|         registerLogicVerticleConsumer(); | ||||
|  | ||||
|         vertx.createHttpServer() | ||||
|   | ||||
| @@ -18,8 +18,8 @@ public class HuertosLogicVerticle extends AbstractVerticle{ | ||||
| 		configManager = ConfigManager.getInstance(); | ||||
| 		Pool pool = DatabaseProvider.createPool(vertx, configManager); | ||||
| 		Router router = Router.router(vertx); | ||||
| 		RouterUtil.attachLogger(router); | ||||
| 		HuertosLogicRouter.mount(router, vertx, pool); | ||||
| 		RouterUtil.attachLogger(router); | ||||
| 		 | ||||
| 		vertx.createHttpServer() | ||||
| 			.requestHandler(router) | ||||
|   | ||||
| @@ -33,8 +33,9 @@ public class CineDataVerticle extends AbstractVerticle { | ||||
|         viewerService = new ViewerService(pool); | ||||
|  | ||||
|         Router router = Router.router(vertx); | ||||
|         RouterUtil.attachLogger(router); | ||||
|          | ||||
|         CineDataRouter.mount(router, vertx, pool); | ||||
|         RouterUtil.attachLogger(router); | ||||
|         registerLogicVerticleConsumer(); | ||||
|  | ||||
|         vertx.createHttpServer() | ||||
|   | ||||
| @@ -18,8 +18,9 @@ public class CineLogicVerticle extends AbstractVerticle { | ||||
|         configManager = ConfigManager.getInstance(); | ||||
|         Pool pool = DatabaseProvider.createPool(vertx, configManager); | ||||
|         Router router = Router.router(vertx); | ||||
|         RouterUtil.attachLogger(router); | ||||
|          | ||||
|         CineLogicRouter.mount(router, vertx, pool); | ||||
|         RouterUtil.attachLogger(router); | ||||
|  | ||||
|         vertx.createHttpServer() | ||||
|             .requestHandler(router) | ||||
|   | ||||
| @@ -28,8 +28,9 @@ public class MMCDataVerticle extends AbstractVerticle { | ||||
| 		playerService = new PlayerService(pool); | ||||
| 		 | ||||
| 		Router router = Router.router(vertx); | ||||
| 		RouterUtil.attachLogger(router); | ||||
| 		 | ||||
| 		MMCDataRouter.mount(router, vertx, pool); | ||||
| 		RouterUtil.attachLogger(router); | ||||
| 		registerLogicVerticleConsumer(); | ||||
| 		 | ||||
| 		vertx.createHttpServer() | ||||
|   | ||||
| @@ -18,8 +18,9 @@ public class MMCLogicVerticle extends AbstractVerticle { | ||||
| 		configManager = ConfigManager.getInstance(); | ||||
| 		Pool pool = DatabaseProvider.createPool(vertx, configManager); | ||||
| 		Router router = Router.router(vertx); | ||||
| 		RouterUtil.attachLogger(router); | ||||
| 		 | ||||
| 		MMCLogicRouter.mount(router, vertx, pool); | ||||
| 		RouterUtil.attachLogger(router); | ||||
| 		 | ||||
| 		vertx.createHttpServer() | ||||
| 			.requestHandler(router) | ||||
|   | ||||
| @@ -25,8 +25,9 @@ public class MPasteDataVerticle extends AbstractVerticle { | ||||
|         pasteService = new PasteService(pool); | ||||
|          | ||||
|         Router router = Router.router(vertx); | ||||
|         RouterUtil.attachLogger(router); | ||||
|          | ||||
|         MPasteDataRouter.mount(router, vertx, pool); | ||||
|         RouterUtil.attachLogger(router); | ||||
|         registerLogicVerticleConsumer(); | ||||
|  | ||||
|         vertx.createHttpServer() | ||||
|   | ||||
| @@ -17,8 +17,9 @@ public class MPasteLogicVerticle extends AbstractVerticle { | ||||
| 		configManager = ConfigManager.getInstance(); | ||||
| 		Pool pool = DatabaseProvider.createPool(vertx, configManager); | ||||
| 		Router router = Router.router(vertx); | ||||
| 		RouterUtil.attachLogger(router); | ||||
| 		 | ||||
| 		MPasteLogicRouter.mount(router, vertx, pool); | ||||
| 		RouterUtil.attachLogger(router); | ||||
| 		 | ||||
| 		vertx.createHttpServer() | ||||
| 			.requestHandler(router) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user