|
| 1 | +--- |
| 2 | +layout: default |
| 3 | +title: Plugin Architecture |
| 4 | +--- |
| 5 | + |
| 6 | +<div class="jumbotron jumbotron-compact"> |
| 7 | + <div class="container"> |
| 8 | + <h1> |
| 9 | + <a href="/xerahs/">XerahS</a> |
| 10 | + </h1> |
| 11 | + <p>Plugin Architecture</p> |
| 12 | + </div> |
| 13 | +</div> |
| 14 | + |
| 15 | +<div class="container"> |
| 16 | + <div class="row"> |
| 17 | + <div class="col-lg-12"> |
| 18 | + <h1>Plugin-Based Architecture</h1> |
| 19 | + <p class="lead">XerahS features a modular, plugin-based architecture for upload destinations, enabling the community to easily extend functionality without modifying the core codebase.</p> |
| 20 | + |
| 21 | + <h2 class="mt-4">Overview</h2> |
| 22 | + <p>Unlike ShareX, where all uploaders are compiled into the main application, XerahS isolates destinations into standalone plugins. This ensures:</p> |
| 23 | + <ul> |
| 24 | + <li><strong>Modularity:</strong> Users only install what they need, keeping the base application lightweight.</li> |
| 25 | + <li><strong>Stability:</strong> Issues in a single plugin (like Imgur or S3) do not crash the main application.</li> |
| 26 | + <li><strong>Updates:</strong> Plugins can be updated independently of the main XerahS version.</li> |
| 27 | + </ul> |
| 28 | + |
| 29 | + <h2 class="mt-4">The .sxadp Package System</h2> |
| 30 | + <p>Plugins are distributed as <code>.sxadp</code> (ShareX Avalonia Plugin) files. These are essentially ZIP archives containing:</p> |
| 31 | + <ul> |
| 32 | + <li><strong>Assembly DLL:</strong> The compiled C# code implementing the <code>IUploader</code> interface.</li> |
| 33 | + <li><strong>Manifest (plugin.json):</strong> Defining metadata like Name, Version, Author, and unique Plugin ID.</li> |
| 34 | + <li><strong>Resources:</strong> Any icons or assets required by the plugin.</li> |
| 35 | + </ul> |
| 36 | + |
| 37 | + <h3 class="mt-3">Installation</h3> |
| 38 | + <p>Installing a plugin is simple:</p> |
| 39 | + <ol> |
| 40 | + <li>Download the <code>.sxadp</code> file.</li> |
| 41 | + <li>Navigate to <strong>Application Settings -> Uploaders</strong>.</li> |
| 42 | + <li>Click <strong>Install Plugin...</strong> and select the file.</li> |
| 43 | + </ol> |
| 44 | + <p>The system validates the manifest and API version compatibility before installing it to the `Plugins/` directory.</p> |
| 45 | + |
| 46 | + <h2 class="mt-4">Development</h2> |
| 47 | + <p>Developers can create their own plugins by referencing the <code>XerahS.Core</code> library and implementing the <code>IUploader</code> interface. The API provides:</p> |
| 48 | + <ul> |
| 49 | + <li><strong>Authentication Helpers:</strong> OAuth2 and API key management.</li> |
| 50 | + <li><strong>Result Handling:</strong> Simplified methods to return URLs, direct links, or error messages.</li> |
| 51 | + <li><strong>UI Integration:</strong> Automatically generated settings UI based on property attributes.</li> |
| 52 | + </ul> |
| 53 | + |
| 54 | + <div class="mt-5"> |
| 55 | + <a class="btn btn-primary" href="/xerahs/">Back to Home</a> |
| 56 | + </div> |
| 57 | + </div> |
| 58 | + </div> |
| 59 | +</div> |
| 60 | + |
| 61 | +{% include common-js.html %} |
| 62 | +<script src="/xerahs/js/xerahs.main.js"></script> |
0 commit comments