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

Andras Bacsai2c9c9a86f48e
diff --git a/app/Http/Livewire/Source/Github/Change.php b/app/Http/Livewire/Source/Github/Change.php
index 9fd00d84b7..161073b81e 100644
--- a/app/Http/Livewire/Source/Github/Change.php
+++ b/app/Http/Livewire/Source/Github/Change.php
@@ -12,6 +12,10 @@ class Change extends Component
public string|null $ipv4;
public string|null $ipv6;
public string|null $fqdn;
+
+ public bool|null $default_permissions = true;
+ public bool|null $preview_deployment_permissions = true;
+
public $parameters;
public GithubApp $github_app;
public string $name;
@@ -48,13 +52,6 @@ class Change extends Component
}
public function instantSave()
{
- try {
- $this->github_app->is_system_wide = $this->is_system_wide;
- $this->github_app->save();
- $this->emit('saved', 'GitHub settings updated!');
- } catch (\Exception $e) {
- return general_error_handler(err: $e, that: $this);
- }
}
public function delete()
diff --git a/resources/views/components/forms/checkbox.blade.php b/resources/views/components/forms/checkbox.blade.php
index 86e61c7262..15bc107246 100644
--- a/resources/views/components/forms/checkbox.blade.php
+++ b/resources/views/components/forms/checkbox.blade.php
@@ -8,7 +8,7 @@
'noDirty' => $attributes->has('noDirty'),
'disabled' => null,
])
-<label {{ $attributes->merge(['class' => 'flex cursor-pointer w-64 label']) }}>
+<div {{ $attributes->merge(['class' => 'flex cursor-pointer w-96 label']) }}>
<div class="flex gap-1 label-text">
@if ($label)
{{ $label }}
@@ -16,7 +16,7 @@
{{ $id }}
@endif
@if ($helper)
- <div class="group">
+ <div class="group w-fit">
<div class="cursor-pointer text-warning">
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24"
class="w-4 h-4 stroke-current">
@@ -36,4 +36,4 @@
<input type="checkbox" @if ($disabled !== null) disabled @endif name={{ $id }}
@if (!$noDirty) wire:dirty.class="input-warning" @endif
@if ($instantSave) wire:click='instantSave' wire:model.defer={{ $id }} @else wire:model.defer={{ $value ?? $id }} @endif />
-</label>
+</div>
diff --git a/resources/views/livewire/source/github/change.blade.php b/resources/views/livewire/source/github/change.blade.php
index 1007772791..e9986b4d9f 100644
--- a/resources/views/livewire/source/github/change.blade.php
+++ b/resources/views/livewire/source/github/change.blade.php
@@ -62,26 +62,43 @@
helper="If checked, this GitHub App will be available for everyone in this Coolify instance."
instantSave id="is_system_wide" />
@else
- <div class="text-sm ">You need to register a GitHub App before using this source.</div>
- <div class="flex items-end gap-4 pt-2 pb-10">
- <form class="flex gap-2">
- <x-forms.select wire:model='webhook_endpoint' label="Webhook Endpoint"
- helper="All Git webhooks will be sent to this endpoint. <br><br>If you would like to use domain instead of IP address, set your Coolify instance's FQDN in the Settings menu.">
- @if ($ipv4)
- <option value="{{ $ipv4 }}">Use {{ $ipv4 }}</option>
- @endif
- @if ($ipv6)
- <option value="{{ $ipv6 }}">Use {{ $ipv6 }}</option>
- @endif
- @if ($fqdn)
- <option value="{{ $fqdn }}">Use {{ $fqdn }}</option>
- @endif
- </x-forms.select>
- <x-forms.button x-on:click.prevent="createGithubApp('{{ $webhook_endpoint }}')">Register a GitHub
+ <form class="flex gap-4">
+ <div class="flex items-end gap-2">
+ <h3>Register a GitHub App</h3>
+ <x-forms.button
+ x-on:click.prevent="createGithubApp('{{ $webhook_endpoint }}','{{ $preview_deployment_permissions }}')">
+ Register a
+ GitHub
Application
</x-forms.button>
- </form>
- </div>
+ </div>
+ <div class="pt-1 pb-2 text-sm">You need to register a GitHub App before using this source.</div>
+ <div class="pt-2 pb-10">
+ <div class="flex items-end gap-2">
+ <x-forms.select wire:model='webhook_endpoint' label="Webhook Endpoint"
+ helper="All Git webhooks will be sent to this endpoint. <br><br>If you would like to use domain instead of IP address, set your Coolify instance's FQDN in the Settings menu.">
+ @if ($ipv4)
+ <option value="{{ $ipv4 }}">Use {{ $ipv4 }}</option>
+ @endif
+ @if ($ipv6)
+ <option value="{{ $ipv6 }}">Use {{ $ipv6 }}</option>
+ @endif
+ @if ($fqdn)
+ <option value="{{ $fqdn }}">Use {{ $fqdn }}</option>
+ @endif
+ </x-forms.select>
+
+
+ </div>
+ <div class="flex flex-col gap-2 pt-4">
+ <x-forms.checkbox disabled instantSave id="default_permissions" label="Default Permissions"
+ helper="Contents: read<br>Metadata: read<br>Email: read" />
+ <x-forms.checkbox instantSave id="preview_deployment_permissions"
+ label="Preview Deployments Permission"
+ helper="Necessary for updating pull requests with useful comments (deployment status, links, etc.)<br><br>Pull Request: read & write" />
+ </div>
+ </div>
+ </form>
<div class="flex gap-2">
<x-forms.input id="github_app.name" label="App Name" disabled />
<x-forms.input id="github_app.organization" label="Organization"
@@ -102,9 +119,9 @@
</div>
<x-forms.checkbox
helper="If checked, this GitHub App will be available for everyone in this Coolify instance." noDirty
- label="System Wide?" instantSave disabled id="is_system_wide" />
+ label="System Wide?" disabled id="is_system_wide" />
<script>
- function createGithubApp(webhook_endpoint) {
+ function createGithubApp(webhook_endpoint, preview_deployment_permissions) {
const {
organization,
uuid,
@@ -119,6 +136,14 @@
}
const webhookBaseUrl = `${baseUrl}/webhooks`;
const path = organization ? `organizations/${organization}/settings/apps/new` : 'settings/apps/new';
+ const default_permissions = {
+ contents: 'read',
+ metadata: 'read',
+ emails: 'read'
+ };
+ if (preview_deployment_permissions) {
+ default_permissions.pull_requests = 'write';
+ }
const data = {
name,
url: baseUrl,
@@ -132,12 +157,7 @@
request_oauth_on_install: false,
setup_url: `${webhookBaseUrl}/source/github/install?source=${uuid}`,
setup_on_update: true,
- default_permissions: {
- contents: 'read',
- metadata: 'read',
- pull_requests: 'write',
- emails: 'read'
- },
+ default_permissions,
default_events: ['pull_request', 'push']
};
const form = document.createElement('form');