mirror of
https://github.com/PhyreApps/PhyrePanel.git
synced 2024-11-23 16:10:26 +00:00
update
This commit is contained in:
parent
1ebe71f883
commit
fcd885d2f7
26 changed files with 481 additions and 1 deletions
0
web/Modules/Minecraft/App/Http/Controllers/.gitkeep
Normal file
0
web/Modules/Minecraft/App/Http/Controllers/.gitkeep
Normal file
|
@ -0,0 +1,67 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Minecraft\App\Http\Controllers;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Http\Response;
|
||||
|
||||
class MinecraftController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
return view('minecraft::index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('minecraft::create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('minecraft::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
return view('minecraft::edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*/
|
||||
public function update(Request $request, $id): RedirectResponse
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
0
web/Modules/Minecraft/App/Providers/.gitkeep
Normal file
0
web/Modules/Minecraft/App/Providers/.gitkeep
Normal file
123
web/Modules/Minecraft/App/Providers/MinecraftServiceProvider.php
Normal file
123
web/Modules/Minecraft/App/Providers/MinecraftServiceProvider.php
Normal file
|
@ -0,0 +1,123 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Minecraft\App\Providers;
|
||||
|
||||
use BladeUI\Icons\Factory;
|
||||
use Illuminate\Support\Facades\Blade;
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
|
||||
class MinecraftServiceProvider extends ServiceProvider
|
||||
{
|
||||
protected string $moduleName = 'Minecraft';
|
||||
|
||||
protected string $moduleNameLower = 'minecraft';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
$this->registerCommands();
|
||||
$this->registerCommandSchedules();
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*/
|
||||
public function register(): void
|
||||
{
|
||||
// Register Phyre Icons set
|
||||
$this->callAfterResolving(Factory::class, function (Factory $factory) {
|
||||
$factory->add('minecraft', [
|
||||
'path' => __DIR__ . '/../../resources/assets/icons-svg',
|
||||
'prefix' => 'minecraft',
|
||||
]);
|
||||
});
|
||||
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register commands in the format of Command::class
|
||||
*/
|
||||
protected function registerCommands(): void
|
||||
{
|
||||
// $this->commands([]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register command Schedules.
|
||||
*/
|
||||
protected function registerCommandSchedules(): void
|
||||
{
|
||||
// $this->app->booted(function () {
|
||||
// $schedule = $this->app->make(Schedule::class);
|
||||
// $schedule->command('inspire')->hourly();
|
||||
// });
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*/
|
||||
public function registerTranslations(): void
|
||||
{
|
||||
$langPath = resource_path('lang/modules/'.$this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*/
|
||||
protected function registerConfig(): void
|
||||
{
|
||||
$this->publishes([module_path($this->moduleName, 'config/config.php') => config_path($this->moduleNameLower.'.php')], 'config');
|
||||
$this->mergeConfigFrom(module_path($this->moduleName, 'config/config.php'), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*/
|
||||
public function registerViews(): void
|
||||
{
|
||||
$viewPath = resource_path('views/modules/'.$this->moduleNameLower);
|
||||
$sourcePath = module_path($this->moduleName, 'resources/views');
|
||||
|
||||
$this->publishes([$sourcePath => $viewPath], ['views', $this->moduleNameLower.'-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
|
||||
$componentNamespace = str_replace('/', '\\', config('modules.namespace').'\\'.$this->moduleName.'\\'.config('modules.paths.generator.component-class.path'));
|
||||
Blade::componentNamespace($componentNamespace, $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*/
|
||||
public function provides(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (config('view.paths') as $path) {
|
||||
if (is_dir($path.'/modules/'.$this->moduleNameLower)) {
|
||||
$paths[] = $path.'/modules/'.$this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
|
||||
return $paths;
|
||||
}
|
||||
}
|
59
web/Modules/Minecraft/App/Providers/RouteServiceProvider.php
Normal file
59
web/Modules/Minecraft/App/Providers/RouteServiceProvider.php
Normal file
|
@ -0,0 +1,59 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Minecraft\App\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The module namespace to assume when generating URLs to actions.
|
||||
*/
|
||||
protected string $moduleNamespace = 'Modules\Minecraft\App\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Called before routes are registered.
|
||||
*
|
||||
* Register any model bindings or pattern based filters.
|
||||
*/
|
||||
public function boot(): void
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*/
|
||||
public function map(): void
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*/
|
||||
protected function mapWebRoutes(): void
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('Minecraft', '/routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*/
|
||||
protected function mapApiRoutes(): void
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('Minecraft', '/routes/api.php'));
|
||||
}
|
||||
}
|
0
web/Modules/Minecraft/Database/Seeders/.gitkeep
Normal file
0
web/Modules/Minecraft/Database/Seeders/.gitkeep
Normal file
|
@ -0,0 +1,16 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Minecraft\Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class MinecraftDatabaseSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// $this->call([]);
|
||||
}
|
||||
}
|
18
web/Modules/Minecraft/PostInstall.php
Normal file
18
web/Modules/Minecraft/PostInstall.php
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
|
||||
namespace Modules\Minecraft;
|
||||
|
||||
use App\ModulePostInstall;
|
||||
|
||||
class PostInstall extends ModulePostInstall
|
||||
{
|
||||
public $supportLog = true;
|
||||
public function run()
|
||||
{
|
||||
$installDockerShellFile = base_path('Modules/Minecraft/shell-scripts/install-docker.sh');
|
||||
|
||||
shell_exec("chmod +x $installDockerShellFile");
|
||||
shell_exec("bash $installDockerShellFile >> $this->logFile &");
|
||||
|
||||
}
|
||||
}
|
31
web/Modules/Minecraft/composer.json
Normal file
31
web/Modules/Minecraft/composer.json
Normal file
|
@ -0,0 +1,31 @@
|
|||
{
|
||||
"name": "phyreapps/minecraft",
|
||||
"description": "",
|
||||
"authors": [
|
||||
{
|
||||
"name": "Bozhidar Slaveykov",
|
||||
"email": "selfworksbg@gmail.com"
|
||||
}
|
||||
],
|
||||
"extra": {
|
||||
"laravel": {
|
||||
"providers": [],
|
||||
"aliases": {
|
||||
|
||||
}
|
||||
}
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Modules\\Minecraft\\": "",
|
||||
"Modules\\Minecraft\\App\\": "app/",
|
||||
"Modules\\Minecraft\\Database\\Factories\\": "database/factories/",
|
||||
"Modules\\Minecraft\\Database\\Seeders\\": "database/seeders/"
|
||||
}
|
||||
},
|
||||
"autoload-dev": {
|
||||
"psr-4": {
|
||||
"Modules\\Minecraft\\Tests\\": "tests/"
|
||||
}
|
||||
}
|
||||
}
|
0
web/Modules/Minecraft/config/.gitkeep
Normal file
0
web/Modules/Minecraft/config/.gitkeep
Normal file
5
web/Modules/Minecraft/config/config.php
Normal file
5
web/Modules/Minecraft/config/config.php
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Minecraft',
|
||||
];
|
14
web/Modules/Minecraft/module.json
Normal file
14
web/Modules/Minecraft/module.json
Normal file
|
@ -0,0 +1,14 @@
|
|||
{
|
||||
"name": "Minecraft",
|
||||
"alias": "minecraft",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"logoIcon": "minecraft-logo",
|
||||
"category": "Game Servers",
|
||||
"adminUrl": "/admin/minecraft/servers",
|
||||
"providers": [
|
||||
"Modules\\Minecraft\\App\\Providers\\MinecraftServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
15
web/Modules/Minecraft/package.json
Normal file
15
web/Modules/Minecraft/package.json
Normal file
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"private": true,
|
||||
"type": "module",
|
||||
"scripts": {
|
||||
"dev": "vite",
|
||||
"build": "vite build"
|
||||
},
|
||||
"devDependencies": {
|
||||
"axios": "^1.1.2",
|
||||
"laravel-vite-plugin": "^0.7.5",
|
||||
"sass": "^1.69.5",
|
||||
"postcss": "^8.3.7",
|
||||
"vite": "^4.0.0"
|
||||
}
|
||||
}
|
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 148 KiB |
0
web/Modules/Minecraft/resources/assets/js/app.js
Normal file
0
web/Modules/Minecraft/resources/assets/js/app.js
Normal file
0
web/Modules/Minecraft/resources/assets/sass/app.scss
Normal file
0
web/Modules/Minecraft/resources/assets/sass/app.scss
Normal file
0
web/Modules/Minecraft/resources/views/.gitkeep
Normal file
0
web/Modules/Minecraft/resources/views/.gitkeep
Normal file
7
web/Modules/Minecraft/resources/views/index.blade.php
Normal file
7
web/Modules/Minecraft/resources/views/index.blade.php
Normal file
|
@ -0,0 +1,7 @@
|
|||
@extends('minecraft::layouts.master')
|
||||
|
||||
@section('content')
|
||||
<h1>Hello World</h1>
|
||||
|
||||
<p>Module: {!! config('minecraft.name') !!}</p>
|
||||
@endsection
|
|
@ -0,0 +1,29 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="{{ str_replace('_', '-', app()->getLocale()) }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
|
||||
<title>Minecraft Module - {{ config('app.name', 'Laravel') }}</title>
|
||||
|
||||
<meta name="description" content="{{ $description ?? '' }}">
|
||||
<meta name="keywords" content="{{ $keywords ?? '' }}">
|
||||
<meta name="author" content="{{ $author ?? '' }}">
|
||||
|
||||
<!-- Fonts -->
|
||||
<link rel="preconnect" href="https://fonts.bunny.net">
|
||||
<link href="https://fonts.bunny.net/css?family=figtree:400,500,600&display=swap" rel="stylesheet" />
|
||||
|
||||
{{-- Vite CSS --}}
|
||||
{{-- {{ module_vite('build-minecraft', 'resources/assets/sass/app.scss') }} --}}
|
||||
</head>
|
||||
|
||||
<body>
|
||||
@yield('content')
|
||||
|
||||
{{-- Vite JS --}}
|
||||
{{-- {{ module_vite('build-minecraft', 'resources/assets/js/app.js') }} --}}
|
||||
</body>
|
0
web/Modules/Minecraft/routes/.gitkeep
Normal file
0
web/Modules/Minecraft/routes/.gitkeep
Normal file
19
web/Modules/Minecraft/routes/api.php
Normal file
19
web/Modules/Minecraft/routes/api.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register API routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| is assigned the "api" middleware group. Enjoy building your API!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::middleware(['auth:sanctum'])->prefix('v1')->name('api.')->group(function () {
|
||||
Route::get('minecraft', fn (Request $request) => $request->user())->name('minecraft');
|
||||
});
|
19
web/Modules/Minecraft/routes/web.php
Normal file
19
web/Modules/Minecraft/routes/web.php
Normal file
|
@ -0,0 +1,19 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Modules\Minecraft\App\Http\Controllers\MinecraftController;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| Web Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register web routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| contains the "web" middleware group. Now create something great!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::group([], function () {
|
||||
Route::resource('minecraft', MinecraftController::class)->names('minecraft');
|
||||
});
|
14
web/Modules/Minecraft/shell-scripts/get-available-port.sh
Normal file
14
web/Modules/Minecraft/shell-scripts/get-available-port.sh
Normal file
|
@ -0,0 +1,14 @@
|
|||
netstat -aln | awk '
|
||||
$6 == "LISTEN" {
|
||||
if ($4 ~ "[.:][0-9]+$") {
|
||||
split($4, a, /[:.]/);
|
||||
port = a[length(a)];
|
||||
p[port] = 1
|
||||
}
|
||||
}
|
||||
END {
|
||||
for (i = 3000; i < 65000 && p[i]; i++){};
|
||||
if (i == 65000) {exit 1};
|
||||
print i
|
||||
}
|
||||
'
|
16
web/Modules/Minecraft/shell-scripts/install-docker.sh
Normal file
16
web/Modules/Minecraft/shell-scripts/install-docker.sh
Normal file
|
@ -0,0 +1,16 @@
|
|||
sudo apt-get update -y
|
||||
sudo apt-get install ca-certificates curl -y
|
||||
sudo install -m 0755 -d /etc/apt/keyrings
|
||||
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg -o /etc/apt/keyrings/docker.asc
|
||||
sudo chmod a+r /etc/apt/keyrings/docker.asc
|
||||
|
||||
# Add the repository to Apt sources:
|
||||
echo \
|
||||
"deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu \
|
||||
$(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \
|
||||
sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
|
||||
sudo apt-get update
|
||||
|
||||
sudo apt-get install docker-compose docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin -y
|
||||
|
||||
echo "Done!"
|
26
web/Modules/Minecraft/vite.config.js
Normal file
26
web/Modules/Minecraft/vite.config.js
Normal file
|
@ -0,0 +1,26 @@
|
|||
import { defineConfig } from 'vite';
|
||||
import laravel from 'laravel-vite-plugin';
|
||||
|
||||
export default defineConfig({
|
||||
build: {
|
||||
outDir: '../../public/build-minecraft',
|
||||
emptyOutDir: true,
|
||||
manifest: true,
|
||||
},
|
||||
plugins: [
|
||||
laravel({
|
||||
publicDirectory: '../../public',
|
||||
buildDirectory: 'build-minecraft',
|
||||
input: [
|
||||
__dirname + '/resources/assets/sass/app.scss',
|
||||
__dirname + '/resources/assets/js/app.js'
|
||||
],
|
||||
refresh: true,
|
||||
}),
|
||||
],
|
||||
});
|
||||
|
||||
//export const paths = [
|
||||
// 'Modules/$STUDLY_NAME$/resources/assets/sass/app.scss',
|
||||
// 'Modules/$STUDLY_NAME$/resources/assets/js/app.js',
|
||||
//];
|
|
@ -7,5 +7,6 @@
|
|||
"DockerTemplate": true,
|
||||
"Terminal": true,
|
||||
"Mail": true,
|
||||
"Email": true
|
||||
"Email": true,
|
||||
"Minecraft": true
|
||||
}
|
Loading…
Reference in a new issue