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

99
app/Core/Bootloader.php Normal file
View File

@@ -0,0 +1,99 @@
<?php
namespace Leantime\Core;
use Illuminate\Contracts\Container\BindingResolutionException;
use Leantime\Core\Console\ConsoleKernel;
use Leantime\Core\Events\DispatchesEvents;
use Leantime\Core\Http\HttpKernel;
use Leantime\Core\Http\IncomingRequest;
/**
* Bootloader
*/
class Bootloader
{
use DispatchesEvents;
/**
* Bootloader instance
*/
protected static ?Bootloader $instance = null;
protected Application $app;
/**
* Get the Bootloader instance
*/
public static function getInstance(): self
{
if (is_null(static::$instance)) {
static::$instance = new self;
}
return static::$instance;
}
/**
* Constructor
*/
private function __construct() {}
/**
* Execute the Application lifecycle.
*
* @return void
*
* @throws BindingResolutionException
*/
public function boot(Application $app)
{
// Start Application
// Load the bindings and service providers
$this->app = $app;
// Capture the request and instantiate the correct type
$request = IncomingRequest::capture();
// Use the right kernel for the job and handle the request.
$this->handleRequest($request);
self::dispatchEvent('end', ['bootloader' => $this]);
}
/**
* Handle the request
*
* @throws BindingResolutionException
*/
private function handleRequest($request): void
{
if (! $this->app->runningInConsole()) {
/** @var HttpKernel $kernel */
$kernel = $this->app->make(HttpKernel::class);
$kernelHandler = $kernel->handle($request);
$response = $kernelHandler->send();
$kernel->terminate($request, $response);
} else {
/** @var ConsoleKernel $kernel */
$kernel = $this->app->make(ConsoleKernel::class);
$status = $kernel->handle(
$input = new \Symfony\Component\Console\Input\ArgvInput,
new \Symfony\Component\Console\Output\ConsoleOutput
);
$kernel->terminate($input, $status);
exit($status);
}
}
}