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: master is the default, not main
Andras Bacsai6c955424cde6
diff --git a/app/Http/Livewire/Project/New/PublicGitRepository.php b/app/Http/Livewire/Project/New/PublicGitRepository.phpindex 9e24ed56d0..1b4a3462dd 100644--- a/app/Http/Livewire/Project/New/PublicGitRepository.php+++ b/app/Http/Livewire/Project/New/PublicGitRepository.php@@ -8,7 +8,7 @@ use App\Models\GitlabApp;use App\Models\Project;use App\Models\StandaloneDocker;use App\Models\SwarmDocker;-use Illuminate\Support\Facades\Log;+use Carbon\Carbon;use Livewire\Component;use Spatie\Url\Url;@@ -26,9 +26,9 @@ class PublicGitRepository extends Componentpublic string $selected_branch = 'main';public bool $is_static = false;public string|null $publish_directory = null;- public string $git_branch;+ public string $git_branch = 'main';public int $rate_limit_remaining = 0;- public int $rate_limit_reset = 0;+ public $rate_limit_reset = 0;private GithubApp|GitlabApp $git_source;private string $git_host;@@ -67,6 +67,12 @@ class PublicGitRepository extends Component}$this->emit('success', 'Application settings updated!');}+ private function get_branch()+ {+ ['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->rate_limit_reset = Carbon::parse((int)$this->rate_limit_reset)->format('Y-M-d H:i:s.u');+ $this->branch_found = true;+ }public function load_branch(){$this->branch_found = false;@@ -74,12 +80,18 @@ class PublicGitRepository extends Component'repository_url' => 'required|url']);$this->get_git_source();-try {- ['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);+ $this->get_branch();+ } catch (\Exception $e) {+ }++ if (!$this->branch_found && $this->git_branch == 'main') {+ try {+ $this->git_branch = 'master';+ $this->get_branch();+ } catch (\Exception $e) {+ return general_error_handler(err: $e, that: $this);+ }}}private function get_git_source()diff --git a/bootstrap/helpers/github.php b/bootstrap/helpers/github.phpindex 4e4fdd7fc2..8d18e62906 100644--- a/bootstrap/helpers/github.php+++ b/bootstrap/helpers/github.php@@ -2,6 +2,7 @@use App\Models\GithubApp;use App\Models\GitlabApp;+use Carbon\Carbon;use Illuminate\Support\Str;use Illuminate\Support\Facades\Http;use Lcobucci\JWT\Encoding\ChainedFormatter;@@ -64,7 +65,7 @@ function git_api(GithubApp|GitlabApp $source, string $endpoint, string $method =}$json = $response->json();if ($response->failed() && $throwError) {- throw new \Exception("Failed to get data from {$source->name} with error:<br><br>" . $json['message']);+ throw new \Exception("Failed to get data from {$source->name} with error:<br><br>" . $json['message'] . "<br><br>Rate Limit resets at: " . Carbon::parse((int)$response->header('X-RateLimit-Reset'))->format('Y-m-d H:i:s') . 'UTC');}return ['rate_limit_remaining' => $response->header('X-RateLimit-Remaining'),diff --git a/resources/views/livewire/project/new/public-git-repository.blade.php b/resources/views/livewire/project/new/public-git-repository.blade.phpindex 63cfc0f54c..21af86a2e0 100644--- a/resources/views/livewire/project/new/public-git-repository.blade.php+++ b/resources/views/livewire/project/new/public-git-repository.blade.php@@ -14,7 +14,7 @@@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>Rate limit reset at: {{ $rate_limit_reset }}</div></div><div class="flex flex-col gap-2 pb-6"><div class="flex gap-2">