Merge branch 'ControlPanel-gg:main' into Invoices
This commit is contained in:
commit
9d64eaf73f
2
LICENSE
2
LICENSE
|
@ -1,6 +1,6 @@
|
||||||
MIT License
|
MIT License
|
||||||
|
|
||||||
Copyright (c) 2021 Arno VIsker
|
Copyright (c) 2021 ControlPanel.gg
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
|
|
@ -14,6 +14,11 @@ use Illuminate\Support\Facades\Http;
|
||||||
|
|
||||||
class Pterodactyl
|
class Pterodactyl
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @description per_page option to pull more than the default 50 from pterodactyl
|
||||||
|
*/
|
||||||
|
public CONST PER_PAGE = 200;
|
||||||
|
|
||||||
//TODO: Extend error handling (maybe logger for more errors when debugging)
|
//TODO: Extend error handling (maybe logger for more errors when debugging)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -43,7 +48,7 @@ class Pterodactyl
|
||||||
*/
|
*/
|
||||||
public static function getEggs(Nest $nest)
|
public static function getEggs(Nest $nest)
|
||||||
{
|
{
|
||||||
$response = self::client()->get("/application/nests/{$nest->id}/eggs?include=nest,variables");
|
$response = self::client()->get("/application/nests/{$nest->id}/eggs?include=nest,variables&per_page=" . self::PER_PAGE);
|
||||||
if ($response->failed()) throw self::getException();
|
if ($response->failed()) throw self::getException();
|
||||||
return $response->json()['data'];
|
return $response->json()['data'];
|
||||||
}
|
}
|
||||||
|
@ -54,7 +59,7 @@ class Pterodactyl
|
||||||
*/
|
*/
|
||||||
public static function getNodes()
|
public static function getNodes()
|
||||||
{
|
{
|
||||||
$response = self::client()->get('/application/nodes');
|
$response = self::client()->get('/application/nodes?per_page=' . self::PER_PAGE);
|
||||||
if ($response->failed()) throw self::getException();
|
if ($response->failed()) throw self::getException();
|
||||||
return $response->json()['data'];
|
return $response->json()['data'];
|
||||||
}
|
}
|
||||||
|
@ -65,7 +70,7 @@ class Pterodactyl
|
||||||
*/
|
*/
|
||||||
public static function getNests()
|
public static function getNests()
|
||||||
{
|
{
|
||||||
$response = self::client()->get('/application/nests');
|
$response = self::client()->get('/application/nests?per_page=' . self::PER_PAGE);
|
||||||
if ($response->failed()) throw self::getException();
|
if ($response->failed()) throw self::getException();
|
||||||
return $response->json()['data'];
|
return $response->json()['data'];
|
||||||
}
|
}
|
||||||
|
@ -76,7 +81,7 @@ class Pterodactyl
|
||||||
*/
|
*/
|
||||||
public static function getLocations()
|
public static function getLocations()
|
||||||
{
|
{
|
||||||
$response = self::client()->get('/application/locations');
|
$response = self::client()->get('/application/locations?per_page=' . self::PER_PAGE);
|
||||||
if ($response->failed()) throw self::getException();
|
if ($response->failed()) throw self::getException();
|
||||||
return $response->json()['data'];
|
return $response->json()['data'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,6 +5,7 @@ namespace App\Http\Controllers\Auth;
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use App\Models\Configuration;
|
use App\Models\Configuration;
|
||||||
use App\Models\DiscordUser;
|
use App\Models\DiscordUser;
|
||||||
|
use App\Models\User;
|
||||||
use App\Models\Voucher;
|
use App\Models\Voucher;
|
||||||
use Illuminate\Support\Facades\Auth;
|
use Illuminate\Support\Facades\Auth;
|
||||||
use Illuminate\Support\Facades\Http;
|
use Illuminate\Support\Facades\Http;
|
||||||
|
@ -27,14 +28,15 @@ class SocialiteController extends Controller
|
||||||
return abort(500);
|
return abort(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** @var User $user */
|
||||||
|
$user = Auth::user();
|
||||||
$discord = Socialite::driver('discord')->user();
|
$discord = Socialite::driver('discord')->user();
|
||||||
$discordUser = DiscordUser::find($discord->id);
|
|
||||||
$botToken = env('DISCORD_BOT_TOKEN');
|
$botToken = env('DISCORD_BOT_TOKEN');
|
||||||
$guildId = env('DISCORD_GUILD_ID');
|
$guildId = env('DISCORD_GUILD_ID');
|
||||||
$roleId = env('DISCORD_ROLE_ID');
|
$roleId = env('DISCORD_ROLE_ID');
|
||||||
|
|
||||||
//save / update discord_users
|
//save / update discord_users
|
||||||
if (is_null($discordUser)) {
|
if (is_null($user->discordUser)) {
|
||||||
//create discord user in db
|
//create discord user in db
|
||||||
DiscordUser::create(array_merge($discord->user, ['user_id' => Auth::user()->id]));
|
DiscordUser::create(array_merge($discord->user, ['user_id' => Auth::user()->id]));
|
||||||
//update user
|
//update user
|
||||||
|
@ -42,7 +44,7 @@ class SocialiteController extends Controller
|
||||||
Auth::user()->increment('server_limit', Configuration::getValueByKey('SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD'));
|
Auth::user()->increment('server_limit', Configuration::getValueByKey('SERVER_LIMIT_REWARD_AFTER_VERIFY_DISCORD'));
|
||||||
Auth::user()->update(['discord_verified_at' => now()]);
|
Auth::user()->update(['discord_verified_at' => now()]);
|
||||||
} else {
|
} else {
|
||||||
$discordUser->update($discord->user);
|
$user->discordUser->update($discord->user);
|
||||||
}
|
}
|
||||||
|
|
||||||
//force user into discord server
|
//force user into discord server
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
||||||
'version' => '0.6',
|
'version' => '0.6.2',
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Application Name
|
| Application Name
|
||||||
|
|
|
@ -78,9 +78,12 @@
|
||||||
class="pt-sm-2 pb-1 mb-0 text-nowrap">{{$user->name}}</h4>
|
class="pt-sm-2 pb-1 mb-0 text-nowrap">{{$user->name}}</h4>
|
||||||
<p class="mb-0">{{$user->email}}
|
<p class="mb-0">{{$user->email}}
|
||||||
@if($user->hasVerifiedEmail())
|
@if($user->hasVerifiedEmail())
|
||||||
<i data-toggle="popover" data-trigger="hover" data-content="Verified" class="text-success fas fa-check-circle"></i>
|
<i data-toggle="popover" data-trigger="hover" data-content="Verified"
|
||||||
|
class="text-success fas fa-check-circle"></i>
|
||||||
@else
|
@else
|
||||||
<i data-toggle="popover" data-trigger="hover" data-content="Not verified" class="text-danger fas fa-exclamation-circle"></i>
|
<i data-toggle="popover" data-trigger="hover"
|
||||||
|
data-content="Not verified"
|
||||||
|
class="text-danger fas fa-exclamation-circle"></i>
|
||||||
@endif
|
@endif
|
||||||
|
|
||||||
</p>
|
</p>
|
||||||
|
@ -189,8 +192,8 @@
|
||||||
</div>
|
</div>
|
||||||
@if(!empty(env('DISCORD_CLIENT_ID')) && !empty(env('DISCORD_CLIENT_SECRET')))
|
@if(!empty(env('DISCORD_CLIENT_ID')) && !empty(env('DISCORD_CLIENT_SECRET')))
|
||||||
<div class="col-12 col-sm-5 offset-sm-1 mb-3">
|
<div class="col-12 col-sm-5 offset-sm-1 mb-3">
|
||||||
<b>Link your discord account!</b>
|
|
||||||
@if(is_null(Auth::user()->discordUser))
|
@if(is_null(Auth::user()->discordUser))
|
||||||
|
<b>Link your discord account!</b>
|
||||||
<div class="verify-discord">
|
<div class="verify-discord">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
@if($credits_reward_after_verify_discord)
|
@if($credits_reward_after_verify_discord)
|
||||||
|
@ -198,7 +201,8 @@
|
||||||
extra
|
extra
|
||||||
<b><i
|
<b><i
|
||||||
class="fa fa-coins mx-1"></i>{{$credits_reward_after_verify_discord}}
|
class="fa fa-coins mx-1"></i>{{$credits_reward_after_verify_discord}}
|
||||||
</b> {{CREDITS_DISPLAY_NAME}} and increased server limit
|
</b> {{CREDITS_DISPLAY_NAME}} and increased server
|
||||||
|
limit
|
||||||
</p>
|
</p>
|
||||||
@endif
|
@endif
|
||||||
</div>
|
</div>
|
||||||
|
@ -213,21 +217,25 @@
|
||||||
<p>You are verified!</p>
|
<p>You are verified!</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row">
|
<div class="row pl-2">
|
||||||
<div class="small-box bg-dark">
|
<div class="small-box bg-dark">
|
||||||
<div class="d-flex justify-content-between">
|
<div class="d-flex justify-content-between">
|
||||||
<div class="p-3">
|
<div class="p-3">
|
||||||
<h3>{{$user->discordUser->username}} <sup>{{$user->discordUser->locale}}</sup> </h3>
|
<h3>{{$user->discordUser->username}}
|
||||||
<p>{{$user->discordUser->id}}
|
<sup>{{$user->discordUser->locale}}</sup></h3>
|
||||||
</p>
|
<p>{{$user->discordUser->id}}
|
||||||
</div>
|
</p>
|
||||||
<div class="p-3"><img width="100px" height="100px" class="rounded-circle" src="{{$user->discordUser->getAvatar()}}" alt="avatar"></div>
|
|
||||||
</div>
|
|
||||||
<div class="small-box-footer">
|
|
||||||
<a href="{{route('auth.redirect')}}">
|
|
||||||
<i class="fab fa-discord mr-1"></i>Re-Sync Discord
|
|
||||||
</a>
|
|
||||||
</div>
|
</div>
|
||||||
|
<div class="p-3"><img width="100px" height="100px"
|
||||||
|
class="rounded-circle"
|
||||||
|
src="{{$user->discordUser->getAvatar()}}"
|
||||||
|
alt="avatar"></div>
|
||||||
|
</div>
|
||||||
|
<div class="small-box-footer">
|
||||||
|
<a href="{{route('auth.redirect')}}">
|
||||||
|
<i class="fab fa-discord mr-1"></i>Re-Sync Discord
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endif
|
@endif
|
||||||
|
|
|
@ -411,8 +411,11 @@
|
||||||
this.selectedNestObject = this.nests.find(nest => nest.id == this.selectedNest) ?? {}
|
this.selectedNestObject = this.nests.find(nest => nest.id == this.selectedNest) ?? {}
|
||||||
this.selectedEggObject = this.eggs.find(egg => egg.id == this.selectedEgg) ?? {}
|
this.selectedEggObject = this.eggs.find(egg => egg.id == this.selectedEgg) ?? {}
|
||||||
|
|
||||||
|
this.selectedNodeObject = {};
|
||||||
this.locations.forEach(location => {
|
this.locations.forEach(location => {
|
||||||
this.selectedNodeObject = location.nodes.find(node => node.id == this.selectedNode) ?? {};
|
if (!this.selectedNodeObject?.id) {
|
||||||
|
this.selectedNodeObject = location.nodes.find(node => node.id == this.selectedNode) ?? {};
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
this.selectedProductObject = this.products.find(product => product.id == this.selectedProduct) ?? {}
|
this.selectedProductObject = this.products.find(product => product.id == this.selectedProduct) ?? {}
|
||||||
|
|
Loading…
Reference in a new issue