add plugin dev mode

This commit is contained in:
Boy132 2025-08-07 11:58:55 +02:00
parent 4759c62432
commit e970ae3767
3 changed files with 30 additions and 0 deletions

View File

@ -22,6 +22,7 @@ use Filament\Panel;
* @method static void updateLoadOrder(array<int, string> $order)
* @method static bool hasThemePluginEnabled()
* @method static string[] getPluginLanguages()
* @method static bool isDevModeActive()
*
* @see \App\Services\Helpers\PluginService
*/

View File

@ -113,6 +113,10 @@ class PluginService
});
}
} catch (Exception $exception) {
if ($this->isDevModeActive()) {
throw ($exception);
}
report($exception);
$this->setStatus($plugin, PluginStatus::Errored, $exception->getMessage());
@ -144,6 +148,10 @@ class PluginService
$this->enablePlugin($plugin);
} catch (Exception $exception) {
if ($this->isDevModeActive()) {
throw ($exception);
}
report($exception);
$this->setStatus($plugin, PluginStatus::Errored, $exception->getMessage());
@ -181,6 +189,10 @@ class PluginService
return true;
} catch (Exception $exception) {
if ($this->isDevModeActive()) {
throw ($exception);
}
report($exception);
}
@ -200,6 +212,10 @@ class PluginService
$this->enablePlugin($plugin);
}
} catch (Exception $exception) {
if ($this->isDevModeActive()) {
throw ($exception);
}
report($exception);
$this->setStatus($plugin, PluginStatus::Errored, $exception->getMessage());
@ -215,6 +231,10 @@ class PluginService
cache()->forget("plugins.$plugin->id.update");
} catch (Exception $exception) {
if ($this->isDevModeActive()) {
throw ($exception);
}
report($exception);
$this->setStatus($plugin, PluginStatus::Errored, $exception->getMessage());
@ -328,4 +348,9 @@ class PluginService
return array_unique($languages);
}
public function isDevModeActive(): bool
{
return config('panel.plugin.dev_mode', false);
}
}

View File

@ -68,4 +68,8 @@ return [
'webhook' => [
'prune_days' => env('APP_WEBHOOK_PRUNE_DAYS', 30),
],
'plugin' => [
'dev_mode' => env('PANEL_PLUGIN_DEV_MODE', false),
],
];