From 37b550aa1637a910d21118bc2ca1ff01cf2114de Mon Sep 17 00:00:00 2001
From: Dom Eori <4j6dq2zi8@relay.firefox.com>
Date: Sun, 10 Apr 2022 22:19:51 +0900
Subject: [PATCH] [maimai2] Fix incompatibility with old versions
---
config/application.properties | 5 +++
.../aqua/sega/allnet/AllNetController.java | 12 +++++--
.../controller/Maimai2ServletController.java | 2 +-
src/main/resources/application.properties | 35 +++++--------------
4 files changed, 24 insertions(+), 30 deletions(-)
diff --git a/config/application.properties b/config/application.properties
index 04376998..c44ee32f 100644
--- a/config/application.properties
+++ b/config/application.properties
@@ -39,6 +39,11 @@ game.chusan.team-name=
## For example, if DataConfig.xml says "1, 35, 1" then this need to be 1.35.01
game.ongeki.version=1.05.00
+## Maimai DX
+## Set this true if you are using old version of Splash network patch and have no other choice.
+## This is a dirty workaround. If enabled, you probably won't able to play other versions.
+game.maimai2.splash-old-patch=false
+
## Logging
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=20MB
diff --git a/src/main/java/icu/samnyan/aqua/sega/allnet/AllNetController.java b/src/main/java/icu/samnyan/aqua/sega/allnet/AllNetController.java
index 0217af29..508af0fd 100644
--- a/src/main/java/icu/samnyan/aqua/sega/allnet/AllNetController.java
+++ b/src/main/java/icu/samnyan/aqua/sega/allnet/AllNetController.java
@@ -34,11 +34,14 @@ public class AllNetController {
private final ObjectMapper mapper = new ObjectMapper();
private final String HOST_OVERRIDE;
private final String PORT_OVERRIDE;
+ private final boolean MAIMAI2_NO_HTTP;
public AllNetController(@Value("${allnet.server.host:}") String HOST,
- @Value("${allnet.server.port:}") String PORT) {
+ @Value("${allnet.server.port:}") String PORT,
+ @Value("${game.maimai2.splash-old-patch:false}") boolean MAIMAI2_NO_HTTP) {
this.HOST_OVERRIDE = HOST;
this.PORT_OVERRIDE = PORT;
+ this.MAIMAI2_NO_HTTP = MAIMAI2_NO_HTTP;
}
@GetMapping("/")
@@ -142,7 +145,12 @@ public class AllNetController {
case "SDEY":
return "http://" + addr + ":" + port + "/MaimaiServlet/";
case "SDEZ":
- return "http://" + addr + ":" + port + "/Maimai2Servlet/";
+ // Workaround for old splash patch
+ if (MAIMAI2_NO_HTTP) {
+ return addr + ":" + port + "/Maimai2Servlet/";
+ } else {
+ return "http://" + addr + ":" + port + "/Maimai2Servlet/";
+ }
case "SDHD":
return "http://" + addr + ":" + port + "/ChusanServlet/";
default:
diff --git a/src/main/java/icu/samnyan/aqua/sega/maimai2/controller/Maimai2ServletController.java b/src/main/java/icu/samnyan/aqua/sega/maimai2/controller/Maimai2ServletController.java
index 53b62e69..0c613138 100644
--- a/src/main/java/icu/samnyan/aqua/sega/maimai2/controller/Maimai2ServletController.java
+++ b/src/main/java/icu/samnyan/aqua/sega/maimai2/controller/Maimai2ServletController.java
@@ -14,7 +14,7 @@ import java.util.Map;
* @author samnyan (privateamusement@protonmail.com)
*/
@RestController
-@RequestMapping({"/Maimai2Servlet", "/Maimai2Servlet/Maimai2Servlet"}) // Workaround for endpoint mismatch, let's just accept both
+@RequestMapping({"/Maimai2Servlet/Maimai2Servlet", "/Maimai2Servlet"}) // Workaround for endpoint mismatch, let's just accept both
public class Maimai2ServletController {
private final GetGameSettingHandler getGameSettingHandler;
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index 1264fac7..a485cd11 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -1,41 +1,22 @@
-## AimeDb server setting
+# This configuration file is for define default values
+# User should use application.properties in the /config folder instead, not this
aimedb.server.enable=true
aimedb.server.address=0.0.0.0
aimedb.server.port=22345
-## Billing server setting
+
billing.server.enable=true
billing.server.port=8443
-## Server host & port return to client when boot up.
-## By default the same address and port from the client connection is returned.
-## Please notice DIVA won't work with localhost or 127.0.0.1
-#allnet.server.host=localhost
-#allnet.server.port=80
-## Http Server Port
-## Only change this if you have a reverse proxy running.
-## The game rely on 80 port for boot up command
+
server.port=80
-########## Game specific setting ##########
-## Chunithm
-## This enables team function if you set team name here. Leave this blank to disable it.
-game.chunithm.team-name=
-## Logging
+
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=20MB
-## Database Setting
+
spring.flyway.baseline-on-migrate=true
spring.flyway.locations=classpath:db/migration/{vendor}
-########## For Sqlite ##########
+
spring.datasource.driver-class-name=org.sqlite.JDBC
spring.datasource.url=jdbc:sqlite:data/db.sqlite
spring.datasource.hikari.maximum-pool-size=1
-#auto schema update will case sqlite error
spring.jpa.hibernate.ddl-auto=none
-spring.jpa.properties.hibernate.dialect=org.sqlite.hibernate.dialect.SQLiteDialect
-########## For Mysql ##########
-#spring.datasource.driver-class-name=org.mariadb.jdbc.Driver
-#spring.datasource.username=
-#spring.datasource.password=
-#spring.datasource.url=jdbc:mariadb://localhost:3306/?useSSL=false
-#spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MariaDB10Dialect
-
-## You can add any Spring Boot properties below
\ No newline at end of file
+spring.jpa.properties.hibernate.dialect=org.sqlite.hibernate.dialect.SQLiteDialect
\ No newline at end of file