@@ -25,11 +25,11 @@ class PublicGitRepository extends Component
25
25
26
26
public $ query ;
27
27
28
- public bool $ branch_found = false ;
28
+ public bool $ branchFound = false ;
29
29
30
- public string $ selected_branch = 'main ' ;
30
+ public string $ selectedBranch = 'main ' ;
31
31
32
- public bool $ is_static = false ;
32
+ public bool $ isStatic = false ;
33
33
34
34
public ?string $ publish_directory = null ;
35
35
@@ -62,7 +62,7 @@ class PublicGitRepository extends Component
62
62
protected $ rules = [
63
63
'repository_url ' => 'required|url ' ,
64
64
'port ' => 'required|numeric ' ,
65
- 'is_static ' => 'required|boolean ' ,
65
+ 'isStatic ' => 'required|boolean ' ,
66
66
'publish_directory ' => 'nullable|string ' ,
67
67
'build_pack ' => 'required|string ' ,
68
68
'base_directory ' => 'nullable|string ' ,
@@ -72,7 +72,7 @@ class PublicGitRepository extends Component
72
72
protected $ validationAttributes = [
73
73
'repository_url ' => 'repository ' ,
74
74
'port ' => 'port ' ,
75
- 'is_static ' => 'static ' ,
75
+ 'isStatic ' => 'static ' ,
76
76
'publish_directory ' => 'publish directory ' ,
77
77
'build_pack ' => 'build pack ' ,
78
78
'base_directory ' => 'base directory ' ,
@@ -106,17 +106,17 @@ public function updatedBuildPack()
106
106
$ this ->port = 3000 ;
107
107
} elseif ($ this ->build_pack === 'static ' ) {
108
108
$ this ->show_is_static = false ;
109
- $ this ->is_static = false ;
109
+ $ this ->isStatic = false ;
110
110
$ this ->port = 80 ;
111
111
} else {
112
112
$ this ->show_is_static = false ;
113
- $ this ->is_static = false ;
113
+ $ this ->isStatic = false ;
114
114
}
115
115
}
116
116
117
117
public function instantSave ()
118
118
{
119
- if ($ this ->is_static ) {
119
+ if ($ this ->isStatic ) {
120
120
$ this ->port = 80 ;
121
121
$ this ->publish_directory = '/dist ' ;
122
122
} else {
@@ -126,12 +126,7 @@ public function instantSave()
126
126
$ this ->dispatch ('success ' , 'Application settings updated! ' );
127
127
}
128
128
129
- public function load_any_git ()
130
- {
131
- $ this ->branch_found = true ;
132
- }
133
-
134
- public function load_branch ()
129
+ public function loadBranch ()
135
130
{
136
131
try {
137
132
if (str ($ this ->repository_url )->startsWith ('git@ ' )) {
@@ -155,15 +150,15 @@ public function load_branch()
155
150
return handleError ($ e , $ this );
156
151
}
157
152
try {
158
- $ this ->branch_found = false ;
159
- $ this ->get_git_source ();
160
- $ this ->get_branch ();
161
- $ this ->selected_branch = $ this ->git_branch ;
153
+ $ this ->branchFound = false ;
154
+ $ this ->getGitSource ();
155
+ $ this ->getBranch ();
156
+ $ this ->selectedBranch = $ this ->git_branch ;
162
157
} catch (\Throwable $ e ) {
163
- if (! $ this ->branch_found && $ this ->git_branch == 'main ' ) {
158
+ if (! $ this ->branchFound && $ this ->git_branch == 'main ' ) {
164
159
try {
165
160
$ this ->git_branch = 'master ' ;
166
- $ this ->get_branch ();
161
+ $ this ->getBranch ();
167
162
} catch (\Throwable $ e ) {
168
163
return handleError ($ e , $ this );
169
164
}
@@ -173,13 +168,16 @@ public function load_branch()
173
168
}
174
169
}
175
170
176
- private function get_git_source ()
171
+ private function getGitSource ()
177
172
{
178
173
$ this ->repository_url_parsed = Url::fromString ($ this ->repository_url );
179
174
$ this ->git_host = $ this ->repository_url_parsed ->getHost ();
180
175
$ this ->git_repository = $ this ->repository_url_parsed ->getSegment (1 ).'/ ' .$ this ->repository_url_parsed ->getSegment (2 );
181
- $ this ->git_branch = $ this ->repository_url_parsed ->getSegment (4 ) ?? 'main ' ;
182
-
176
+ if ($ this ->repository_url_parsed ->getSegment (3 ) === 'tree ' ) {
177
+ $ this ->git_branch = str ($ this ->repository_url_parsed ->getPath ())->after ('tree/ ' )->value ();
178
+ } else {
179
+ $ this ->git_branch = 'main ' ;
180
+ }
183
181
if ($ this ->git_host == 'github.com ' ) {
184
182
$ this ->git_source = GithubApp::where ('name ' , 'Public GitHub ' )->first ();
185
183
@@ -189,17 +187,17 @@ private function get_git_source()
189
187
$ this ->git_source = 'other ' ;
190
188
}
191
189
192
- private function get_branch ()
190
+ private function getBranch ()
193
191
{
194
192
if ($ this ->git_source === 'other ' ) {
195
- $ this ->branch_found = true ;
193
+ $ this ->branchFound = true ;
196
194
197
195
return ;
198
196
}
199
197
if ($ this ->git_source ->getMorphClass () === 'App\Models\GithubApp ' ) {
200
198
['rate_limit_remaining ' => $ this ->rate_limit_remaining , 'rate_limit_reset ' => $ this ->rate_limit_reset ] = githubApi (source: $ this ->git_source , endpoint: "/repos/ {$ this ->git_repository }/branches/ {$ this ->git_branch }" );
201
199
$ this ->rate_limit_reset = Carbon::parse ((int ) $ this ->rate_limit_reset )->format ('Y-M-d H:i:s ' );
202
- $ this ->branch_found = true ;
200
+ $ this ->branchFound = true ;
203
201
}
204
202
}
205
203
@@ -287,7 +285,7 @@ public function submit()
287
285
}
288
286
$ application = Application::create ($ application_init );
289
287
290
- $ application ->settings ->is_static = $ this ->is_static ;
288
+ $ application ->settings ->is_static = $ this ->isStatic ;
291
289
$ application ->settings ->save ();
292
290
293
291
$ fqdn = generateFqdn ($ destination ->server , $ application ->uuid );
0 commit comments