From abe6bccca61f17386ff662328e53b68078870a52 Mon Sep 17 00:00:00 2001 From: Felix <154911483+zfelyx@users.noreply.github.com> Date: Sun, 28 Dec 2025 04:32:14 +0100 Subject: [PATCH 1/3] Add egg tag check to determine log upload availability --- .../Components/Actions/UploadLogsAction.php | 47 ++++++++++++++++++- 1 file changed, 45 insertions(+), 2 deletions(-) diff --git a/mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php b/mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php index 977c042..d19c43f 100644 --- a/mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php +++ b/mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php @@ -22,10 +22,53 @@ protected function setUp(): void parent::setUp(); $this->hidden(function () { + $mc_tag = "mclogs-updater"; + /** @var Server $server */ $server = Filament::getTenant(); - return $server->retrieveStatus()->isOffline(); + if ($server->retrieveStatus()->isOffline()) { + return true; + } + $egg = $server->egg; + + // check if egg has tag 'mclogs-updater' + if (method_exists($egg, $mc_tag)) { + try { + $hasTag = $egg->tags()->where('name', $mc_tag)->exists(); + if ($hasTag) { + return false; + } + } catch (Exception $e) { + } + } + if (isset($egg->tags)) { + $tags = is_string($egg->tags) ? json_decode($egg->tags, true) : $egg->tags; + if (is_array($tags) && in_array($mc_tag, $tags)) { + return false; + } + } + if (isset($egg->meta) && is_array($egg->meta) && isset($egg->meta['tags'])) { + if (in_array($mc_tag, $egg->meta['tags'])) { + return false; + } + } + + try { + $eggTags = \DB::table('egg_tag') + ->join('tags', 'egg_tag.tag_id', '=', 'tags.id') + ->where('egg_tag.egg_id', $egg->id) + ->where('tags.name', $mc_tag) + ->exists(); + + if ($eggTags) { + return false; + } + } catch (Exception $e) { + + } + + return true; }); $this->label(fn () => trans('mclogs-uploader::upload.upload_logs')); @@ -82,4 +125,4 @@ protected function setUp(): void } }); } -} +} \ No newline at end of file From febc6adf9cfb4b9dc4141820ac201a66a65a4057 Mon Sep 17 00:00:00 2001 From: Felix <154911483+zfelyx@users.noreply.github.com> Date: Sun, 28 Dec 2025 04:42:30 +0100 Subject: [PATCH 2/3] Update README to include tag-based filtering for log upload button --- README.md | 6 +++--- mclogs-uploader/README.md | 38 +++++++++++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index d446ea6..a106e92 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ A curated list of plugins for the [Pelican Panel](https://pelican.dev). Feel fre ## How to install plugins -[Download the repository archive](https://github.com/pelican-dev/plugins/archive/refs/heads/main.zip) and extract the folders of the plugins you want to install to your panels `plugins` folder (`/var/www/pelican/plugins` by default). Finally, open your panel and head to the plugins page and click on "Install". +[Download the repository archive](https://github.com/pelican-dev/plugins/archive/refs/heads/main.zip) and extract the folders of the plugins you want to install to your panels `plugins` folder (`(/var/www/pelican/plugins` by default). Finally, open your panel and head to the plugins page and click on "Install". ## Plugins @@ -12,7 +12,7 @@ A curated list of plugins for the [Pelican Panel](https://pelican.dev). Feel fre - [Billing](/billing) - Allows users to purchase servers via Stripe - [Generic OIDC Providers](/generic-oidc-providers) - Create generic OIDC providers for authentication - [Legal Pages](/legal-pages) - Adds legal pages (Imprint, Privacy Policy, ToS) to the panel -- [MCLogs Uploader](/mclogs-uploader) - Upload console logs to mclo.gs +- [MCLogs Uploader](/mclogs-uploader) - Upload console logs to mclo.gs (add `mclogs-updater` tag to eggs to enable) - [Minecraft Modrinth](/minecraft-modrinth) - Download Minecraft mods & plugins from Modrinth - [Player Counter](/player-counter) - Show connected players count for game servers - [Register](/register) - Enable user self-registration on all panels @@ -32,4 +32,4 @@ A curated list of plugins for the [Pelican Panel](https://pelican.dev). Feel fre ## Language Packs -- [Pirate Language](/pirate-language) - Turns yer site's lingo into pirate talk, matey! +- [Pirate Language](/pirate-language) - Turns yer site's lingo into pirate talk, matey! \ No newline at end of file diff --git a/mclogs-uploader/README.md b/mclogs-uploader/README.md index 4ec9e92..368b4de 100644 --- a/mclogs-uploader/README.md +++ b/mclogs-uploader/README.md @@ -6,4 +6,40 @@ Upload server console logs to mclo.gs for easy sharing and troubleshooting. - One-click upload of console logs to mclo.gs - Integrated action button in the server console -- Perfect for (but not limited to) Minecraft server +- **Tag-based visibility**: Show upload button only for specific eggs +- Perfect for (but not limited to) Minecraft servers + +## Configuration + +### Tag-Based Filtering + +The upload button can be configured to only appear for servers using eggs with the `mclogs-updater` tag. + +#### How to enable: + +1. Navigate to the Egg configuration in your Pelican Panel +2. Add the tag `mclogs-updater` to eggs that support log uploading +3. The upload button will automatically appear only on servers using tagged eggs + +**Note:** If no eggs have the `mclogs-updater` tag, the button will be hidden for all servers. This ensures the plugin only appears where it's actually needed. + +## Usage + +1. Navigate to your server's console page +2. Click the "Upload logs" button (visible only if your egg has the `mclogs-updater` tag) +3. The current console logs will be uploaded to mclo.gs +4. You'll receive a shareable link in a notification + +## Requirements + +- Pelican Panel +- Server must be online to upload logs +- Egg must have the `mclogs-updater` tag (for tag-based filtering) + +## Installation + +Install via Pelican Panel's plugin system or manually place in the plugins directory. + +## Support + +For issues or feature requests, please visit the [GitHub repository](https://github.com/pelican-dev/plugins/tree/main/mclogs-uploader). \ No newline at end of file From 5febd36f4c680d96d87c11ff7e51f438ccf8cc0d Mon Sep 17 00:00:00 2001 From: Felix <154911483+zfelyx@users.noreply.github.com> Date: Sun, 28 Dec 2025 04:48:30 +0100 Subject: [PATCH 3/3] Refactor log upload availability check to simplify egg tag validation --- .../Components/Actions/UploadLogsAction.php | 42 +++---------------- 1 file changed, 5 insertions(+), 37 deletions(-) diff --git a/mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php b/mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php index d19c43f..e558902 100644 --- a/mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php +++ b/mclogs-uploader/src/Filament/Components/Actions/UploadLogsAction.php @@ -22,53 +22,21 @@ protected function setUp(): void parent::setUp(); $this->hidden(function () { - $mc_tag = "mclogs-updater"; - /** @var Server $server */ $server = Filament::getTenant(); if ($server->retrieveStatus()->isOffline()) { return true; } - $egg = $server->egg; - // check if egg has tag 'mclogs-updater' - if (method_exists($egg, $mc_tag)) { - try { - $hasTag = $egg->tags()->where('name', $mc_tag)->exists(); - if ($hasTag) { - return false; - } - } catch (Exception $e) { - } - } - if (isset($egg->tags)) { - $tags = is_string($egg->tags) ? json_decode($egg->tags, true) : $egg->tags; - if (is_array($tags) && in_array($mc_tag, $tags)) { - return false; - } - } - if (isset($egg->meta) && is_array($egg->meta) && isset($egg->meta['tags'])) { - if (in_array($mc_tag, $egg->meta['tags'])) { - return false; - } - } - - try { - $eggTags = \DB::table('egg_tag') - ->join('tags', 'egg_tag.tag_id', '=', 'tags.id') - ->where('egg_tag.egg_id', $egg->id) - ->where('tags.name', $mc_tag) - ->exists(); - - if ($eggTags) { - return false; - } - } catch (Exception $e) { + $egg = $server->egg; + $mcTag = 'mclogs-updater'; + if (!in_array($mcTag, $egg->tags ?? [])) { + return true; } - return true; + return false; }); $this->label(fn () => trans('mclogs-uploader::upload.upload_logs'));