Fix indentation on VariableService and fix installation check.

Now the installation will be marked as installed after the installation script ends.
This commit is contained in:
purple 2023-06-20 18:08:25 +02:00
parent 9243e01498
commit a52ec1a3c1
4 changed files with 45 additions and 35 deletions

View file

@ -22,4 +22,10 @@ class BlueprintPlaceholderService
$v = "&bp.folder&";
return $v;
}
// installed()
public function installed(): string {
$v = "NOTINSTALLED";
return $v;
}
}

View file

@ -6,44 +6,47 @@ use Pterodactyl\Services\Helpers\BlueprintPlaceholderService;
class BlueprintVariableService
{
// Construct BlueprintVariableService
public function __construct(
private SettingsRepositoryInterface $settings,
private BlueprintPlaceholderService $blueprintplaceholderservice,
) {
}
// Construct BlueprintVariableService
public function __construct(
private SettingsRepositoryInterface $settings,
private BlueprintPlaceholderService $blueprintplaceholderservice,
) {
}
// $bp->serve()
// $bp->version()
// $bp->dbGet('db::record')
// $bp->dbSet('db::record', 'value')
// $bp->exec('arguments')
public function serve(): void {
return;
}
// $bp->serve()
// $bp->isInstalled()
// $bp->version()
// $bp->dbGet('db::record')
// $bp->dbSet('db::record', 'value')
// $bp->exec('arguments')
public function serve(): void {
return;
}
public function version(): string {
return $this->blueprintplaceholderservice->version();
}
public function version(): string {
return $this->blueprintplaceholderservice->version();
}
public function dbGet($key): string {
$a = $this->settings->get("blueprint::".$key);
if (!$a) {
return "";
} else {
return $a;
};
}
public function isInstalled(): string {
return $this->blueprintplaceholderservice->installed();
}
public function dbSet($key, $value): void
{
$this->settings->set('blueprint::' . $key, $value);
return;
}
public function dbGet($key): string {
$a = $this->settings->get("blueprint::".$key);
if (!$a) {
return "";
} else {
return $a;
};
}
public function exec($arg): string|null
{
return shell_exec("cd /var/www/".$this->blueprintplaceholderservice->folder().";bash blueprint.sh -exec ".$arg);
}
public function dbSet($key, $value): void {
$this->settings->set('blueprint::' . $key, $value);
return;
}
public function exec($arg): string|null {
return shell_exec("cd /var/www/".$this->blueprintplaceholderservice->folder().";bash blueprint.sh -exec ".$arg);
}
}

View file

@ -127,6 +127,7 @@ if [[ $1 != "-bash" ]]; then
fi;
dbAdd "blueprint.setupFinished";
sed -i "s!NOTINSTALLED!INSTALLED!g" /var/www/$FOLDER/app/Services/Helpers/BlueprintPlaceholderService.php;
exit 1;
fi;
fi;

View file

@ -13,7 +13,7 @@
@endsection
@section('content')
@if($bp->version() != "&bp.version&")
@if($bp->isInstalled() != "NOTINSTALLED")
<div class="col-xs-6 col-sm-3 text-center">
<a href="{{ route('admin.extensions.blueprint.index') }}"><button class="btn btn-gray" style="width:100%;margin-bottom:17px;"><img src="/assets/extensions/blueprint/logo.jpg" alt="logo" class="img-btn"> Blueprint <small>{{ $bp->version() }}</small></button></a>