Skip to content

Commit fd61115

Browse files
committed
Added section to Advanced Config
1 parent 29a3c5a commit fd61115

File tree

5 files changed

+53
-5
lines changed

5 files changed

+53
-5
lines changed

resources/views/layouts/lang.blade.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,16 @@
22
<html lang="{{ config('advanced-config.lang') }}">
33
@else
44
<html lang="en">
5-
@endif
5+
@endif
6+
7+
8+
{{-- Redirects to https if enabled in the advanced-config --}}
9+
@if(config('advanced-config.redirect_https') == 'true')
10+
@php
11+
if (! isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] == 'off' ) {
12+
$redirect_url = "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
13+
header("Location: $redirect_url");
14+
exit();
15+
}
16+
@endphp
17+
@endif

resources/views/layouts/sidebar.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,8 @@ function getUrlSatusCodesb($urlsb, $timeoutsb = 3)
131131
@if(auth()->user()->role == 'admin')
132132
<ul class="list-unstyled components mb-5">
133133
<li class="active">
134-
<a href="#adminSubmenu" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle">Admin</a>
135-
<ul class="collapse list-unstyled" id="adminSubmenu">
134+
<a @if(config('advanced-config.expand_panel_admin_menu_permanently') != 'true') href="#adminSubmenu" data-toggle="collapse" aria-expanded="false" @endif class="dropdown-toggle">Admin</a>
135+
<ul class="@if(config('advanced-config.expand_panel_admin_menu_permanently') != 'true') collapse @endif list-unstyled" id="adminSubmenu">
136136
<li>
137137
<a href="{{ url('env-editor') }}">Config</a>
138138
</li>

resources/views/update.blade.php

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,28 @@
111111
if(EnvEditor::keyExists('CUSTOM_META_TAGS')){ /* Do nothing if key already exists */
112112
} else {EnvEditor::addKey('CUSTOM_META_TAGS', 'false');}
113113
114+
if (!config()->has('advanced-config.expand_panel_admin_menu_permanently') and !config()->has('advanced-config.redirect_https')) {
115+
116+
function getStringBetween($string, $start, $end) {
117+
$lastStartIndex = strrpos($string, $start);
118+
$lastEndIndex = strrpos($string, $end);
119+
120+
$substringStartIndex = $lastStartIndex + strlen($start);
121+
$substringSize = $lastStartIndex - $lastEndIndex - 1;
122+
123+
return substr($string, $substringStartIndex, $substringSize);
124+
}
125+
126+
$subject = file_get_contents('config/advanced-config.php');
127+
$search = ")";
128+
$replace = "),";
129+
130+
file_put_contents('config/advanced-config.php', str_replace('),,', '),', strrev(implode(strrev($replace), explode(strrev($search), strrev($subject), 2)))));
131+
132+
$replace = "];";
133+
file_put_contents('config/advanced-config.php', str_replace($replace, file_get_contents('storage/templates/advanced-config-update-1.php'), file_get_contents('config/advanced-config.php')));
134+
}
135+
114136
echo "<meta http-equiv=\"refresh\" content=\"0; " . url()->current() . "?success\" />";
115137
?>
116138
@endif

routes/web.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
Route::group([
6868
'middleware' => env('REGISTER_AUTH'),
6969
], function () {
70-
# URL::forceScheme('https'); # uncomment to force https
70+
if(config('advanced-config.redirect_https') == 'true'){URL::forceScheme('https');}
7171
Route::get('/studio/index', [UserController::class, 'index'])->name('studioIndex');
7272
Route::get('/studio/add-link', [UserController::class, 'showButtons'])->name('showButtons');
7373
Route::post('/studio/add-link', [UserController::class, 'addLink'])->name('addLink');
@@ -91,7 +91,7 @@
9191
Route::group([
9292
'middleware' => 'admin',
9393
], function () {
94-
# URL::forceScheme('https'); # uncomment to force https
94+
if(config('advanced-config.redirect_https') == 'true'){URL::forceScheme('https');}
9595
Route::get('/panel/index', [AdminController::class, 'index'])->name('panelIndex');
9696
Route::get('/panel/users/{type}', [AdminController::class, 'users'])->name('showUsers');
9797
Route::post('/panel/users/{name?}', [AdminController::class, 'searchUser'])->name('searchUser');
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
2+
3+
/*
4+
|--------------------------------------------------------------------------
5+
| Extra Settings
6+
|--------------------------------------------------------------------------
7+
|
8+
*/
9+
10+
'expand_panel_admin_menu_permanently' => 'false',
11+
12+
'redirect_https' => 'false',
13+
14+
];

0 commit comments

Comments
 (0)