-
Notifications
You must be signed in to change notification settings - Fork 45
arma-reforger-workshop - Plugin for managing Arma Reforger mods. #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
4409b9b
feat: add arma-reforger-workshop plugin
szpolny 4111baf
browse workshop directly in browser
szpolny 9914044
readme for arma-reforger-workshop plugin
szpolny 0b04697
Merge branch 'main' into arma-reforger-main
Boy132 c697d86
Merge branch 'pelican-dev:main' into main
szpolny f042ae1
fix: correct string interpolation in mod notifications
szpolny 408ae7a
eliminate n+1 calls
szpolny 8befb7b
fix pint
szpolny 4e6ca23
use localization strings instead of hardcoded texts
szpolny b47ada7
enhance mod enrichment with concurrent requests and caching
szpolny 87b02a4
normalize modId to uppercase for consistent comparison
szpolny 1eade90
improve caching for errors
szpolny 44722db
laravel pint
szpolny 303de44
fix: correct URL generation for config path by trimming trailing dots
szpolny e31629f
fix for caching issues
szpolny 0f2798e
replace __('...') with trans('...')
szpolny f287ef4
allow nullable version parameter in addMod method
szpolny a9373b9
replace __('...') with trans('...') for localization consistency
szpolny c24e825
update translations
szpolny cd16777
refactor mod details handling: replace parseModDetailsFromResponse wi…
szpolny e7864ea
Merge branch 'main' into arma-reforger-main
Boy132 bc42c5c
fix phpstan issues
szpolny 307078b
pint fix
szpolny cc9b266
type hint fix
szpolny 216abdf
another fix for phpstan
szpolny 2b564ee
remove getModDetails method
szpolny 36feff0
reset the installed mods cache after successful installation
szpolny 0a1690b
update readme
Boy132 346b2b7
simplify phpdoc
Boy132 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,61 @@ | ||
| # Arma Reforger Workshop Plugin | ||
|
|
||
| A Pelican Panel plugin for managing Arma Reforger workshop mods directly from the server panel. | ||
|
|
||
| ## Features | ||
|
|
||
| - **View Installed Mods** - See all mods currently configured in your server's `config.json` | ||
| - **Add Mods** - Add mods by entering their Workshop ID (GUID) | ||
| - **Remove Mods** - Remove mods from your server configuration | ||
| - **Browse Workshop** - Search and browse mods from the Bohemia Arma Reforger Workshop directly in the panel | ||
| - **One-Click Install** - Add mods to your server directly from the workshop browser | ||
| - **Mod Details** - View version, subscriber count, downloads, and ratings for each mod | ||
|
|
||
| ## Requirements | ||
|
|
||
| Your server egg must have one of the following: | ||
| - Feature: `arma_reforger_workshop` | ||
| - Tag: `arma_reforger` or `arma-reforger` | ||
|
|
||
| ## Configuration | ||
|
|
||
| The plugin automatically detects the server's config file location. By default, it looks for `config.json` in the server root. | ||
|
|
||
| You can customize the config path by adding a `CONFIG_FILE` server variable in your egg. | ||
|
|
||
| ## How It Works | ||
|
|
||
| Arma Reforger servers use a `config.json` file where mods are listed in the `game.mods` array: | ||
|
|
||
| ```json | ||
| { | ||
| "game": { | ||
| "mods": [ | ||
| { | ||
| "modId": "5965550F24A0C152", | ||
| "name": "Where Am I", | ||
| "version": "1.2.0" | ||
| } | ||
| ] | ||
| } | ||
| } | ||
| ``` | ||
|
|
||
| This plugin provides a user-friendly interface to manage this configuration without manually editing the JSON file. | ||
|
|
||
| ## Workshop Integration | ||
|
|
||
| The plugin integrates with the [Bohemia Arma Reforger Workshop](https://reforger.armaplatform.com/workshop) to: | ||
|
|
||
| - Fetch mod details (name, version, subscribers, downloads, rating) | ||
| - Search for mods by name | ||
| - Browse popular mods | ||
| - Display mod thumbnails and descriptions | ||
|
|
||
| Mod data is cached to improve performance: | ||
| - Individual mod details: 6 hours | ||
| - Workshop search results: 15 minutes | ||
|
|
||
| ## Author | ||
|
|
||
| **spolny** |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| <?php | ||
|
|
||
| return [ | ||
| 'navigation' => [ | ||
| 'workshop_mods' => 'Workshop Mods', | ||
| ], | ||
| 'labels' => [ | ||
| 'mod_id' => 'Mod ID', | ||
| 'mod_name' => 'Mod Name', | ||
| 'version' => 'Version', | ||
| 'subscribers' => 'Subscribers', | ||
| 'downloads' => 'Downloads', | ||
| 'rating' => 'Rating', | ||
| 'config_path' => 'Config Path', | ||
| 'installed_mods' => 'Installed Mods', | ||
| ], | ||
| 'actions' => [ | ||
| 'add_mod' => 'Add Mod', | ||
| 'browse_workshop' => 'Browse Workshop', | ||
| 'edit_config' => 'Edit Config', | ||
| 'remove' => 'Remove', | ||
| ], | ||
| 'form' => [ | ||
| 'mod_id_helper' => 'Enter the mod ID (GUID) from the Bohemia Workshop. Example: 5965550F24A0C152', | ||
| 'mod_name_helper' => 'A friendly name for the mod', | ||
| 'version_placeholder' => 'Optional - leave empty for latest', | ||
| ], | ||
| 'modals' => [ | ||
| 'remove_mod_heading' => 'Remove Mod', | ||
| 'remove_mod_description' => 'Are you sure you want to remove ":name" from your server\'s mod list?', | ||
| ], | ||
| 'notifications' => [ | ||
| 'mod_added' => 'Mod added', | ||
| 'mod_added_body' => '\':name\' has been added to your server configuration.', | ||
| 'mod_removed' => 'Mod removed', | ||
| 'mod_removed_body' => '\':name\' has been removed from your server configuration.', | ||
| 'failed_to_add' => 'Failed to add mod', | ||
| 'failed_to_remove' => 'Failed to remove mod', | ||
| 'config_update_failed' => 'Could not update the server configuration.', | ||
| ], | ||
| ]; | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,17 @@ | ||
| { | ||
| "id": "arma-reforger-workshop", | ||
| "name": "Arma Reforger Workshop", | ||
| "author": "spolny", | ||
| "version": "1.0.0", | ||
| "description": "Manage Arma Reforger workshop mods in server config", | ||
| "category": "plugin", | ||
| "url": "https://github.com/pelican-dev/plugins/tree/main/arma-reforger-workshop", | ||
| "update_url": null, | ||
| "namespace": "spolny\\ArmaReforgerWorkshop", | ||
| "class": "ArmaReforgerWorkshopPlugin", | ||
| "panels": [ | ||
| "server" | ||
| ], | ||
| "panel_version": null, | ||
| "composer_packages": null | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| <?php | ||
|
|
||
| namespace spolny\ArmaReforgerWorkshop; | ||
|
|
||
| use Filament\Contracts\Plugin; | ||
| use Filament\Panel; | ||
|
|
||
| class ArmaReforgerWorkshopPlugin implements Plugin | ||
| { | ||
| public function getId(): string | ||
| { | ||
| return 'arma-reforger-workshop'; | ||
| } | ||
|
|
||
| public function register(Panel $panel): void | ||
| { | ||
| $id = str($panel->getId())->title(); | ||
|
|
||
| $panel->discoverPages(plugin_path($this->getId(), "src/Filament/$id/Pages"), "spolny\\ArmaReforgerWorkshop\\Filament\\$id\\Pages"); | ||
| } | ||
|
|
||
| public function boot(Panel $panel): void {} | ||
| } |
29 changes: 29 additions & 0 deletions
29
arma-reforger-workshop/src/Facades/ArmaReforgerWorkshop.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <?php | ||
|
|
||
| namespace spolny\ArmaReforgerWorkshop\Facades; | ||
|
|
||
| use App\Models\Server; | ||
| use App\Repositories\Daemon\DaemonFileRepository; | ||
| use spolny\ArmaReforgerWorkshop\Services\ArmaReforgerWorkshopService; | ||
| use Illuminate\Support\Facades\Facade; | ||
|
|
||
| /** | ||
| * @method static bool isArmaReforgerServer(Server $server) | ||
| * @method static array<int, array{modId: string, name: string, version: string}> getInstalledMods(Server $server, DaemonFileRepository $fileRepository) | ||
| * @method static string getConfigPath(Server $server) | ||
| * @method static bool addMod(Server $server, DaemonFileRepository $fileRepository, string $modId, string $name, string $version = '') | ||
| * @method static bool removeMod(Server $server, DaemonFileRepository $fileRepository, string $modId) | ||
| * @method static string getModWorkshopUrl(string $modId) | ||
| * @method static array<string, mixed> getModDetails(string $modId) | ||
| * @method static array{mods: array, total: int, page: int, perPage: int} browseWorkshop(string $search = '', int $page = 1) | ||
| * @method static bool isModInstalled(Server $server, DaemonFileRepository $fileRepository, string $modId) | ||
| * | ||
| * @see ArmaReforgerWorkshopService | ||
| */ | ||
| class ArmaReforgerWorkshop extends Facade | ||
| { | ||
| protected static function getFacadeAccessor(): string | ||
| { | ||
| return ArmaReforgerWorkshopService::class; | ||
| } | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.