Skip to content

Commit

Permalink
Show notice on System Status page is CloudFlare is used
Browse files Browse the repository at this point in the history
  • Loading branch information
freescout-help-desk committed Dec 13, 2023
1 parent 7908da3 commit 3d522c4
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/Misc/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -2097,4 +2097,18 @@ public static function setChatMode($is_on)
\Session::forget('chat_mode');
}
}

public static function detectCloudFlare()
{
if (!empty($_SERVER['HTTP_CF_IPCOUNTRY'])
|| !empty($_SERVER['HTTP_CF_CONNECTING_IP'])
|| !empty($_SERVER['HTTP_CF_VISITOR'])
|| !empty($_SERVER['HTTP_CF_RAY'])
|| ($_SERVER['HTTP_CDN_LOOP'] ?? '') == 'cloudflare'
) {
return true;
} else {
return false;
}
}
}
13 changes: 13 additions & 0 deletions resources/views/system/status.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,19 @@
<th>{{ __('Protocol') }}</th>
<td class="table-main-col" id="system-app-protocol"></td>
</tr>
@if (\Helper::detectCloudFlare())
@php
$cloudflare_is_used = config('app.cloudflare_is_used');
@endphp
<tr>
<th>Proxy</th>
<td class="table-main-col">
<div @if (!$cloudflare_is_used) class="alert alert-warning alert-narrow margin-bottom-0" @endif>
@if (!$cloudflare_is_used)<i class="glyphicon glyphicon-exclamation-sign"></i> @endif{{ 'CloudFlare' }} (<a href="https://github.com/freescout-helpdesk/freescout/wiki/Installation-Guide#103-cloudflare" target="_blank">{{ __('read more') }}</a>)
</div>
</td>
</tr>
@endif
{{--<tr>
<th>{{ __('.env file') }}</th>
<td class="table-main-col">
Expand Down

0 comments on commit 3d522c4

Please sign in to comment.