diff --git a/app/Livewire/Source/Github/Change.php b/app/Livewire/Source/Github/Change.php index 20f52c322..e73c9dc73 100644 --- a/app/Livewire/Source/Github/Change.php +++ b/app/Livewire/Source/Github/Change.php @@ -37,6 +37,8 @@ class Change extends Component public $applications; + public $privateKeys; + protected $rules = [ 'github_app.name' => 'required|string', 'github_app.organization' => 'nullable|string', @@ -54,6 +56,7 @@ class Change extends Component 'github_app.metadata' => 'nullable|string', 'github_app.pull_requests' => 'nullable|string', 'github_app.administration' => 'nullable|string', + 'github_app.private_key_id' => 'required|int', ]; public function boot() @@ -65,9 +68,13 @@ class Change extends Component public function checkPermissions() { - GithubAppPermissionJob::dispatchSync($this->github_app); - $this->github_app->refresh()->makeVisible('client_secret')->makeVisible('webhook_secret'); - $this->dispatch('success', 'Github App permissions updated.'); + try { + GithubAppPermissionJob::dispatchSync($this->github_app); + $this->github_app->refresh()->makeVisible('client_secret')->makeVisible('webhook_secret'); + $this->dispatch('success', 'Github App permissions updated.'); + } catch (\Throwable $e) { + return handleError($e, $this); + } } // public function check() @@ -109,6 +116,7 @@ class Change extends Component $github_app_uuid = request()->github_app_uuid; $this->github_app = GithubApp::ownedByCurrentTeam()->whereUuid($github_app_uuid)->firstOrFail(); $this->github_app->makeVisible(['client_secret', 'webhook_secret']); + $this->privateKeys = PrivateKey::ownedByCurrentTeam()->get(); $this->applications = $this->github_app->applications; $settings = instanceSettings(); @@ -243,6 +251,7 @@ class Change extends Component 'github_app.client_secret' => 'required|string', 'github_app.webhook_secret' => 'required|string', 'github_app.is_system_wide' => 'required|bool', + 'github_app.private_key_id' => 'required|int', ]); $this->github_app->save(); $this->dispatch('success', 'Github App updated.'); @@ -251,6 +260,15 @@ class Change extends Component } } + public function createGithubAppManually() + { + $this->github_app->makeVisible('client_secret')->makeVisible('webhook_secret'); + $this->github_app->app_id = '1234567890'; + $this->github_app->installation_id = '1234567890'; + $this->github_app->save(); + $this->dispatch('success', 'Github App updated.'); + } + public function instantSave() { try { diff --git a/resources/views/livewire/source/github/change.blade.php b/resources/views/livewire/source/github/change.blade.php index 5a37fa47a..1b5493c58 100644 --- a/resources/views/livewire/source/github/change.blade.php +++ b/resources/views/livewire/source/github/change.blade.php @@ -27,6 +27,7 @@ confirmationText="{{ data_get($github_app, 'name') }}" :confirmWithPassword="false" step2ButtonText="Permanently Delete" /> @endif +
Your Private GitHub App for private repositories.
@@ -46,7 +47,7 @@
- + Sync Name @@ -57,7 +58,7 @@
-
@if (!isCloud()) @@ -68,27 +69,32 @@
@endif
- - + +
- @if ($github_app->html_url === 'https://github.com') - - - @else - - - @endif + +
- + + required />
- - - + + + +
+
+ + @if (blank($github_app->private_key_id)) + + @endif + @foreach ($privateKeys as $privateKey) + + @endforeach +

Permissions

@@ -182,120 +188,129 @@ shortConfirmationLabel="GitHub App Name" :confirmWithPassword="false" step2ButtonText="Permanently Delete" />
-
- - - - You must complete this step before you can use this source! -
-
-
- @if (!isCloud() || isDev()) -
- - @if ($ipv4) - - @endif - @if ($ipv6) - - @endif - @if ($fqdn) - - @endif - @if (config('app.url')) - - @endif - - - Register Now - -
- @else -
-

Register a GitHub App

- - Register Now - -
-
You need to register a GitHub App before using this source.
- @endif +
+

Manual Installation

+
+ If you want to fill the form manually, you can continue below. Only for advanced users. + + Continue + +
+

Automated Installation

+
+ + + + You must complete this step before you can use this source! +
+
+
+ @if (!isCloud() || isDev()) +
+ + @if ($ipv4) + + @endif + @if ($ipv6) + + @endif + @if ($fqdn) + + @endif + @if (config('app.url')) + + @endif + + + Register Now + +
+ @else +
+

Register a GitHub App

+ + Register Now + +
+
You need to register a GitHub App before using this source.
+ @endif -
- - - {{-- + + + {{-- --}} +
-
- + @endif