Added HTTPS redirection to env config
This commit is contained in:
parent
64c1fafeb0
commit
0df539c261
2
.env
2
.env
|
@ -75,3 +75,5 @@ SKIP_UPDATE_BACKUP=false
|
|||
#=CUSTOM_META_TAGS either true or false. Used to enable setting in advanced config file (config/advanced-config.php).
|
||||
#=You can read more about this config at https://llc.bio/advanced-config.
|
||||
CUSTOM_META_TAGS=false
|
||||
|
||||
FORCE_HTTPS=true
|
|
@ -0,0 +1,39 @@
|
|||
<?php
|
||||
|
||||
//run before finishing:
|
||||
if(EnvEditor::keyExists('JOIN_BETA')){ /* Do nothing if key already exists */
|
||||
} else { EnvEditor::addKey('JOIN_BETA', 'false');} // Adds key to .env file
|
||||
|
||||
if(EnvEditor::keyExists('SKIP_UPDATE_BACKUP')){ /* Do nothing if key already exists */
|
||||
} else { EnvEditor::addKey('SKIP_UPDATE_BACKUP', 'false');} // Adds key to .env file
|
||||
|
||||
if(EnvEditor::keyExists('CUSTOM_META_TAGS')){ /* Do nothing if key already exists */
|
||||
} else {EnvEditor::addKey('CUSTOM_META_TAGS', 'false');}
|
||||
|
||||
if (!config()->has('advanced-config.expand_panel_admin_menu_permanently') and !config()->has('disable_default_password_notice')) {
|
||||
|
||||
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')));
|
||||
}
|
||||
|
||||
if(EnvEditor::keyExists('FORCE_HTTPS')){ /* Do nothing if key already exists */
|
||||
} else {EnvEditor::addKey('FORCE_HTTPS', 'false');}
|
||||
|
||||
echo "<meta http-equiv=\"refresh\" content=\"0; " . url()->current() . "?success\" />";
|
||||
?>
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
|
||||
{{-- Redirects to https if enabled in the advanced-config --}}
|
||||
@if(config('advanced-config.redirect_https') == 'true')
|
||||
@if(env('FORCE_HTTPS') == 'true')
|
||||
@php
|
||||
if (! isset($_SERVER['HTTPS']) or $_SERVER['HTTPS'] == 'off' ) {
|
||||
$redirect_url = "https://" . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
|
||||
|
|
|
@ -99,42 +99,7 @@ exit(); ?>
|
|||
</div>
|
||||
<h1 class="loadingtxt">Finishing up</h1>
|
||||
|
||||
<?php
|
||||
|
||||
//run before finishing:
|
||||
if(EnvEditor::keyExists('JOIN_BETA')){ /* Do nothing if key already exists */
|
||||
} else { EnvEditor::addKey('JOIN_BETA', 'false');} // Adds key to .env file
|
||||
|
||||
if(EnvEditor::keyExists('SKIP_UPDATE_BACKUP')){ /* Do nothing if key already exists */
|
||||
} else { EnvEditor::addKey('SKIP_UPDATE_BACKUP', 'false');} // Adds key to .env file
|
||||
|
||||
if(EnvEditor::keyExists('CUSTOM_META_TAGS')){ /* Do nothing if key already exists */
|
||||
} 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\" />";
|
||||
?>
|
||||
@include('components.finishing')
|
||||
@endif
|
||||
|
||||
@if($_SERVER['QUERY_STRING'] === 'success')
|
||||
|
|
|
@ -67,7 +67,7 @@ Route::get('/theme/@{littlelink}', [UserController::class, 'theme'])->name('them
|
|||
Route::group([
|
||||
'middleware' => env('REGISTER_AUTH'),
|
||||
], function () {
|
||||
if(config('advanced-config.redirect_https') == 'true'){URL::forceScheme('https');}
|
||||
if(env('FORCE_HTTPS') == 'true'){URL::forceScheme('https');}
|
||||
Route::get('/studio/index', [UserController::class, 'index'])->name('studioIndex');
|
||||
Route::get('/studio/add-link', [UserController::class, 'showButtons'])->name('showButtons');
|
||||
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([
|
||||
'middleware' => 'admin',
|
||||
], function () {
|
||||
if(config('advanced-config.redirect_https') == 'true'){URL::forceScheme('https');}
|
||||
if(env('FORCE_HTTPS') == 'true'){URL::forceScheme('https');}
|
||||
Route::get('/panel/index', [AdminController::class, 'index'])->name('panelIndex');
|
||||
Route::get('/panel/users/{type}', [AdminController::class, 'users'])->name('showUsers');
|
||||
Route::post('/panel/users/{name?}', [AdminController::class, 'searchUser'])->name('searchUser');
|
||||
|
|
|
@ -75,3 +75,5 @@ SKIP_UPDATE_BACKUP=false
|
|||
#=CUSTOM_META_TAGS either true or false. Used to enable setting in advanced config file (config/advanced-config.php).
|
||||
#=You can read more about this config at https://llc.bio/advanced-config.
|
||||
CUSTOM_META_TAGS=false
|
||||
|
||||
FORCE_HTTPS=false
|
|
@ -9,8 +9,6 @@
|
|||
|
||||
'expand_panel_admin_menu_permanently' => 'false',
|
||||
|
||||
'redirect_https' => 'false',
|
||||
|
||||
'disable_default_password_notice' => 'false',
|
||||
|
||||
];
|
Loading…
Reference in New Issue