2019-05-03 08:17:27 +10:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2022-10-31 12:02:26 +00:00
|
|
|
class Admin::PluginsController < Admin::StaffController
|
2015-02-06 17:32:59 -05:00
|
|
|
def index
|
2023-12-18 11:42:55 +10:00
|
|
|
render_serialized(
|
2023-12-21 11:37:20 +10:00
|
|
|
Discourse.plugins_sorted_by_name(enabled_only: false),
|
2023-12-18 11:42:55 +10:00
|
|
|
AdminPluginSerializer,
|
|
|
|
root: "plugins",
|
|
|
|
)
|
2015-02-06 17:32:59 -05:00
|
|
|
end
|
2024-03-13 13:15:12 +10:00
|
|
|
|
|
|
|
def show
|
|
|
|
plugin = Discourse.plugins_by_name[params[:plugin_id]]
|
|
|
|
|
|
|
|
# An escape hatch in case a plugin is using an un-prefixed
|
|
|
|
# version of their plugin name for a route.
|
|
|
|
plugin = Discourse.plugins_by_name["discourse-#{params[:plugin_id]}"] if !plugin
|
|
|
|
|
2024-04-02 16:26:15 +03:00
|
|
|
raise Discourse::NotFound if !plugin&.visible?
|
2024-03-13 13:15:12 +10:00
|
|
|
|
|
|
|
render_serialized(plugin, AdminPluginSerializer, root: nil)
|
|
|
|
end
|
2015-02-06 17:32:59 -05:00
|
|
|
end
|