mirror of
https://github.com/MrUnknownDE/panel.git
synced 2026-04-19 06:43:45 +02:00
Remove unused dependencies and cleanup namespacing
This commit is contained in:
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Pterodactyl\Http\Controllers\Auth;
|
||||
|
||||
use Cake\Chronos\Chronos;
|
||||
use Illuminate\Support\Str;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Auth\AuthManager;
|
||||
use Illuminate\Http\JsonResponse;
|
||||
@@ -101,7 +101,7 @@ class LoginController extends AbstractLoginController
|
||||
|
||||
if ($user->use_totp) {
|
||||
$token = Str::random(64);
|
||||
$this->cache->put($token, $user->id, Chronos::now()->addMinutes(5));
|
||||
$this->cache->put($token, $user->id, CarbonImmutable::now()->addMinutes(5));
|
||||
|
||||
return new JsonResponse([
|
||||
'data' => [
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Pterodactyl\Http\Middleware\Api;
|
||||
|
||||
use Closure;
|
||||
use Cake\Chronos\Chronos;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Illuminate\Http\Request;
|
||||
use Pterodactyl\Models\User;
|
||||
use Pterodactyl\Models\ApiKey;
|
||||
@@ -110,7 +110,7 @@ class AuthenticateKey
|
||||
throw new AccessDeniedHttpException;
|
||||
}
|
||||
|
||||
$this->repository->withoutFreshModel()->update($model->id, ['last_used_at' => Chronos::now()]);
|
||||
$this->repository->withoutFreshModel()->update($model->id, ['last_used_at' => CarbonImmutable::now()]);
|
||||
|
||||
return $model;
|
||||
}
|
||||
|
||||
@@ -2,6 +2,18 @@
|
||||
|
||||
namespace Pterodactyl\Models;
|
||||
|
||||
/**
|
||||
* @property int $id
|
||||
* @property string $name
|
||||
* @property string $host
|
||||
* @property int $port
|
||||
* @property string $username
|
||||
* @property string $password
|
||||
* @property int|null $max_databases
|
||||
* @property int|null $node_id
|
||||
* @property \Carbon\CarbonImmutable $created_at
|
||||
* @property \Carbon\CarbonImmutable $updated_at
|
||||
*/
|
||||
class DatabaseHost extends Model
|
||||
{
|
||||
/**
|
||||
@@ -10,6 +22,11 @@ class DatabaseHost extends Model
|
||||
*/
|
||||
const RESOURCE_NAME = 'database_host';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $immutableDates = true;
|
||||
|
||||
/**
|
||||
* The table associated with the model.
|
||||
*
|
||||
|
||||
@@ -13,7 +13,7 @@ class BladeServiceProvider extends ServiceProvider
|
||||
{
|
||||
$this->app->make('blade.compiler')
|
||||
->directive('datetimeHuman', function ($expression) {
|
||||
return "<?php echo \Cake\Chronos\Chronos::createFromFormat(\Cake\Chronos\Chronos::DEFAULT_TO_STRING_FORMAT, $expression)->setTimezone(config('app.timezone'))->toDateTimeString(); ?>";
|
||||
return "<?php echo \Carbon\CarbonImmutable::createFromFormat(\Carbon\CarbonImmutable::DEFAULT_TO_STRING_FORMAT, $expression)->setTimezone(config('app.timezone'))->toDateTimeString(); ?>";
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Pterodactyl\Transformers\Api\Application;
|
||||
|
||||
use Cake\Chronos\Chronos;
|
||||
use Carbon\CarbonImmutable;
|
||||
use Pterodactyl\Models\ApiKey;
|
||||
use Illuminate\Container\Container;
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
@@ -107,7 +107,7 @@ abstract class BaseTransformer extends TransformerAbstract
|
||||
*/
|
||||
protected function formatTimestamp(string $timestamp): string
|
||||
{
|
||||
return Chronos::createFromFormat(Chronos::DEFAULT_TO_STRING_FORMAT, $timestamp)
|
||||
return CarbonImmutable::createFromFormat(CarbonImmutable::DEFAULT_TO_STRING_FORMAT, $timestamp)
|
||||
->setTimezone(self::RESPONSE_TIMEZONE)
|
||||
->toIso8601String();
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Pterodactyl\Transformers\Api\Application;
|
||||
|
||||
use Cake\Chronos\Chronos;
|
||||
use Pterodactyl\Models\Database;
|
||||
use Pterodactyl\Models\DatabaseHost;
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
@@ -41,12 +40,8 @@ class DatabaseHostTransformer extends BaseTransformer
|
||||
'port' => $model->port,
|
||||
'username' => $model->username,
|
||||
'node' => $model->node_id,
|
||||
'created_at' => Chronos::createFromFormat(Chronos::DEFAULT_TO_STRING_FORMAT, $model->created_at)
|
||||
->setTimezone(config('app.timezone'))
|
||||
->toIso8601String(),
|
||||
'updated_at' => Chronos::createFromFormat(Chronos::DEFAULT_TO_STRING_FORMAT, $model->updated_at)
|
||||
->setTimezone(config('app.timezone'))
|
||||
->toIso8601String(),
|
||||
'created_at' => $model->created_at->toIso8601String(),
|
||||
'updated_at' => $model->updated_at->toIso8601String(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
namespace Pterodactyl\Transformers\Api\Application;
|
||||
|
||||
use Cake\Chronos\Chronos;
|
||||
use Pterodactyl\Models\Database;
|
||||
use Pterodactyl\Models\DatabaseHost;
|
||||
use Pterodactyl\Services\Acl\Api\AdminAcl;
|
||||
@@ -56,12 +55,8 @@ class ServerDatabaseTransformer extends BaseTransformer
|
||||
'username' => $model->username,
|
||||
'remote' => $model->remote,
|
||||
'max_connections' => $model->max_connections,
|
||||
'created_at' => Chronos::createFromFormat(Chronos::DEFAULT_TO_STRING_FORMAT, $model->created_at)
|
||||
->setTimezone(config('app.timezone'))
|
||||
->toIso8601String(),
|
||||
'updated_at' => Chronos::createFromFormat(Chronos::DEFAULT_TO_STRING_FORMAT, $model->updated_at)
|
||||
->setTimezone(config('app.timezone'))
|
||||
->toIso8601String(),
|
||||
'created_at' => $model->created_at->toIso8601String(),
|
||||
'updated_at' => $model->updated_at->toIso8601String(),
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user