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.

feat: send request in cloud

Andras Bacsai6b9c7aa9c56b
diff --git a/app/Http/Livewire/Help.php b/app/Http/Livewire/Help.php
new file mode 100644
index 0000000000..1078215018
--- /dev/null
+++ b/app/Http/Livewire/Help.php
@@ -0,0 +1,54 @@
+<?php
+
+namespace App\Http\Livewire;
+
+use DanHarrin\LivewireRateLimiting\WithRateLimiting;
+use Illuminate\Notifications\Messages\MailMessage;
+use Livewire\Component;
+use Route;
+
+class Help extends Component
+{
+ use WithRateLimiting;
+ public string $description;
+ public string $subject;
+ public ?string $path = null;
+ protected $rules = [
+ 'description' => 'required|min:10',
+ 'subject' => 'required|min:3'
+ ];
+ public function mount()
+ {
+ $this->path = Route::current()->uri();
+ if (isDev()) {
+ $this->description = "I'm having trouble with {$this->path}";
+ $this->subject = "Help with {$this->path}";
+ }
+ }
+ public function submit()
+ {
+ try {
+ $this->rateLimit(1, 60);
+ $this->validate();
+ $subscriptionType = auth()->user()?->subscription?->type() ?? 'unknown';
+ $debug = "Route: {$this->path}";
+ $mail = new MailMessage();
+ $mail->view(
+ 'emails.help',
+ [
+ 'description' => $this->description,
+ 'debug' => $debug
+ ]
+ );
+ $mail->subject("[HELP - {$subscriptionType}]: {$this->subject}");
+ send_user_an_email($mail, '[email protected]');
+ $this->emit('success', 'Your message has been sent successfully. We will get in touch with you as soon as possible.');
+ } catch (\Exception $e) {
+ return general_error_handler($e, $this);
+ }
+ }
+ public function render()
+ {
+ return view('livewire.help')->layout('layouts.app');
+ }
+}
diff --git a/app/Notifications/Channels/TransactionalEmailChannel.php b/app/Notifications/Channels/TransactionalEmailChannel.php
index aa5541dee1..2985d51837 100644
--- a/app/Notifications/Channels/TransactionalEmailChannel.php
+++ b/app/Notifications/Channels/TransactionalEmailChannel.php
@@ -12,7 +12,6 @@ use Log;
class TransactionalEmailChannel
{
- private bool $isResend = false;
public function send(User $notifiable, Notification $notification): void
{
$settings = InstanceSettings::get();
@@ -26,33 +25,14 @@ class TransactionalEmailChannel
}
$this->bootConfigs();
$mailMessage = $notification->toMail($notifiable);
- // if ($this->isResend) {
Mail::send(
[],
[],
fn (Message $message) => $message
- ->from(
- data_get($settings, 'smtp_from_address'),
- data_get($settings, 'smtp_from_name'),
- )
->to($email)
->subject($mailMessage->subject)
->html((string)$mailMessage->render())
);
- // } else {
- // Mail::send(
- // [],
- // [],
- // fn (Message $message) => $message
- // ->from(
- // data_get($settings, 'smtp_from_address'),
- // data_get($settings, 'smtp_from_name'),
- // )
- // ->bcc($email)
- // ->subject($mailMessage->subject)
- // ->html((string)$mailMessage->render())
- // );
- // }
}
private function bootConfigs(): void
@@ -61,8 +41,5 @@ class TransactionalEmailChannel
if (!$type) {
throw new Exception('No email settings found.');
}
- if ($type === 'resend') {
- $this->isResend = true;
- }
}
}
diff --git a/bootstrap/helpers/shared.php b/bootstrap/helpers/shared.php
index 7056b159b4..e45dfa08a3 100644
--- a/bootstrap/helpers/shared.php
+++ b/bootstrap/helpers/shared.php
@@ -7,7 +7,6 @@ use DanHarrin\LivewireRateLimiting\Exceptions\TooManyRequestsException;
use Illuminate\Database\QueryException;
use Illuminate\Mail\Message;
use Illuminate\Notifications\Messages\MailMessage;
-use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\Route;
@@ -261,15 +260,10 @@ function send_user_an_email(MailMessage $mail, string $email): void
[],
[],
fn (Message $message) => $message
- ->from(
- data_get($settings, 'smtp_from_address'),
- data_get($settings, 'smtp_from_name')
- )
->to($email)
->subject($mail->subject)
->html((string) $mail->render())
);
-
}
function isEmailEnabled($notifiable)
{
diff --git a/bootstrap/helpers/subscriptions.php b/bootstrap/helpers/subscriptions.php
index 7691ca7d66..ae35067824 100644
--- a/bootstrap/helpers/subscriptions.php
+++ b/bootstrap/helpers/subscriptions.php
@@ -47,6 +47,9 @@ function getEndDate()
function isSubscriptionActive()
{
+ if (!isCloud()) {
+ return false;
+ }
$team = currentTeam();
if (!$team) {
return false;
diff --git a/resources/views/components/modal.blade.php b/resources/views/components/modal.blade.php
index 7115154379..d31dc542a1 100644
--- a/resources/views/components/modal.blade.php
+++ b/resources/views/components/modal.blade.php
@@ -43,10 +43,6 @@
@endisset
@if ($modalSubmit)
{{ $modalSubmit }}
- @else
- <x-forms.button onclick="{{ $modalId }}.close()" type="submit">
- Save
- </x-forms.button>
@endif
</form>
diff --git a/resources/views/components/navbar.blade.php b/resources/views/components/navbar.blade.php
index 6fd4b218a3..65cbc482ba 100644
--- a/resources/views/components/navbar.blade.php
+++ b/resources/views/components/navbar.blade.php
@@ -95,6 +95,20 @@
</a>
</li>
@endif
+ @if (isSubscriptionActive() || isDev())
+ <li title="Help" class="mt-auto">
+ <div class="justify-center icons" wire:click="help" onclick="help.showModal()">
+ <svg class="{{ request()->is('help*') ? 'text-warning icon' : 'icon' }}" viewBox="0 0 24 24"
+ xmlns="http://www.w3.org/2000/svg">
+ <g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round"
+ stroke-width="2">
+ <path d="M3 12a9 9 0 1 0 18 0a9 9 0 0 0-18 0m9 4v.01" />
+ <path d="M12 13a2 2 0 0 0 .914-3.782a1.98 1.98 0 0 0-2.414.483" />
+ </g>
+ </svg>
+ </div>
+ </li>
+ @endif
<li class="pb-6" title="Logout">
<form action="/logout" method="POST" class=" hover:bg-transparent">
@csrf
diff --git a/resources/views/emails/help.blade.php b/resources/views/emails/help.blade.php
new file mode 100644
index 0000000000..a9f8aeb697
--- /dev/null
+++ b/resources/views/emails/help.blade.php
@@ -0,0 +1,5 @@
+{{ $description }}
+
+{{ Illuminate\Mail\Markdown::parse('---') }}
+
+{{ Illuminate\Mail\Markdown::parse($debug) }}
diff --git a/resources/views/layouts/base.blade.php b/resources/views/layouts/base.blade.php
index 6302eddebb..6c69eecc36 100644
--- a/resources/views/layouts/base.blade.php
+++ b/resources/views/layouts/base.blade.php
@@ -25,6 +25,14 @@
<body>
@livewireScripts
+ @if (isSubscriptionActive() || isDev())
+ <dialog id="help" class="modal">
+ <livewire:help />
+ <form method="dialog" class="modal-backdrop">
+ <button>close</button>
+ </form>
+ </dialog>
+ @endif
<x-toaster-hub />
<x-version class="fixed left-2 bottom-1" />
<script>
diff --git a/resources/views/livewire/help.blade.php b/resources/views/livewire/help.blade.php
new file mode 100644
index 0000000000..a08bdda057
--- /dev/null
+++ b/resources/views/livewire/help.blade.php
@@ -0,0 +1,10 @@
+<div class="flex flex-col gap-2 rounded modal-box">
+ <h3>How can we help?</h3>
+ <div>You can report bug on the current page, or send us general feedback.</div>
+ <form wire:submit.prevent="submit" class="flex flex-col gap-4 pt-4">
+ <x-forms.input id="subject" label="Subject" placeholder="Summary of your problem."></x-forms.input>
+ <x-forms.textarea id="description" label="Message"
+ placeholder="Please provide as much information as possible."></x-forms.textarea>
+ <x-forms.button class="w-full mt-4" type="submit">Send Request</x-forms.button>
+ </form>
+</div>
diff --git a/routes/web.php b/routes/web.php
index d59b9a48d0..f2e0935e67 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -9,6 +9,7 @@ use App\Http\Controllers\ServerController;
use App\Http\Livewire\Boarding\Index;
use App\Http\Livewire\Boarding\Server as BoardingServer;
use App\Http\Livewire\Dashboard;
+use App\Http\Livewire\Help;
use App\Http\Livewire\Server\All;
use App\Http\Livewire\Server\Show;
use App\Http\Livewire\Waitlist\Index as WaitlistIndex;
@@ -103,6 +104,7 @@ Route::middleware(['auth'])->group(function () {
Route::get('/force-password-reset', [Controller::class, 'force_passoword_reset'])->name('auth.force-password-reset');
});
Route::get('/subscription', [Controller::class, 'subscription'])->name('subscription.index');
+ // Route::get('/help', Help::class)->name('help');
Route::get('/settings', [Controller::class, 'settings'])->name('settings.configuration');
Route::get('/settings/license', [Controller::class, 'license'])->name('settings.license');
Route::get('/profile', fn () => view('profile', ['request' => request()]))->name('profile');