mirror of
https://github.com/bs-community/blessing-skin-server.git
synced 2024-12-21 06:19:38 +08:00
use name as unique identifier for plugins generally
This commit is contained in:
parent
954329a8e7
commit
07b3a025a5
@ -17,24 +17,24 @@ class PluginController extends Controller
|
||||
|
||||
public function manage(Request $request, PluginManager $plugins)
|
||||
{
|
||||
if ($request->has('action') && $request->has('id')) {
|
||||
$id = $request->get('id');
|
||||
if ($request->has('action') && $request->has('name')) {
|
||||
$name = $request->get('name');
|
||||
|
||||
if ($plugins->getPlugins()->has($id)) {
|
||||
$plugin = $plugins->getPlugin($id);
|
||||
if ($plugins->getPlugins()->has($name)) {
|
||||
$plugin = $plugins->getPlugin($name);
|
||||
|
||||
// pass the plugin title through the translator
|
||||
$plugin->title = trans($plugin->title);
|
||||
|
||||
switch ($request->get('action')) {
|
||||
case 'enable':
|
||||
$plugins->enable($id);
|
||||
$plugins->enable($name);
|
||||
|
||||
return json(trans('admin.plugins.operations.enabled', ['plugin' => $plugin->title]), 0);
|
||||
break;
|
||||
|
||||
case 'disable':
|
||||
$plugins->disable($id);
|
||||
$plugins->disable($name);
|
||||
|
||||
return json(trans('admin.plugins.operations.disabled', ['plugin' => $plugin->title]), 0);
|
||||
break;
|
||||
@ -43,7 +43,7 @@ class PluginController extends Controller
|
||||
if ($request->isMethod('post')) {
|
||||
event(new Events\PluginWasDeleted($plugin));
|
||||
|
||||
$plugins->uninstall($id);
|
||||
$plugins->uninstall($name);
|
||||
|
||||
return json(trans('admin.plugins.operations.deleted'), 0);
|
||||
}
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author: printempw
|
||||
* @Date: 2016-07-22 14:02:44
|
||||
* @Last Modified by: printempw
|
||||
* @Last Modified time: 2017-01-02 15:30:42
|
||||
* @Last Modified time: 2017-01-08 16:07:24
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
@ -299,7 +299,7 @@ function deletePlayer(pid) {
|
||||
function enablePlugin(name) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "?action=enable&id=" + name,
|
||||
url: "?action=enable&name=" + name,
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
if (json.errno == 0) {
|
||||
@ -317,7 +317,7 @@ function enablePlugin(name) {
|
||||
function disablePlugin(name) {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "?action=disable&id=" + name,
|
||||
url: "?action=disable&name=" + name,
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
if (json.errno == 0) {
|
||||
@ -340,7 +340,7 @@ function deletePlugin(name) {
|
||||
}).then(function() {
|
||||
$.ajax({
|
||||
type: "POST",
|
||||
url: "?action=delete&id=" + name,
|
||||
url: "?action=delete&name=" + name,
|
||||
dataType: "json",
|
||||
success: function(json) {
|
||||
if (json.errno == 0) {
|
||||
|
Loading…
Reference in New Issue
Block a user