Project rename!

This commit is contained in:
flash 2024-11-14 01:22:18 +00:00
parent 589697ee6c
commit 5cca82df07
19 changed files with 46 additions and 45 deletions

1
.gitignore vendored
View file

@ -4,3 +4,4 @@
/.debug
/vendor
/aleister.cfg
/syokuhou.cfg

View file

@ -1,3 +1,3 @@
# Aleister
# Syokuhou
Aleister is the API gateway server for Flashii.
Syokuhou is the API gateway server for Flashii.

View file

@ -1,7 +1,7 @@
{
"autoload": {
"psr-4": {
"Aleister\\": "src"
"Syokuhou\\": "src"
}
},
"require": {

View file

@ -4,7 +4,7 @@ parameters:
paths:
- src
bootstrapFiles:
- aleister.php
- syokuhou.php
dynamicConstantNames:
- CRW_CLI
- CRW_DEBUG
- SKH_CLI
- SKH_DEBUG

View file

@ -1,7 +1,7 @@
<?php
namespace Aleister;
namespace Syokuhou;
require_once __DIR__ . '/../aleister.php';
require_once __DIR__ . '/../syokuhou.php';
set_exception_handler(function(\Throwable $ex) {
\Sentry\captureException($ex);
@ -11,7 +11,7 @@ set_exception_handler(function(\Throwable $ex) {
http_response_code(500);
header('Content-Type: text/plain; charset=utf-8');
if(CRW_DEBUG)
if(SKH_DEBUG)
echo (string)$ex;
else
echo 'Internal Server Error';

View file

@ -1,5 +1,5 @@
<?php
namespace Aleister;
namespace Syokuhou;
use RuntimeException;
use RPCii\Client\RpcClient;

View file

@ -1,5 +1,5 @@
<?php
namespace Aleister;
namespace Syokuhou;
use Index\{MediaType,XString};

View file

@ -1,9 +1,9 @@
<?php
namespace Aleister\OAuth2;
namespace Syokuhou\OAuth2;
use RuntimeException;
use Aleister\AleisterContext;
use Aleister\RpcModels\Hanyuu\{OAuth2AuthInfo,OAuth2RfcModel};
use Syokuhou\SyokuhouContext;
use Syokuhou\RpcModels\Hanyuu\{OAuth2AuthInfo,OAuth2RfcModel};
use Index\Http\Routing\{HandlerAttribute,HttpGet,HttpOptions,HttpPost,Router,RouteHandler,RouteHandlerTrait};
class OAuth2Routes implements RouteHandler {
@ -15,7 +15,7 @@ class OAuth2Routes implements RouteHandler {
];
public function __construct(
private AleisterContext $ctx
private SyokuhouContext $ctx
) {}
public function registerRoutes(Router $router): void {

View file

@ -1,5 +1,5 @@
<?php
namespace Aleister;
namespace Syokuhou;
use RuntimeException;
use Index\Config\Config;

View file

@ -1,7 +1,7 @@
<?php
namespace Aleister\RpcModels\Hanyuu;
namespace Syokuhou\RpcModels\Hanyuu;
use Aleister\RpcModels\RpcModel;
use Syokuhou\RpcModels\RpcModel;
class OAuth2AuthInfo extends RpcModel {
public function getMethod(): string {

View file

@ -1,7 +1,7 @@
<?php
namespace Aleister\RpcModels\Hanyuu;
namespace Syokuhou\RpcModels\Hanyuu;
use Aleister\RpcModels\RpcModel;
use Syokuhou\RpcModels\RpcModel;
class OAuth2RfcModel extends RpcModel {
public function hasErrorDescription(): bool {

View file

@ -1,5 +1,5 @@
<?php
namespace Aleister\RpcModels;
namespace Syokuhou\RpcModels;
abstract class RpcModel {
protected array $info;

View file

@ -1,11 +1,11 @@
<?php
namespace Aleister;
namespace Syokuhou;
use JsonSerializable;
use Index\Bencode\BencodeSerializable;
use Index\Http\{HttpContentHandler,HttpResponseBuilder};
class AleisterContentHandler implements HttpContentHandler {
class SyokuhouContentHandler implements HttpContentHandler {
public function __construct(
private HttpAcceptHeader $accept
) {}

View file

@ -1,12 +1,12 @@
<?php
namespace Aleister;
namespace Syokuhou;
use RuntimeException;
use Aleister\RpcModels\Hanyuu\OAuth2AuthInfo;
use Syokuhou\RpcModels\Hanyuu\OAuth2AuthInfo;
use Index\Config\Config;
use Index\Http\Routing\{HttpRouter,Router};
class AleisterContext {
class SyokuhouContext {
private RpcClientWrapper $rpcWrapper;
private HttpRouter $router;
private AuthzContext $authz;
@ -44,12 +44,12 @@ class AleisterContext {
public function handleAcceptHeader($response, $request) {
$accept = HttpAcceptHeader::parse($request->getHeaderLine('Accept'));
$contentHandler = new AleisterContentHandler($accept);
$contentHandler = new SyokuhouContentHandler($accept);
if(!$contentHandler->hasAcceptableType())
return 406;
$this->router->setErrorHandler(new AleisterErrorHandler($contentHandler));
$this->router->setErrorHandler(new SyokuhouErrorHandler($contentHandler));
$this->router->registerContentHandler($contentHandler);
}
}

View file

@ -1,11 +1,11 @@
<?php
namespace Aleister;
namespace Syokuhou;
use Index\Http\{HttpErrorHandler,HttpResponseBuilder,HttpRequest};
class AleisterErrorHandler implements HttpErrorHandler {
class SyokuhouErrorHandler implements HttpErrorHandler {
public function __construct(
private AleisterContentHandler $contentHandler,
private SyokuhouContentHandler $contentHandler,
) {}
public function handle(HttpResponseBuilder $response, HttpRequest $request, int $code, string $message): void {

View file

@ -1,12 +1,12 @@
<?php
namespace Aleister\V1;
namespace Syokuhou\V1;
use Aleister\{AleisterContext,AuthzContext};
use Syokuhou\{SyokuhouContext,AuthzContext};
use RPCii\Client\RpcClient;
class V1Context {
public function __construct(
private AleisterContext $ctx
private SyokuhouContext $ctx
) {}
public function getRpcClient(): RpcClient {

View file

@ -1,5 +1,5 @@
<?php
namespace Aleister\V1;
namespace Syokuhou\V1;
use Index\Http\Routing\{Router,RouteHandler};

View file

@ -1,5 +1,5 @@
<?php
namespace Aleister\V1;
namespace Syokuhou\V1;
use Index\Http\Routing\{RouteHandler,RouteHandlerTrait};
use RPCii\Client\RpcClient;

View file

@ -1,20 +1,20 @@
<?php
namespace Aleister;
namespace Syokuhou;
use Index\Config\Fs\FsConfig;
define('CRW_STARTUP', microtime(true));
define('CRW_ROOT', __DIR__);
define('CRW_CLI', PHP_SAPI === 'cli');
define('CRW_DEBUG', is_file(CRW_ROOT . '/.debug'));
define('SKH_STARTUP', microtime(true));
define('SKH_ROOT', __DIR__);
define('SKH_CLI', PHP_SAPI === 'cli');
define('SKH_DEBUG', is_file(SKH_ROOT . '/.debug'));
require_once CRW_ROOT . '/vendor/autoload.php';
require_once SKH_ROOT . '/vendor/autoload.php';
error_reporting(CRW_DEBUG ? -1 : 0);
error_reporting(SKH_DEBUG ? -1 : 0);
mb_internal_encoding('UTF-8');
date_default_timezone_set('GMT');
$cfg = FsConfig::fromFile(CRW_ROOT . '/aleister.cfg');
$cfg = FsConfig::fromFile(SKH_ROOT . '/syokuhou.cfg');
if($cfg->hasValues('sentry:dsn'))
(function($cfg) {
@ -29,4 +29,4 @@ if($cfg->hasValues('sentry:dsn'))
});
})($cfg->scopeTo('sentry'));
$ctx = new AleisterContext($cfg);
$ctx = new SyokuhouContext($cfg);