feat core build-files views: No longer use nul characters for placeholders in build files.

This commit is contained in:
prplwtf 2024-01-30 13:17:25 +01:00
parent a877a487d0
commit 891a346a8e
6 changed files with 45 additions and 47 deletions

View file

@ -827,7 +827,6 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) ]]; then VCMD="y"
if [[ -f ".blueprint/tmp/$n/$dashboard_components/Components.yml" ]]; then
cp ".blueprint/tmp/$n/$dashboard_components/Components.yml" ".blueprint/extensions/$identifier/private/.store/Components.yml" #backup Components.yml
fi
# End creating data directory.
@ -875,34 +874,33 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) ]]; then VCMD="y"
if [[ $identifier == *"~"* ]]; then PRINT WARNING "'identifier' contains '~' and may result in an error.";fi
# Replace $name variables.
sed -i "s~␀title␀~$name~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
sed -i "s~␀name␀~$name~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
sed -i "s~␀name␀~$name~g" ".blueprint/extensions/blueprint/private/build/extensions/button.blade.php.bak"
sed -i "s~[name]~$name~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
sed -i "s~[name]~$name~g" ".blueprint/extensions/blueprint/private/build/extensions/button.blade.php.bak"
# Replace $description variables.
sed -i "s~␀description␀~$description~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
sed -i "s~[description]~$description~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
# Replace $version variables.
sed -i "s~␀version␀~$version~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
sed -i "s~␀version␀~$version~g" ".blueprint/extensions/blueprint/private/build/extensions/button.blade.php.bak"
sed -i "s~[version]~$version~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
sed -i "s~[version]~$version~g" ".blueprint/extensions/blueprint/private/build/extensions/button.blade.php.bak"
# Replace $ICON variables.
sed -i "s~␀icon␀~$ICON~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
sed -i "s~[icon]~$ICON~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
# Replace $website variables.
if [[ $website != "" ]]; then
sed -i "s~␀website␀~$website~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
sed -i "s~<!--websitecomment␀ ~~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
sed -i "s~ ␀websitecomment-->~~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
sed -i "s~␀weblinkicon␀~$websiteiconclass~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
sed -i "s~[website]~$website~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
sed -i "s~<!--[web] ~~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
sed -i "s~ [web]-->~~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
sed -i "s~[webicon]~$websiteiconclass~g" ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
fi
# Replace $identifier variables.
if [[ $controller_type == "default" ]]; then
sed -i "s~␀id␀~$identifier~g" ".blueprint/extensions/blueprint/private/build/extensions/controller.php.bak"
sed -i "s~[id]~$identifier~g" ".blueprint/extensions/blueprint/private/build/extensions/controller.php.bak"
fi
sed -i "s~␀id␀~$identifier~g" ".blueprint/extensions/blueprint/private/build/extensions/route.php.bak"
sed -i "s~␀id␀~$identifier~g" ".blueprint/extensions/blueprint/private/build/extensions/button.blade.php.bak"
sed -i "s~[id]~$identifier~g" ".blueprint/extensions/blueprint/private/build/extensions/route.php.bak"
sed -i "s~[id]~$identifier~g" ".blueprint/extensions/blueprint/private/build/extensions/button.blade.php.bak"
# Place extension admin view content into template.
echo -e "$CONTENT\n@endsection" >> ".blueprint/extensions/blueprint/private/build/extensions/admin.blade.php.bak"
@ -948,7 +946,7 @@ if [[ ( $2 == "-i" ) || ( $2 == "-install" ) ]]; then VCMD="y"
OLDBUTTON_RESULT=$(<.blueprint/extensions/"$identifier"/private/.store/build/button.blade.php)
sed -i "s~$OLDBUTTON_RESULT~~g" "resources/views/admin/extensions.blade.php"
fi
sed -i "s~<!--␀replace␀-->~$ADMINBUTTON_RESULT\n<!--␀replace␀-->~g" "resources/views/admin/extensions.blade.php"
sed -i "s~<!-- [entry-placeholder] -->~$ADMINBUTTON_RESULT\n<!-- [entry-placeholder] -->~g" "resources/views/admin/extensions.blade.php"
# Place dashboard wrapper
if [[ $dashboard_wrapper != "" ]]; then

View file

