OneBot: Leantime 改造版源码(BOM/Univer 表格/AI 接管/品牌替换等)

This commit is contained in:
wangruiguo
2026-09-03 18:49:20 +08:00
commit d647428529
3501 changed files with 1988906 additions and 0 deletions

View File

@@ -0,0 +1,75 @@
<?php
namespace Leantime\Domain\Install\Controllers;
use Illuminate\Http\Exceptions\HttpResponseException;
use Leantime\Core\Controller\Controller;
use Leantime\Core\Controller\Frontcontroller as FrontcontrollerCore;
use Leantime\Domain\Install\Services\Install as InstallService;
use Symfony\Component\HttpFoundation\Response;
class Index extends Controller
{
private InstallService $installService;
/**
* init - initialize private variables
*
* @throws HttpResponseException
*/
public function init(InstallService $installService)
{
$this->installService = $installService;
if ($this->installService->isInstalled()) {
return FrontcontrollerCore::redirect(BASE_URL.'/');
}
}
/**
* get - handle get requests
*
* @param $params parameters or body of the request
*/
public function get($params)
{
return $this->tpl->display('install.new', 'entry');
}
/**
* post - process the installation form submission
*
* @param array $params parameters or body of the request
*/
public function post($params): Response
{
if (isset($_POST['install'])) {
$values = [
'email' => ($params['email']),
'firstname' => ($params['firstname']),
'lastname' => ($params['lastname']),
'company' => ($params['company']),
];
try {
$this->installService->validateInstallInput($values);
} catch (\InvalidArgumentException $e) {
$this->tpl->setNotification($e->getMessage(), 'error');
return FrontcontrollerCore::redirect(BASE_URL.'/install');
}
if ($this->installService->runInstall($values)) {
$this->tpl->setNotification(sprintf($this->language->__('notifications.installation_success_setup_account'), BASE_URL), 'success');
if (session()->has('pwReset')) {
return FrontcontrollerCore::redirect(BASE_URL.'/auth/userInvite/'.session('pwReset'));
}
} else {
$this->tpl->setNotification($this->language->__('notification.error_installing'), 'error');
}
}
return FrontcontrollerCore::redirect(BASE_URL.'/install');
}
}

View File

@@ -0,0 +1,66 @@
<?php
namespace Leantime\Domain\Install\Controllers;
use Illuminate\Contracts\Container\BindingResolutionException;
use Leantime\Core\Controller\Controller;
use Leantime\Core\Controller\Frontcontroller as FrontcontrollerCore;
use Leantime\Domain\Install\Services\Install as InstallService;
use Symfony\Component\HttpFoundation\Response;
class Update extends Controller
{
private InstallService $installService;
/**
* init - initialize private variables
*/
public function init(InstallService $installService)
{
$this->installService = $installService;
}
/**
* get - handle get requests
*
* @params parameters or body of the request
*/
public function get($params)
{
if (! $this->installService->needsUpdate()) {
return FrontcontrollerCore::redirect(BASE_URL.'/auth/login');
}
$updatePage = self::dispatch_filter('customUpdatePage', 'install.update');
return $this->tpl->display($updatePage, 'entry');
}
/**
* @throws BindingResolutionException
*/
public function post($params): Response
{
if (isset($_POST['updateDB'])) {
$success = $this->installService->runUpdate();
if (is_array($success) === true) {
foreach ($success as $errorMessage) {
$this->tpl->setNotification('There was a problem. Please reach out to support@leantime.io for assistance.', 'error');
// report($errorMessage);
}
$this->tpl->setNotification('There was a problem updating your database. Please check your error logs to verify your database is up to date.', 'error');
return FrontcontrollerCore::redirect(BASE_URL.'/install/update');
}
if ($success === true) {
return FrontcontrollerCore::redirect(BASE_URL);
}
}
$this->tpl->setNotification('There was a problem. Please reach out to support@leantime.io for assistance.', 'error');
return FrontcontrollerCore::redirect(BASE_URL.'/install/update');
}
}