From ab9a19d3aae87b7a0f17c1b4665f3421884814e2 Mon Sep 17 00:00:00 2001 From: Gravit Date: Mon, 2 Mar 2020 12:26:50 +0700 Subject: [PATCH 1/5] [FIX] FMLPatcher --- .../main/java/pro/gravit/launcher/client/ClientLauncher.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java index 42c85934..a432d646 100644 --- a/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java +++ b/Launcher/src/main/java/pro/gravit/launcher/client/ClientLauncher.java @@ -14,6 +14,7 @@ import pro.gravit.launcher.managers.ClientGsonManager; import pro.gravit.launcher.managers.ClientHookManager; import pro.gravit.launcher.modules.events.PreConfigPhase; +import pro.gravit.launcher.patches.FMLPatcher; import pro.gravit.launcher.profiles.ClientProfile; import pro.gravit.launcher.profiles.PlayerProfile; import pro.gravit.launcher.request.Request; @@ -294,6 +295,7 @@ private static void launch(ClientProfile profile, Params params) throws Throwabl { LogHelper.info("ClassLoader URL: %s", u.toString()); } + FMLPatcher.apply(); MethodHandle mainMethod = MethodHandles.publicLookup().findStatic(mainClass, "main", MethodType.methodType(void.class, String[].class)).asFixedArity(); Launcher.LAUNCHED.set(true); JVMHelper.fullGC(); From b2888d0cdf579e4f9d3ec0a9bc5e75242bbc9d29 Mon Sep 17 00:00:00 2001 From: Zaxar163 <35835496+Zaxar163@users.noreply.github.com> Date: Thu, 5 Mar 2020 15:44:06 +0100 Subject: [PATCH 2/5] [FEATURE] Laravel migrations (#359) --- .../2020_03_04_172425_create_hwid_table.php | 36 +++++++++++++++++++ ..._03_05_140131_add_auth_handler_collums.php | 36 +++++++++++++++++++ ..._03_05_142041_add_hwid_handler_collums.php | 32 +++++++++++++++++ compat/auth/laravel/migrations/README.MD | 1 + 4 files changed, 105 insertions(+) create mode 100644 compat/auth/laravel/migrations/2020_03_04_172425_create_hwid_table.php create mode 100644 compat/auth/laravel/migrations/2020_03_05_140131_add_auth_handler_collums.php create mode 100644 compat/auth/laravel/migrations/2020_03_05_142041_add_hwid_handler_collums.php create mode 100644 compat/auth/laravel/migrations/README.MD diff --git a/compat/auth/laravel/migrations/2020_03_04_172425_create_hwid_table.php b/compat/auth/laravel/migrations/2020_03_04_172425_create_hwid_table.php new file mode 100644 index 00000000..db0c8b9f --- /dev/null +++ b/compat/auth/laravel/migrations/2020_03_04_172425_create_hwid_table.php @@ -0,0 +1,36 @@ +bigIncrements('id'); + $table->tinyInteger('isBanned')->default('0'); + $table->text('totalMemory'); + $table->text('serialNumber'); + $table->text('HWDiskSerial'); + $table->text('processorID'); + $table->text('macAddr'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('users_hwids'); + } +} diff --git a/compat/auth/laravel/migrations/2020_03_05_140131_add_auth_handler_collums.php b/compat/auth/laravel/migrations/2020_03_05_140131_add_auth_handler_collums.php new file mode 100644 index 00000000..8a456f60 --- /dev/null +++ b/compat/auth/laravel/migrations/2020_03_05_140131_add_auth_handler_collums.php @@ -0,0 +1,36 @@ +char('uuid', '36')->unique()->nullable(); + $table->char('accessToken', '32')->nullable(); + $table->string('serverID', '41')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('uuid'); + $table->dropColumn('accessToken'); + $table->dropColumn('serverID'); + }); + } +} diff --git a/compat/auth/laravel/migrations/2020_03_05_142041_add_hwid_handler_collums.php b/compat/auth/laravel/migrations/2020_03_05_142041_add_hwid_handler_collums.php new file mode 100644 index 00000000..5040340b --- /dev/null +++ b/compat/auth/laravel/migrations/2020_03_05_142041_add_hwid_handler_collums.php @@ -0,0 +1,32 @@ +bigInteger('hwid')->nullable(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('hwid'); + }); + } +} diff --git a/compat/auth/laravel/migrations/README.MD b/compat/auth/laravel/migrations/README.MD new file mode 100644 index 00000000..856151ac --- /dev/null +++ b/compat/auth/laravel/migrations/README.MD @@ -0,0 +1 @@ +# Миграции для Laravel \ No newline at end of file From c44384ccb2658d7ffbccde5f07d33ca357f4ee78 Mon Sep 17 00:00:00 2001 From: Zaxar163 <35835496+Zaxar163@users.noreply.github.com> Date: Thu, 5 Mar 2020 16:39:02 +0100 Subject: [PATCH 3/5] [FEATURE] Laravel auth controller (#360) --- .../authcontroller/LauncherAuthController.php | 38 +++++++++++++++++++ compat/auth/laravel/authcontroller/README.MD | 9 +++++ ...020_03_05_151322_add_permission_collum.php | 32 ++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 compat/auth/laravel/authcontroller/LauncherAuthController.php create mode 100644 compat/auth/laravel/authcontroller/README.MD create mode 100644 compat/auth/laravel/authcontroller/migrations/2020_03_05_151322_add_permission_collum.php diff --git a/compat/auth/laravel/authcontroller/LauncherAuthController.php b/compat/auth/laravel/authcontroller/LauncherAuthController.php new file mode 100644 index 00000000..5d4b2732 --- /dev/null +++ b/compat/auth/laravel/authcontroller/LauncherAuthController.php @@ -0,0 +1,38 @@ +getContent()); + + if ($data->apiKey !== env('LAUNCHER_APIKEY')) { + $response = [ + 'error' => 'Неверный ключ. Обратитесь к администратору', + ]; + return json_encode($response); + } + + if (Auth::attempt(['name' => $data->username, 'password' => $data->password])) { + $perm = DB::table('users') + ->select('launcher_permission') + ->where('name', '=', $data->username) + ->first(); + + $response = [ + 'username' => $data->username, + 'permission' => $perm->launcher_permission, + ]; + } else { + $response = [ + 'error' => 'Неверный логин или пароль', + ]; + } + return json_encode($response); + } +} diff --git a/compat/auth/laravel/authcontroller/README.MD b/compat/auth/laravel/authcontroller/README.MD new file mode 100644 index 00000000..d09d30bd --- /dev/null +++ b/compat/auth/laravel/authcontroller/README.MD @@ -0,0 +1,9 @@ +#Контроллер авторизации методом json + +Route: +```php +Route::put('launcher/auth', 'LauncherAuthController@json'); +``` + +Добавить в **.env** строку `LAUNCHER_APIKEY=none` +Где `none` ваш apiKey \ No newline at end of file diff --git a/compat/auth/laravel/authcontroller/migrations/2020_03_05_151322_add_permission_collum.php b/compat/auth/laravel/authcontroller/migrations/2020_03_05_151322_add_permission_collum.php new file mode 100644 index 00000000..d82e5eb2 --- /dev/null +++ b/compat/auth/laravel/authcontroller/migrations/2020_03_05_151322_add_permission_collum.php @@ -0,0 +1,32 @@ +integer('launcher_permission')->default('0'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('users', function (Blueprint $table) { + $table->dropColumn('launcher_permission'); + }); + } +} From 606eca22aaa27d162665a6b5428eaa9d6b89c0a3 Mon Sep 17 00:00:00 2001 From: Zaxar163 <35835496+Zaxar163@users.noreply.github.com> Date: Thu, 5 Mar 2020 16:52:19 +0100 Subject: [PATCH 4/5] [ANY] Laravel auth controller (#361) --- .../authcontroller/LauncherAuthController.php | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/compat/auth/laravel/authcontroller/LauncherAuthController.php b/compat/auth/laravel/authcontroller/LauncherAuthController.php index 5d4b2732..6c41adc4 100644 --- a/compat/auth/laravel/authcontroller/LauncherAuthController.php +++ b/compat/auth/laravel/authcontroller/LauncherAuthController.php @@ -12,10 +12,9 @@ class LauncherAuthController extends Controller $data = json_decode($request->getContent()); if ($data->apiKey !== env('LAUNCHER_APIKEY')) { - $response = [ + return response()->json([ 'error' => 'Неверный ключ. Обратитесь к администратору', - ]; - return json_encode($response); + ]); } if (Auth::attempt(['name' => $data->username, 'password' => $data->password])) { @@ -24,15 +23,14 @@ class LauncherAuthController extends Controller ->where('name', '=', $data->username) ->first(); - $response = [ + return response()->json([ 'username' => $data->username, 'permission' => $perm->launcher_permission, - ]; + ]); } else { - $response = [ + return response()->json([ 'error' => 'Неверный логин или пароль', - ]; + ]); } - return json_encode($response); } } From b40a1497c837119cc0755e5189d084a023fa29b2 Mon Sep 17 00:00:00 2001 From: Gravit Date: Wed, 11 Mar 2020 22:14:35 +0700 Subject: [PATCH 5/5] =?UTF-8?q?[ANY]=20=D0=9E=D0=B1=D0=BD=D0=BE=D0=B2?= =?UTF-8?q?=D0=BB=D0=B5=D0=BD=D1=8B=20=D0=BC=D0=BE=D0=B4=D1=83=D0=BB=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modules | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules b/modules index 55982085..2edb2c72 160000 --- a/modules +++ b/modules @@ -1 +1 @@ -Subproject commit 559820852c231b7045b2c12fabbde1261485a75e +Subproject commit 2edb2c7259d5a7dba3fa82c503f88a8a0e171840