@ -1,15 +1,15 @@
@extends('layouts.admin')
@section('title')
␀title␀
[name]
@endsection
@section('content-header')
<img src="␀icon␀" alt="logo" style="float:left;width:30px;height:30px;border-radius:3px;margin-right:5px;">
<!--websitecomment␀ <a href="␀website␀" target="_blank"><button class="btn btn-gray-alt pull-right" style="padding: 5px 10px;"><i class="bx ␀weblinkicon␀"></i></button></a> ␀websitecomment-->
<h1 ext-title>␀name␀<tag mg-left blue>␀version␀</tag></h1>
<img src="[icon]" alt="logo" style="float:left;width:30px;height:30px;border-radius:3px;margin-right:5px;"/>
<!--[web] <a href="[website]" target="_blank"><button class="btn btn-gray-alt pull-right" style="padding: 5px 10px;"><i class="bx [webicon]"></i></button></a> [web]-->
<h1 ext-title>[name]<tag mg-left blue>[version]</tag></h1>
@endsection
@section('content')
<p>␀description␀</p>
<p>[description]</p>

View file

@ -1 +1 @@
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 text-center"><a href="{{ route('admin.extensions.␀id␀.index') }}"><button class="btn extension-btn" style="width:100%;margin-bottom:17px;"><img src="/assets/extensions/␀id␀/icon.jpg" alt="logo" class="extension-btn-image"><p class="extension-btn-text">␀name␀</p><p class="extension-btn-version">␀version␀</p></button></a></div>
<div class="col-lg-3 col-md-4 col-sm-6 col-xs-12 text-center"><a href="{{ route('admin.extensions.[id].index') }}"><button class="btn extension-btn" style="width:100%;margin-bottom:17px;"><img src="/assets/extensions/[id]/icon.jpg" alt="logo" class="extension-btn-image"><p class="extension-btn-text">[name]</p><p class="extension-btn-version">[version]</p></button></a></div>

View file

@ -1,6 +1,6 @@
<?php
namespace Pterodactyl\Http\Controllers\Admin\Extensions\␀id␀;
namespace Pterodactyl\Http\Controllers\Admin\Extensions\[id];
use Illuminate\View\View;
use Illuminate\View\Factory as ViewFactory;
@ -9,27 +9,27 @@ use Pterodactyl\Services\Helpers\SoftwareVersionService;
use Pterodactyl\BlueprintFramework\Libraries\ExtensionLibrary\Admin\BlueprintAdminLibrary as BlueprintExtensionLibrary;
class ␀id␀ExtensionController extends Controller
class [id]ExtensionController extends Controller
{
/**
* ␀id␀ExtensionController constructor.
*/
public function __construct(
private BlueprintExtensionLibrary $blueprint,
private SoftwareVersionService $version,
private ViewFactory $view
){}
/**
* [id]ExtensionController constructor.
*/
public function __construct(
private BlueprintExtensionLibrary $blueprint,
private SoftwareVersionService $version,
private ViewFactory $view
){}
/**
* Return the extension index view.
*/
public function index(): View
{
$rootPath = "/admin/extensions/␀id␀";
return $this->view->make('admin.extensions.␀id␀.index', [
'blueprint' => $this->blueprint,
'version' => $this->version,
'root' => $rootPath
]);
}
/**
* Return the extension index view.
*/
public function index(): View
{
$rootPath = "/admin/extensions/[id]";
return $this->view->make('admin.extensions.[id].index', [
'blueprint' => $this->blueprint,
'version' => $this->version,
'root' => $rootPath
]);
}
}

View file

@ -1 +1 @@
Route::group(['prefix' => 'extensions/␀id␀'], function () {Route::get('/', [Admin\Extensions\␀id␀\␀id␀ExtensionController::class, 'index'])->name('admin.extensions.␀id␀.index');Route::patch('/', [Admin\Extensions\␀id␀\␀id␀ExtensionController::class, 'update']);Route::post('/', [Admin\Extensions\␀id␀\␀id␀ExtensionController::class, 'post']);});
Route::group(['prefix' => 'extensions/[id]'], function () {Route::get('/', [Admin\Extensions\[id]\[id]ExtensionController::class, 'index'])->name('admin.extensions.[id].index');Route::patch('/', [Admin\Extensions\[id]\[id]ExtensionController::class, 'update']);Route::post('/', [Admin\Extensions\[id]\[id]ExtensionController::class, 'post']);});

View file

@ -25,7 +25,7 @@
</a>
</div>
<!--␀replace␀-->
<!-- [entry-placeholder] -->
@else