diff --git a/app/Http/Livewire/Source/Github/Change.php b/app/Http/Livewire/Source/Github/Change.php index f0b922088..995428e1a 100644 --- a/app/Http/Livewire/Source/Github/Change.php +++ b/app/Http/Livewire/Source/Github/Change.php @@ -8,7 +8,10 @@ use Livewire\Component; class Change extends Component { - public string $host; + public string $webhook_endpoint; + public string|null $ipv4; + public string|null $ipv6; + public string|null $fqdn; public $parameters; public GithubApp $github_app; public string $installation_url; @@ -23,12 +26,18 @@ class Change extends Component 'github_app.custom_user' => 'required|string', 'github_app.custom_port' => 'required|int', 'github_app.app_id' => 'required|int', - 'github_app.installation_id' => 'required|int', - 'github_app.client_id' => 'required|string', - 'github_app.client_secret' => 'required|string', - 'github_app.webhook_secret' => 'required|string', + 'github_app.installation_id' => 'nullable', + 'github_app.client_id' => 'nullable', + 'github_app.client_secret' => 'nullable', + 'github_app.webhook_secret' => 'nullable', 'github_app.is_system_wide' => 'required|bool', ]; + public function mount() + { + $this->webhook_endpoint = $this->ipv4; + $this->parameters = get_parameters(); + $this->is_system_wide = $this->github_app->is_system_wide; + } public function submit() { try { @@ -48,15 +57,7 @@ class Change extends Component return general_error_handler(err: $e, that: $this); } } - public function mount() - { - $settings = InstanceSettings::get(); - if ($settings->fqdn) { - $this->host = $settings->fqdn; - } - $this->parameters = get_parameters(); - $this->is_system_wide = $this->github_app->is_system_wide; - } + public function delete() { try { diff --git a/config/app.php b/config/app.php index 6a2c5ce28..a3347a8cd 100644 --- a/config/app.php +++ b/config/app.php @@ -4,6 +4,7 @@ use Illuminate\Support\Facades\Facade; return [ + 'port' => env('APP_PORT', 8000), /* |-------------------------------------------------------------------------- | Application Name diff --git a/resources/views/livewire/source/github/change.blade.php b/resources/views/livewire/source/github/change.blade.php index ea2b319c0..243ad5d06 100644 --- a/resources/views/livewire/source/github/change.blade.php +++ b/resources/views/livewire/source/github/change.blade.php @@ -30,40 +30,25 @@
Your Private GitHub App for private repositories.
- @if (!$github_app->app_id) -
-
You need to register a GitHub App before using this source:
-
- Register a GitHub - Application - -
-
- @endif -
- - - @if ($github_app->app_id) - - @else - - @endif -
-
- - -
-
- @if ($github_app->html_url === 'https://github.com') - - - @else - - - @endif -
@if ($github_app->app_id) +
+ + +
+
+ + +
+
+ @if ($github_app->html_url === 'https://github.com') + + + @else + + + @endif +
@@ -77,61 +62,97 @@ helper="If checked, this GitHub App will be available for everyone in this Coolify instance." instantSave id="is_system_wide" /> @else +
You need to register a GitHub App before using this source.
+
+
+ + @if ($ipv4) + + @endif + @if ($ipv6) + + @endif + @if ($fqdn) + + @endif + + Register a GitHub + Application + +
+
+
+ + +
+
+ + +
+
+ @if ($github_app->html_url === 'https://github.com') + + + @else + + + @endif +
+ label="System Wide?" instantSave disabled id="is_system_wide" /> + @endif - @if (!$github_app->app_id) - - @endif
diff --git a/resources/views/source/github/show.blade.php b/resources/views/source/github/show.blade.php index d1da2979f..6cbba2911 100644 --- a/resources/views/source/github/show.blade.php +++ b/resources/views/source/github/show.blade.php @@ -1,3 +1,4 @@ - + diff --git a/routes/web.php b/routes/web.php index e52d18eb8..38ae861f3 100644 --- a/routes/web.php +++ b/routes/web.php @@ -101,18 +101,22 @@ Route::middleware(['auth'])->group(function () { })->name('source.all'); Route::get('/source/github/{github_app_uuid}', function (Request $request) { $github_app = GithubApp::where('uuid', request()->github_app_uuid)->first(); - $name = Str::of(Str::kebab($github_app->name))->start('coolify-'); $settings = InstanceSettings::get(); - $host = $request->schemeAndHttpHost(); - if ($settings->fqdn) { - $host = $settings->fqdn; - } + $name = Str::of(Str::kebab($github_app->name)); $installation_path = $github_app->html_url === 'https://github.com' ? 'apps' : 'github-apps'; $installation_url = "$github_app->html_url/$installation_path/$name/installations/new"; + if ($settings->public_ipv4) { + $ipv4 = 'http://' . $settings->public_ipv4 . ':' . config('app.port'); + } + if ($settings->public_ipv6) { + $ipv6 = 'http://' . $settings->public_ipv6 . ':' . config('app.port'); + } return view('source.github.show', [ 'github_app' => $github_app, - 'host' => $host, 'name' => $name, + 'ipv4' => $ipv4 ?? null, + 'ipv6' => $ipv6 ?? null, + 'fqdn' => $settings->fqdn, 'installation_url' => $installation_url, ]); })->name('source.github.show');