Merge pull request #2821 from coollabsio/next

v4.0.0-beta.313
This commit is contained in:
Andras Bacsai 2024-07-12 15:46:08 +02:00 committed by GitHub
commit 6ada6d145c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
22 changed files with 36 additions and 36 deletions

View File

@ -65,7 +65,7 @@ public function register(): void
if ($e instanceof RuntimeException) { if ($e instanceof RuntimeException) {
return; return;
} }
$this->settings = view()->shared('instanceSettings'); $this->settings = \App\Models\InstanceSettings::get();
if ($this->settings->do_not_track) { if ($this->settings->do_not_track) {
return; return;
} }

View File

@ -84,7 +84,7 @@ public function enable_api(Request $request)
if ($teamId !== '0') { if ($teamId !== '0') {
return response()->json(['message' => 'You are not allowed to enable the API.'], 403); return response()->json(['message' => 'You are not allowed to enable the API.'], 403);
} }
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
$settings->update(['is_api_enabled' => true]); $settings->update(['is_api_enabled' => true]);
return response()->json(['message' => 'API enabled.'], 200); return response()->json(['message' => 'API enabled.'], 200);
@ -135,7 +135,7 @@ public function disable_api(Request $request)
if ($teamId !== '0') { if ($teamId !== '0') {
return response()->json(['message' => 'You are not allowed to disable the API.'], 403); return response()->json(['message' => 'You are not allowed to disable the API.'], 403);
} }
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
$settings->update(['is_api_enabled' => false]); $settings->update(['is_api_enabled' => false]);
return response()->json(['message' => 'API disabled.'], 200); return response()->json(['message' => 'API disabled.'], 200);

View File

