Skip to content

Commit

Permalink
v1.0.2 (#1056)
Browse files Browse the repository at this point in the history
  • Loading branch information
1day2die authored Nov 26, 2024
2 parents a951e01 + b033fdd commit 43cac5b
Show file tree
Hide file tree
Showing 11 changed files with 128 additions and 16 deletions.
54 changes: 54 additions & 0 deletions app/Console/Commands/DisableRecaptcha.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

namespace App\Console\Commands;

use App\Settings\GeneralSettings;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Log;


class DisableRecaptcha extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'cp:recaptcha:toggle';

/**
* The console command description.
*
* @var string
*/
protected $description = 'Toggle Recaptcha on and off';

/**
* Execute the console command.
*
* @return int
*/

protected GeneralSettings $settings;

public function __construct(GeneralSettings $settings)
{
parent::__construct();
$this->settings = $settings;
}
public function handle()
{
try{

$this->settings->recaptcha_enabled = !$this->settings->recaptcha_enabled;
$this->settings->save();
$this->info('Recaptcha enabled: ' . ($this->settings->recaptcha_enabled ? 'true' : 'false'));

} catch (Exception $e) {
$this->error('An error occurred: ' . $e->getMessage());
Log::error($e);
}
return Command::SUCCESS;
}
}
11 changes: 11 additions & 0 deletions app/Http/Controllers/TicketsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class TicketsController extends Controller
const WRITE_PERMISSION = 'user.ticket.write';
public function index(LocaleSettings $locale_settings, TicketSettings $ticketSettings)
{
$this->checkAnyPermission([self::READ_PERMISSION, self::WRITE_PERMISSION]);
return view('ticket.index', [
'ticketsettings' => $ticketSettings,
'tickets' => Ticket::where('user_id', Auth::user()->id)->paginate(10),
Expand All @@ -39,6 +40,8 @@ public function index(LocaleSettings $locale_settings, TicketSettings $ticketSet

public function store(Request $request, GeneralSettings $generalSettings)
{
$this->checkPermission(self::WRITE_PERMISSION);

if (RateLimiter::tooManyAttempts('ticket-send:'.Auth::user()->id, $perMinute = 1)) {
return redirect()->back()->with('error', __('Please wait before creating a new Ticket'));
}
Expand Down Expand Up @@ -88,6 +91,7 @@ public function show($ticket_id, PterodactylSettings $ptero_settings)
$this->checkPermission(self::READ_PERMISSION);
try {
$ticket = Ticket::where('ticket_id', $ticket_id)->firstOrFail();
if($ticket->user_id != Auth::user()->id){ return redirect()->back()->with('error', __('This ticket is not made by you or dosent exist')); }
} catch (Exception $e) {
return redirect()->back()->with('warning', __('Ticket not found on the server. It potentially got deleted earlier'));
}
Expand All @@ -101,6 +105,8 @@ public function show($ticket_id, PterodactylSettings $ptero_settings)

public function reply(Request $request)
{
$this->checkPermission(self::WRITE_PERMISSION);

if (RateLimiter::tooManyAttempts('ticket-reply:'.Auth::user()->id, $perMinute = 1)) {
return redirect()->back()->with('error', __('Please wait before answering a Ticket'));
}
Expand All @@ -112,6 +118,7 @@ public function reply(Request $request)
$this->validate($request, ['ticketcomment' => 'required']);
try {
$ticket = Ticket::where('id', $request->input('ticket_id'))->firstOrFail();
if($ticket->user_id != Auth::user()->id){ return redirect()->back()->with('error', __('This ticket is not made by you or dosent exist')); }
} catch (Exception $e) {
return redirect()->back()->with('warning', __('Ticket not found on the server. It potentially got deleted earlier'));
}
Expand Down Expand Up @@ -151,8 +158,12 @@ public function create()

public function changeStatus($ticket_id)
{
$this->checkPermission(self::WRITE_PERMISSION);


try {
$ticket = Ticket::where('user_id', Auth::user()->id)->where("ticket_id", $ticket_id)->firstOrFail();
if($ticket->user_id != Auth::user()->id){ return redirect()->back()->with('warning', __('This ticket is not made by you or dosent exist')); }
} catch (Exception $e) {
return redirect()->back()->with('warning', __('Ticket not found on the server. It potentially got deleted earlier'));
}
Expand Down
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

return [

'version' => '1.0.0',
'version' => '1.0.2',

/*
|--------------------------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion docker/standalone/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM php:8.1-fpm
FROM php:8.3-fpm

# Install system dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
Expand Down
14 changes: 7 additions & 7 deletions public/installer/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@
2 => ['view' => 'timezone-configuration', 'is_revertable' => true],
3 => ['view' => 'database-configuration', 'is_revertable' => true],
4 => ['view' => 'database-migration', 'is_revertable' => false],
5 => ['view' => 'redis-configuration', 'is_revertable' => true],
6 => ['view' => 'dashboard-configuration', 'is_revertable' => true],
7 => ['view' => 'email-configuration', 'is_revertable' => true],
8 => ['view' => 'pterodactyl-configuration', 'is_revertable' => false],
9 => ['view' => 'admin-creation', 'is_revertable' => false],
10 => ['view' => 'installation-complete', 'is_revertable' => false],
// 5 => ['view' => 'redis-configuration', 'is_revertable' => true],
5 => ['view' => 'dashboard-configuration', 'is_revertable' => true],
6 => ['view' => 'email-configuration', 'is_revertable' => true],
7 => ['view' => 'pterodactyl-configuration', 'is_revertable' => false],
8 => ['view' => 'admin-creation', 'is_revertable' => false],
9 => ['view' => 'installation-complete', 'is_revertable' => false],
];

$_SESSION['last_installation_step'] = count($stepConfig);
Expand Down Expand Up @@ -100,4 +100,4 @@
// setting / reseting the error message
$_SESSION['error-message'] = null;

?>
?>
2 changes: 1 addition & 1 deletion public/installer/src/functions/environment.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ function checkExtensions(): array

$requirements = [
'minPhp' => '8.2',
'maxPhp' => '8.4', // This version is not supported
'maxPhp' => '8.5', // This version is not supported
'mysql' => '5.7.22',
];

Expand Down
2 changes: 1 addition & 1 deletion public/installer/views/mandatory-checks.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
<p class="text-neutral-400 mb-1">
<br>
<span style="color: #eab308;">Important:</span>
CtrlPanel.gg requires a MySQL-Database, Redis-Server, and Pterodactyl-Panel to work.<br>
CtrlPanel.gg requires a MySQL-Database and Pterodactyl-Panel to work.<br>
Please make sure you have these installed and running before you continue.
</p>
</li>
Expand Down
5 changes: 5 additions & 0 deletions public/installer/views/redis-configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,11 @@ class="px-2 py-1 bg-[#1D2125] border-2 focus:border-sky-500 box-border rounded-m
<?php
}
?>
<a href="?step=next">
<button type="button" class="w-full px-4 py-2 font-bold rounded-md bg-yellow-500/90 hover:bg-yellow-600 shadow-yellow-400 focus:outline-2 focus:outline focus:outline-offset-2 focus:outline-yellow-600">
Skip For Now
</button>
</a>

<button type="submit" class="flex items-center px-4 py-2 font-bold rounded-md bg-sky-500 hover:bg-sky-600 shadow-sky-400 focus:outline-2 focus:outline focus:outline-offset-2 focus:outline-sky-500" name="redisSetup">
Next
Expand Down
26 changes: 26 additions & 0 deletions themes/BlueInfinity/views/layouts/main.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -448,6 +448,16 @@ class="nav-link @if (Request::routeIs('admin.partners.*')) active @endif">
</li>
@endcanany

@canany(["admin.coupons.read", "admin.coupons.write"])
<li class="nav-item">
<a href="{{ route('admin.coupons.index') }}"
class="nav-link @if (Request::routeIs('admin.coupons.*')) active @endif">
<i class="nav-icon fas fa-ticket-alt"></i>
<p>{{ __('Coupons') }}</p>
</a>
</li>
@endcanany

@canany(["admin.useful_links.read","admin.legal.read"])
<li class="nav-header">{{ __('Other') }}</li>
@endcanany
Expand Down Expand Up @@ -633,6 +643,22 @@ class="nav-link @if (Request::routeIs('admin.activitylogs.*')) active @endif">
}
})
@endif
@if (Session::has('warning'))
Swal.fire({
icon: 'warning',
title: '{{ Session::get('warning') }}',
position: 'top-end',
showConfirmButton: false,
background: '#343a40',
toast: true,
timer: 3000,
timerProgressBar: true,
didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
})
@endif
</script>
</body>

Expand Down
10 changes: 5 additions & 5 deletions themes/default/views/admin/users/edit.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,7 @@ class="form-control @error('referral_code') is-invalid @enderror" required="requ
<button type="submit" class="btn btn-primary">{{__('Submit')}}</button>
</div>

<input type="hidden" name="_token" value="{{ csrf_token() }}">
</form>

</div>
</div>
</div>
Expand All @@ -139,7 +138,7 @@ class="form-control @error('referral_code') is-invalid @enderror" required="requ
<div class="col">
<div class="form-group"><label>{{__('New Password')}}</label> <input
class="form-control @error('new_password') is-invalid @enderror"
name="new_password" type="password" placeholder="••••••">
name="new_password" id="new_password" type="password" placeholder="••••••">

@error('new_password')
<div class="invalid-feedback">
Expand All @@ -152,7 +151,7 @@ class="form-control @error('new_password') is-invalid @enderror"
<div class="form-group"><label>{{__('Confirm Password')}}</label>
<input
class="form-control @error('new_password_confirmation') is-invalid @enderror"
name="new_password_confirmation" type="password"
name="new_password_confirmation" id="new_password_confirmation" type="password"
placeholder="••••••">

@error('new_password_confirmation')
Expand All @@ -162,7 +161,8 @@ class="form-control @error('new_password_confirmation') is-invalid @enderror"
@enderror
</div>
</div>
</form>
<input type="hidden" name="_token" value="{{ csrf_token() }}">
</form>
</div>
</div>
</div>
Expand Down
16 changes: 16 additions & 0 deletions themes/default/views/layouts/main.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,22 @@ class="nav-link @if (Request::routeIs('admin.activitylogs.*')) active @endif">
}
})
@endif
@if (Session::has('warning'))
Swal.fire({
icon: 'warning',
title: '{{ Session::get('warning') }}',
position: 'top-end',
showConfirmButton: false,
background: '#343a40',
toast: true,
timer: 3000,
timerProgressBar: true,
didOpen: (toast) => {
toast.addEventListener('mouseenter', Swal.stopTimer)
toast.addEventListener('mouseleave', Swal.resumeTimer)
}
})
@endif
</script>
</body>

Expand Down

0 comments on commit 43cac5b

Please sign in to comment.