Hook up RPCii server.
This commit is contained in:
parent
7135c028b5
commit
e43da58f68
4 changed files with 59 additions and 13 deletions
|
@ -1,21 +1,17 @@
|
||||||
{
|
{
|
||||||
"require": {
|
"require": {
|
||||||
"flashwave/index": "^0.2410",
|
"flashwave/index": "^0.2410",
|
||||||
|
"flashii/rpcii": "^2.0",
|
||||||
"flashii/apii": "^0.3",
|
"flashii/apii": "^0.3",
|
||||||
"sentry/sdk": "^4.0",
|
"sentry/sdk": "^4.0",
|
||||||
"nesbot/carbon": "^3.7"
|
"nesbot/carbon": "^3.7"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"phpstan/phpstan": "^1.11"
|
"phpstan/phpstan": "^2.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"EEPROM\\": "src"
|
"EEPROM\\": "src"
|
||||||
}
|
}
|
||||||
},
|
|
||||||
"config": {
|
|
||||||
"allow-plugins": {
|
|
||||||
"php-http/discovery": true
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
53
composer.lock
generated
53
composer.lock
generated
|
@ -4,7 +4,7 @@
|
||||||
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
|
||||||
"This file is @generated automatically"
|
"This file is @generated automatically"
|
||||||
],
|
],
|
||||||
"content-hash": "fa0ddf7057b8dfb31f5584cffd77255e",
|
"content-hash": "e0f4f136fd5f294da46e13de674e9a2b",
|
||||||
"packages": [
|
"packages": [
|
||||||
{
|
{
|
||||||
"name": "carbonphp/carbon-doctrine-types",
|
"name": "carbonphp/carbon-doctrine-types",
|
||||||
|
@ -112,6 +112,45 @@
|
||||||
"homepage": "https://api.flashii.net",
|
"homepage": "https://api.flashii.net",
|
||||||
"time": "2024-11-22T21:36:01+00:00"
|
"time": "2024-11-22T21:36:01+00:00"
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"name": "flashii/rpcii",
|
||||||
|
"version": "v2.0.1",
|
||||||
|
"source": {
|
||||||
|
"type": "git",
|
||||||
|
"url": "https://patchii.net/flashii/rpcii-php.git",
|
||||||
|
"reference": "1cbc1edb061612dc1d014a82e24b741d2a0bc11a"
|
||||||
|
},
|
||||||
|
"require": {
|
||||||
|
"ext-msgpack": ">=2.2",
|
||||||
|
"flashwave/index": "^0.2410",
|
||||||
|
"php": ">=8.3"
|
||||||
|
},
|
||||||
|
"require-dev": {
|
||||||
|
"phpstan/phpstan": "^2.0",
|
||||||
|
"phpunit/phpunit": "^11.4"
|
||||||
|
},
|
||||||
|
"type": "library",
|
||||||
|
"autoload": {
|
||||||
|
"psr-4": {
|
||||||
|
"RPCii\\": "src"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"notification-url": "https://packagist.org/downloads/",
|
||||||
|
"license": [
|
||||||
|
"bsd-3-clause-clear"
|
||||||
|
],
|
||||||
|
"authors": [
|
||||||
|
{
|
||||||
|
"name": "flashwave",
|
||||||
|
"email": "packagist@flash.moe",
|
||||||
|
"homepage": "https://flash.moe",
|
||||||
|
"role": "mom"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"description": "HTTP RPC client/server library.",
|
||||||
|
"homepage": "https://railgun.sh/rpcii",
|
||||||
|
"time": "2024-11-14T02:22:09+00:00"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"name": "flashwave/index",
|
"name": "flashwave/index",
|
||||||
"version": "v0.2410.830205",
|
"version": "v0.2410.830205",
|
||||||
|
@ -1934,20 +1973,20 @@
|
||||||
"packages-dev": [
|
"packages-dev": [
|
||||||
{
|
{
|
||||||
"name": "phpstan/phpstan",
|
"name": "phpstan/phpstan",
|
||||||
"version": "1.12.13",
|
"version": "2.0.4",
|
||||||
"source": {
|
"source": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
"url": "https://github.com/phpstan/phpstan.git",
|
"url": "https://github.com/phpstan/phpstan.git",
|
||||||
"reference": "9b469068840cfa031e1deaf2fa1886d00e20680f"
|
"reference": "50d276fc3bf1430ec315f2f109bbde2769821524"
|
||||||
},
|
},
|
||||||
"dist": {
|
"dist": {
|
||||||
"type": "zip",
|
"type": "zip",
|
||||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/9b469068840cfa031e1deaf2fa1886d00e20680f",
|
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/50d276fc3bf1430ec315f2f109bbde2769821524",
|
||||||
"reference": "9b469068840cfa031e1deaf2fa1886d00e20680f",
|
"reference": "50d276fc3bf1430ec315f2f109bbde2769821524",
|
||||||
"shasum": ""
|
"shasum": ""
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": "^7.2|^8.0"
|
"php": "^7.4|^8.0"
|
||||||
},
|
},
|
||||||
"conflict": {
|
"conflict": {
|
||||||
"phpstan/phpstan-shim": "*"
|
"phpstan/phpstan-shim": "*"
|
||||||
|
@ -1988,7 +2027,7 @@
|
||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"time": "2024-12-17T17:00:20+00:00"
|
"time": "2024-12-17T17:14:01+00:00"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"aliases": [],
|
"aliases": [],
|
||||||
|
|
|
@ -6,9 +6,13 @@ misuzu:endpoint https://flashii.net/_sockchat/verify
|
||||||
domain:short i.flashii.net
|
domain:short i.flashii.net
|
||||||
domain:api eeprom.flashii.net
|
domain:api eeprom.flashii.net
|
||||||
|
|
||||||
|
;storage:local /eeprom/storage
|
||||||
|
|
||||||
; List of allowed remote domains
|
; List of allowed remote domains
|
||||||
cors:origins flashii.net chat.flashii.net sockchat.flashii.net
|
cors:origins flashii.net chat.flashii.net sockchat.flashii.net
|
||||||
|
|
||||||
|
;rpcii:secret beans
|
||||||
|
|
||||||
;sentry:dsn https://sentry dsn here
|
;sentry:dsn https://sentry dsn here
|
||||||
;sentry:tracesRate 1.0
|
;sentry:tracesRate 1.0
|
||||||
;sentry:profilesRate 1.0
|
;sentry:profilesRate 1.0
|
||||||
|
|
|
@ -4,6 +4,8 @@ namespace EEPROM;
|
||||||
use Index\Config\Config;
|
use Index\Config\Config;
|
||||||
use Index\Db\DbConnection;
|
use Index\Db\DbConnection;
|
||||||
use EEPROM\Auth\AuthInfo;
|
use EEPROM\Auth\AuthInfo;
|
||||||
|
use RPCii\HmacVerificationProvider;
|
||||||
|
use RPCii\Server\HttpRpcServer;
|
||||||
|
|
||||||
class EEPROMContext {
|
class EEPROMContext {
|
||||||
public private(set) DatabaseContext $database;
|
public private(set) DatabaseContext $database;
|
||||||
|
@ -39,6 +41,11 @@ class EEPROMContext {
|
||||||
$routingCtx->register($this->database);
|
$routingCtx->register($this->database);
|
||||||
|
|
||||||
if($isApiDomain) {
|
if($isApiDomain) {
|
||||||
|
$rpcServer = new HttpRpcServer;
|
||||||
|
$routingCtx->register($rpcServer->createRouteHandler(
|
||||||
|
new HmacVerificationProvider(fn() => $this->config->getString('rpcii:secret'))
|
||||||
|
));
|
||||||
|
|
||||||
$routingCtx->register(new Auth\AuthRoutes(
|
$routingCtx->register(new Auth\AuthRoutes(
|
||||||
$this->config->scopeTo('apii'),
|
$this->config->scopeTo('apii'),
|
||||||
$this->authInfo,
|
$this->authInfo,
|
||||||
|
|
Loading…
Add table
Reference in a new issue