Added first setup page

This setup will:
1. Check the server dependencies
2. Setup the database
3. Create the admin user
4. Configure the app
This commit is contained in:
Julian Prieber 2022-11-23 15:52:33 +01:00
parent 292d37f280
commit 9b9593b98d
6 changed files with 588 additions and 24 deletions

0
INSTALLING Normal file
View File

View File

@ -0,0 +1,141 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Hash;
use Illuminate\Auth\Events\Registered;
use Illuminate\Support\Facades\Schema;
use Illuminate\Support\Facades\File;
use Illuminate\Support\Facades\DB;
use GeoSot\EnvEditor\Controllers\EnvController;
use GeoSot\EnvEditor\Exceptions\EnvException;
use GeoSot\EnvEditor\Helpers\EnvFileContentManager;
use GeoSot\EnvEditor\Helpers\EnvFilesManager;
use GeoSot\EnvEditor\Helpers\EnvKeysManager;
use GeoSot\EnvEditor\Facades\EnvEditor;
use GeoSot\EnvEditor\ServiceProvider;
use Auth;
use Exception;
use ZipArchive;
use Artisan;
use App\Models\User;
use App\Models\Admin;
use App\Models\Button;
use App\Models\Link;
use App\Models\Page;
class InstallerController extends Controller
{
public function showInstaller()
{
return view('installer/installer');
}
public function db(request $request)
{
if($request->database == 'MySQL'){
return redirect(url('?mysql'));
}else{
return redirect(url('?4'));
}
}
public function createAdmin(request $request)
{
$email = $request->email;
$password = $request->password;
if(DB::table('users')->count() == '0'){
Schema::disableForeignKeyConstraints();
DB::table('users')->delete();
DB::table('users')->truncate();
Schema::enableForeignKeyConstraints();
$user = User::create([
'name' => 'Admin',
'email' => $email,
'email_verified_at' => '0001-01-01 00:00:00',
'password' => Hash::make($password),
'littlelink_name' => 'admin',
'littlelink_description' => 'admin page',
'block' => 'no',
]);
User::where('id', '1')->update(['role' => 'admin']);
}
return redirect(url('?5'));
}
public function mysql(request $request)
{
$DB_CONNECTION = 'mysql';
$DB_HOST = $request->host;
$DB_PORT = $request->port;
$DB_DATABASE = $request->name;
$DB_USERNAME = $request->username;
$DB_PASSWORD = $request->password;
if(EnvEditor::keyExists('DB_CONNECTION')){EnvEditor::editKey('DB_CONNECTION', $DB_CONNECTION);}else{EnvEditor::addKey('DB_CONNECTION', $DB_CONNECTION);}
if(EnvEditor::keyExists('DB_HOST')){EnvEditor::editKey('DB_HOST', $DB_HOST);}else{EnvEditor::addKey('DB_HOST', $DB_HOST);}
if(EnvEditor::keyExists('DB_PORT')){EnvEditor::editKey('DB_PORT', $DB_PORT);}else{EnvEditor::addKey('DB_PORT', $DB_PORT);}
if(EnvEditor::keyExists('DB_DATABASE')){EnvEditor::editKey('DB_DATABASE', $DB_DATABASE);}else{EnvEditor::addKey('DB_DATABASE', $DB_DATABASE);}
if(EnvEditor::keyExists('DB_USERNAME')){EnvEditor::editKey('DB_USERNAME', $DB_USERNAME);}else{EnvEditor::addKey('DB_USERNAME', $DB_USERNAME);}
if(EnvEditor::keyExists('DB_PASSWORD')){EnvEditor::editKey('DB_PASSWORD', $DB_PASSWORD);}else{EnvEditor::addKey('DB_PASSWORD', $DB_PASSWORD);}
return redirect(url('mysql-test'));
}
public function mysqlTest(request $request)
{
try {Artisan::call('migrate');} catch (exception $e) {$failed = "true";}
try {Artisan::call('db:seed --force');} catch (exception $e) {$failed = "true";}
try {Artisan::call('db:seed --class="PageSeeder" --force');} catch (exception $e) {$failed = "true";}
try {Artisan::call('db:seed --class="ButtonSeeder" --force');} catch (exception $e) {$failed = "true";}
try {$users = DB::table('buttons')->count(); $failed = false;} catch (exception $e) {$failed = true;}
if($failed == true){
if(EnvEditor::keyExists('DB_CONNECTION')){EnvEditor::editKey('DB_CONNECTION', 'sqlite');}else{EnvEditor::addKey('DB_CONNECTION', 'sqlite');}
if(EnvEditor::keyExists('DB_HOST')){EnvEditor::deleteKey('DB_HOST');}
if(EnvEditor::keyExists('DB_PORT')){EnvEditor::deleteKey('DB_PORT');}
if(EnvEditor::keyExists('DB_DATABASE')){EnvEditor::deleteKey('DB_DATABASE');}
if(EnvEditor::keyExists('DB_USERNAME')){EnvEditor::deleteKey('DB_USERNAME');}
if(EnvEditor::keyExists('DB_PASSWORD')){EnvEditor::deleteKey('DB_PASSWORD');}
return redirect(url('?error'));
}else{
return redirect(url('?4'));
}
}
public function options(request $request)
{
$user = User::find(1);
$llName = $user->littlelink_name;
if($request->register == 'Yes'){$register = "true";}else{$register = "false";}
Page::first()->update(['register' => $register]);
if($request->verify == 'Yes'){$value = "verified";}else{$value = "auth";}
if(EnvEditor::keyExists('REGISTER_AUTH')){EnvEditor::editKey('REGISTER_AUTH', $value);}
if($request->page == 'No'){$value = "";}else{$value = '"' . $llName . '"';}
if(EnvEditor::keyExists('HOME_URL')){EnvEditor::editKey('HOME_URL', $value);}
if(EnvEditor::keyExists('APP_NAME')){EnvEditor::editKey('APP_NAME', '"' . $request->app . '"');}
if(file_exists(base_path("INSTALLING"))){unlink(base_path("INSTALLING"));}
return redirect(url(''));
}
}

38
composer.lock generated
View File

@ -2878,25 +2878,25 @@
},
{
"name": "nette/schema",
"version": "v1.2.2",
"version": "v1.2.3",
"source": {
"type": "git",
"url": "https://github.com/nette/schema.git",
"reference": "9a39cef03a5b34c7de64f551538cbba05c2be5df"
"reference": "abbdbb70e0245d5f3bf77874cea1dfb0c930d06f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nette/schema/zipball/9a39cef03a5b34c7de64f551538cbba05c2be5df",
"reference": "9a39cef03a5b34c7de64f551538cbba05c2be5df",
"url": "https://api.github.com/repos/nette/schema/zipball/abbdbb70e0245d5f3bf77874cea1dfb0c930d06f",
"reference": "abbdbb70e0245d5f3bf77874cea1dfb0c930d06f",
"shasum": ""
},
"require": {
"nette/utils": "^2.5.7 || ^3.1.5 || ^4.0",
"php": ">=7.1 <8.2"
"php": ">=7.1 <8.3"
},
"require-dev": {
"nette/tester": "^2.3 || ^2.4",
"phpstan/phpstan-nette": "^0.12",
"phpstan/phpstan-nette": "^1.0",
"tracy/tracy": "^2.7"
},
"type": "library",
@ -2934,9 +2934,9 @@
],
"support": {
"issues": "https://github.com/nette/schema/issues",
"source": "https://github.com/nette/schema/tree/v1.2.2"
"source": "https://github.com/nette/schema/tree/v1.2.3"
},
"time": "2021-10-15T11:40:02+00:00"
"time": "2022-10-13T01:24:26+00:00"
},
{
"name": "nette/utils",
@ -7866,16 +7866,16 @@
},
{
"name": "laravel/sail",
"version": "v1.16.2",
"version": "v1.16.3",
"source": {
"type": "git",
"url": "https://github.com/laravel/sail.git",
"reference": "7d1ed5f856ec8b9708712e3fc0708fcabe114659"
"reference": "0dbee8802e17911afbe29a8506316343829b056e"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/laravel/sail/zipball/7d1ed5f856ec8b9708712e3fc0708fcabe114659",
"reference": "7d1ed5f856ec8b9708712e3fc0708fcabe114659",
"url": "https://api.github.com/repos/laravel/sail/zipball/0dbee8802e17911afbe29a8506316343829b056e",
"reference": "0dbee8802e17911afbe29a8506316343829b056e",
"shasum": ""
},
"require": {
@ -7922,7 +7922,7 @@
"issues": "https://github.com/laravel/sail/issues",
"source": "https://github.com/laravel/sail"
},
"time": "2022-09-28T13:13:22+00:00"
"time": "2022-11-21T16:19:18+00:00"
},
{
"name": "mockery/mockery",
@ -8363,16 +8363,16 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "9.2.18",
"version": "9.2.19",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a"
"reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/12fddc491826940cf9b7e88ad9664cf51f0f6d0a",
"reference": "12fddc491826940cf9b7e88ad9664cf51f0f6d0a",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/c77b56b63e3d2031bd8997fcec43c1925ae46559",
"reference": "c77b56b63e3d2031bd8997fcec43c1925ae46559",
"shasum": ""
},
"require": {
@ -8428,7 +8428,7 @@
],
"support": {
"issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.18"
"source": "https://github.com/sebastianbergmann/php-code-coverage/tree/9.2.19"
},
"funding": [
{
@ -8436,7 +8436,7 @@
"type": "github"
}
],
"time": "2022-10-27T13:35:33+00:00"
"time": "2022-11-18T07:47:47+00:00"
},
{
"name": "phpunit/php-file-iterator",

View File

@ -0,0 +1,201 @@
@extends('layouts.installing')
@Push('installer-body')
<div class="container">
@if($_SERVER['QUERY_STRING'] === '')
{{-- Landing page --}}
<div class="logo-container fadein">
<img class="logo-img" src="{{ asset('littlelink/images/logo.svg') }}" alt="Logo">
</div>
<h1>Setup LittleLink Custom</h1>
<p class="inst-txt">
<div class="left-txt glass-container">
Welcome to the setup for LittleLink Custom<br><br>
<b>This setup will:</b><br>
1. Check the server dependencies<br>
2. Setup the database<br>
3. Create the admin user<br>
4. Configure the app<br>
</div></p>
<div class="row">
&ensp;<a class="btn" href="{{url('?2')}}"><button>Next</button></a>&ensp;
</div>
@endif
@if($_SERVER['QUERY_STRING'] === 'error')
{{-- Landing page --}}
<div class="logo-container fadein">
<img class="logo-img" src="{{ asset('littlelink/images/logo.svg') }}" alt="Logo">
</div>
<h1>Setup failed</h1>
<p class="inst-txt">An error has occured. Please try again.</p>
<div class="row">
&ensp;<a class="btn" href="{{url('')}}"><button>Try again</button></a>&ensp;
</div>
@endif
@if($_SERVER['QUERY_STRING'] === '2')
{{-- Landing page --}}
<div class="logo-container fadein">
<img class="logo-img" src="{{ asset('littlelink/images/logo.svg') }}" alt="Logo">
</div>
<h1>Dependency check</h1>
<p class="inst-txt">Required PHP modules:</p>
<div class="left-txt glass-container">
<table style="width:115%">
<style>.bi-x-lg{color:tomato}</style>
<tr><td>BCMath: </td><td>@if(extension_loaded('bcmath'))<i class="bi bi-check-lg"></i>@else<i class="bi bi-x-lg"></i>@endif</td></tr>
<tr><td>Ctype: </td><td>@if(extension_loaded('Ctype'))<i class="bi bi-check-lg"></i>@else<i class="bi bi-x-lg"></i>@endif</td></tr>
<tr><td>cURL: </td><td>@if(extension_loaded('cURL'))<i class="bi bi-check-lg"></i>@else<i class="bi bi-x-lg"></i>@endif</td></tr>
<tr><td>DOM: </td><td>@if(extension_loaded('DOM'))<i class="bi bi-check-lg"></i>@else<i class="bi bi-x-lg"></i>@endif</td></tr>
<tr><td>Fileinfo: </td><td>@if(extension_loaded('Fileinfo'))<i class="bi bi-check-lg"></i>@else<i class="bi bi-x-lg"></i>@endif</td></tr>
<tr><td>JSON: </td><td>@if(extension_loaded('JSON'))<i class="bi bi-check-lg"></i>@else<i class="bi bi-x-lg"></i>@endif</td></tr>
<tr><td>Mbstring: </td><td>@if(extension_loaded('Mbstring'))<i class="bi bi-check-lg"></i>@else<i class="bi bi-x-lg"></i>@endif</td></tr>
<tr><td>OpenSSL: </td><td>@if(extension_loaded('OpenSSL'))<i class="bi bi-check-lg"></i>@else<i class="bi bi-x-lg"></i>@endif</td></tr>
<tr><td>PCRE: </td><td>@if(extension_loaded('PCRE'))<i class="bi bi-check-lg"></i>@else<i class="bi bi-x-lg"></i>@endif</td></tr>
<tr><td>PDO: </td><td>@if(extension_loaded('PDO'))<i class="bi bi-check-lg"></i>@else<i class="bi bi-x-lg"></i>@endif</td></tr>
<tr><td>Tokenizer: </td><td>@if(extension_loaded('Tokenizer'))<i class="bi bi-check-lg"></i>@else<i class="bi bi-x-lg"></i>@endif</td></tr>
<tr><td>XML: </td><td>@if(extension_loaded('XML'))<i class="bi bi-check-lg"></i>@else<i class="bi bi-x-lg"></i>@endif</td></tr>
</table>
<br>
<b style="font-size:90%;margin-bottom:5px;display:flex;">Depending on your database type:</b>
<table style="width:123%">
<tr><td>SQLite: </td><td>@if(extension_loaded('PDO_SQLite'))<i class="bi bi-check-lg"></i>@else<i class="bi bi-x-lg"></i>@endif</td></tr>
<tr><td>MySQL: </td><td>@if(extension_loaded('PDO_MySQL'))<i class="bi bi-check-lg"></i>@else<i class="bi bi-x-lg"></i>@endif</td></tr>
</table>
</div><br>
<div class="row">
&ensp;<a class="btn" href="?3"><button>Next</button></a>&ensp;
</div>
@endif
@if($_SERVER['QUERY_STRING'] === '3')
{{-- Landing page --}}
<div class="logo-container fadein">
<img class="logo-img" src="{{ asset('littlelink/images/logo.svg') }}" alt="Logo">
</div>
<h1>Setup LittleLink Custom</h1>
<p class="inst-txt">Select a database type</p>
<p>Under most circumstances, we recommend using SQLite.<br>MySQL requires a separate, empty MySQL database.</p><br>
<form id="home-url-form" action="{{route('db')}}" enctype="multipart/form-data" method="post">
<div class="form-group col-lg-8">
<div class="input-group">
<label>Database type:</label>
<select style="max-width:300px" class="form-control" name="database">
<option>SQLite</option>
<option>MySQL</option>
</select>
</div></div><br><br>
<input type="hidden" name="_token" value="{{csrf_token()}}">
<button type="submit" class="mt-3 ml-3 btn btn-info">Next</button>
</form>
@endif
@if($_SERVER['QUERY_STRING'] === 'mysql')
{{-- Landing page --}}
<div class="logo-container fadein">
<img class="logo-img" src="{{ asset('littlelink/images/logo.svg') }}" alt="Logo">
</div>
<h1>Setup LittleLink Custom</h1>
<p class="inst-txt">MySQL</p>
<form id="home-url-form" action="{{route('mysql')}}" enctype="multipart/form-data" method="post">
<div class="form-group col-lg-8">
<label>Database host:</label>
<input style="max-width:275px;" class="form-control" name="host" type="text" required>
<label>Database port:</label>
<input style="max-width:275px;" class="form-control" name="port" type="text" required>
<label>Database name:</label>
<input style="max-width:275px;" class="form-control" name="name" type="text" required>
<label>Database username:</label>
<input style="max-width:275px;" class="form-control" name="username" type="text" required>
<label>Database password:</label>
<input style="max-width:275px;" class="form-control" name="password" type="password" />
<div class="input-group">
</div></div><br>
<input type="hidden" name="_token" value="{{csrf_token()}}">
<button type="submit" class="mt-3 ml-3 btn btn-info">Next</button>
</form>
<div class="row">
</div>
@endif
@if($_SERVER['QUERY_STRING'] === '4')
{{-- Landing page --}}
<div class="logo-container fadein">
<img class="logo-img" src="{{ asset('littlelink/images/logo.svg') }}" alt="Logo">
</div>
<h1>Setup LittleLink Custom</h1>
<p class="inst-txt">Create an admin account.</p>
<form id="home-url-form" action="{{route('createAdmin')}}" enctype="multipart/form-data" method="post">
<div class="form-group col-lg-8">
<label>Admin email:</label>
<input style="max-width:275px;" class="form-control" placeholder="admin@admin.com" name="email" type="email" required>
<label>Admin password:</label>
<input style="max-width:275px;" class="form-control" placeholder="12345678" name="password" type="password" required>
<div class="input-group">
</div></div><br>
<input type="hidden" name="_token" value="{{csrf_token()}}">
<button type="submit" class="mt-3 ml-3 btn btn-info">Next</button>
</form>
@endif
@if($_SERVER['QUERY_STRING'] === '5')
{{-- Landing page --}}
<div class="logo-container fadein">
<img class="logo-img" src="{{ asset('littlelink/images/logo.svg') }}" alt="Logo">
</div>
<h1>Setup LittleLink Custom</h1>
<p class="inst-txt">Configure your page</p>
<form id="home-url-form" action="{{route('options')}}" enctype="multipart/form-data" method="post">
<div class="form-group col-lg-8">
<div class="input-group">
<label>Enable registration:</label>
<select style="max-width:300px" class="form-control" name="register">
<option>Yes</option>
<option>No</option>
</select>
<label>Enable email verification:</label>
<select style="max-width:300px" class="form-control" name="verify">
<option>Yes</option>
<option>No</option>
</select>
<label>Set your page as Home Page</label>
<select style="max-width:300px" class="form-control" name="page">
<option>No</option>
<option>Yes</option>
</select>
<label>App Name:</label>
<input style="max-width:275px;" class="form-control" value="LittleLink Custom" name="app" type="text" required>
</div></div><br>
<input type="hidden" name="_token" value="{{csrf_token()}}">
<button type="submit" class="mt-3 ml-3 btn btn-info">Finish setup</button>
</form>
@endif
</div>
@endpush

View File

@ -0,0 +1,207 @@
<!DOCTYPE html>
@include('layouts.lang')
<head>
<meta charset="utf-8">
@include('layouts.analytics')
<meta name="viewport" content="width=device-width, initial-scale=1">
@stack('installer-head')
<title>LittleLink Custom setup</title>
<link href="//fonts.bunny.net/css?family=Open+Sans:400,600,800&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.8.1/font/bootstrap-icons.css">
<link rel="stylesheet" href="{{ asset('littlelink/css/normalize.css') }}">
<link rel="stylesheet" href="{{ asset('littlelink/css/brands.css') }}">
<link rel="stylesheet" href="{{ asset('littlelink/css/hover-min.css') }}">
<link rel="stylesheet" href="{{ asset('littlelink/css/animate.css') }}">
@if(file_exists(base_path("littlelink/images/avatar.png" )))
<link rel="icon" type="image/png" href="{{ asset('littlelink/images/avatar.png') }}">
@else
<link rel="icon" type="image/svg+xml" href="{{ asset('littlelink/images/logo.svg') }}">
@endif
{{-- custom font for logo text --}}
<style>@font-face{font-family:'ll';src:url({{ asset('littlelink/fonts/littlelink-custom.otf') }}) format("opentype")}</style>
<?php // override dark/light mode if override cookie is set
$color_scheme_override = isset($_COOKIE["color_scheme_override"]) ? $_COOKIE["color_scheme_override"] : false; ?>
@if ($color_scheme_override == 'dark')
<link rel="stylesheet" href="{{ asset('littlelink/css/skeleton-dark.css') }}">
@elseif ($color_scheme_override == 'light')
<link rel="stylesheet" href="{{ asset('littlelink/css/skeleton-light.css') }}">
@elseif (config('advanced-config.theme') == 'dark')
<link rel="stylesheet" href="{{ asset('littlelink/css/skeleton-dark.css') }}">
@elseif (config('advanced-config.theme') == 'light')
<link rel="stylesheet" href="{{ asset('littlelink/css/skeleton-light.css') }}">
@else
<link rel="stylesheet" href="{{ asset('littlelink/css/skeleton-auto.css') }}">
@endif
<style>
html,
body {
height: 100%;
width: 100%;
}
h1 {
font-size: 30px;
margin-bottom: -20px;
font-weight: 700;
}
.inst-txt {
font-size: 15px;
margin-bottom: 50px;
display: flex;
}
.left-txt {
display: inline;
text-align: left;
}
.left-txt p {
margin-bottom: 0px !important;
}
.container {
align-items: center;
display: flex;
flex-direction: column;
justify-content: center;
height: 100%;
width: 100%;
}
@media (min-width:700px) {
.row {
display: flex;
flex-direction: row;
}
}
.logo-centered {
/* top: 44vh; */
font-size: 130px;
}
.logo-img{
/* position: relative; */
width: 150px;
height: auto;
}
.loading {
animation: loading 3s linear infinite;
}
@keyframes loading {
from {
transform: rotate(0deg);
}
to {
transform: rotate(359deg);
}
}
.generic {
margin: auto;
width: 2.5em;
height: 2.5em;
border: 0.4em solid transparent;
border-color: #eee;
border-top-color: #333;
border-radius: 50%;
animation: loadingspin 1s linear infinite;
}
@keyframes loadingspin {
100% {
transform: rotate(360deg)
}
}
.loadingtxt:after {
content: '.';
animation: dots 1.5s steps(5, end) infinite;}
@keyframes dots {
0%, 20% {
color: rgba(0,0,0,0);
text-shadow:
.25em 0 0 rgba(0,0,0,0),
.5em 0 0 rgba(0,0,0,0);}
40% {
color: white;
text-shadow:
.25em 0 0 rgba(0,0,0,0),
.5em 0 0 rgba(0,0,0,0);}
60% {
text-shadow:
.25em 0 0 white,
.5em 0 0 rgba(0,0,0,0);}
80%, 100% {
text-shadow:
.25em 0 0 white,
.5em 0 0 white;}}
button {
border-style: none;
background-color: #0085ff;
}
button:hover {
background-color: #0065c1;
color: #FFF;
box-shadow: 0 10px 20px -10px rgba(0,0,0, 0.6);
}
.btn {
color: #FFF !important;
}
.form-control {
display: block;
width: 100%;
height: calc(1.5em + 0.75rem + 2px);
padding: 0.375rem 0.75rem;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
color: #495057;
background-color: #fff;
background-clip: padding-box;
border: 1px solid #ced4da;
border-radius: 0.25rem;
-webkit-transition: border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;
transition: border-color 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;
-o-transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out, -webkit-box-shadow 0.15s ease-in-out;
}
.glass-container{
display: block;
padding: 10px;
background-color: rgba(0,0,0,.3);
color: #fff;
text-align: left;
border-radius: 3px;
cursor: default;
padding: 25px;
}
</style>
</head>
<body>
@stack('installer-body')
</body>
</html>

View File

@ -7,6 +7,7 @@ use App\Http\Controllers\UserController;
use App\Http\Controllers\Auth\SocialLoginController;
use App\Http\Controllers\LinkTypeViewController;
use App\Http\Controllers\PagesController;
use App\Http\Controllers\InstallerController;
/*
|--------------------------------------------------------------------------
@ -21,12 +22,24 @@ use App\Http\Controllers\PagesController;
// Prevents section below from being run by 'composer update'
if(file_exists(base_path('storage/app/ISINSTALLED'))){
// generates new APP KEY if no one is set
if(EnvEditor::getKey('APP_KEY')==''){Artisan::call('key:generate');}
// generates new APP KEY if no one is set
if(EnvEditor::getKey('APP_KEY')==''){Artisan::call('key:generate');}
// copies template meta config if none is present
if(!file_exists(base_path("config/advanced-config.php"))){copy(base_path('storage/templates/advanced-config.php'), base_path('config/advanced-config.php'));}
}
// copies template meta config if none is present
if(!file_exists(base_path("config/advanced-config.php"))){copy(base_path('storage/templates/advanced-config.php'), base_path('config/advanced-config.php'));}
}
// Installer
if(file_exists(base_path('INSTALLING'))){
Route::get('/', [InstallerController::class, 'showInstaller'])->name('showInstaller');
Route::post('/create-admin', [InstallerController::class, 'createAdmin'])->name('createAdmin');
Route::post('/db', [InstallerController::class, 'db'])->name('db');
Route::post('/mysql', [InstallerController::class, 'mysql'])->name('mysql');
Route::post('/options', [InstallerController::class, 'options'])->name('options');
Route::get('/mysql-test', [InstallerController::class, 'mysqlTest'])->name('mysqlTest');
}else{
// Disables routes if in Maintenance Mode
if(env('MAINTENANCE_MODE') != 'true' and !file_exists(base_path("storage/MAINTENANCE"))){
@ -189,4 +202,6 @@ Route::get('/{any}', function () {
})->where('any', '.*');
}
}
require __DIR__.'/auth.php';