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.
PHP coolifydatabasesdeploymentdockerdocker-composeinertiajslaravelmariadbmysqlnextjsnodejsphppostgresredisself-hostedself-hostingserverstatic-sitesveltesvelte5
wip
Andras Bacsaiec3fe284b682
diff --git a/app/Http/Livewire/Source/Github/Change.php b/app/Http/Livewire/Source/Github/Change.phpindex 7cf1ed5382..53d5f374ca 100644--- a/app/Http/Livewire/Source/Github/Change.php+++ b/app/Http/Livewire/Source/Github/Change.php@@ -55,7 +55,6 @@ class Change extends Component$this->host = $settings->fqdn;}$this->parameters = getParameters();- $this->github_app = GithubApp::where('uuid', $this->parameters['github_app_uuid'])->first();$this->is_system_wide = $this->github_app->is_system_wide;}public function createGithubApp()diff --git a/app/Models/GithubApp.php b/app/Models/GithubApp.phpindex 918beb53d4..e8f25a96a1 100644--- a/app/Models/GithubApp.php+++ b/app/Models/GithubApp.php@@ -22,6 +22,6 @@ class GithubApp extends BaseModel}static public function private(){- return GithubApp::where('team_id', session('currentTeam')->id)->where('is_public', false)->get();+ return GithubApp::where('team_id', session('currentTeam')->id)->where('is_public', false)->whereNotNull('app_id')->whereNotNull('installation_id')->get();}}diff --git a/resources/views/components/layout.blade.php b/resources/views/components/layout.blade.phpindex 8e6787fbe6..cd9f8b5323 100644--- a/resources/views/components/layout.blade.php+++ b/resources/views/components/layout.blade.php@@ -21,6 +21,8 @@</head><body>+ @livewireScripts+@auth<x-navbar />@endauth@@ -28,7 +30,6 @@{{ $slot }}</main>- @livewireScripts@auth<script>function checkIfIamDead() {@@ -80,6 +81,7 @@})</script>@endauth+</body></html>diff --git a/resources/views/livewire/source/github/change.blade.php b/resources/views/livewire/source/github/change.blade.phpindex 2d50714fe8..652efd8f38 100644--- a/resources/views/livewire/source/github/change.blade.php+++ b/resources/views/livewire/source/github/change.blade.php@@ -23,22 +23,9 @@@else<div class="py-2"><x-inputs.button type="submit">Save</x-inputs.button>-</div>@endif</form>- <form x-data="ContactForm()" @submit.prevent="submitForm">- <x-inputs.input id="host" noLabel />- <button type="submit">Create GitHub Application</button>- </form>- <script>- function ContactForm() {- return {- host: "",- submitForm() {- console.log(JSON.stringify(this.host));- },- };- }- </script>++</div>diff --git a/resources/views/source/github/show.blade.php b/resources/views/source/github/show.blade.phpindex 0af07010fd..7c6e8d992f 100644--- a/resources/views/source/github/show.blade.php+++ b/resources/views/source/github/show.blade.php@@ -1,4 +1,53 @@<x-layout><h1>GitHub App</h1>- <livewire:source.github.change :host="$host" />+ <livewire:source.github.change :github_app="$github_app" />+ <form x-data>+ <x-inputs.button x-on:click.prevent="createGithubApp">Create GitHub Application</x-inputs.button>+ </form>+ <script>+ function createGithubApp() {+ const {+ organization,+ uuid,+ html_url+ } = @json($github_app);+ const host = @js($host);+ const name = @js($name);+ let url = 'settings/apps/new';+ if (organization) {+ organization = `'organizations/${organization}/settings/apps/new`;+ }+ const data = {+ name,+ url: host,+ hook_attributes: {+ url: `${host}/webhooks/github/events`+ },+ redirect_url: `${host}/webhooks/github`,+ callback_urls: [`${host}/login/github/app`],+ public: false,+ request_oauth_on_install: false,+ setup_url: `${host}/webhooks/github/install?source=${uuid}`,+ setup_on_update: true,+ default_permissions: {+ contents: 'read',+ metadata: 'read',+ pull_requests: 'read',+ emails: 'read'+ },+ default_events: ['pull_request', 'push']+ };+ const form = document.createElement('form');+ form.setAttribute('method', 'post');+ form.setAttribute('action', `${html_url}/${url}?state=${uuid}`);+ const input = document.createElement('input');+ input.setAttribute('id', 'manifest');+ input.setAttribute('name', 'manifest');+ input.setAttribute('type', 'hidden');+ input.setAttribute('value', data);+ form.appendChild(input);+ document.getElementsByTagName('body')[0].appendChild(form);+ form.submit();+ }+ </script></x-layout>diff --git a/routes/web.php b/routes/web.phpindex 6909cd74d6..bc697d1aa4 100644--- a/routes/web.php+++ b/routes/web.php@@ -13,6 +13,7 @@ use App\Models\Project;use App\Models\Server;use Illuminate\Http\Request;use Illuminate\Support\Facades\Route;+use Illuminate\Support\Str;/*|--------------------------------------------------------------------------@@ -84,7 +85,17 @@ Route::middleware(['auth'])->group(function () {Route::middleware(['auth'])->group(function () {Route::get('/source/new', fn () => view('source.new'))->name('source.new');Route::get('/source/github/{github_app_uuid}', function (Request $request) {- return view('source.github.show', ['host' => $request->schemeAndHttpHost()]);+ $settings = InstanceSettings::first();+ $host = $request->schemeAndHttpHost();+ if ($settings->fqdn) {+ $host = $settings->fqdn;+ }+ $github_app = GithubApp::where('uuid', request()->github_app_uuid)->first();+ return view('source.github.show', [+ 'github_app' => $github_app,+ 'host' => $host,+ 'name' => Str::kebab('coolify' . $github_app->name)+ ]);})->name('source.github.show');});Route::middleware(['auth'])->group(function () {