feat: set preferred_renderer when installing from catalog

This commit is contained in:
Benjamin Nussbaum 2025-11-04 22:53:47 +01:00
parent 3ae8a610a0
commit b98cda881e
3 changed files with 14 additions and 4 deletions

View file

@ -12,6 +12,9 @@ ENV APP_VERSION=${APP_VERSION}
ENV AUTORUN_ENABLED="true"
# Mark trmnl-liquid-cli as installed
ENV TRMNL_LIQUID_ENABLED=1
# Switch to the root user so we can do root things
USER root
@ -49,5 +52,6 @@ FROM base AS production
COPY --chown=www-data:www-data --from=assets /app/public/build /var/www/html/public/build
COPY --chown=www-data:www-data --from=assets /app/node_modules /var/www/html/node_modules
COPY --chown=www-data:www-data --from=bnussbau/trmnl-liquid-cli:latest /usr/local/bin/trmnl-liquid-cli /usr/local/bin/
# Drop back to the www-data user
USER www-data

View file

@ -143,7 +143,7 @@ class PluginImportService
*
* @throws Exception If the ZIP file is invalid or required files are missing
*/
public function importFromUrl(string $zipUrl, User $user, ?string $zipEntryPath = null): Plugin
public function importFromUrl(string $zipUrl, User $user, ?string $zipEntryPath = null, $preferredRenderer = null): Plugin
{
// Download the ZIP file
$response = Http::timeout(60)->get($zipUrl);
@ -232,6 +232,7 @@ class PluginImportService
'render_markup' => $fullLiquid,
'configuration_template' => $configurationTemplate,
'data_payload' => json_decode($settings['static_data'] ?? '{}', true),
'preferred_renderer' => $preferredRenderer,
]);
if (! $plugin_updated) {

View file

@ -91,7 +91,12 @@ new class extends Component {
try {
$zipUrl = "https://usetrmnl.com/api/plugin_settings/{$recipeId}/archive";
$plugin = $pluginImportService->importFromUrl($zipUrl, auth()->user());
$plugin = $pluginImportService->importFromUrl(
$zipUrl,
auth()->user(),
preferredRenderer: config('services.trmnl.liquid_enabled') ? 'trmnl-liquid' : null
);
$this->dispatch('plugin-installed');
Flux::modal('import-from-trmnl-catalog')->close();