Added section to Advanced Config

This commit is contained in:
Julian Prieber 2022-06-27 16:29:50 +02:00
parent 29a3c5ad2e
commit fd611155f9
5 changed files with 53 additions and 5 deletions

View File

@ -2,4 +2,16 @@
<html lang="{{ config('advanced-config.lang') }}"> <html lang="{{ config('advanced-config.lang') }}">
@else @else
<html lang="en"> <html lang="en">
@endif @endif
{{-- Redirects to https if enabled in the advanced-config --}}
@if(config('advanced-config.redirect_https') == 'true')
@php
if (! isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] == 'off' ) {
$redirect_url = "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
header("Location: $redirect_url");
exit();
}
@endphp
@endif

View File

@ -131,8 +131,8 @@ if($url1sb == '200' or $url2sb == '200') {
@if(auth()->user()->role == 'admin') @if(auth()->user()->role == 'admin')
<ul class="list-unstyled components mb-5"> <ul class="list-unstyled components mb-5">
<li class="active"> <li class="active">
<a href="#adminSubmenu" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle">Admin</a> <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>
<ul class="collapse list-unstyled" id="adminSubmenu"> <ul class="@if(config('advanced-config.expand_panel_admin_menu_permanently') != 'true') collapse @endif list-unstyled" id="adminSubmenu">
<li> <li>
<a href="{{ url('env-editor') }}">Config</a> <a href="{{ url('env-editor') }}">Config</a>
</li> </li>

View File

@ -111,6 +111,28 @@ exit(); ?>
if(EnvEditor::keyExists('CUSTOM_META_TAGS')){ /* Do nothing if key already exists */ if(EnvEditor::keyExists('CUSTOM_META_TAGS')){ /* Do nothing if key already exists */
} else {EnvEditor::addKey('CUSTOM_META_TAGS', 'false');} } else {EnvEditor::addKey('CUSTOM_META_TAGS', 'false');}
if (!config()->has('advanced-config.expand_panel_admin_menu_permanently') and !config()->has('advanced-config.redirect_https')) {
function getStringBetween($string, $start, $end) {
$lastStartIndex = strrpos($string, $start);
$lastEndIndex = strrpos($string, $end);
$substringStartIndex = $lastStartIndex + strlen($start);
$substringSize = $lastStartIndex - $lastEndIndex - 1;
return substr($string, $substringStartIndex, $substringSize);
}
$subject = file_get_contents('config/advanced-config.php');
$search = ")";
$replace = "),";
file_put_contents('config/advanced-config.php', str_replace('),,', '),', strrev(implode(strrev($replace), explode(strrev($search), strrev($subject), 2)))));
$replace = "];";
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')));
}
echo "<meta http-equiv=\"refresh\" content=\"0; " . url()->current() . "?success\" />"; echo "<meta http-equiv=\"refresh\" content=\"0; " . url()->current() . "?success\" />";
?> ?>
@endif @endif

View File

@ -67,7 +67,7 @@ Route::get('/theme/@{littlelink}', [UserController::class, 'theme'])->name('them
Route::group([ Route::group([
'middleware' => env('REGISTER_AUTH'), 'middleware' => env('REGISTER_AUTH'),
], function () { ], function () {
# URL::forceScheme('https'); # uncomment to force https if(config('advanced-config.redirect_https') == 'true'){URL::forceScheme('https');}
Route::get('/studio/index', [UserController::class, 'index'])->name('studioIndex'); Route::get('/studio/index', [UserController::class, 'index'])->name('studioIndex');
Route::get('/studio/add-link', [UserController::class, 'showButtons'])->name('showButtons'); Route::get('/studio/add-link', [UserController::class, 'showButtons'])->name('showButtons');
Route::post('/studio/add-link', [UserController::class, 'addLink'])->name('addLink'); Route::post('/studio/add-link', [UserController::class, 'addLink'])->name('addLink');
@ -91,7 +91,7 @@ Route::post('/studio/profile', [UserController::class, 'editProfile'])->name('ed
Route::group([ Route::group([
'middleware' => 'admin', 'middleware' => 'admin',
], function () { ], function () {
# URL::forceScheme('https'); # uncomment to force https if(config('advanced-config.redirect_https') == 'true'){URL::forceScheme('https');}
Route::get('/panel/index', [AdminController::class, 'index'])->name('panelIndex'); Route::get('/panel/index', [AdminController::class, 'index'])->name('panelIndex');
Route::get('/panel/users/{type}', [AdminController::class, 'users'])->name('showUsers'); Route::get('/panel/users/{type}', [AdminController::class, 'users'])->name('showUsers');
Route::post('/panel/users/{name?}', [AdminController::class, 'searchUser'])->name('searchUser'); Route::post('/panel/users/{name?}', [AdminController::class, 'searchUser'])->name('searchUser');

View File

@ -0,0 +1,14 @@
/*
|--------------------------------------------------------------------------
| Extra Settings
|--------------------------------------------------------------------------
|
*/
'expand_panel_admin_menu_permanently' => 'false',
'redirect_https' => 'false',
];