Skip to content

An open-source, self-hostable PaaS alternative to Vercel, Heroku & Netlify that lets you easily deploy static sites, databases, full-stack applications and 360+ one-click services on your own servers.

fix: feedback from self-hosted envs to discord

Andras Bacsaib96807d34c5c
diff --git a/app/Livewire/Help.php b/app/Livewire/Help.php
index 5e0876f89b..6576705267 100644
--- a/app/Livewire/Help.php
+++ b/app/Livewire/Help.php
@@ -2,8 +2,10 @@
namespace App\Livewire;
+use App\Models\InstanceSettings;
use DanHarrin\LivewireRateLimiting\WithRateLimiting;
use Illuminate\Notifications\Messages\MailMessage;
+use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Route;
use Livewire\Component;
@@ -28,9 +30,8 @@ class Help extends Component
public function submit()
{
try {
- $this->rateLimit(3, 60);
+ $this->rateLimit(3, 30);
$this->validate();
- $subscriptionType = auth()->user()?->subscription?->type() ?? 'Free';
$debug = "Route: {$this->path}";
$mail = new MailMessage();
$mail->view(
@@ -40,9 +41,21 @@ class Help extends Component
'debug' => $debug
]
);
- $mail->subject("[HELP - {$subscriptionType}]: {$this->subject}");
- send_user_an_email($mail, auth()->user()?->email, '[email protected]');
- $this->dispatch('success', 'Your message has been sent successfully. <br>We will get in touch with you as soon as possible.');
+ $mail->subject("[HELP]: {$this->subject}");
+ $settings = InstanceSettings::get();
+ $type = set_transanctional_email_settings($settings);
+ if (!$type) {
+ $url = "https://app.coolify.io/api/feedback";
+ if (isDev()) {
+ $url = "http://localhost:80/api/feedback";
+ }
+ Http::post($url, [
+ 'content' => "User: `" . auth()->user()?->email . "` with subject: `" . $this->subject . "` has the following problem: `" . $this->description . "`"
+ ]);
+ } else {
+ send_user_an_email($mail, auth()->user()?->email, '[email protected]');
+ }
+ $this->dispatch('success', 'Feedback sent.', 'We will get in touch with you as soon as possible.');
} catch (\Throwable $e) {
return handleError($e, $this);
}
diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php
index a6d8a4ae59..23ee3fa065 100644
--- a/bootstrap/helpers/shared.php
+++ b/bootstrap/helpers/shared.php
@@ -104,7 +104,7 @@ function handleError(?Throwable $error = null, ?Livewire\Component $livewire = n
ray($error);
if ($error instanceof TooManyRequestsException) {
if (isset($livewire)) {
- return $livewire->dispatch('error', "Too many requests. Please try again in {$error->secondsUntilAvailable} seconds.");
+ return $livewire->dispatch('error', "Too many requests.","Please try again in {$error->secondsUntilAvailable} seconds.");
}
return "Too many requests. Please try again in {$error->secondsUntilAvailable} seconds.";
}
diff --git a/config/coolify.php b/config/coolify.php
index 2e15c86182..69ec231461 100644
--- a/config/coolify.php
+++ b/config/coolify.php
@@ -3,6 +3,7 @@
return [
'docs' => 'https://coolify.io/docs/',
'contact' => 'https://coolify.io/docs/contact',
+ 'feedback_discord_webhook' => env('FEEDBACK_DISCORD_WEBHOOK'),
'self_hosted' => env('SELF_HOSTED', true),
'waitlist' => env('WAITLIST', false),
'license_url' => 'https://licenses.coollabs.io',
diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml
index 0961fad030..b4b81530c8 100644
--- a/docker-compose.prod.yml
+++ b/docker-compose.prod.yml
@@ -46,6 +46,7 @@ services:
- PUSHER_APP_SECRET
- AUTOUPDATE
- SELF_HOSTED
+ - FEEDBACK_DISCORD_WEBHOOK
- WAITLIST
- SUBSCRIPTION_PROVIDER
- STRIPE_API_KEY
diff --git a/resources/views/components/navbar-subscription.blade.php b/resources/views/components/navbar-subscription.blade.php
index 8638430e51..084e778fb4 100644
--- a/resources/views/components/navbar-subscription.blade.php
+++ b/resources/views/components/navbar-subscription.blade.php
@@ -26,11 +26,10 @@
</li>
<li title="Send us feedback or get help!" class="fixed top-0 right-0 p-2 px-4 pt-4 mt-auto text-xs">
<div class="justify-center" wire:click="help" onclick="help.showModal()">
- <svg class="w-5 h-5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
+ <svg class="icon" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg">
<path fill="currentColor"
- d="M22 5.5H9c-1.1 0-2 .9-2 2v9a2 2 0 0 0 2 2h13c1.11 0 2-.89 2-2v-9a2 2 0 0 0-2-2m0 11H9V9.17l6.5 3.33L22 9.17v7.33m-6.5-5.69L9 7.5h13l-6.5 3.31M5 16.5c0 .17.03.33.05.5H1c-.552 0-1-.45-1-1s.448-1 1-1h4v1.5M3 7h2.05c-.02.17-.05.33-.05.5V9H3c-.55 0-1-.45-1-1s.45-1 1-1m-2 5c0-.55.45-1 1-1h3v2H2c-.55 0-1-.45-1-1Z" />
+ d="M144 180a16 16 0 1 1-16-16a16 16 0 0 1 16 16m92-52A108 108 0 1 1 128 20a108.12 108.12 0 0 1 108 108m-24 0a84 84 0 1 0-84 84a84.09 84.09 0 0 0 84-84m-84-64c-24.26 0-44 17.94-44 40v4a12 12 0 0 0 24 0v-4c0-8.82 9-16 20-16s20 7.18 20 16s-9 16-20 16a12 12 0 0 0-12 12v8a12 12 0 0 0 23.73 2.56C158.31 137.88 172 122.37 172 104c0-22.06-19.74-40-44-40" />
</svg>
- Feedback
</div>
</li>
<li class="pb-6" title="Logout">
diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php
index 9256dc5020..881ad1bd8b 100644
--- a/resources/views/components/navbar.blade.php
+++ b/resources/views/components/navbar.blade.php
@@ -142,13 +142,12 @@
</li>
@endif
@if (isSubscriptionActive() || isDev())
- <li title="Send us feedback or get help!" class="fixed top-0 right-0 p-2 px-4 pt-4 mt-auto text-xs">
+ <li title="Send us feedback or get help!" class="hover:bg-transparent">
<div class="justify-center" wire:click="help" onclick="help.showModal()">
- <svg class="w-5 h-5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
+ <svg class="icon" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg">
<path fill="currentColor"
- d="M22 5.5H9c-1.1 0-2 .9-2 2v9a2 2 0 0 0 2 2h13c1.11 0 2-.89 2-2v-9a2 2 0 0 0-2-2m0 11H9V9.17l6.5 3.33L22 9.17v7.33m-6.5-5.69L9 7.5h13l-6.5 3.31M5 16.5c0 .17.03.33.05.5H1c-.552 0-1-.45-1-1s.448-1 1-1h4v1.5M3 7h2.05c-.02.17-.05.33-.05.5V9H3c-.55 0-1-.45-1-1s.45-1 1-1m-2 5c0-.55.45-1 1-1h3v2H2c-.55 0-1-.45-1-1Z" />
+ d="M144 180a16 16 0 1 1-16-16a16 16 0 0 1 16 16m92-52A108 108 0 1 1 128 20a108.12 108.12 0 0 1 108 108m-24 0a84 84 0 1 0-84 84a84.09 84.09 0 0 0 84-84m-84-64c-24.26 0-44 17.94-44 40v4a12 12 0 0 0 24 0v-4c0-8.82 9-16 20-16s20 7.18 20 16s-9 16-20 16a12 12 0 0 0-12 12v8a12 12 0 0 0 23.73 2.56C158.31 137.88 172 122.37 172 104c0-22.06-19.74-40-44-40" />
</svg>
- Feedback
</div>
</li>
@endif
diff --git a/resources/views/layouts/boarding.blade.php b/resources/views/layouts/boarding.blade.php
index d108c2e38b..e110679380 100644
--- a/resources/views/layouts/boarding.blade.php
+++ b/resources/views/layouts/boarding.blade.php
@@ -3,11 +3,10 @@
@if (isSubscriptionActive() || isDev())
<div title="Send us feedback or get help!" class="fixed top-0 right-0 p-2 px-4 pt-4 mt-auto text-xs">
<button class="flex items-center justify-center gap-2" wire:click="help" onclick="help.showModal()">
- <svg class="w-5 h-5" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
+ <svg class="icon" viewBox="0 0 256 256" xmlns="http://www.w3.org/2000/svg">
<path fill="currentColor"
- d="M22 5.5H9c-1.1 0-2 .9-2 2v9a2 2 0 0 0 2 2h13c1.11 0 2-.89 2-2v-9a2 2 0 0 0-2-2m0 11H9V9.17l6.5 3.33L22 9.17v7.33m-6.5-5.69L9 7.5h13l-6.5 3.31M5 16.5c0 .17.03.33.05.5H1c-.552 0-1-.45-1-1s.448-1 1-1h4v1.5M3 7h2.05c-.02.17-.05.33-.05.5V9H3c-.55 0-1-.45-1-1s.45-1 1-1m-2 5c0-.55.45-1 1-1h3v2H2c-.55 0-1-.45-1-1Z" />
+ d="M144 180a16 16 0 1 1-16-16a16 16 0 0 1 16 16m92-52A108 108 0 1 1 128 20a108.12 108.12 0 0 1 108 108m-24 0a84 84 0 1 0-84 84a84.09 84.09 0 0 0 84-84m-84-64c-24.26 0-44 17.94-44 40v4a12 12 0 0 0 24 0v-4c0-8.82 9-16 20-16s20 7.18 20 16s-9 16-20 16a12 12 0 0 0-12 12v8a12 12 0 0 0 23.73 2.56C158.31 137.88 172 122.37 172 104c0-22.06-19.74-40-44-40" />
</svg>
- Feedback
</button>
</div>
@endif
diff --git a/resources/views/livewire/help.blade.php b/resources/views/livewire/help.blade.php
index 84a4f99bdc..66e80e428b 100644
--- a/resources/views/livewire/help.blade.php
+++ b/resources/views/livewire/help.blade.php
@@ -6,6 +6,6 @@
<x-forms.textarea rows="10" id="description" label="Description"
placeholder="Please provide as much information as possible."></x-forms.textarea>
<div></div>
- <x-forms.button class="w-full mt-4" type="submit" onclick="help.close()">Send Email</x-forms.button>
+ <x-forms.button class="w-full mt-4" type="submit" onclick="help.close()">Send</x-forms.button>
</form>
</div>
diff --git a/routes/api.php b/routes/api.php
index ee44e390e4..30dddd2d4a 100644
--- a/routes/api.php
+++ b/routes/api.php
@@ -12,6 +12,7 @@ use App\Models\Tag;
use App\Models\User;
use App\Providers\RouteServiceProvider;
use Illuminate\Http\Request;
+use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Route;
use Visus\Cuid2\Cuid2;
@@ -34,6 +35,16 @@ if (isDev()) {
Route::get('/health', function () {
return 'OK';
});
+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);
+});
// Route::group([
// 'middleware' => $middlewares,
// 'prefix' => 'v1'
@@ -53,6 +64,8 @@ Route::group([
'prefix' => 'v1'
], function () {
Route::get('/deploy', [Deploy::class, 'deploy']);
+
+
});
Route::middleware(['throttle:5'])->group(function () {