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 /.debug
/vendor /vendor
/aleister.cfg /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": { "autoload": {
"psr-4": { "psr-4": {
"Aleister\\": "src" "Syokuhou\\": "src"
} }
}, },
"require": { "require": {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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