2023-03-17 14:33:48 +00:00
|
|
|
<?php
|
|
|
|
|
2024-02-27 07:03:42 +00:00
|
|
|
use App\Http\Controllers\Api\Deploy;
|
2024-03-07 10:14:03 +00:00
|
|
|
use App\Http\Controllers\Api\Domains;
|
2024-02-27 07:03:42 +00:00
|
|
|
use App\Http\Controllers\Api\Project;
|
2024-03-07 10:35:00 +00:00
|
|
|
use App\Http\Controllers\Api\Resources;
|
2024-02-27 07:03:42 +00:00
|
|
|
use App\Http\Controllers\Api\Server;
|
2024-03-07 11:01:21 +00:00
|
|
|
use App\Http\Controllers\Api\Team;
|
2023-10-20 12:51:01 +00:00
|
|
|
use Illuminate\Http\Request;
|
2024-02-06 10:36:20 +00:00
|
|
|
use Illuminate\Support\Facades\Http;
|
2023-03-17 14:33:48 +00:00
|
|
|
use Illuminate\Support\Facades\Route;
|
2024-01-25 12:45:17 +00:00
|
|
|
|
2023-04-28 09:06:55 +00:00
|
|
|
Route::get('/health', function () {
|
|
|
|
return 'OK';
|
2023-03-17 14:33:48 +00:00
|
|
|
});
|
2024-02-06 10:36:20 +00:00
|
|
|
Route::post('/feedback', function (Request $request) {
|
|
|
|
$content = $request->input('content');
|
|
|
|
$webhook_url = config('coolify.feedback_discord_webhook');
|
|
|
|
if ($webhook_url) {
|
|
|
|
Http::post($webhook_url, [
|
|
|
|
'content' => $content
|
|
|
|
]);
|
|
|
|
}
|
|
|
|
return response()->json(['message' => 'Feedback sent.'], 200);
|
|
|
|
});
|
2024-02-16 20:56:38 +00:00
|
|
|
|
2023-10-20 12:51:01 +00:00
|
|
|
Route::group([
|
|
|
|
'middleware' => ['auth:sanctum'],
|
|
|
|
'prefix' => 'v1'
|
|
|
|
], function () {
|
2024-02-16 20:56:38 +00:00
|
|
|
Route::get('/version', function () {
|
|
|
|
return response(config('version'));
|
|
|
|
});
|
2024-02-02 10:50:28 +00:00
|
|
|
Route::get('/deploy', [Deploy::class, 'deploy']);
|
2024-02-16 20:56:38 +00:00
|
|
|
Route::get('/servers', [Server::class, 'servers']);
|
|
|
|
Route::get('/server/{uuid}', [Server::class, 'server_by_uuid']);
|
2024-03-07 10:35:00 +00:00
|
|
|
Route::get('/resources', [Resources::class, 'resources']);
|
2024-03-07 10:14:03 +00:00
|
|
|
Route::get('/domains', [Domains::class, 'domains']);
|
2024-03-07 11:01:21 +00:00
|
|
|
Route::get('/teams', [Team::class, 'teams']);
|
|
|
|
Route::get('/team/current', [Team::class, 'current_team']);
|
|
|
|
Route::get('/team/current/members', [Team::class, 'current_team_members']);
|
|
|
|
Route::get('/team/{id}', [Team::class, 'team_by_id']);
|
|
|
|
Route::get('/team/{id}/members', [Team::class, 'members_by_id']);
|
|
|
|
|
|
|
|
|
2024-03-07 10:35:00 +00:00
|
|
|
//Route::get('/projects', [Project::class, 'projects']);
|
|
|
|
//Route::get('/project/{uuid}', [Project::class, 'project_by_uuid']);
|
|
|
|
//Route::get('/project/{uuid}/{environment_name}', [Project::class, 'environment_details']);
|
2023-10-20 12:51:01 +00:00
|
|
|
});
|
2023-09-25 18:57:52 +00:00
|
|
|
|
2024-02-16 20:56:38 +00:00
|
|
|
Route::get('/{any}', function () {
|
|
|
|
return response()->json(['error' => 'Not found.'], 404);
|
|
|
|
})->where('any', '.*');
|
|
|
|
|
|
|
|
// Route::middleware(['throttle:5'])->group(function () {
|
|
|
|
// Route::get('/unsubscribe/{token}', function () {
|
|
|
|
// try {
|
|
|
|
// $token = request()->token;
|
|
|
|
// $email = decrypt($token);
|
|
|
|
// if (!User::whereEmail($email)->exists()) {
|
|
|
|
// return redirect(RouteServiceProvider::HOME);
|
|
|
|
// }
|
|
|
|
// if (User::whereEmail($email)->first()->marketing_emails === false) {
|
|
|
|
// return 'You have already unsubscribed from marketing emails.';
|
|
|
|
// }
|
|
|
|
// User::whereEmail($email)->update(['marketing_emails' => false]);
|
|
|
|
// return 'You have been unsubscribed from marketing emails.';
|
|
|
|
// } catch (\Throwable $e) {
|
|
|
|
// return 'Something went wrong. Please try again or contact support.';
|
|
|
|
// }
|
|
|
|
// })->name('unsubscribe.marketing.emails');
|
|
|
|
// });
|