mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 00:51:01 +03:00
Merge remote-tracking branch 'origin/dev' into scriptsRewrite
This commit is contained in:
commit
01fa09a115
8 changed files with 184 additions and 0 deletions
|
@ -14,6 +14,7 @@
|
||||||
import pro.gravit.launcher.managers.ClientGsonManager;
|
import pro.gravit.launcher.managers.ClientGsonManager;
|
||||||
import pro.gravit.launcher.managers.ClientHookManager;
|
import pro.gravit.launcher.managers.ClientHookManager;
|
||||||
import pro.gravit.launcher.modules.events.PreConfigPhase;
|
import pro.gravit.launcher.modules.events.PreConfigPhase;
|
||||||
|
import pro.gravit.launcher.patches.FMLPatcher;
|
||||||
import pro.gravit.launcher.profiles.ClientProfile;
|
import pro.gravit.launcher.profiles.ClientProfile;
|
||||||
import pro.gravit.launcher.profiles.PlayerProfile;
|
import pro.gravit.launcher.profiles.PlayerProfile;
|
||||||
import pro.gravit.launcher.request.Request;
|
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());
|
LogHelper.info("ClassLoader URL: %s", u.toString());
|
||||||
}
|
}
|
||||||
|
FMLPatcher.apply();
|
||||||
MethodHandle mainMethod = MethodHandles.publicLookup().findStatic(mainClass, "main", MethodType.methodType(void.class, String[].class)).asFixedArity();
|
MethodHandle mainMethod = MethodHandles.publicLookup().findStatic(mainClass, "main", MethodType.methodType(void.class, String[].class)).asFixedArity();
|
||||||
Launcher.LAUNCHED.set(true);
|
Launcher.LAUNCHED.set(true);
|
||||||
JVMHelper.fullGC();
|
JVMHelper.fullGC();
|
||||||
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Auth;
|
||||||
|
use Illuminate\Support\Facades\DB;
|
||||||
|
|
||||||
|
class LauncherAuthController extends Controller
|
||||||
|
{
|
||||||
|
public function json(Request $request) {
|
||||||
|
$data = json_decode($request->getContent());
|
||||||
|
|
||||||
|
if ($data->apiKey !== env('LAUNCHER_APIKEY')) {
|
||||||
|
return response()->json([
|
||||||
|
'error' => 'Неверный ключ. Обратитесь к администратору',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (Auth::attempt(['name' => $data->username, 'password' => $data->password])) {
|
||||||
|
$perm = DB::table('users')
|
||||||
|
->select('launcher_permission')
|
||||||
|
->where('name', '=', $data->username)
|
||||||
|
->first();
|
||||||
|
|
||||||
|
return response()->json([
|
||||||
|
'username' => $data->username,
|
||||||
|
'permission' => $perm->launcher_permission,
|
||||||
|
]);
|
||||||
|
} else {
|
||||||
|
return response()->json([
|
||||||
|
'error' => 'Неверный логин или пароль',
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
9
compat/auth/laravel/authcontroller/README.MD
Normal file
9
compat/auth/laravel/authcontroller/README.MD
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#Контроллер авторизации методом json
|
||||||
|
|
||||||
|
Route:
|
||||||
|
```php
|
||||||
|
Route::put('launcher/auth', 'LauncherAuthController@json');
|
||||||
|
```
|
||||||
|
|
||||||
|
Добавить в **.env** строку `LAUNCHER_APIKEY=none`
|
||||||
|
Где `none` ваш apiKey
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
|
||||||
|
class AddPermissionCollum extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->integer('launcher_permission')->default('0');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('launcher_permission');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class CreateHwidTable extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::create('users_hwids', function (Blueprint $table) {
|
||||||
|
$table->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');
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,36 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddAuthHandlerCollums extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->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');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,32 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
use Illuminate\Database\Migrations\Migration;
|
||||||
|
use Illuminate\Database\Schema\Blueprint;
|
||||||
|
use Illuminate\Support\Facades\Schema;
|
||||||
|
|
||||||
|
class AddHwidHandlerCollums extends Migration
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Run the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->bigInteger('hwid')->nullable();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reverse the migrations.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::table('users', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('hwid');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
1
compat/auth/laravel/migrations/README.MD
Normal file
1
compat/auth/laravel/migrations/README.MD
Normal file
|
@ -0,0 +1 @@
|
||||||
|
# Миграции для Laravel
|
Loading…
Reference in a new issue