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
fix: public repo limit shown + branch should be preselected.
Andras Bacsaiba18c589f074
diff --git a/app/Http/Livewire/Project/New/PublicGitRepository.php b/app/Http/Livewire/Project/New/PublicGitRepository.phpindex 05793695e8..9e24ed56d0 100644--- a/app/Http/Livewire/Project/New/PublicGitRepository.php+++ b/app/Http/Livewire/Project/New/PublicGitRepository.php@@ -8,6 +8,7 @@ use App\Models\GitlabApp;use App\Models\Project;use App\Models\StandaloneDocker;use App\Models\SwarmDocker;+use Illuminate\Support\Facades\Log;use Livewire\Component;use Spatie\Url\Url;@@ -21,15 +22,17 @@ class PublicGitRepository extends Componentpublic $parameters;public $query;- public $branches = [];+ public bool $branch_found = false;public string $selected_branch = 'main';public bool $is_static = false;public string|null $publish_directory = null;+ public string $git_branch;+ public int $rate_limit_remaining = 0;+ public int $rate_limit_reset = 0;private GithubApp|GitlabApp $git_source;private string $git_host;private string $git_repository;- private string $git_branch;protected $rules = ['repository_url' => 'required|url',@@ -64,16 +67,17 @@ class PublicGitRepository extends Component}$this->emit('success', 'Application settings updated!');}- public function load_branches()+ public function load_branch(){+ $this->branch_found = false;$this->validate(['repository_url' => 'required|url']);$this->get_git_source();try {- ['data' => $data] = git_api(source: $this->git_source, endpoint: "/repos/{$this->git_repository}/branches");- $this->branches = collect($data)->pluck('name')->toArray();+ ['data' => $data, 'rate_limit_remaining' => $this->rate_limit_remaining, 'rate_limit_reset' => $this->rate_limit_reset] = git_api(source: $this->git_source, endpoint: "/repos/{$this->git_repository}/branches/{$this->git_branch}");+ $this->branch_found = true;} catch (\Throwable $e) {return general_error_handler(err: $e, that: $this);}diff --git a/bootstrap/helpers/github.php b/bootstrap/helpers/github.phpindex f282ee6f12..53a0f52fb5 100644--- a/bootstrap/helpers/github.php+++ b/bootstrap/helpers/github.php@@ -68,6 +68,7 @@ function git_api(GithubApp|GitlabApp $source, string $endpoint, string $method =}return ['rate_limit_remaining' => $response->header('X-RateLimit-Remaining'),+ 'rate_limit_reset' => $response->header('X-RateLimit-Reset'),'data' => collect($json)];}diff --git a/resources/views/livewire/project/new/public-git-repository.blade.php b/resources/views/livewire/project/new/public-git-repository.blade.phpindex 53ef8bbd08..63cfc0f54c 100644--- a/resources/views/livewire/project/new/public-git-repository.blade.php+++ b/resources/views/livewire/project/new/public-git-repository.blade.php@@ -5,21 +5,21 @@<div class="flex flex-col gap-2"><div class="flex flex-col"><div class="flex items-end gap-2">- <x-forms.input wire:keydown.enter='load_branches' id="repository_url" label="Repository URL"+ <x-forms.input wire:keydown.enter='load_branch' id="repository_url" label="Repository URL"helper="{!! __('repository.url') !!}" />- <x-forms.button wire:click.prevent="load_branches">+ <x-forms.button wire:click.prevent="load_branch">Check repository</x-forms.button></div>- @if (count($branches) > 0)+ @if ($branch_found)+ <div class="py-2">+ <div>Rate limit remaining: {{ $rate_limit_remaining }}</div>+ <div>Rate limit reset at: {{ date('Y-m-d H:i:s', substr($rate_limit_reset, 0, 10)) }}</div>+ </div><div class="flex flex-col gap-2 pb-6"><div class="flex gap-2">- <x-forms.select id="selected_branch" label="Branch">- <option value="default" disabled selected>Select a branch</option>- @foreach ($branches as $branch)- <option value="{{ $branch }}">{{ $branch }}</option>- @endforeach- </x-forms.select>+ <x-forms.input disabled id="git_branch" label="Selected branch"+ helper="You can select other branches after configuration is done." />@if ($is_static)<x-forms.input id="publish_directory" label="Publish Directory"helper="If there is a build process involved (like Svelte, React, Next, etc..), please specify the output directory for the build assets." />