Merge branch 'main' into charles/filament-v5

This commit is contained in:
notCharles
2026-02-23 15:44:27 -05:00
20 changed files with 131 additions and 93 deletions

View File

@@ -69,8 +69,7 @@ RUN apk add --no-cache \
zip unzip 7zip bzip2-dev yarn git
# Copy composer binary for runtime plugin dependency management
COPY --from=composer /usr/local/bin/composer /usr/local/bin/composer
COPY --from=composer /usr/local/bin/composer /usr/local/bin/composer
COPY --chown=root:www-data --chmod=770 --from=composerbuild /build .
COPY --chown=root:www-data --chmod=770 --from=yarnbuild /build/public ./public

View File

@@ -74,8 +74,7 @@ RUN apk add --no-cache \
zip unzip 7zip bzip2-dev yarn git
# Copy composer binary for runtime plugin dependency management
COPY --from=composer /usr/local/bin/composer /usr/local/bin/composer
COPY --from=composer /usr/local/bin/composer /usr/local/bin/composer
COPY --chown=root:www-data --chmod=770 --from=composerbuild /build .
COPY --chown=root:www-data --chmod=770 --from=yarnbuild /build/public ./public

View File

@@ -8,7 +8,6 @@ use App\Services\Eggs\Sharing\EggExporterService;
use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
use JsonException;
use Symfony\Component\Yaml\Yaml;
class CheckEggUpdatesCommand extends Command
@@ -22,14 +21,12 @@ class CheckEggUpdatesCommand extends Command
try {
$this->check($egg, $exporterService);
} catch (Exception $exception) {
$this->error("{$egg->name}: Error ({$exception->getMessage()})");
$this->error("$egg->name: Error ({$exception->getMessage()})");
}
}
}
/**
* @throws JsonException
*/
/** @throws Exception */
private function check(Egg $egg, EggExporterService $exporterService): void
{
if (is_null($egg->update_url)) {
@@ -45,7 +42,13 @@ class CheckEggUpdatesCommand extends Command
? Yaml::parse($exporterService->handle($egg->id, EggFormat::YAML))
: json_decode($exporterService->handle($egg->id, EggFormat::JSON), true);
$remote = Http::timeout(5)->connectTimeout(1)->get($egg->update_url)->throw()->body();
$remote = Http::timeout(5)->connectTimeout(1)->get($egg->update_url);
if ($remote->failed()) {
throw new Exception("HTTP request returned status code {$remote->status()}");
}
$remote = $remote->body();
$remote = $isYaml ? Yaml::parse($remote) : json_decode($remote, true);
unset($local['exported_at'], $remote['exported_at']);

View File

@@ -16,7 +16,7 @@ class DisablePluginCommand extends Command
{
$id = $this->argument('id') ?? $this->choice('Plugin', Plugin::pluck('name', 'id')->toArray());
$plugin = Plugin::find($id);
$plugin = Plugin::find(str($id)->lower()->toString());
if (!$plugin) {
$this->error('Plugin does not exist!');

View File

@@ -18,7 +18,7 @@ class InstallPluginCommand extends Command
{
$id = $this->argument('id') ?? $this->choice('Plugin', Plugin::pluck('name', 'id')->toArray());
$plugin = Plugin::find($id);
$plugin = Plugin::find(str($id)->lower()->toString());
if (!$plugin) {
$this->error('Plugin does not exist!');

View File

@@ -18,7 +18,7 @@ class UninstallPluginCommand extends Command
{
$id = $this->argument('id') ?? $this->choice('Plugin', Plugin::pluck('name', 'id')->toArray());
$plugin = Plugin::find($id);
$plugin = Plugin::find(str($id)->lower()->toString());
if (!$plugin) {
$this->error('Plugin does not exist!');

View File

@@ -17,7 +17,7 @@ class UpdatePluginCommand extends Command
{
$id = $this->argument('id') ?? $this->choice('Plugin', Plugin::pluck('name', 'id')->toArray());
$plugin = Plugin::find($id);
$plugin = Plugin::find(str($id)->lower()->toString());
if (!$plugin) {
$this->error('Plugin does not exist!');

View File

@@ -485,18 +485,20 @@ class EditEgg extends EditRecord
],
]);
$normalizedExtension = match ($extension) {
'svg+xml', 'svg' => 'svg',
'jpeg', 'jpg' => 'jpg',
'png' => 'png',
'webp' => 'webp',
default => throw new Exception(trans('admin/egg.import.unknown_extension')),
};
$data = @file_get_contents($imageUrl, false, $context, 0, 1048576); // 1024KB
if (empty($data)) {
throw new Exception(trans('admin/egg.import.invalid_url'));
}
$normalizedExtension = match ($extension) {
'svg+xml' => 'svg',
'jpeg' => 'jpg',
default => $extension,
};
Storage::disk('public')->put(Egg::ICON_STORAGE_PATH . "/$egg->uuid.$normalizedExtension", $data);
}

View File

@@ -121,6 +121,7 @@ class EditServer extends EditRecord
->columnSpan(2)
->alignJustify(),
Action::make('uploadIcon')
->hiddenLabel()
->icon(TablerIcon::PhotoUp)
->tooltip(trans('admin/server.import_image'))
->modal()
@@ -1126,7 +1127,7 @@ class EditServer extends EditRecord
->hidden(fn () => $canForceDelete)
->authorize(fn (Server $server) => user()?->can('delete server', $server))
->icon(TablerIcon::Trash),
Action::make('ForceDelete')
Action::make('exclude_force_delete')
->color('danger')
->label(trans('filament-actions::force-delete.single.label'))
->modalHeading(trans('filament-actions::force-delete.single.modal.heading', ['label' => $this->getRecordTitle()]))
@@ -1218,18 +1219,20 @@ class EditServer extends EditRecord
],
]);
$normalizedExtension = match ($extension) {
'svg+xml', 'svg' => 'svg',
'jpeg', 'jpg' => 'jpg',
'png' => 'png',
'webp' => 'webp',
default => throw new Exception(trans('admin/egg.import.unknown_extension')),
};
$data = @file_get_contents($imageUrl, false, $context, 0, 262144); //256KB
if (empty($data)) {
throw new \Exception(trans('admin/egg.import.invalid_url'));
throw new Exception(trans('admin/egg.import.invalid_url'));
}
$normalizedExtension = match ($extension) {
'svg+xml' => 'svg',
'jpeg' => 'jpg',
default => $extension,
};
Storage::disk('public')->put(Server::ICON_STORAGE_PATH . "/$server->uuid.$normalizedExtension", $data);
}
}

View File

@@ -426,13 +426,13 @@ class EditProfile extends BaseEditProfile
->label(trans('profile.tabs.activity'))
->icon(TablerIcon::History)
->schema([
Repeater::make('activity')
->hiddenLabel()
Repeater::make('activity') // TODO: move to a table
->label(trans('profile.activity_info'))
->inlineLabel(false)
->deletable(false)
->addable(false)
->relationship(null, function (Builder $query) {
$query->orderBy('timestamp', 'desc');
$query->orderBy('timestamp', 'desc')->limit(50);
})
->schema([
TextEntry::make('log')

View File

@@ -462,18 +462,20 @@ class Settings extends ServerFormPage
],
]);
$normalizedExtension = match ($extension) {
'svg+xml', 'svg' => 'svg',
'jpeg', 'jpg' => 'jpg',
'png' => 'png',
'webp' => 'webp',
default => throw new Exception(trans('admin/egg.import.unknown_extension')),
};
$data = @file_get_contents($imageUrl, false, $context, 0, 262144); //256KB
if (empty($data)) {
throw new \Exception(trans('admin/egg.import.invalid_url'));
throw new Exception(trans('admin/egg.import.invalid_url'));
}
$normalizedExtension = match ($extension) {
'svg+xml' => 'svg',
'jpeg' => 'jpg',
default => $extension,
};
Storage::disk('public')->put(Server::ICON_STORAGE_PATH . "/$server->uuid.$normalizedExtension", $data);
}

View File

@@ -109,13 +109,11 @@ class Plugin extends Model implements HasPluginSettings
continue;
}
$plugin = Str::lower($plugin);
try {
$data = File::json($path, JSON_THROW_ON_ERROR);
$data['id'] = Str::lower($data['id']);
if ($data['id'] !== $plugin) {
if ($data['id'] !== Str::lower($plugin)) {
throw new PluginIdMismatchException("Plugin id mismatch for folder name ($plugin) and id in plugin.json ({$data['id']})!");
}
@@ -161,7 +159,7 @@ class Plugin extends Model implements HasPluginSettings
if (!$exception instanceof JsonException) {
$plugins[] = [
'id' => $data['id'] ?? Str::uuid(),
'id' => $exception instanceof PluginIdMismatchException ? $plugin : ($data['id'] ?? Str::uuid()),
'name' => $data['name'] ?? Str::headline($plugin),
'author' => $data['author'] ?? 'Unknown',
'version' => $data['version'] ?? '0.0.0',

View File

@@ -39,7 +39,7 @@ class PluginService
/** @var ClassLoader $classLoader */
$classLoader = File::getRequire(base_path('vendor/autoload.php'));
$plugins = Plugin::query()->orderBy('load_order')->get();
$plugins = Plugin::orderBy('load_order')->get();
foreach ($plugins as $plugin) {
try {
// Filter out plugins that are not compatible with the current panel version
@@ -138,7 +138,7 @@ class PluginService
return;
}
$plugins = Plugin::query()->orderBy('load_order')->get();
$plugins = Plugin::orderBy('load_order')->get();
foreach ($plugins as $plugin) {
try {
if (!$plugin->shouldLoad($panel->getId())) {
@@ -172,7 +172,7 @@ class PluginService
{
$newPackages ??= [];
$plugins = Plugin::query()->orderBy('load_order')->get();
$plugins = Plugin::orderBy('load_order')->get();
foreach ($plugins as $plugin) {
if (!$plugin->composer_packages) {
continue;
@@ -434,7 +434,7 @@ class PluginService
/** @param array<string, mixed> $data */
private function setMetaData(string|Plugin $plugin, array $data): void
{
$path = plugin_path($plugin instanceof Plugin ? $plugin->id : $plugin, 'plugin.json');
$path = plugin_path($plugin->id, 'plugin.json');
if (File::exists($path)) {
$pluginData = File::json($path, JSON_THROW_ON_ERROR);
@@ -443,7 +443,6 @@ class PluginService
File::put($path, json_encode($pluginData, JSON_THROW_ON_ERROR | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
$plugin = $plugin instanceof Plugin ? $plugin : Plugin::findOrFail($plugin);
$plugin->update($metaData);
}
}
@@ -464,6 +463,8 @@ class PluginService
public function updateLoadOrder(array $order): void
{
foreach ($order as $i => $plugin) {
$plugin = Plugin::firstOrFail(str($plugin)->lower()->toString());
$this->setMetaData($plugin, [
'load_order' => $i,
]);
@@ -472,7 +473,7 @@ class PluginService
public function hasThemePluginEnabled(): bool
{
$plugins = Plugin::query()->orderBy('load_order')->get();
$plugins = Plugin::orderBy('load_order')->get();
foreach ($plugins as $plugin) {
if ($plugin->isTheme() && $plugin->status === PluginStatus::Enabled) {
return true;
@@ -487,7 +488,7 @@ class PluginService
{
$languages = [];
$plugins = Plugin::query()->orderBy('load_order')->get();
$plugins = Plugin::orderBy('load_order')->get();
foreach ($plugins as $plugin) {
if ($plugin->status !== PluginStatus::Enabled || !$plugin->isLanguage()) {
continue;
@@ -504,7 +505,7 @@ class PluginService
return config('panel.plugin.dev_mode', false);
}
private function handlePluginException(string|Plugin $plugin, Exception $exception): void
private function handlePluginException(Plugin $plugin, Exception $exception): void
{
if ($this->isDevModeActive()) {
throw ($exception);

View File

@@ -13,11 +13,11 @@
"calebporzio/sushi": "^2.5",
"dedoc/scramble": "^0.13",
"filament/filament": "~5.0",
"gboquizosanchez/filament-log-viewer": "^2.1",
"gboquizosanchez/filament-log-viewer": "^2.2",
"guzzlehttp/guzzle": "^7.10",
"laravel/framework": "^12.51",
"laravel/framework": "^12.52",
"laravel/helpers": "^1.8",
"laravel/sanctum": "^4.2",
"laravel/sanctum": "^4.3",
"laravel/socialite": "^5.24",
"laravel/tinker": "^2.10.1",
"laravel/ui": "^4.6",
@@ -35,7 +35,7 @@
"socialiteproviders/steam": "^4.3",
"spatie/laravel-data": "^4.19",
"spatie/laravel-fractal": "^6.3",
"spatie/laravel-health": "^1.34",
"spatie/laravel-health": "^1.37",
"spatie/laravel-permission": "^6.24",
"spatie/laravel-query-builder": "^6.4",
"spatie/temporary-directory": "^2.3",

2
composer.lock generated
View File

@@ -15056,5 +15056,5 @@
"platform-overrides": {
"php": "8.3"
},
"plugin-api-version": "2.9.0"
"plugin-api-version": "2.6.0"
}

View File

@@ -8,29 +8,35 @@ return new class extends Migration
{
$mappings = [
// Forge Minecraft
'ed072427-f209-4603-875c-f540c6dd5a65' => [
'new_uuid' => 'd6018085-eecc-42bf-bf8c-51ea45a69ace',
'd6018085-eecc-42bf-bf8c-51ea45a69ace' => [
'new_uuid' => 'ed072427-f209-4603-875c-f540c6dd5a65',
'new_update_url' => 'https://raw.githubusercontent.com/pelican-eggs/minecraft/refs/heads/main/java/forge/egg-forge-minecraft.yaml',
],
// Paper
'5da37ef6-58da-4169-90a6-e683e1721247' => [
'new_uuid' => '150956be-4164-4086-9057-631ae95505e9',
'150956be-4164-4086-9057-631ae95505e9' => [
'new_uuid' => '5da37ef6-58da-4169-90a6-e683e1721247',
'new_update_url' => 'https://raw.githubusercontent.com/pelican-eggs/minecraft/refs/heads/main/java/paper/egg-paper.yaml',
],
// Garrys Mod
'60ef81d4-30a2-4d98-ab64-f59c69e2f915' => [
'new_uuid' => 'c0b2f96a-f753-4d82-a73e-6e5be2bbadd5',
'c0b2f96a-f753-4d82-a73e-6e5be2bbadd5' => [
'new_uuid' => '60ef81d4-30a2-4d98-ab64-f59c69e2f915',
'new_update_url' => 'https://raw.githubusercontent.com/pelican-eggs/games-steamcmd/refs/heads/main/gmod/egg-garrys-mod.yaml',
],
];
foreach ($mappings as $oldUuid => $newData) {
DB::table('eggs')->where('uuid', $oldUuid)->update([
'uuid' => $newData['new_uuid'],
'update_url' => $newData['new_update_url'],
]);
if (DB::table('eggs')->where('uuid', $newData['new_uuid'])->exists()) {
DB::table('eggs')->where('uuid', $newData['new_uuid'])->update([
'update_url' => $newData['new_update_url'],
]);
} else {
DB::table('eggs')->where('uuid', $oldUuid)->update([
'uuid' => $newData['new_uuid'],
'update_url' => $newData['new_update_url'],
]);
}
}
}

View File

@@ -5,11 +5,11 @@
{$CADDY_STRICT_PROXIES}
}
admin off
{$PARSED_AUTO_HTTPS}
{$PARSED_LE_EMAIL}
{$CADDY_AUTO_HTTPS}
{$CADDY_LE_EMAIL}
}
{$PARSED_APP_URL} {
{$CADDY_APP_URL} {
root * /var/www/html/public
encode gzip

View File

@@ -1,34 +1,48 @@
#!/bin/ash -e
# shellcheck shell=dash
# check for .env file or symlink and generate app keys if missing
if [ -f /var/www/html/.env ]; then
echo "external vars exist."
if [ -f /pelican-data/.env ]; then
echo ".env vars exist."
# load specific env vars from .env used in the entrypoint and they are not already set
for VAR in "APP_KEY" "APP_INSTALLED" "DB_CONNECTION" "DB_HOST" "DB_PORT"; do if ! (printenv | grep -q ${VAR}); then export $(grep ${VAR} .env | grep -ve "^#"); fi; done
for VAR in "APP_KEY" "APP_INSTALLED" "DB_CONNECTION" "DB_HOST" "DB_PORT"; do
echo "checking for ${VAR}"
## skip if it looks like it might try to execute code
if (grep "${VAR}" .env | grep -qE "\$\(|=\`|\$#"); then echo "var in .env may be executable or a comment, skipping"; continue; fi
# if the variable is in .env then set it
if (grep -q "${VAR}" .env); then
echo "loading ${VAR} from .env"
export "$(grep "${VAR}" .env | sed 's/"//g')"
continue
fi
## variable wasn't loaded or in the env to set
echo "didn't find variable to set"
done
else
echo "external vars don't exist."
echo ".env vars don't exist."
# webroot .env is symlinked to this path
touch /pelican-data/.env
# manually generate a key because key generate --force fails
if [ -z ${APP_KEY} ]; then
echo -e "Generating key."
if [ -z "${APP_KEY}" ]; then
echo "No key set, Generating key."
APP_KEY=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1)
echo -e "Generated app key: $APP_KEY"
echo -e "APP_KEY=$APP_KEY" > /pelican-data/.env
echo "APP_KEY=$APP_KEY" > /pelican-data/.env
echo "Generated app key written to .env file"
else
echo -e "APP_KEY exists in environment, using that."
echo -e "APP_KEY=$APP_KEY" > /pelican-data/.env
echo "APP_KEY exists in environment, using that."
echo "APP_KEY=$APP_KEY" > /pelican-data/.env
fi
# enable installer
echo -e "APP_INSTALLED=false" >> /pelican-data/.env
echo "APP_INSTALLED=false" >> /pelican-data/.env
fi
# create directories for volumes
mkdir -p /pelican-data/database /pelican-data/storage/avatars /pelican-data/storage/fonts /pelican-data/storage/icons /pelican-data/plugins /var/www/html/storage/logs/supervisord 2>/dev/null
# if the app is installed then we need to run migrations on start. New installs will run migrations when you run the installer.
if [ "${APP_INSTALLED}" == "true" ]; then
if [ "${APP_INSTALLED}" = "true" ]; then
#if the db is anything but sqlite wait until it's accepting connections
if [ "${DB_CONNECTION}" != "sqlite" ]; then
# check for DB up before starting the panel
@@ -39,36 +53,44 @@ if [ "${APP_INSTALLED}" == "true" ]; then
# wait for 1 seconds before check again
sleep 1
done
else
echo "using sqlite database"
fi
# run migration
php artisan migrate --force
fi
echo -e "Optimizing Filament"
echo "Optimizing Filament"
php artisan filament:optimize
# default to caddy not starting
export SUPERVISORD_CADDY=false
export PARSED_APP_URL=${APP_URL}
export CADDY_APP_URL="${APP_URL}"
# checking if app url is using https
if echo "${APP_URL}" | grep -qE '^https://'; then
# checking if app url is https
if (echo "${APP_URL}" | grep -qE '^https://'); then
# check lets encrypt email was set without a proxy
if [ -z "${LE_EMAIL}" ] && [ "${BEHIND_PROXY}" != "true" ]; then
echo "when app url is https a lets encrypt email must be set when not behind a proxy"
exit 1
fi
echo "https domain found setting email var"
export PARSED_LE_EMAIL="email ${LE_EMAIL}"
export CADDY_LE_EMAIL="email ${LE_EMAIL}"
fi
# when running behind a proxy
if [ "${BEHIND_PROXY}" == "true" ]; then
if [ "${BEHIND_PROXY}" = "true" ]; then
echo "running behind proxy"
echo "listening on port 80 internally"
export PARSED_LE_EMAIL=""
export PARSED_APP_URL=":80"
export PARSED_AUTO_HTTPS="auto_https off"
export ASSET_URL=${APP_URL}
export CADDY_LE_EMAIL=""
export CADDY_APP_URL=":80"
export CADDY_AUTO_HTTPS="auto_https off"
export ASSET_URL="${APP_URL}"
fi
# disable caddy if SKIP_CADDY is set
if [ "${SKIP_CADDY:-}" == "true" ]; then
if [ "${SKIP_CADDY:-}" = "true" ]; then
echo "Starting PHP-FPM only"
else
echo "Starting PHP-FPM and Caddy"
@@ -76,8 +98,9 @@ else
export SUPERVISORD_CADDY=true
# handle trusted proxies for caddy when variable has data
if [ ! -z ${TRUSTED_PROXIES} ]; then
export CADDY_TRUSTED_PROXIES=$(echo "trusted_proxies static ${TRUSTED_PROXIES}" | sed 's/,/ /g')
if [ -n "${TRUSTED_PROXIES:-}" ]; then
FORMATTED_PROXIES=$(echo "trusted_proxies static ${TRUSTED_PROXIES}" | sed 's/,/ /g')
export CADDY_TRUSTED_PROXIES="${FORMATTED_PROXIES}"
export CADDY_STRICT_PROXIES="trusted_proxies_strict"
fi
fi

View File

@@ -31,6 +31,7 @@ return [
'no_local_ip' => 'Local IP Addresses are not allowed',
'unsupported_format' => 'Unsupported Format. Supported Formats: :formats',
'invalid_url' => 'The provided URL is invalid',
'unknown_extension' => 'Unknown image extension',
'image_deleted' => 'Image Deleted',
'no_image' => 'No Image Provided',
'image_updated' => 'Image Updated',

View File

@@ -69,4 +69,5 @@ return [
'no_oauth' => 'No Accounts Linked',
'no_api_keys' => 'No API Keys',
'no_ssh_keys' => 'No SSH Keys',
'activity_info' => 'Showing last 50 activity logs',
];