SEO & Update Notification

Development
This commit is contained in:
Dennis 2023-01-13 18:58:06 +01:00 committed by GitHub
commit c817b5d72d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 111 additions and 5 deletions

View file

@ -59,6 +59,8 @@ class System
'motd-enabled' => 'string',
'usefullinks-enabled' => 'string',
'motd-message' => 'string|nullable',
'seo-title' => 'string|nullable',
'seo-description' => 'string|nullable',
]);
$validator->after(function ($validator) use ($request) {
@ -111,6 +113,8 @@ class System
"SETTINGS::SYSTEM:MOTD_ENABLED" => "motd-enabled",
"SETTINGS::SYSTEM:MOTD_MESSAGE" => "motd-message",
"SETTINGS::SYSTEM:USEFULLINKS_ENABLED" => "usefullinks-enabled",
"SETTINGS::SYSTEM:SEO_TITLE" => "seo-title",
"SETTINGS::SYSTEM:SEO_DESCRIPTION" => "seo-description",
];
foreach ($values as $key => $value) {

View file

@ -0,0 +1,43 @@
<?php
namespace App\Console\Commands;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
class GetGithubVersion extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cp:versioncheck:get';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Get the latest Version from Github';
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
try{
$latestVersion = Http::get('https://api.github.com/repos/controlpanel-gg/dashboard/tags')->json()[0]['name'];
Storage::disk('local')->put('latestVersion', $latestVersion);
} catch (Exception $e) {
Storage::disk('local')->put('latestVersion', "unknown");
Log::error($e);
}
return Command::SUCCESS;
}
}

View file

@ -17,6 +17,7 @@ class Kernel extends ConsoleKernel
protected function schedule(Schedule $schedule)
{
$schedule->command('credits:charge')->hourly();
$schedule->command('cp:versioncheck:get')->daily();
//log cronjob activity
$schedule->call(function () {

View file

@ -630,5 +630,20 @@ class SettingsSeeder extends Seeder
'type' => 'text',
'description' => 'MOTD Message',
]);
Settings::firstOrCreate([
'key' => 'SETTINGS::SYSTEM:SEO_TITLE',
], [
'value' => 'Controlpanel.gg',
'type' => 'text',
'description' => 'The SEO Title',
]);
Settings::firstOrCreate([
'key' => 'SETTINGS::SYSTEM:SEO_DESCRIPTION',
], [
'value' => 'Billing software for Pterodactyl Dashboard!',
'type' => 'text',
'description' => 'SEO Description',
]);
}
}

View file

@ -8,6 +8,7 @@
<div class="col-sm-6">
<h1>{{__('Admin Overview')}}</h1>
</div>
<div class="col-sm-6">
<ol class="breadcrumb float-sm-right">
<li class="breadcrumb-item"><a href="{{route('home')}}">{{__('Dashboard')}}</a></li>
@ -17,6 +18,14 @@
</div>
</div>
</div>
@if(Storage::get('latestVersion') && config("app.version") < Storage::get('latestVersion'))
<div class="alert alert-danger" role="alert">
<b><i class="fas fa-shield-alt"></i> {{__("Version Outdated:")}}</b></br>
{{__("You are running on")}} v{{config("app.version")}}-{{config("BRANCHNAME")}}.
{{__("The latest Version is")}} v{{Storage::get('latestVersion')}}</br>
<a href="https://controlpanel.gg/docs/Installation/updating">{{__("Consider updating now")}}</a>
</div>
@endif
</section>
<!-- END CONTENT HEADER -->
@ -171,7 +180,7 @@
</tr>
</thead>
<tbody>
@foreach($tickets as $ticket_id => $ticket)
<tr>
<td><a class="text-info" href="{{route('moderator.ticket.show', ['ticket_id' => $ticket_id])}}">#{{$ticket_id}} - {{$ticket->title}}</td>
@ -180,7 +189,7 @@
<td>{{$ticket->last_updated}}</td>
</tr>
@endforeach
</tbody>
</table>
@endif
@ -323,7 +332,7 @@
<hr style="width: 100%; height:1px; border-width:0; background-color:#6c757d; margin-top: -16px">
</div>
</div>
</div>
</div>
<div class="card">

View file

@ -300,7 +300,35 @@
class="form-control @error('minimum-credits') is-invalid @enderror" required>
</div>
</div>
<div class="row mb-2">
<div class="col text-center">
<h1>{{ __('SEO') }}</h1>
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3 p-0">
<div class="col m-0 p-0 d-flex justify-content-between align-items-center">
<label for="seo-title">{{ __('SEO Title') }}</label>
<i data-toggle="popover" data-trigger="hover" data-html="true"
data-content="{{ __('An SEO title tag must contain your target keyword. This tells both Google and searchers that your web page is relevant to this search query!') }}"
class="fas fa-info-circle"></i>
</div>
<input x-model="seo-title" id="seo-title" name="seo-title"
type="text" value="{{ config('SETTINGS::SYSTEM:SEO_TITLE') }}"
class="form-control @error('seo-title') is-invalid @enderror" required>
</div>
<div class="custom-control mb-3 p-0">
<div class="col m-0 p-0 d-flex justify-content-between align-items-center">
<label for="seo-description">{{ __('SEO Description') }}</label>
<i data-toggle="popover" data-trigger="hover" data-html="true"
data-content="{{ __('The SEO site description represents your homepage. Search engines show this description in search results for your homepage if they dont find content more relevant to a visitors search terms.') }}"
class="fas fa-info-circle"></i>
</div>
<input x-model="seo-description" id="seo-description" name="seo-description"
type="text" value="{{ config('SETTINGS::SYSTEM:SEO_DESCRIPTION') }}"
class="form-control @error('seo-description') is-invalid @enderror" required>
</div>
</div>
</div>
@ -454,7 +482,7 @@
</form>
</div>
<script>tinymce.init({selector:'textarea',skin: "oxide-dark",
content_css: "dark",branding: false, height: 200,
content_css: "dark",branding: false, height: 500,
plugins: ['image','link'],});
</script>

View file

@ -4,6 +4,9 @@
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta content="{{ config('SETTINGS::SYSTEM:SEO_TITLE') }}" property="og:title">
<meta content="{{ config('SETTINGS::SYSTEM:SEO_DESCRIPTION') }}" property="og:description">
<meta content='{{ \Illuminate\Support\Facades\Storage::disk('public')->exists('logo.png') ? asset('storage/logo.png') : asset('images/controlpanel_logo.png') }}' property="og:image">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">

View file

@ -6,6 +6,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- CSRF Token -->
<meta name="csrf-token" content="{{ csrf_token() }}">
<meta content="{{ config('SETTINGS::SYSTEM:SEO_TITLE') }}" property="og:title">
<meta content="{{ config('SETTINGS::SYSTEM:SEO_DESCRIPTION') }}" property="og:description">
<meta content='{{ \Illuminate\Support\Facades\Storage::disk('public')->exists('logo.png') ? asset('storage/logo.png') : asset('images/controlpanel_logo.png') }}' property="og:image">
<title>{{ config('app.name', 'Laravel') }}</title>
<link rel="icon"
href="{{ \Illuminate\Support\Facades\Storage::disk('public')->exists('favicon.ico') ? asset('storage/favicon.ico') : asset('favicon.ico') }}"