OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)
This commit is contained in:
28
app/Domain/Plugins/Controllers/CssLoader.php
Normal file
28
app/Domain/Plugins/Controllers/CssLoader.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Plugins\Controllers;
|
||||
|
||||
use Leantime\Core\Controller\Controller;
|
||||
use Leantime\Domain\Auth\Models\Roles;
|
||||
use Leantime\Domain\Auth\Services\Auth;
|
||||
use Leantime\Domain\Plugins\Services\Plugins as PluginService;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class CssLoader extends Controller
|
||||
{
|
||||
private PluginService $pluginService;
|
||||
|
||||
public function init(PluginService $pluginService): void
|
||||
{
|
||||
Auth::authOrRedirect([Roles::$owner, Roles::$admin]);
|
||||
$this->pluginService = $pluginService;
|
||||
}
|
||||
|
||||
public function get(): Response
|
||||
{
|
||||
$response = new Response($this->pluginService->getAggregatedPluginCss());
|
||||
$response->headers->set('Content-Type', 'text/css');
|
||||
|
||||
return $response;
|
||||
}
|
||||
}
|
||||
45
app/Domain/Plugins/Controllers/Details.php
Normal file
45
app/Domain/Plugins/Controllers/Details.php
Normal file
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Plugins\Controllers;
|
||||
|
||||
use Leantime\Core\Controller\Controller;
|
||||
use Leantime\Domain\Auth\Models\Roles;
|
||||
use Leantime\Domain\Auth\Services\Auth;
|
||||
use Leantime\Domain\Plugins\Services\Plugins as PluginService;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class Details extends Controller
|
||||
{
|
||||
private PluginService $pluginService;
|
||||
|
||||
public function init(PluginService $pluginService): void
|
||||
{
|
||||
$this->pluginService = $pluginService;
|
||||
}
|
||||
|
||||
public function get(): Response
|
||||
{
|
||||
|
||||
Auth::authOrRedirect([Roles::$owner, Roles::$admin], true);
|
||||
|
||||
if (! $this->incomingRequest->query->has('id')) {
|
||||
throw new \Exception('Plugin Identifier is required');
|
||||
}
|
||||
|
||||
/**
|
||||
* @var \Leantime\Domain\Plugins\Models\MarketplacePlugin|false $plugin
|
||||
*/
|
||||
$plugin = $this->pluginService->getMarketplacePlugin(
|
||||
$this->incomingRequest->query->get('id'),
|
||||
);
|
||||
|
||||
if (! $plugin) {
|
||||
return $this->tpl->display('errors.error404', 'blank');
|
||||
}
|
||||
|
||||
$this->tpl->assign('isBundle', $this->pluginService->isBundle($plugin));
|
||||
$this->tpl->assign('plugin', $plugin);
|
||||
|
||||
return $this->tpl->display('plugins.plugindetails', 'blank');
|
||||
}
|
||||
}
|
||||
21
app/Domain/Plugins/Controllers/Marketplace.php
Normal file
21
app/Domain/Plugins/Controllers/Marketplace.php
Normal file
@@ -0,0 +1,21 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Plugins\Controllers;
|
||||
|
||||
use Leantime\Core\Controller\Controller;
|
||||
use Leantime\Domain\Auth\Models\Roles;
|
||||
use Leantime\Domain\Auth\Services\Auth;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class Marketplace extends Controller
|
||||
{
|
||||
public function get(): Response
|
||||
{
|
||||
|
||||
Auth::authOrRedirect([Roles::$owner, Roles::$admin], true);
|
||||
|
||||
$this->tpl->assign('plugins', []);
|
||||
|
||||
return $this->tpl->display('plugins.marketplace');
|
||||
}
|
||||
}
|
||||
54
app/Domain/Plugins/Controllers/Myapps.php
Normal file
54
app/Domain/Plugins/Controllers/Myapps.php
Normal file
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace Leantime\Domain\Plugins\Controllers;
|
||||
|
||||
use Illuminate\Contracts\Container\BindingResolutionException;
|
||||
use Leantime\Core\Controller\Controller;
|
||||
use Leantime\Core\Controller\Frontcontroller;
|
||||
use Leantime\Domain\Auth\Models\Roles;
|
||||
use Leantime\Domain\Auth\Services\Auth;
|
||||
use Leantime\Domain\Plugins\Services\Plugins as PluginService;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
|
||||
class Myapps extends Controller
|
||||
{
|
||||
private PluginService $pluginService;
|
||||
|
||||
public function init(PluginService $pluginService): void
|
||||
{
|
||||
Auth::authOrRedirect([Roles::$owner, Roles::$admin], true);
|
||||
$this->pluginService = $pluginService;
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws BindingResolutionException
|
||||
*/
|
||||
public function get(): Response
|
||||
{
|
||||
foreach (['install', 'enable', 'disable', 'remove'] as $action) {
|
||||
$id = $this->incomingRequest->query->get($action);
|
||||
|
||||
if (empty($id)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
try {
|
||||
$this->tpl->setNotification(...$this->pluginService->performPluginAction($action, $id));
|
||||
} catch (\Exception $e) {
|
||||
$this->tpl->setNotification($e->getMessage(), 'error');
|
||||
}
|
||||
|
||||
return Frontcontroller::redirect(BASE_URL.'/plugins/myapps');
|
||||
}
|
||||
|
||||
$this->tpl->assign('newPlugins', $this->pluginService->discoverNewPlugins());
|
||||
$this->tpl->assign('installedPlugins', $this->pluginService->getAllPlugins());
|
||||
|
||||
return $this->tpl->display('plugins.myapps');
|
||||
}
|
||||
|
||||
public function post($params): Response
|
||||
{
|
||||
return Frontcontroller::redirect(BASE_URL.'/plugins/myapps');
|
||||
}
|
||||
}
|
||||
0
app/Domain/Plugins/Controllers/Show.php
Normal file
0
app/Domain/Plugins/Controllers/Show.php
Normal file
Reference in New Issue
Block a user