2023-03-17 14:33:48 +00:00
|
|
|
<?php
|
|
|
|
|
2024-02-16 20:56:38 +00:00
|
|
|
use App\Http\Controllers\Api\Server as ApiServer;
|
2024-01-07 15:23:41 +00:00
|
|
|
use App\Models\GitlabApp;
|
|
|
|
use App\Models\PrivateKey;
|
|
|
|
use App\Models\Server;
|
|
|
|
use App\Models\StandaloneDocker;
|
|
|
|
use App\Models\SwarmDocker;
|
|
|
|
use App\Providers\RouteServiceProvider;
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
use Illuminate\Support\Facades\Route;
|
|
|
|
|
2023-06-07 13:08:35 +00:00
|
|
|
use App\Http\Controllers\Controller;
|
|
|
|
use App\Http\Controllers\MagicController;
|
2024-02-08 10:45:19 +00:00
|
|
|
|
|
|
|
use App\Livewire\Admin\Index as AdminIndex;
|
2023-12-07 18:06:32 +00:00
|
|
|
use App\Livewire\Dev\Compose as Compose;
|
2024-01-07 15:23:41 +00:00
|
|
|
|
2023-12-07 18:06:32 +00:00
|
|
|
use App\Livewire\Dashboard;
|
2024-01-07 15:23:41 +00:00
|
|
|
use App\Livewire\Boarding\Index as BoardingIndex;
|
|
|
|
use App\Livewire\Settings\Index as SettingsIndex;
|
|
|
|
use App\Livewire\Settings\License as SettingsLicense;
|
|
|
|
use App\Livewire\Profile\Index as ProfileIndex;
|
|
|
|
|
|
|
|
use App\Livewire\Team\Index as TeamIndex;
|
|
|
|
use App\Livewire\Team\Create as TeamCreate;
|
|
|
|
use App\Livewire\Team\Notification\Index as TeamNotificationIndex;
|
|
|
|
|
|
|
|
use App\Livewire\Team\Storage\Index as TeamStorageIndex;
|
|
|
|
use App\Livewire\Team\Storage\Create as TeamStorageCreate;
|
|
|
|
use App\Livewire\Team\Storage\Show as TeamStorageShow;
|
|
|
|
use App\Livewire\Team\Member\Index as TeamMemberIndex;
|
|
|
|
|
|
|
|
use App\Livewire\CommandCenter\Index as CommandCenterIndex;
|
|
|
|
use App\Livewire\ForcePasswordReset;
|
|
|
|
use App\Livewire\Project\Index as ProjectIndex;
|
|
|
|
use App\Livewire\Project\Show as ProjectShow;
|
|
|
|
use App\Livewire\Project\Edit as ProjectEdit;
|
|
|
|
use App\Livewire\Project\CloneMe as ProjectCloneMe;
|
|
|
|
use App\Livewire\Project\Resource\Index as ResourceIndex;
|
|
|
|
use App\Livewire\Project\Resource\Create as ResourceCreate;
|
|
|
|
|
|
|
|
use App\Livewire\Project\Application\Configuration as ApplicationConfiguration;
|
|
|
|
use App\Livewire\Project\Application\Deployment\Index as DeploymentIndex;
|
|
|
|
use App\Livewire\Project\Application\Deployment\Show as DeploymentShow;
|
|
|
|
use App\Livewire\Project\Database\Configuration as DatabaseConfiguration;
|
|
|
|
use App\Livewire\Project\Database\Backup\Index as DatabaseBackupIndex;
|
|
|
|
use App\Livewire\Project\Database\Backup\Execution as DatabaseBackupExecution;
|
|
|
|
|
|
|
|
use App\Livewire\Project\Service\Configuration as ServiceConfiguration;
|
|
|
|
use App\Livewire\Project\Service\Index as ServiceIndex;
|
|
|
|
|
2023-12-30 13:47:26 +00:00
|
|
|
use App\Livewire\Project\EnvironmentEdit;
|
2023-12-07 18:06:32 +00:00
|
|
|
use App\Livewire\Project\Shared\ExecuteContainerCommand;
|
|
|
|
use App\Livewire\Project\Shared\Logs;
|
2024-01-02 02:23:29 +00:00
|
|
|
use App\Livewire\Project\Shared\ScheduledTask\Show as ScheduledTaskShow;
|
2024-01-07 15:23:41 +00:00
|
|
|
|
2023-12-07 18:06:32 +00:00
|
|
|
use App\Livewire\Security\ApiTokens;
|
2024-01-07 15:23:41 +00:00
|
|
|
use App\Livewire\Security\PrivateKey\Create as SecurityPrivateKeyCreate;
|
|
|
|
use App\Livewire\Security\PrivateKey\Show as SecurityPrivateKeyShow;
|
|
|
|
|
|
|
|
use App\Livewire\Server\Index as ServerIndex;
|
|
|
|
use App\Livewire\Server\Create as ServerCreate;
|
|
|
|
use App\Livewire\Server\Show as ServerShow;
|
2024-02-16 20:56:38 +00:00
|
|
|
use App\Livewire\Server\Resources as ResourcesShow;
|
|
|
|
|
2023-12-07 18:06:32 +00:00
|
|
|
use App\Livewire\Server\Destination\Show as DestinationShow;
|
|
|
|
use App\Livewire\Server\LogDrains;
|
|
|
|
use App\Livewire\Server\PrivateKey\Show as PrivateKeyShow;
|
|
|
|
use App\Livewire\Server\Proxy\Show as ProxyShow;
|
|
|
|
use App\Livewire\Server\Proxy\Logs as ProxyLogs;
|
|
|
|
use App\Livewire\Source\Github\Change as GitHubChange;
|
2024-01-07 15:23:41 +00:00
|
|
|
use App\Livewire\Subscription\Index as SubscriptionIndex;
|
2024-02-01 14:38:12 +00:00
|
|
|
|
|
|
|
use App\Livewire\Tags\Index as TagsIndex;
|
|
|
|
use App\Livewire\Tags\Show as TagsShow;
|
|
|
|
|
2024-01-23 16:13:23 +00:00
|
|
|
use App\Livewire\TeamSharedVariablesIndex;
|
2023-12-07 18:06:32 +00:00
|
|
|
use App\Livewire\Waitlist\Index as WaitlistIndex;
|
2023-12-05 12:56:11 +00:00
|
|
|
|
2023-12-05 14:19:54 +00:00
|
|
|
if (isDev()) {
|
2023-10-04 12:40:33 +00:00
|
|
|
Route::get('/dev/compose', Compose::class)->name('dev.compose');
|
|
|
|
}
|
2024-02-08 13:01:16 +00:00
|
|
|
Route::get('/admin', AdminIndex::class)->name('admin.index');
|
2023-12-06 09:25:23 +00:00
|
|
|
|
2024-01-11 07:52:30 +00:00
|
|
|
Route::post('/forgot-password', [Controller::class, 'forgot_password'])->name('password.forgot');
|
2024-01-07 15:23:41 +00:00
|
|
|
Route::get('/api/v1/test/realtime', [Controller::class, 'realtime_test'])->middleware('auth');
|
2023-09-01 07:34:25 +00:00
|
|
|
Route::get('/waitlist', WaitlistIndex::class)->name('waitlist.index');
|
2024-01-07 15:23:41 +00:00
|
|
|
Route::get('/verify', [Controller::class, 'verify'])->middleware('auth')->name('verify.email');
|
2024-01-11 07:52:30 +00:00
|
|
|
Route::get('/email/verify/{id}/{hash}', [Controller::class, 'email_verify'])->middleware(['auth'])->name('verify.verify');
|
2023-09-11 14:51:38 +00:00
|
|
|
Route::middleware(['throttle:login'])->group(function () {
|
2023-09-06 10:07:34 +00:00
|
|
|
Route::get('/auth/link', [Controller::class, 'link'])->name('auth.link');
|
|
|
|
});
|
2024-01-07 15:23:41 +00:00
|
|
|
|
2023-06-06 09:35:50 +00:00
|
|
|
Route::prefix('magic')->middleware(['auth'])->group(function () {
|
2023-06-07 13:08:35 +00:00
|
|
|
Route::get('/servers', [MagicController::class, 'servers']);
|
|
|
|
Route::get('/destinations', [MagicController::class, 'destinations']);
|
|
|
|
Route::get('/projects', [MagicController::class, 'projects']);
|
|
|
|
Route::get('/environments', [MagicController::class, 'environments']);
|
2023-06-15 07:15:41 +00:00
|
|
|
Route::get('/project/new', [MagicController::class, 'newProject']);
|
|
|
|
Route::get('/environment/new', [MagicController::class, 'newEnvironment']);
|
2023-06-05 22:18:48 +00:00
|
|
|
});
|
2023-06-07 13:08:35 +00:00
|
|
|
|
2023-10-09 12:20:55 +00:00
|
|
|
Route::middleware(['auth', 'verified'])->group(function () {
|
2024-01-07 15:23:41 +00:00
|
|
|
Route::middleware(['throttle:force-password-reset'])->group(function () {
|
|
|
|
Route::get('/force-password-reset', ForcePasswordReset::class)->name('auth.force-password-reset');
|
|
|
|
});
|
2023-11-21 14:31:46 +00:00
|
|
|
|
2023-08-29 12:36:17 +00:00
|
|
|
Route::get('/', Dashboard::class)->name('dashboard');
|
2023-09-20 13:42:41 +00:00
|
|
|
Route::get('/boarding', BoardingIndex::class)->name('boarding');
|
2023-08-09 14:47:24 +00:00
|
|
|
|
2024-01-07 15:23:41 +00:00
|
|
|
Route::get('/subscription', SubscriptionIndex::class)->name('subscription.index');
|
2024-01-02 02:23:29 +00:00
|
|
|
|
2024-01-07 15:23:41 +00:00
|
|
|
Route::get('/settings', SettingsIndex::class)->name('settings.index');
|
|
|
|
Route::get('/settings/license', SettingsLicense::class)->name('settings.license');
|
2023-10-02 11:38:16 +00:00
|
|
|
|
2024-01-07 15:23:41 +00:00
|
|
|
Route::get('/profile', ProfileIndex::class)->name('profile');
|
2024-02-01 14:38:12 +00:00
|
|
|
Route::prefix('tags')->group(function () {
|
|
|
|
Route::get('/', TagsIndex::class)->name('tags.index');
|
|
|
|
Route::get('/{tag_name}', TagsShow::class)->name('tags.show');
|
|
|
|
});
|
2024-01-07 15:23:41 +00:00
|
|
|
Route::prefix('team')->group(function () {
|
|
|
|
Route::get('/', TeamIndex::class)->name('team.index');
|
|
|
|
Route::get('/new', TeamCreate::class)->name('team.create');
|
|
|
|
Route::get('/members', TeamMemberIndex::class)->name('team.member.index');
|
|
|
|
Route::get('/notifications', TeamNotificationIndex::class)->name('team.notification.index');
|
2024-01-23 16:13:23 +00:00
|
|
|
Route::get('/shared-variables', TeamSharedVariablesIndex::class)->name('team.shared-variables.index');
|
2024-01-07 15:23:41 +00:00
|
|
|
Route::get('/storages', TeamStorageIndex::class)->name('team.storage.index');
|
|
|
|
Route::get('/storages/new', TeamStorageCreate::class)->name('team.storage.create');
|
|
|
|
Route::get('/storages/{storage_uuid}', TeamStorageShow::class)->name('team.storage.show');
|
2023-08-15 12:27:45 +00:00
|
|
|
});
|
2023-09-20 13:42:41 +00:00
|
|
|
|
2024-01-07 15:23:41 +00:00
|
|
|
Route::get('/command-center', CommandCenterIndex::class)->name('command-center');
|
2024-01-05 05:06:36 +00:00
|
|
|
|
2024-01-07 15:23:41 +00:00
|
|
|
Route::prefix('invitations')->group(function () {
|
|
|
|
Route::get('/{uuid}', [Controller::class, 'accept_invitation'])->name('team.invitation.accept');
|
|
|
|
Route::get('/{uuid}/revoke', [Controller::class, 'revoke_invitation'])->name('team.invitation.revoke');
|
|
|
|
});
|
2023-04-25 07:38:05 +00:00
|
|
|
|
2024-01-07 15:23:41 +00:00
|
|
|
Route::get('/projects', ProjectIndex::class)->name('project.index');
|
|
|
|
Route::prefix('project/{project_uuid}')->group(function () {
|
|
|
|
Route::get('/', ProjectShow::class)->name('project.show');
|
|
|
|
Route::get('/edit', ProjectEdit::class)->name('project.edit');
|
|
|
|
});
|
|
|
|
Route::prefix('project/{project_uuid}/{environment_name}')->group(function () {
|
|
|
|
Route::get('/', ResourceIndex::class)->name('project.resource.index');
|
|
|
|
Route::get('/clone', ProjectCloneMe::class)->name('project.clone-me');
|
|
|
|
Route::get('/new', ResourceCreate::class)->name('project.resource.create');
|
|
|
|
Route::get('/edit', EnvironmentEdit::class)->name('project.environment.edit');
|
|
|
|
});
|
|
|
|
Route::prefix('project/{project_uuid}/{environment_name}/application/{application_uuid}')->group(function () {
|
|
|
|
Route::get('/', ApplicationConfiguration::class)->name('project.application.configuration');
|
|
|
|
Route::get('/deployment', DeploymentIndex::class)->name('project.application.deployment.index');
|
|
|
|
Route::get('/deployment/{deployment_uuid}', DeploymentShow::class)->name('project.application.deployment.show');
|
|
|
|
Route::get('/logs', Logs::class)->name('project.application.logs');
|
|
|
|
Route::get('/command', ExecuteContainerCommand::class)->name('project.application.command');
|
2024-01-10 11:03:48 +00:00
|
|
|
Route::get('/tasks/{task_uuid}', ScheduledTaskShow::class)->name('project.application.scheduled-tasks');
|
2024-01-07 15:23:41 +00:00
|
|
|
});
|
|
|
|
Route::prefix('project/{project_uuid}/{environment_name}/database/{database_uuid}')->group(function () {
|
|
|
|
Route::get('/', DatabaseConfiguration::class)->name('project.database.configuration');
|
|
|
|
Route::get('/logs', Logs::class)->name('project.database.logs');
|
|
|
|
Route::get('/command', ExecuteContainerCommand::class)->name('project.database.command');
|
|
|
|
Route::get('/backups', DatabaseBackupIndex::class)->name('project.database.backup.index');
|
|
|
|
Route::get('/backups/{backup_uuid}', DatabaseBackupExecution::class)->name('project.database.backup.execution');
|
|
|
|
});
|
|
|
|
Route::prefix('project/{project_uuid}/{environment_name}/service/{service_uuid}')->group(function () {
|
|
|
|
Route::get('/', ServiceConfiguration::class)->name('project.service.configuration');
|
2024-02-11 14:44:02 +00:00
|
|
|
Route::get('/{stack_service_uuid}', ServiceIndex::class)->name('project.service.index');
|
2024-01-07 15:23:41 +00:00
|
|
|
Route::get('/command', ExecuteContainerCommand::class)->name('project.service.command');
|
2024-01-10 11:03:48 +00:00
|
|
|
Route::get('/tasks/{task_uuid}', ScheduledTaskShow::class)->name('project.service.scheduled-tasks');
|
2024-01-07 15:23:41 +00:00
|
|
|
});
|
2023-04-25 07:38:05 +00:00
|
|
|
|
2024-01-07 15:23:41 +00:00
|
|
|
Route::get('/servers', ServerIndex::class)->name('server.index');
|
|
|
|
Route::get('/server/new', ServerCreate::class)->name('server.create');
|
2023-04-25 07:38:05 +00:00
|
|
|
|
2024-01-07 15:23:41 +00:00
|
|
|
Route::prefix('server/{server_uuid}')->group(function () {
|
|
|
|
Route::get('/', ServerShow::class)->name('server.show');
|
2024-02-16 20:56:38 +00:00
|
|
|
Route::get('/resources', ResourcesShow::class)->name('server.resources');
|
2024-01-07 15:23:41 +00:00
|
|
|
Route::get('/proxy', ProxyShow::class)->name('server.proxy');
|
|
|
|
Route::get('/proxy/logs', ProxyLogs::class)->name('server.proxy.logs');
|
|
|
|
Route::get('/private-key', PrivateKeyShow::class)->name('server.private-key');
|
|
|
|
Route::get('/destinations', DestinationShow::class)->name('server.destinations');
|
|
|
|
Route::get('/log-drains', LogDrains::class)->name('server.log-drains');
|
2023-08-15 12:27:45 +00:00
|
|
|
});
|
2023-04-25 07:38:05 +00:00
|
|
|
|
2024-01-07 15:23:41 +00:00
|
|
|
// Route::get('/security', fn () => view('security.index'))->name('security.index');
|
2023-09-04 07:44:44 +00:00
|
|
|
Route::get('/security/private-key', fn () => view('security.private-key.index', [
|
2023-09-29 09:01:58 +00:00
|
|
|
'privateKeys' => PrivateKey::ownedByCurrentTeam(['name', 'uuid', 'is_git_related'])->get()
|
2023-09-04 07:44:44 +00:00
|
|
|
]))->name('security.private-key.index');
|
2024-01-07 15:23:41 +00:00
|
|
|
Route::get('/security/private-key/new', SecurityPrivateKeyCreate::class)->name('security.private-key.create');
|
|
|
|
Route::get('/security/private-key/{private_key_uuid}', SecurityPrivateKeyShow::class)->name('security.private-key.show');
|
|
|
|
|
2023-10-20 12:51:01 +00:00
|
|
|
Route::get('/security/api-tokens', ApiTokens::class)->name('security.api-tokens');
|
2023-05-03 10:38:57 +00:00
|
|
|
});
|
2023-06-07 13:08:35 +00:00
|
|
|
|
2023-05-08 11:36:49 +00:00
|
|
|
Route::middleware(['auth'])->group(function () {
|
2023-08-11 18:48:52 +00:00
|
|
|
Route::get('/source/new', fn () => view('source.new'))->name('source.new');
|
2023-06-12 20:02:10 +00:00
|
|
|
Route::get('/sources', function () {
|
2023-08-22 15:44:49 +00:00
|
|
|
$sources = currentTeam()->sources();
|
2023-06-12 20:02:10 +00:00
|
|
|
return view('source.all', [
|
|
|
|
'sources' => $sources,
|
|
|
|
]);
|
|
|
|
})->name('source.all');
|
2023-11-07 08:44:47 +00:00
|
|
|
Route::get('/source/github/{github_app_uuid}', GitHubChange::class)->name('source.github.show');
|
2023-06-12 20:02:10 +00:00
|
|
|
Route::get('/source/gitlab/{gitlab_app_uuid}', function (Request $request) {
|
|
|
|
$gitlab_app = GitlabApp::where('uuid', request()->gitlab_app_uuid)->first();
|
|
|
|
return view('source.gitlab.show', [
|
|
|
|
'gitlab_app' => $gitlab_app,
|
|
|
|
]);
|
|
|
|
})->name('source.gitlab.show');
|
2023-05-08 11:36:49 +00:00
|
|
|
});
|
2023-04-25 08:47:13 +00:00
|
|
|
|
2023-05-02 10:47:52 +00:00
|
|
|
Route::middleware(['auth'])->group(function () {
|
2023-06-13 08:02:58 +00:00
|
|
|
Route::get('/destinations', function () {
|
|
|
|
$servers = Server::all();
|
|
|
|
$destinations = collect([]);
|
|
|
|
foreach ($servers as $server) {
|
|
|
|
$destinations = $destinations->merge($server->destinations());
|
|
|
|
}
|
|
|
|
return view('destination.all', [
|
|
|
|
'destinations' => $destinations,
|
|
|
|
]);
|
|
|
|
})->name('destination.all');
|
2023-05-03 09:16:08 +00:00
|
|
|
Route::get('/destination/new', function () {
|
2023-07-14 11:38:24 +00:00
|
|
|
$servers = Server::isUsable()->get();
|
2023-05-12 11:10:09 +00:00
|
|
|
$pre_selected_server_uuid = data_get(request()->query(), 'server');
|
|
|
|
if ($pre_selected_server_uuid) {
|
|
|
|
$server = $servers->firstWhere('uuid', $pre_selected_server_uuid);
|
|
|
|
if ($server) {
|
|
|
|
$server_id = $server->id;
|
|
|
|
}
|
|
|
|
}
|
2023-05-03 09:16:08 +00:00
|
|
|
return view('destination.new', [
|
2023-05-04 09:14:37 +00:00
|
|
|
"servers" => $servers,
|
2023-05-12 11:10:09 +00:00
|
|
|
"server_id" => $server_id ?? null,
|
2023-05-03 09:16:08 +00:00
|
|
|
]);
|
|
|
|
})->name('destination.new');
|
2023-05-02 10:47:52 +00:00
|
|
|
Route::get('/destination/{destination_uuid}', function () {
|
|
|
|
$standalone_dockers = StandaloneDocker::where('uuid', request()->destination_uuid)->first();
|
|
|
|
$swarm_dockers = SwarmDocker::where('uuid', request()->destination_uuid)->first();
|
|
|
|
if (!$standalone_dockers && !$swarm_dockers) {
|
|
|
|
abort(404);
|
|
|
|
}
|
|
|
|
$destination = $standalone_dockers ? $standalone_dockers : $swarm_dockers;
|
|
|
|
return view('destination.show', [
|
2023-05-04 09:14:37 +00:00
|
|
|
'destination' => $destination->load(['server']),
|
2023-05-02 10:47:52 +00:00
|
|
|
]);
|
|
|
|
})->name('destination.show');
|
2023-08-08 09:51:36 +00:00
|
|
|
});
|
2023-12-13 14:29:45 +00:00
|
|
|
|
|
|
|
Route::any('/{any}', function () {
|
|
|
|
if (auth()->user()) {
|
2023-12-27 15:45:01 +00:00
|
|
|
return redirect(RouteServiceProvider::HOME);
|
2023-12-13 14:29:45 +00:00
|
|
|
}
|
2023-12-27 15:45:01 +00:00
|
|
|
return redirect()->route('login');
|
2023-12-13 14:29:45 +00:00
|
|
|
})->where('any', '.*');
|