-
Notifications
You must be signed in to change notification settings - Fork 222
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f120a57
commit f06b8f7
Showing
9 changed files
with
140 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
namespace App\Http\Livewire\Sites; | ||
|
||
use App\Models\Site; | ||
use App\Traits\HasToast; | ||
use App\Traits\RefreshComponentOnBroadcast; | ||
use Illuminate\Contracts\View\View; | ||
use Livewire\Component; | ||
use Throwable; | ||
|
||
class UpdateVHost extends Component | ||
{ | ||
use HasToast; | ||
use RefreshComponentOnBroadcast; | ||
|
||
public Site $site; | ||
|
||
public string $vHost = 'Loading...'; | ||
|
||
public function loadVHost(): void | ||
{ | ||
$this->vHost = $this->site->server->webserver()->handler()->getVHost($this->site); | ||
} | ||
|
||
public function update(): void | ||
{ | ||
try { | ||
$this->site->server->webserver()->handler()->updateVHost($this->site, false, $this->vHost); | ||
|
||
$this->toast()->success('VHost updated successfully!'); | ||
} catch (Throwable $e) { | ||
$this->toast()->error($e->getMessage()); | ||
} | ||
} | ||
|
||
public function render(): View | ||
{ | ||
return view('livewire.sites.update-v-host'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
<?php | ||
|
||
namespace App\SSHCommands\Nginx; | ||
|
||
use App\SSHCommands\Command; | ||
use Illuminate\Support\Facades\File; | ||
|
||
class GetNginxVHostCommand extends Command | ||
{ | ||
public function __construct( | ||
protected string $domain | ||
) { | ||
} | ||
|
||
public function file(): string | ||
{ | ||
return File::get(resource_path('commands/webserver/nginx/get-vhost.sh')); | ||
} | ||
|
||
public function content(): string | ||
{ | ||
return str($this->file()) | ||
->replace('__domain__', $this->domain) | ||
->toString(); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
cat /etc/nginx/sites-available/__domain__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<x-card> | ||
<x-slot name="title">{{ __('Update VHost') }}</x-slot> | ||
|
||
<x-slot name="description">{{ __("You can change your site's PHP version here") }}</x-slot> | ||
|
||
<form | ||
id="update-vhost" | ||
wire:submit.prevent="update" | ||
class="space-y-6" | ||
> | ||
<div> | ||
<x-textarea | ||
id="vHost" | ||
wire:init="loadVHost" | ||
wire:model.defer="vHost" | ||
rows="10" | ||
class="mt-1 block w-full" | ||
></x-textarea> | ||
@error('vHost') | ||
<x-input-error | ||
class="mt-2" | ||
:messages="$message" | ||
/> | ||
@enderror | ||
</div> | ||
</form> | ||
|
||
<x-slot name="actions"> | ||
<x-primary-button | ||
form="update-vhost" | ||
wire:loading.attr="disabled" | ||
>{{ __('Save') }}</x-primary-button> | ||
</x-slot> | ||
</x-card> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters