Skip to content

Commit

Permalink
Welcome Page + PHP 8 by default + JWT Logic + Other Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
andreapollastri committed Dec 11, 2021
1 parent f355bf3 commit f28371c
Show file tree
Hide file tree
Showing 14 changed files with 124 additions and 21 deletions.
17 changes: 17 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

(no unreleased versions)

## [3.1.8] - 2021-12-11

### Added
- Configurable users and db/path naming prefix
- Selective Dashboard login check

### Fixed
- JWT Key Logic
- PHP 8.0 by default (not 8.1) because WP is not ready to it
- Main welcome page Fix
- Client welcome page Fix
- New Sites Welcome Page
- New Login Page

### Removed
- Mobile App link into sidebar

## [3.1.7] - 2021-12-10

### Added
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/SiteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ public function create(Request $request)
$site->domain = strtolower($request->domain);
$site->php = $php;
$site->basepath = $request->basepath;
$site->username = 'cp'.hash('crc32', (Str::uuid()->toString())).rand(1, 9);
$site->username = config('cipi.users_prefix').hash('crc32', (Str::uuid()->toString())).rand(1, 9);
$site->password = Str::random(24);
$site->database = Str::random(24);
$site->deploy = ' ';
Expand Down
15 changes: 8 additions & 7 deletions config/cipi.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,26 @@

return [

//Panel Credential
// Panel Credential
'username' => env('CIPI_USERNAME', 'administrator'),
'password' => env('CIPI_PASSWORD', '12345678'),

//JWT Settings
'jwt_secret' => env('JWT_SECRET', config('app.key')),
// JWT Settings
'jwt_secret' => env('JWT_SECRET', env('APP_KEY')),
'jwt_access' => env('JWT_ACCESS', 900),
'jwt_refresh' => env('JWT_REFRESH', 7200),

//Branding
// Custom Vars
'name' => env('CIPI_NAME', 'Cipi Control Panel'),
'website' => env('CIPI_WEBSITE', 'https://cipi.sh'),
'background' => env('CIPI_BACKGROUNG', 'login'),
'activesetupcount' => env('CIPI_ACTIVESETUPCOUNT', 'https://service.cipi.sh/setupcount'),
'documentation' => env('CIPI_DOCUMENTATION', 'https://cipi.sh/docs.html'),
'app' => env('CIPI_APP', 'https://play.google.com/store/apps/details?id=it.christiangiupponi.cipi'),

//Global Settings
// Global Settings
'users_prefix' => env('CIPI_USERS_PREFIX', 'cp'),
'phpvers' => ['8.1','8.0','7.4'],
'services' => ['nginx','php','mysql','redis','supervisor'],
'default_php' => '8.1',
'default_php' => '8.0',

];
3 changes: 2 additions & 1 deletion go.sh
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ echo "PHP CLI configuration..."
echo "${reset}"
sleep 1s

sudo update-alternatives --set php /usr/bin/php8.1
sudo update-alternatives --set php /usr/bin/php8.0



Expand Down Expand Up @@ -678,6 +678,7 @@ echo " MySQL root user: cipi"
echo " MySQL root pass: $DBPASS"
echo ""
echo " To manage your server visit: http://$IP"
echo " and click on 'dashboard' button."
echo " Default credentials are: administrator / 12345678"
echo ""
echo "***********************************************************"
Expand Down
Binary file removed public/assets/bg/login.jpg
Binary file not shown.
Binary file modified public/favicon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 1 addition & 3 deletions resources/views/login.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,7 @@
<link href="/assets/css/app.css" rel="stylesheet" />
<style>
.auth-bg {
background-image: url("/assets/bg/{{ config('cipi.background') }}.jpg");
background-size: cover;
background-position: bottom;
background: #212529;
}
</style>
</head>
Expand Down
4 changes: 0 additions & 4 deletions resources/views/template.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,6 @@
<div class="sb-nav-link-icon"><i class="fas fa-fw fa-cog"></i></div>
{{ __('cipi.sidebar_menu.settings') }}
</a>
<a class="nav-link" href="{{ config('cipi.app') }}" target="_blank">
<div class="sb-nav-link-icon"><i class="fas fa-fw fa-mobile-alt"></i></div>
{{ __('cipi.sidebar_menu.app') }}
</a>
<a class="nav-link" href="#" id="logout">
<div class="sb-nav-link-icon"><i class="fas fa-fw fa-sign-out-alt"></i></div>
{{ __('cipi.sidebar_menu.logout') }}
Expand Down
85 changes: 85 additions & 0 deletions resources/views/welcome.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
<!DOCTYPE html>
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">

<title>{{ config('cipi.name') }}</title>

<!-- Fonts -->
<link href="https://fonts.googleapis.com/css2?family=Nunito:wght@200;600&display=swap" rel="stylesheet">

<!-- Styles -->
<style>
html, body {
background: #212529;
color: #636b6f;
font-family: 'Nunito', sans-serif;
font-weight: 200;
height: 100vh;
margin: 0;
}
.full-height {
height: 100vh;
}
.flex-center {
align-items: center;
display: flex;
justify-content: center;
}
.position-ref {
position: relative;
}
.top-right {
position: absolute;
right: 10px;
top: 18px;
}
.content {
text-align: center;
}
.title {
font-size: 64px;
}
.links > a {
color: #636b6f;
padding: 0 25px;
font-size: 13px;
font-weight: 600;
letter-spacing: .1rem;
text-decoration: none;
text-transform: uppercase;
}
.m-b-md {
margin-bottom: 30px;
}
</style>
</head>
<body>
<div class="flex-center position-ref full-height">
<div class="top-right links">
<a href="/dashoboard">Dashboard</a>
</div>

<div class="content">
<div class="title m-b-md">
{{ config('cipi.name') }}
</div>

<div class="links">
<a target="_blank" href="{{ config('cipi.website') }}">Website</a>
<a target="_blank" href="{{ config('cipi.documentation') }}">Documentation</a>
<a target="_blank" href="{{ config('cipi.app') }}">Mobile App</a>
</div>
</div>
</div>
</body>
</html>
7 changes: 6 additions & 1 deletion routes/web.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,12 @@
|
*/

Route::redirect('/', '/dashboard');
Route::get('/', function () {
if (filter_var(request()->getHttpHost(), FILTER_VALIDATE_IP)) || request()->getHttpHost() == \App\Models\Site::where(['panel' => 1])->pluck('domain')->first()) {
return view('welcome');
}
return file_get_contents('/var/www/html/utility/zero-page/index.php');
});

Route::get('/login', function () {
return view('login');
Expand Down
2 changes: 1 addition & 1 deletion storage/app/cipi/newsite.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ else
fi
sudo touch $WELCOME
sudo cat > "$WELCOME" <<EOF
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Coming Soon</title> <style>html{font-family: Arial, sans-serif; color: #000; font-size: 16px; font-weight: 400;}main{margin: 5rem 0 0 5rem;}h1, p{margin-top: 0; margin-bottom: 2rem;}h1{font-weight: 700; font-size: 4.5rem;}p{color: #7d7d7d; font-size: 1.75rem;}@media screen and (max-width: 768px){html{font-size: 12px;}main{margin: 3rem 0 0 3rem;}}</style></head><body> <main> <h1>Coming Soon</h1> <p> powered by Cipi Control Panel </p></main></body></html>
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Coming Soon</title> <style>html{font-family: Arial, sans-serif; color: #000; font-size: 16px; font-weight: 400;}main{margin: 3rem 0 0 3rem;}h1, p{margin-top: 0; margin-bottom: 1.8rem;}h1{font-weight: 700; font-size: 4.5rem;}p{color: #7d7d7d; font-size: 1.75rem;}@media screen and (max-width: 768px){html{font-size: 12px;}main{margin: 3rem 0 0 3rem;}}</style></head><body><main><h1>Coming Soon</h1><p><script>document.write(window.location.hostname);</script></p></main></body></html>
EOF

NGINX=/etc/nginx/sites-available/$USER_NAME.conf
Expand Down
2 changes: 1 addition & 1 deletion storage/app/cipi/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ echo "PHP CLI configuration..."
echo "${reset}"
sleep 1s

sudo update-alternatives --set php /usr/bin/php8.1
sudo update-alternatives --set php /usr/bin/php8.0



Expand Down
2 changes: 1 addition & 1 deletion storage/app/cipi/version.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.1.7
3.1.8
2 changes: 1 addition & 1 deletion utility/zero-page/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Coming Soon...</title>
<title><?php echo substr($quotes[$randquote]['quote'], 0, 21); ?>...</title>
<style>
html {
font-family: Arial, sans-serif;
Expand Down

0 comments on commit f28371c

Please sign in to comment.