@ -300,7 +300,7 @@ public function domains_by_server(Request $request)
$projects = Project::where('team_id', $teamId)->get(); $projects = Project::where('team_id', $teamId)->get();
$domains = collect(); $domains = collect();
$applications = $projects->pluck('applications')->flatten(); $applications = $projects->pluck('applications')->flatten();
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
if ($applications->count() > 0) { if ($applications->count() > 0) {
foreach ($applications as $application) { foreach ($applications as $application) {
$ip = $application->destination->server->ip; $ip = $application->destination->server->ip;

View File

@ -14,7 +14,7 @@ public function handle(Request $request, Closure $next): Response
if (isCloud()) { if (isCloud()) {
return $next($request); return $next($request);
} }
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
if ($settings->is_api_enabled === false) { if ($settings->is_api_enabled === false) {
return response()->json(['success' => true, 'message' => 'API is disabled.'], 403); return response()->json(['success' => true, 'message' => 'API is disabled.'], 403);
} }

View File

@ -35,7 +35,7 @@ public function handle(): void
$latest_version = get_latest_version_of_coolify(); $latest_version = get_latest_version_of_coolify();
instant_remote_process(["docker pull -q ghcr.io/coollabsio/coolify:{$latest_version}"], $server, false); instant_remote_process(["docker pull -q ghcr.io/coollabsio/coolify:{$latest_version}"], $server, false);
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
$current_version = config('version'); $current_version = config('version');
if (! $settings->is_auto_update_enabled) { if (! $settings->is_auto_update_enabled) {
return; return;

View File

@ -47,7 +47,7 @@ public function submit()
] ]
); );
$mail->subject("[HELP]: {$this->subject}"); $mail->subject("[HELP]: {$this->subject}");
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
$type = set_transanctional_email_settings($settings); $type = set_transanctional_email_settings($settings);
if (! $type) { if (! $type) {
$url = 'https://app.coolify.io/api/feedback'; $url = 'https://app.coolify.io/api/feedback';

View File

@ -172,7 +172,7 @@ public function submitResend()
public function copyFromInstanceSettings() public function copyFromInstanceSettings()
{ {
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
if ($settings->smtp_enabled) { if ($settings->smtp_enabled) {
$team = currentTeam(); $team = currentTeam();
$team->update([ $team->update([

View File

@ -18,7 +18,7 @@ class Index extends Component
public function mount() public function mount()
{ {
if (isInstanceAdmin()) { if (isInstanceAdmin()) {
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
$database = StandalonePostgresql::whereName('coolify-db')->first(); $database = StandalonePostgresql::whereName('coolify-db')->first();
$s3s = S3Storage::whereTeamId(0)->get() ?? []; $s3s = S3Storage::whereTeamId(0)->get() ?? [];
if ($database) { if ($database) {

View File

@ -29,7 +29,7 @@ public function mount()
abort(404); abort(404);
} }
$this->instance_id = config('app.id'); $this->instance_id = config('app.id');
$this->settings = view()->shared('instanceSettings'); $this->settings = \App\Models\InstanceSettings::get();
} }
public function render() public function render()

View File

@ -99,7 +99,7 @@ public function mount()
return redirect()->route('source.all'); return redirect()->route('source.all');
} }
$this->applications = $this->github_app->applications; $this->applications = $this->github_app->applications;
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
$this->github_app->makeVisible('client_secret')->makeVisible('webhook_secret'); $this->github_app->makeVisible('client_secret')->makeVisible('webhook_secret');
$this->name = str($this->github_app->name)->kebab(); $this->name = str($this->github_app->name)->kebab();

View File

@ -23,7 +23,7 @@ public function mount()
if (data_get(currentTeam(), 'subscription') && isSubscriptionActive()) { if (data_get(currentTeam(), 'subscription') && isSubscriptionActive()) {
return redirect()->route('subscription.show'); return redirect()->route('subscription.show');
} }
$this->settings = view()->shared('instanceSettings'); $this->settings = \App\Models\InstanceSettings::get();
$this->alreadySubscribed = currentTeam()->subscription()->exists(); $this->alreadySubscribed = currentTeam()->subscription()->exists();
} }

View File

@ -318,7 +318,7 @@ public function setupDefault404Redirect()
public function setupDynamicProxyConfiguration() public function setupDynamicProxyConfiguration()
{ {
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
$dynamic_config_path = $this->proxyPath().'/dynamic'; $dynamic_config_path = $this->proxyPath().'/dynamic';
if ($this->proxyType() === 'TRAEFIK_V2') { if ($this->proxyType() === 'TRAEFIK_V2') {
$file = "$dynamic_config_path/coolify.yaml"; $file = "$dynamic_config_path/coolify.yaml";

View File

@ -13,7 +13,7 @@ class TransactionalEmailChannel
{ {
public function send(User $notifiable, Notification $notification): void public function send(User $notifiable, Notification $notification): void
{ {
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
if (! data_get($settings, 'smtp_enabled') && ! data_get($settings, 'resend_enabled')) { if (! data_get($settings, 'smtp_enabled') && ! data_get($settings, 'resend_enabled')) {
Log::info('SMTP/Resend not enabled'); Log::info('SMTP/Resend not enabled');

View File

@ -18,7 +18,7 @@ class ResetPassword extends Notification
public function __construct($token) public function __construct($token)
{ {
$this->settings = view()->shared('instanceSettings'); $this->settings = \App\Models\InstanceSettings::get();
$this->token = $token; $this->token = $token;
} }

View File

@ -30,9 +30,9 @@ public function boot(): void
])->baseUrl($api_url); ])->baseUrl($api_url);
} }
}); });
if (! env('CI')) { // if (! env('CI')) {
View::share('instanceSettings', InstanceSettings::get()); // View::share('instanceSettings', InstanceSettings::get());
} // }
} }
} }

View File

@ -44,7 +44,7 @@ public function boot(): void
{ {
Fortify::createUsersUsing(CreateNewUser::class); Fortify::createUsersUsing(CreateNewUser::class);
Fortify::registerView(function () { Fortify::registerView(function () {
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
if (! $settings->is_registration_enabled) { if (! $settings->is_registration_enabled) {
return redirect()->route('login'); return redirect()->route('login');
} }
@ -56,7 +56,7 @@ public function boot(): void
}); });
Fortify::loginView(function () { Fortify::loginView(function () {
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
$enabled_oauth_providers = OauthSetting::where('enabled', true)->get(); $enabled_oauth_providers = OauthSetting::where('enabled', true)->get();
$users = User::count(); $users = User::count();
if ($users == 0) { if ($users == 0) {

View File

@ -244,13 +244,13 @@ function generate_application_name(string $git_repository, string $git_branch, ?
function is_transactional_emails_active(): bool function is_transactional_emails_active(): bool
{ {
return isEmailEnabled(view()->shared('instanceSettings')); return isEmailEnabled(\App\Models\InstanceSettings::get());
} }
function set_transanctional_email_settings(?InstanceSettings $settings = null): ?string function set_transanctional_email_settings(?InstanceSettings $settings = null): ?string
{ {
if (! $settings) { if (! $settings) {
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
} }
config()->set('mail.from.address', data_get($settings, 'smtp_from_address')); config()->set('mail.from.address', data_get($settings, 'smtp_from_address'));
config()->set('mail.from.name', data_get($settings, 'smtp_from_name')); config()->set('mail.from.name', data_get($settings, 'smtp_from_name'));
@ -284,7 +284,7 @@ function base_ip(): string
if (isDev()) { if (isDev()) {
return 'localhost'; return 'localhost';
} }
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
if ($settings->public_ipv4) { if ($settings->public_ipv4) {
return "$settings->public_ipv4"; return "$settings->public_ipv4";
} }
@ -312,7 +312,7 @@ function getFqdnWithoutPort(string $fqdn)
*/ */
function base_url(bool $withPort = true): string function base_url(bool $withPort = true): string
{ {
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
if ($settings->fqdn) { if ($settings->fqdn) {
return $settings->fqdn; return $settings->fqdn;
} }
@ -379,7 +379,7 @@ function send_internal_notification(string $message): void
} }
function send_user_an_email(MailMessage $mail, string $email, ?string $cc = null): void function send_user_an_email(MailMessage $mail, string $email, ?string $cc = null): void
{ {
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
$type = set_transanctional_email_settings($settings); $type = set_transanctional_email_settings($settings);
if (! $type) { if (! $type) {
throw new Exception('No email settings found.'); throw new Exception('No email settings found.');
@ -2258,7 +2258,7 @@ function validate_dns_entry(string $fqdn, Server $server)
if (str($host)->contains('sslip.io')) { if (str($host)->contains('sslip.io')) {
return true; return true;
} }
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
$is_dns_validation_enabled = data_get($settings, 'is_dns_validation_enabled'); $is_dns_validation_enabled = data_get($settings, 'is_dns_validation_enabled');
if (! $is_dns_validation_enabled) { if (! $is_dns_validation_enabled) {
return true; return true;
@ -2378,7 +2378,7 @@ function checkIfDomainIsAlreadyUsed(Collection|array $domains, ?string $teamId =
if ($domainFound) { if ($domainFound) {
return true; return true;
} }
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
if (data_get($settings, 'fqdn')) { if (data_get($settings, 'fqdn')) {
$domain = data_get($settings, 'fqdn'); $domain = data_get($settings, 'fqdn');
if (str($domain)->endsWith('/')) { if (str($domain)->endsWith('/')) {
@ -2450,7 +2450,7 @@ function check_domain_usage(ServiceApplication|Application|null $resource = null
} }
} }
if ($resource) { if ($resource) {
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
if (data_get($settings, 'fqdn')) { if (data_get($settings, 'fqdn')) {
$domain = data_get($settings, 'fqdn'); $domain = data_get($settings, 'fqdn');
if (str($domain)->endsWith('/')) { if (str($domain)->endsWith('/')) {
@ -2525,7 +2525,7 @@ function get_public_ips()
{ {
try { try {
echo "Refreshing public ips!\n"; echo "Refreshing public ips!\n";
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
[$first, $second] = Process::concurrently(function (Pool $pool) { [$first, $second] = Process::concurrently(function (Pool $pool) {
$pool->path(__DIR__)->command('curl -4s https://ifconfig.io'); $pool->path(__DIR__)->command('curl -4s https://ifconfig.io');
$pool->path(__DIR__)->command('curl -6s https://ifconfig.io'); $pool->path(__DIR__)->command('curl -6s https://ifconfig.io');

View File

@ -7,7 +7,7 @@
// The release version of your application // The release version of your application
// Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD')) // Example with dynamic git hash: trim(exec('git --git-dir ' . base_path('.git') . ' log --pretty="%h" -n1 HEAD'))
'release' => '4.0.0-beta.312', 'release' => '4.0.0-beta.313',
// When left empty or `null` the Laravel environment will be used // When left empty or `null` the Laravel environment will be used
'environment' => config('app.env'), 'environment' => config('app.env'),

View File

@ -1,3 +1,3 @@
<?php <?php
return '4.0.0-beta.312'; return '4.0.0-beta.313';

View File

@ -27,14 +27,14 @@ public function run(): void
$ipv4 = Process::run('curl -4s https://ifconfig.io')->output(); $ipv4 = Process::run('curl -4s https://ifconfig.io')->output();
$ipv4 = trim($ipv4); $ipv4 = trim($ipv4);
$ipv4 = filter_var($ipv4, FILTER_VALIDATE_IP); $ipv4 = filter_var($ipv4, FILTER_VALIDATE_IP);
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
if (is_null($settings->public_ipv4) && $ipv4) { if (is_null($settings->public_ipv4) && $ipv4) {
$settings->update(['public_ipv4' => $ipv4]); $settings->update(['public_ipv4' => $ipv4]);
} }
$ipv6 = Process::run('curl -6s https://ifconfig.io')->output(); $ipv6 = Process::run('curl -6s https://ifconfig.io')->output();
$ipv6 = trim($ipv6); $ipv6 = trim($ipv6);
$ipv6 = filter_var($ipv6, FILTER_VALIDATE_IP); $ipv6 = filter_var($ipv6, FILTER_VALIDATE_IP);
$settings = view()->shared('instanceSettings'); $settings = \App\Models\InstanceSettings::get();
if (is_null($settings->public_ipv6) && $ipv6) { if (is_null($settings->public_ipv6) && $ipv6) {
$settings->update(['public_ipv6' => $ipv6]); $settings->update(['public_ipv6' => $ipv6]);
} }

View File

@ -8,7 +8,7 @@
@use('App\Models\InstanceSettings') @use('App\Models\InstanceSettings')
@php @php
$instanceSettings = view()->shared('instanceSettings'); $instanceSettings = \App\Models\InstanceSettings::get();
$name = null; $name = null;
if ($instanceSettings) { if ($instanceSettings) {

View File

@ -1,7 +1,7 @@
{ {
"coolify": { "coolify": {
"v4": { "v4": {
"version": "4.0.0-beta.312" "version": "4.0.0-beta.313"
} }
} }
} }