Skip to content

Commit

Permalink
Merge pull request #402 from MineTrax/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Xinecraft authored Dec 5, 2024
2 parents b6814dd + 9b8abc7 commit 765f745
Show file tree
Hide file tree
Showing 210 changed files with 1,909 additions and 1,846 deletions.
4 changes: 3 additions & 1 deletion app/Http/Controllers/Admin/RoleController.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,9 @@ public function store(CreateRoleRequest $request)

$role->givePermissionTo($request->permissions);

$role->addMediaFromRequest('photo')->toMediaCollection('role');
if ($request->photo) {
$role->addMediaFromRequest('photo')->toMediaCollection('role');
}

return redirect()->route('admin.role.index')
->with(['toast' => ['type' => 'success', 'title' => __('Created Successfully'), 'body' => __('New Role is created successfully')]]);
Expand Down
17 changes: 9 additions & 8 deletions app/Http/Controllers/Admin/ServerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,12 @@ public function index()
->allowedSorts(['id', 'name', 'hostname', 'ip_address', 'join_port', 'query_port', 'webquery_port', 'type', 'minecraft_version', 'order', 'country_id', 'last_scanned_at', 'created_at'])
->defaultSort('-order')
->paginate($perPage)
->through(fn($server) => $server->append('masked_ip_address')->makeHidden('ip_address'))
->withQueryString();

return Inertia::render('Admin/Server/IndexServer', [
'servers' => $servers,
'canCreateBungeeServer' => ! $canCreateBungeeServer,
'canCreateBungeeServer' => !$canCreateBungeeServer,
'filters' => request()->all(['perPage', 'sort', 'filter']),
]);
}
Expand Down Expand Up @@ -177,7 +178,7 @@ public function storeBungee(Request $request, GeolocationService $geolocationSer
'order' => $request->order,
]);

if (! $request->webquery_port) {
if (!$request->webquery_port) {
return redirect()->route('admin.server.index')
->with(['toast' => ['type' => 'success', 'title' => __('Created Successfully'), 'body' => __('Proxy server added successfully')]]);
}
Expand Down Expand Up @@ -306,9 +307,9 @@ public function updateBungee(Request $request, Server $server, GeolocationServic
$server->save();

// We forget the cached result so that new data will be shown instantly and not redundant data.
Cache::forget('server:ping:'.$server->id);
Cache::forget('server:query:'.$server->id);
Cache::forget('server:webquery:'.$server->id);
Cache::forget('server:ping:' . $server->id);
Cache::forget('server:query:' . $server->id);
Cache::forget('server:webquery:' . $server->id);

return redirect()->route('admin.server.index')
->with(['toast' => ['type' => 'success', 'title' => __('Updated Successfully'), 'body' => __('Server updated successfully')]]);
Expand Down Expand Up @@ -338,9 +339,9 @@ public function update(UpdateServerRequest $request, Server $server, Geolocation
$server->save();

// We forget the cached result so that new data will be shown instantly and not redundant data.
Cache::forget('server:ping:'.$server->id);
Cache::forget('server:query:'.$server->id);
Cache::forget('server:webquery:'.$server->id);
Cache::forget('server:ping:' . $server->id);
Cache::forget('server:query:' . $server->id);
Cache::forget('server:webquery:' . $server->id);

return redirect()->route('admin.server.index')
->with(['toast' => ['type' => 'success', 'title' => __('Updated Successfully'), 'body' => __('Server updated successfully')]]);
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Admin/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,9 @@ public function index()
'updated_at',
'country_id',
'last_login_at',
'roles.display_name',
'country.name',
'discord_user_id',
AllowedFilter::exact('roles.display_name'),
AllowedFilter::custom('q', new FilterMultipleFields(['name', 'email', 'username', 'discord_user_id'])),
AllowedFilter::scope('is_verified'),
])
Expand Down
2 changes: 0 additions & 2 deletions app/Http/Controllers/PlayerPasswordResetController.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,6 @@ public function update(Request $request, PluginSettings $pluginSettings)
'toast' => [
'type' => 'success',
'title' => __('Action Successful!'),
'body' => __('Password reset request has been queued. It will complete in a few seconds.'),
'milliseconds' => 15000,
]
]);
}
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Requests/CreateRoleRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function rules()
'display_name' => 'required|string|max:255',
'is_staff' => 'required|boolean',
'is_hidden_from_staff_list' => 'required|boolean',
'photo' => 'required|image|max:300',
'photo' => 'nullable|image|max:300',
'weight' => 'required|integer',
'web_message_format' => 'nullable|string|max:255',
'permissions' => 'sometimes|nullable|array|exists:permissions,name'
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function registerMediaCollections(): void

public function getPhotoUrlAttribute()
{
$photo_url = url('images/default-roles/'.$this->name.'.png');
$photo_url = null;
if ($this->getFirstMediaUrl('role')) {
$photo_url = $this->getFirstMediaUrl('role');
}
Expand Down
5 changes: 5 additions & 0 deletions app/Models/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,4 +117,9 @@ public function getSettingsKey($key, $default = null)
{
return Arr::dot($this->settings)[$key] ?? $default;
}

public function getMaskedIpAddressAttribute()
{
return preg_replace('/(\d{1,3})\.\d{1,3}\.\d{1,3}\.\d{1,3}/', '$1.xx.xx.xx', $this->ip_address);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function up()
$table->uuid('player_uuid')->index();
$table->string('player_username');
$table->string('player_displayname')->nullable();
$table->timestamp('session_started_at');
$table->timestamp('session_started_at')->nullable();
$table->timestamp('session_ended_at')->nullable();
$table->integer('mob_kills')->default(0);
$table->integer('player_kills')->default(0);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function up()
$table->uuid('victim_uuid')->index();
$table->string('killer_username');
$table->string('victim_username');
$table->timestamp('killed_at');
$table->timestamp('killed_at')->nullable();
$table->string('weapon')->nullable();
$table->json('world_location')->nullable();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function up()
$table->string('player_username');
$table->string('mob_id');
$table->string('mob_name');
$table->timestamp('killed_at');
$table->timestamp('killed_at')->nullable();
$table->string('weapon')->nullable();
$table->json('world_location')->nullable();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function up()

$table->string('killer_entity_id')->nullable(); // If killed by mob: Entity id
$table->string('killer_entity_name')->nullable(); // If killed by mob: Entity name
$table->timestamp('died_at');
$table->timestamp('died_at')->nullable();
$table->string('world_location')->nullable();

$table->foreignId('session_id')->constrained('minecraft_player_sessions')->onDelete('cascade');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function up(): void
$table->double('pvp_damage_given')->nullable()->default(0);
$table->double('pvp_damage_taken')->nullable()->default(0);

$table->timestamp('first_seen_at');
$table->timestamp('first_seen_at')->nullable();
$table->timestamp('last_seen_at')->nullable();
$table->string('last_minecraft_version')->nullable();
$table->string('last_join_address')->nullable();
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 765f745

Please sign in to comment.