From a53085e44793e0e54430ffc3ed6f8c2ca88fb115 Mon Sep 17 00:00:00 2001 From: flashwave Date: Wed, 13 Nov 2024 23:58:43 +0000 Subject: [PATCH] Updated Index and RPCii. --- composer.json | 8 +- composer.lock | 475 ++++++------------ database/2024_07_20_185612_apps_tables.php | 8 +- database/2024_07_20_185921_oauth_tables.php | 8 +- ...7_025524_configurable_refresh_lifetime.php | 8 +- ...201438_nine_character_device_user_code.php | 8 +- ...0_001441_removed_device_attempts_field.php | 8 +- ...ve_state_fields_from_authorisations_db.php | 8 +- database/2024_09_03_201657_scope_tables.php | 8 +- ...8_access_lifetime_field_for_apps_table.php | 8 +- hanyuu.php | 8 +- src/Apps/AppInfo.php | 4 +- src/Apps/AppUriInfo.php | 4 +- src/Apps/AppsContext.php | 4 +- src/Apps/AppsData.php | 4 +- src/Apps/ScopeInfo.php | 4 +- src/Apps/ScopesData.php | 4 +- src/HanyuuContext.php | 39 +- src/MisuzuRpcClient.php | 10 +- src/OAuth2/OAuth2AccessInfo.php | 4 +- src/OAuth2/OAuth2ApiRoutes.php | 7 +- src/OAuth2/OAuth2AuthorisationData.php | 11 +- src/OAuth2/OAuth2AuthorisationInfo.php | 4 +- src/OAuth2/OAuth2Context.php | 10 +- src/OAuth2/OAuth2DeviceInfo.php | 4 +- src/OAuth2/OAuth2DevicesData.php | 5 +- src/OAuth2/OAuth2RefreshInfo.php | 4 +- ...th2RpcActions.php => OAuth2RpcHandler.php} | 21 +- src/OAuth2/OAuth2TokensData.php | 5 +- src/OAuth2/OAuth2WebRoutes.php | 31 +- src/RoutingContext.php | 12 +- src/RoutingErrorHandler.php | 5 +- src/SiteInfo.php | 4 +- ...eExtension.php => TemplatingExtension.php} | 2 +- tools/migrate | 2 +- tools/new-migration | 2 +- 36 files changed, 307 insertions(+), 454 deletions(-) rename src/OAuth2/{OAuth2RpcActions.php => OAuth2RpcHandler.php} (89%) rename src/{HanyuuSasaeExtension.php => TemplatingExtension.php} (93%) diff --git a/composer.json b/composer.json index 4e3f5eb..90453d5 100644 --- a/composer.json +++ b/composer.json @@ -1,15 +1,13 @@ { "require": { - "flashwave/index": "^0.2408.40014", - "flashwave/sasae": "^1.1", - "flashwave/syokuhou": "^1.2", + "flashwave/index": "^0.2410", + "flashii/rpcii": "^2.0", "chillerlan/php-qrcode": "^4.3", "symfony/mailer": "^6.0", "matomo/device-detector": "^6.1", "sentry/sdk": "^4.0", "phpseclib/phpseclib": "~3.0", - "nesbot/carbon": "^3.7", - "flashwave/aiwass": "^1.0" + "nesbot/carbon": "^3.7" }, "autoload": { "classmap": [ diff --git a/composer.lock b/composer.lock index 063c8d1..7e17deb 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "8cfa8c2738ab51aba3efea42afb68771", + "content-hash": "d4d57efb7f1a7860dd2c0a3df353fc08", "packages": [ { "name": "carbonphp/carbon-doctrine-types", @@ -367,26 +367,26 @@ "time": "2023-10-06T06:47:41+00:00" }, { - "name": "flashwave/aiwass", - "version": "v1.0.0", + "name": "flashii/rpcii", + "version": "v2.0.0", "source": { "type": "git", - "url": "https://patchii.net/flashii/aiwass.git", - "reference": "de27da54b603f0fdc06dab89341908e73ea7a880" + "url": "https://patchii.net/flashii/rpcii-php.git", + "reference": "93ec139171d023f210f0b7464266b6fc42b4d838" }, "require": { "ext-msgpack": ">=2.2", - "flashwave/index": "^0.2408.40014", + "flashwave/index": "^0.2410", "php": ">=8.3" }, "require-dev": { - "phpstan/phpstan": "^1.11", - "phpunit/phpunit": "^11.2" + "phpstan/phpstan": "^2.0", + "phpunit/phpunit": "^11.4" }, "type": "library", "autoload": { "psr-4": { - "Aiwass\\": "src" + "RPCii\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -401,32 +401,45 @@ "role": "mom" } ], - "description": "Shared HTTP RPC client/server library.", - "homepage": "https://railgun.sh/aiwass", - "time": "2024-08-16T15:59:19+00:00" + "description": "HTTP RPC client/server library.", + "homepage": "https://railgun.sh/rpcii", + "time": "2024-11-13T23:17:29+00:00" }, { "name": "flashwave/index", - "version": "v0.2408.40014", + "version": "v0.2410.191603", "source": { "type": "git", "url": "https://patchii.net/flash/index.git", - "reference": "fbca708fbd75e8ecc6b36b39c1307a67bf250808" + "reference": "17cdb4d1c239241200d7e30968122a8cd8b26509" }, "require": { "ext-mbstring": "*", - "php": ">=8.3" + "php": ">=8.3", + "twig/html-extra": "^3.13", + "twig/twig": "^3.14" }, "require-dev": { "phpstan/phpstan": "^1.11", "phpunit/phpunit": "^11.2" }, "suggest": { - "ext-mysqli": "Support for the Index\\Data\\MariaDB namespace (both mysqlnd and libmysql are supported).", - "ext-sqlite3": "Support for the Index\\Data\\SQLite namespace." + "ext-memcache": "Support for the Index\\Cache\\Memcached namespace (only if you can't use ext-memcached for some reason).", + "ext-memcached": "Support for the Index\\Cache\\Memcached namespace (you should use this instead of ext-memcache).", + "ext-mysqli": "Support for the Index\\Db\\MariaDb namespace (both mysqlnd and libmysql are supported).", + "ext-redis": "Support for the Index\\Cache\\Valkey namespace.", + "ext-sqlite3": "Support for the Index\\Db\\Sqlite namespace." }, "type": "library", "autoload": { + "files": [ + "src/Cache/ArrayCache/_ndx.php", + "src/Cache/Memcached/_ndx.php", + "src/Cache/Valkey/_ndx.php", + "src/Db/MariaDb/_ndx.php", + "src/Db/NullDb/_ndx.php", + "src/Db/Sqlite/_ndx.php" + ], "psr-4": { "Index\\": "src" } @@ -445,85 +458,7 @@ ], "description": "Composer package for the common library for my projects.", "homepage": "https://railgun.sh/index", - "time": "2024-08-04T00:14:17+00:00" - }, - { - "name": "flashwave/sasae", - "version": "v1.1.0", - "source": { - "type": "git", - "url": "https://patchii.net/flash/sasae.git", - "reference": "ad63107a4387aa35c45bce71c2d6262a15b96f9d" - }, - "require": { - "flashwave/index": "^0.2408.40014", - "php": ">=8.3", - "twig/html-extra": "^3.10", - "twig/twig": "^3.10" - }, - "require-dev": { - "phpstan/phpstan": "^1.11", - "phpunit/phpunit": "^11.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "Sasae\\": "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": "A wrapper for Twig with added common functionality.", - "homepage": "https://railgun.sh/sasae", - "time": "2024-08-04T00:48:17+00:00" - }, - { - "name": "flashwave/syokuhou", - "version": "v1.2.0", - "source": { - "type": "git", - "url": "https://patchii.net/flash/syokuhou.git", - "reference": "129a46c0d917382f9bc195cce278be51984eb87d" - }, - "require": { - "flashwave/index": "^0.2408.40014", - "php": ">=8.3" - }, - "require-dev": { - "phpstan/phpstan": "^1.11", - "phpunit/phpunit": "^11.2" - }, - "type": "library", - "autoload": { - "psr-4": { - "Syokuhou\\": "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": "Configuration library for PHP.", - "homepage": "https://railgun.sh/syokuhou", - "time": "2024-08-04T01:07:23+00:00" + "time": "2024-10-19T16:04:17+00:00" }, { "name": "guzzlehttp/psr7", @@ -702,16 +637,16 @@ }, { "name": "matomo/device-detector", - "version": "6.3.2", + "version": "6.4.1", "source": { "type": "git", "url": "https://github.com/matomo-org/device-detector.git", - "reference": "fd4042cb6a7f3f985a81aedc075dd59e0b991a51" + "reference": "0d364e0dd6c177da3c24cd4049178026324fd7ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/matomo-org/device-detector/zipball/fd4042cb6a7f3f985a81aedc075dd59e0b991a51", - "reference": "fd4042cb6a7f3f985a81aedc075dd59e0b991a51", + "url": "https://api.github.com/repos/matomo-org/device-detector/zipball/0d364e0dd6c177da3c24cd4049178026324fd7ac", + "reference": "0d364e0dd6c177da3c24cd4049178026324fd7ac", "shasum": "" }, "require": { @@ -767,7 +702,7 @@ "source": "https://github.com/matomo-org/matomo", "wiki": "https://dev.matomo.org/" }, - "time": "2024-05-28T10:16:19+00:00" + "time": "2024-09-24T13:50:04+00:00" }, { "name": "mustangostang/spyc", @@ -825,20 +760,20 @@ }, { "name": "nesbot/carbon", - "version": "3.7.0", + "version": "3.8.2", "source": { "type": "git", "url": "https://github.com/briannesbitt/Carbon.git", - "reference": "cb4374784c87d0a0294e8513a52eb63c0aff3139" + "reference": "e1268cdbc486d97ce23fef2c666dc3c6b6de9947" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/cb4374784c87d0a0294e8513a52eb63c0aff3139", - "reference": "cb4374784c87d0a0294e8513a52eb63c0aff3139", + "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/e1268cdbc486d97ce23fef2c666dc3c6b6de9947", + "reference": "e1268cdbc486d97ce23fef2c666dc3c6b6de9947", "shasum": "" }, "require": { - "carbonphp/carbon-doctrine-types": "*", + "carbonphp/carbon-doctrine-types": "<100.0", "ext-json": "*", "php": "^8.1", "psr/clock": "^1.0", @@ -927,7 +862,7 @@ "type": "tidelift" } ], - "time": "2024-07-16T22:29:20+00:00" + "time": "2024-11-07T17:46:48+00:00" }, { "name": "paragonie/constant_time_encoding", @@ -1048,16 +983,16 @@ }, { "name": "phpseclib/phpseclib", - "version": "3.0.39", + "version": "3.0.42", "source": { "type": "git", "url": "https://github.com/phpseclib/phpseclib.git", - "reference": "211ebc399c6e73c225a018435fe5ae209d1d1485" + "reference": "db92f1b1987b12b13f248fe76c3a52cadb67bb98" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/211ebc399c6e73c225a018435fe5ae209d1d1485", - "reference": "211ebc399c6e73c225a018435fe5ae209d1d1485", + "url": "https://api.github.com/repos/phpseclib/phpseclib/zipball/db92f1b1987b12b13f248fe76c3a52cadb67bb98", + "reference": "db92f1b1987b12b13f248fe76c3a52cadb67bb98", "shasum": "" }, "require": { @@ -1138,7 +1073,7 @@ ], "support": { "issues": "https://github.com/phpseclib/phpseclib/issues", - "source": "https://github.com/phpseclib/phpseclib/tree/3.0.39" + "source": "https://github.com/phpseclib/phpseclib/tree/3.0.42" }, "funding": [ { @@ -1154,7 +1089,7 @@ "type": "tidelift" } ], - "time": "2024-06-24T06:27:33+00:00" + "time": "2024-09-16T03:06:04+00:00" }, { "name": "psr/clock", @@ -1417,16 +1352,16 @@ }, { "name": "psr/log", - "version": "3.0.0", + "version": "3.0.2", "source": { "type": "git", "url": "https://github.com/php-fig/log.git", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", - "reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", "shasum": "" }, "require": { @@ -1461,9 +1396,9 @@ "psr-3" ], "support": { - "source": "https://github.com/php-fig/log/tree/3.0.0" + "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2021-07-14T16:46:02+00:00" + "time": "2024-09-11T13:17:53+00:00" }, { "name": "ralouphie/getallheaders", @@ -1566,16 +1501,16 @@ }, { "name": "sentry/sentry", - "version": "4.8.1", + "version": "4.10.0", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-php.git", - "reference": "61770efd8b7888e0bdd7d234f0ba67b066e47d04" + "reference": "2af937d47d8aadb8dab0b1d7b9557e495dd12856" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/61770efd8b7888e0bdd7d234f0ba67b066e47d04", - "reference": "61770efd8b7888e0bdd7d234f0ba67b066e47d04", + "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/2af937d47d8aadb8dab0b1d7b9557e495dd12856", + "reference": "2af937d47d8aadb8dab0b1d7b9557e495dd12856", "shasum": "" }, "require": { @@ -1593,12 +1528,12 @@ }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.4", - "guzzlehttp/promises": "^1.0|^2.0", + "guzzlehttp/promises": "^2.0.3", "guzzlehttp/psr7": "^1.8.4|^2.1.1", "monolog/monolog": "^1.6|^2.0|^3.0", "phpbench/phpbench": "^1.0", "phpstan/phpstan": "^1.3", - "phpunit/phpunit": "^8.5.14|^9.4", + "phpunit/phpunit": "^8.5|^9.6", "symfony/phpunit-bridge": "^5.2|^6.0|^7.0", "vimeo/psalm": "^4.17" }, @@ -1639,7 +1574,7 @@ ], "support": { "issues": "https://github.com/getsentry/sentry-php/issues", - "source": "https://github.com/getsentry/sentry-php/tree/4.8.1" + "source": "https://github.com/getsentry/sentry-php/tree/4.10.0" }, "funding": [ { @@ -1651,20 +1586,20 @@ "type": "custom" } ], - "time": "2024-07-16T13:45:27+00:00" + "time": "2024-11-06T07:44:19+00:00" }, { "name": "symfony/clock", - "version": "v7.1.1", + "version": "v7.1.6", "source": { "type": "git", "url": "https://github.com/symfony/clock.git", - "reference": "3dfc8b084853586de51dd1441c6242c76a28cbe7" + "reference": "97bebc53548684c17ed696bc8af016880f0f098d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/clock/zipball/3dfc8b084853586de51dd1441c6242c76a28cbe7", - "reference": "3dfc8b084853586de51dd1441c6242c76a28cbe7", + "url": "https://api.github.com/repos/symfony/clock/zipball/97bebc53548684c17ed696bc8af016880f0f098d", + "reference": "97bebc53548684c17ed696bc8af016880f0f098d", "shasum": "" }, "require": { @@ -1709,7 +1644,7 @@ "time" ], "support": { - "source": "https://github.com/symfony/clock/tree/v7.1.1" + "source": "https://github.com/symfony/clock/tree/v7.1.6" }, "funding": [ { @@ -1725,7 +1660,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/deprecation-contracts", @@ -1796,16 +1731,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v7.1.1", + "version": "v7.1.6", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "9fa7f7a21beb22a39a8f3f28618b29e50d7a55a7" + "reference": "87254c78dd50721cfd015b62277a8281c5589702" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/9fa7f7a21beb22a39a8f3f28618b29e50d7a55a7", - "reference": "9fa7f7a21beb22a39a8f3f28618b29e50d7a55a7", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/87254c78dd50721cfd015b62277a8281c5589702", + "reference": "87254c78dd50721cfd015b62277a8281c5589702", "shasum": "" }, "require": { @@ -1856,7 +1791,7 @@ "description": "Provides tools that allow your application components to communicate with each other by dispatching events and listening to them", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/event-dispatcher/tree/v7.1.1" + "source": "https://github.com/symfony/event-dispatcher/tree/v7.1.6" }, "funding": [ { @@ -1872,7 +1807,7 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/event-dispatcher-contracts", @@ -1952,16 +1887,16 @@ }, { "name": "symfony/mailer", - "version": "v6.4.9", + "version": "v6.4.13", "source": { "type": "git", "url": "https://github.com/symfony/mailer.git", - "reference": "e2d56f180f5b8c5e7c0fbea872bb1f529b6d6d45" + "reference": "c2f7e0d8d7ac8fe25faccf5d8cac462805db2663" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mailer/zipball/e2d56f180f5b8c5e7c0fbea872bb1f529b6d6d45", - "reference": "e2d56f180f5b8c5e7c0fbea872bb1f529b6d6d45", + "url": "https://api.github.com/repos/symfony/mailer/zipball/c2f7e0d8d7ac8fe25faccf5d8cac462805db2663", + "reference": "c2f7e0d8d7ac8fe25faccf5d8cac462805db2663", "shasum": "" }, "require": { @@ -2012,7 +1947,7 @@ "description": "Helps sending emails", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/mailer/tree/v6.4.9" + "source": "https://github.com/symfony/mailer/tree/v6.4.13" }, "funding": [ { @@ -2028,20 +1963,20 @@ "type": "tidelift" } ], - "time": "2024-06-28T07:59:05+00:00" + "time": "2024-09-25T14:18:03+00:00" }, { "name": "symfony/mime", - "version": "v7.1.2", + "version": "v7.1.6", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "26a00b85477e69a4bab63b66c5dce64f18b0cbfc" + "reference": "caa1e521edb2650b8470918dfe51708c237f0598" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/26a00b85477e69a4bab63b66c5dce64f18b0cbfc", - "reference": "26a00b85477e69a4bab63b66c5dce64f18b0cbfc", + "url": "https://api.github.com/repos/symfony/mime/zipball/caa1e521edb2650b8470918dfe51708c237f0598", + "reference": "caa1e521edb2650b8470918dfe51708c237f0598", "shasum": "" }, "require": { @@ -2096,7 +2031,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v7.1.2" + "source": "https://github.com/symfony/mime/tree/v7.1.6" }, "funding": [ { @@ -2112,20 +2047,20 @@ "type": "tidelift" } ], - "time": "2024-06-28T10:03:55+00:00" + "time": "2024-10-25T15:11:02+00:00" }, { "name": "symfony/options-resolver", - "version": "v7.1.1", + "version": "v7.1.6", "source": { "type": "git", "url": "https://github.com/symfony/options-resolver.git", - "reference": "47aa818121ed3950acd2b58d1d37d08a94f9bf55" + "reference": "85e95eeede2d41cd146146e98c9c81d9214cae85" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/options-resolver/zipball/47aa818121ed3950acd2b58d1d37d08a94f9bf55", - "reference": "47aa818121ed3950acd2b58d1d37d08a94f9bf55", + "url": "https://api.github.com/repos/symfony/options-resolver/zipball/85e95eeede2d41cd146146e98c9c81d9214cae85", + "reference": "85e95eeede2d41cd146146e98c9c81d9214cae85", "shasum": "" }, "require": { @@ -2163,7 +2098,7 @@ "options" ], "support": { - "source": "https://github.com/symfony/options-resolver/tree/v7.1.1" + "source": "https://github.com/symfony/options-resolver/tree/v7.1.6" }, "funding": [ { @@ -2179,24 +2114,24 @@ "type": "tidelift" } ], - "time": "2024-05-31T14:57:53+00:00" + "time": "2024-09-25T14:20:29+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "0424dff1c58f028c451efff2045f5d92410bd540" + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", - "reference": "0424dff1c58f028c451efff2045f5d92410bd540", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638", + "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-ctype": "*" @@ -2242,7 +2177,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0" }, "funding": [ { @@ -2258,26 +2193,25 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-idn", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-idn.git", - "reference": "a6e83bdeb3c84391d1dfe16f42e40727ce524a5c" + "reference": "c36586dcf89a12315939e00ec9b4474adcb1d773" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a6e83bdeb3c84391d1dfe16f42e40727ce524a5c", - "reference": "a6e83bdeb3c84391d1dfe16f42e40727ce524a5c", + "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/c36586dcf89a12315939e00ec9b4474adcb1d773", + "reference": "c36586dcf89a12315939e00ec9b4474adcb1d773", "shasum": "" }, "require": { - "php": ">=7.1", - "symfony/polyfill-intl-normalizer": "^1.10", - "symfony/polyfill-php72": "^1.10" + "php": ">=7.2", + "symfony/polyfill-intl-normalizer": "^1.10" }, "suggest": { "ext-intl": "For best performance" @@ -2326,7 +2260,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-intl-idn/tree/v1.31.0" }, "funding": [ { @@ -2342,24 +2276,24 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb" + "reference": "3833d7255cc303546435cb650316bff708a1c75c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/a95281b0be0d9ab48050ebd988b967875cdb9fdb", - "reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c", + "reference": "3833d7255cc303546435cb650316bff708a1c75c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" @@ -2407,7 +2341,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.31.0" }, "funding": [ { @@ -2423,24 +2357,24 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", - "reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341", + "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "provide": { "ext-mbstring": "*" @@ -2487,7 +2421,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0" }, "funding": [ { @@ -2503,24 +2437,24 @@ "type": "tidelift" } ], - "time": "2024-06-19T12:30:46+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { - "name": "symfony/polyfill-php72", - "version": "v1.30.0", + "name": "symfony/polyfill-php81", + "version": "v1.31.0", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php72.git", - "reference": "10112722600777e02d2745716b70c5db4ca70442" + "url": "https://github.com/symfony/polyfill-php81.git", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/10112722600777e02d2745716b70c5db4ca70442", - "reference": "10112722600777e02d2745716b70c5db4ca70442", + "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", + "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { @@ -2534,80 +2468,7 @@ "bootstrap.php" ], "psr-4": { - "Symfony\\Polyfill\\Php72\\": "" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.2+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php72/tree/v1.30.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", - "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2024-06-19T12:30:46+00:00" - }, - { - "name": "symfony/polyfill-php80", - "version": "v1.30.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/77fa7995ac1b21ab60769b7323d600a991a90433", - "reference": "77fa7995ac1b21ab60769b7323d600a991a90433", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "files": [ - "bootstrap.php" - ], - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" + "Symfony\\Polyfill\\Php81\\": "" }, "classmap": [ "Resources/stubs" @@ -2618,10 +2479,6 @@ "MIT" ], "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -2631,7 +2488,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 8.1+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -2640,7 +2497,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0" }, "funding": [ { @@ -2656,24 +2513,24 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/polyfill-php83", - "version": "v1.30.0", + "version": "v1.31.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-php83.git", - "reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9" + "reference": "2fb86d65e2d424369ad2905e83b236a8805ba491" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9", - "reference": "dbdcdf1a4dcc2743591f1079d0c35ab1e2dcbbc9", + "url": "https://api.github.com/repos/symfony/polyfill-php83/zipball/2fb86d65e2d424369ad2905e83b236a8805ba491", + "reference": "2fb86d65e2d424369ad2905e83b236a8805ba491", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { @@ -2716,7 +2573,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php83/tree/v1.30.0" + "source": "https://github.com/symfony/polyfill-php83/tree/v1.31.0" }, "funding": [ { @@ -2732,7 +2589,7 @@ "type": "tidelift" } ], - "time": "2024-06-19T12:35:24+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "name": "symfony/service-contracts", @@ -2819,16 +2676,16 @@ }, { "name": "symfony/translation", - "version": "v7.1.3", + "version": "v7.1.6", "source": { "type": "git", "url": "https://github.com/symfony/translation.git", - "reference": "8d5e50c813ba2859a6dfc99a0765c550507934a1" + "reference": "b9f72ab14efdb6b772f85041fa12f820dee8d55f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/translation/zipball/8d5e50c813ba2859a6dfc99a0765c550507934a1", - "reference": "8d5e50c813ba2859a6dfc99a0765c550507934a1", + "url": "https://api.github.com/repos/symfony/translation/zipball/b9f72ab14efdb6b772f85041fa12f820dee8d55f", + "reference": "b9f72ab14efdb6b772f85041fa12f820dee8d55f", "shasum": "" }, "require": { @@ -2893,7 +2750,7 @@ "description": "Provides tools to internationalize your application", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/translation/tree/v7.1.3" + "source": "https://github.com/symfony/translation/tree/v7.1.6" }, "funding": [ { @@ -2909,7 +2766,7 @@ "type": "tidelift" } ], - "time": "2024-07-26T12:41:01+00:00" + "time": "2024-09-28T12:35:13+00:00" }, { "name": "symfony/translation-contracts", @@ -2991,23 +2848,23 @@ }, { "name": "twig/html-extra", - "version": "v3.10.0", + "version": "v3.13.0", "source": { "type": "git", "url": "https://github.com/twigphp/html-extra.git", - "reference": "1c045fc28ace0dcaf464f8e0d4e2aca6347d5fda" + "reference": "8229e750091171c1f11801a525927811c7ac5a7e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/html-extra/zipball/1c045fc28ace0dcaf464f8e0d4e2aca6347d5fda", - "reference": "1c045fc28ace0dcaf464f8e0d4e2aca6347d5fda", + "url": "https://api.github.com/repos/twigphp/html-extra/zipball/8229e750091171c1f11801a525927811c7ac5a7e", + "reference": "8229e750091171c1f11801a525927811c7ac5a7e", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/deprecation-contracts": "^2.5|^3", "symfony/mime": "^5.4|^6.4|^7.0", - "twig/twig": "^3.0" + "twig/twig": "^3.13|^4.0" }, "require-dev": { "symfony/phpunit-bridge": "^6.4|^7.0" @@ -3043,7 +2900,7 @@ "twig" ], "support": { - "source": "https://github.com/twigphp/html-extra/tree/v3.10.0" + "source": "https://github.com/twigphp/html-extra/tree/v3.13.0" }, "funding": [ { @@ -3055,28 +2912,28 @@ "type": "tidelift" } ], - "time": "2024-05-11T07:35:57+00:00" + "time": "2024-09-03T13:08:40+00:00" }, { "name": "twig/twig", - "version": "v3.10.3", + "version": "v3.14.2", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "67f29781ffafa520b0bbfbd8384674b42db04572" + "reference": "0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/67f29781ffafa520b0bbfbd8384674b42db04572", - "reference": "67f29781ffafa520b0bbfbd8384674b42db04572", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a", + "reference": "0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.0.2", "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-ctype": "^1.8", "symfony/polyfill-mbstring": "^1.3", - "symfony/polyfill-php80": "^1.22" + "symfony/polyfill-php81": "^1.29" }, "require-dev": { "psr/container": "^1.0|^2.0", @@ -3122,7 +2979,7 @@ ], "support": { "issues": "https://github.com/twigphp/Twig/issues", - "source": "https://github.com/twigphp/Twig/tree/v3.10.3" + "source": "https://github.com/twigphp/Twig/tree/v3.14.2" }, "funding": [ { @@ -3134,22 +2991,22 @@ "type": "tidelift" } ], - "time": "2024-05-16T10:04:27+00:00" + "time": "2024-11-07T12:36:22+00:00" } ], "packages-dev": [ { "name": "phpstan/phpstan", - "version": "1.11.9", + "version": "1.12.10", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e370bcddadaede0c1716338b262346f40d296f82" + "reference": "fc463b5d0fe906dcf19689be692c65c50406a071" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e370bcddadaede0c1716338b262346f40d296f82", - "reference": "e370bcddadaede0c1716338b262346f40d296f82", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/fc463b5d0fe906dcf19689be692c65c50406a071", + "reference": "fc463b5d0fe906dcf19689be692c65c50406a071", "shasum": "" }, "require": { @@ -3194,7 +3051,7 @@ "type": "github" } ], - "time": "2024-08-01T16:25:18+00:00" + "time": "2024-11-11T15:37:09+00:00" } ], "aliases": [], diff --git a/database/2024_07_20_185612_apps_tables.php b/database/2024_07_20_185612_apps_tables.php index 0ad0a23..9895f81 100644 --- a/database/2024_07_20_185612_apps_tables.php +++ b/database/2024_07_20_185612_apps_tables.php @@ -1,9 +1,9 @@ execute(<<execute(<<execute('ALTER TABLE hau_apps ADD COLUMN app_refresh_lifetime INT UNSIGNED NULL DEFAULT NULL AFTER app_type'); } } diff --git a/database/2024_07_27_201438_nine_character_device_user_code.php b/database/2024_07_27_201438_nine_character_device_user_code.php index 262372e..c452c05 100644 --- a/database/2024_07_27_201438_nine_character_device_user_code.php +++ b/database/2024_07_27_201438_nine_character_device_user_code.php @@ -1,9 +1,9 @@ execute('ALTER TABLE hau_oauth2_device CHANGE COLUMN dev_user_code dev_user_code CHAR(9) NOT NULL COLLATE ascii_general_ci AFTER dev_code'); } } diff --git a/database/2024_07_30_001441_removed_device_attempts_field.php b/database/2024_07_30_001441_removed_device_attempts_field.php index a40cf6e..3adaaca 100644 --- a/database/2024_07_30_001441_removed_device_attempts_field.php +++ b/database/2024_07_30_001441_removed_device_attempts_field.php @@ -1,9 +1,9 @@ execute('ALTER TABLE hau_oauth2_device DROP COLUMN dev_attempts'); } } diff --git a/database/2024_07_30_211859_remove_state_fields_from_authorisations_db.php b/database/2024_07_30_211859_remove_state_fields_from_authorisations_db.php index 9aa02da..1e91fe2 100644 --- a/database/2024_07_30_211859_remove_state_fields_from_authorisations_db.php +++ b/database/2024_07_30_211859_remove_state_fields_from_authorisations_db.php @@ -1,9 +1,9 @@ execute('ALTER TABLE hau_oauth2_authorise DROP COLUMN auth_state, DROP COLUMN auth_approval;'); } } diff --git a/database/2024_09_03_201657_scope_tables.php b/database/2024_09_03_201657_scope_tables.php index b2908fe..add5751 100644 --- a/database/2024_09_03_201657_scope_tables.php +++ b/database/2024_09_03_201657_scope_tables.php @@ -1,9 +1,9 @@ execute(<<execute(<<hasValues('sentry:dsn')) (function($cfg) { @@ -35,7 +35,7 @@ if($cfg->hasValues('sentry:dsn')) }); })($cfg->scopeTo('sentry')); -$dbc = DbTools::create($cfg->getString('database:dsn', 'null')); +$dbc = DbBackends::create($cfg->getString('database:dsn', 'null')); $dbc->execute('SET SESSION time_zone = \'+00:00\', sql_mode = \'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION\';'); $hau = new HanyuuContext($cfg, $dbc); diff --git a/src/Apps/AppInfo.php b/src/Apps/AppInfo.php index 18652c4..7d46364 100644 --- a/src/Apps/AppInfo.php +++ b/src/Apps/AppInfo.php @@ -1,7 +1,7 @@ getString(0), name: $result->getString(1), diff --git a/src/Apps/AppUriInfo.php b/src/Apps/AppUriInfo.php index 4336626..4a02836 100644 --- a/src/Apps/AppUriInfo.php +++ b/src/Apps/AppUriInfo.php @@ -1,7 +1,7 @@ getString(0), appId: $result->getString(1), diff --git a/src/Apps/AppsContext.php b/src/Apps/AppsContext.php index bd581cb..bf54281 100644 --- a/src/Apps/AppsContext.php +++ b/src/Apps/AppsContext.php @@ -2,13 +2,13 @@ namespace Hanyuu\Apps; use RuntimeException; -use Index\Data\IDbConnection; +use Index\Db\DbConnection; class AppsContext { private AppsData $apps; private ScopesData $scopes; - public function __construct(IDbConnection $dbConn) { + public function __construct(DbConnection $dbConn) { $this->apps = new AppsData($dbConn); $this->scopes = new ScopesData($dbConn); } diff --git a/src/Apps/AppsData.php b/src/Apps/AppsData.php index 69b6392..ecd1035 100644 --- a/src/Apps/AppsData.php +++ b/src/Apps/AppsData.php @@ -5,13 +5,13 @@ use stdClass; use InvalidArgumentException; use RuntimeException; use Index\XString; -use Index\Data\{DbStatementCache,IDbConnection}; +use Index\Db\{DbConnection,DbStatementCache}; class AppsData { private DbStatementCache $cache; public function __construct( - private IDbConnection $dbConn + private DbConnection $dbConn ) { $this->cache = new DbStatementCache($dbConn); } diff --git a/src/Apps/ScopeInfo.php b/src/Apps/ScopeInfo.php index 91befb8..0196cd8 100644 --- a/src/Apps/ScopeInfo.php +++ b/src/Apps/ScopeInfo.php @@ -1,7 +1,7 @@ getString(0), $result->getString(1), diff --git a/src/Apps/ScopesData.php b/src/Apps/ScopesData.php index 714e499..ab22628 100644 --- a/src/Apps/ScopesData.php +++ b/src/Apps/ScopesData.php @@ -3,13 +3,13 @@ namespace Hanyuu\Apps; use InvalidArgumentException; use RuntimeException; -use Index\Data\{DbStatementCache,IDbConnection}; +use Index\Db\{DbConnection,DbStatementCache}; class ScopesData { private DbStatementCache $cache; public function __construct( - private IDbConnection $dbConn + private DbConnection $dbConn ) { $this->cache = new DbStatementCache($dbConn); } diff --git a/src/HanyuuContext.php b/src/HanyuuContext.php index 4e653ee..da7f895 100644 --- a/src/HanyuuContext.php +++ b/src/HanyuuContext.php @@ -1,19 +1,18 @@ config = $config; $this->dbConn = $dbConn; $this->siteInfo = new SiteInfo($config->scopeTo('site')); @@ -35,12 +34,12 @@ class HanyuuContext { $this->appsCtx ); - $this->templating = new SasaeEnvironment( + $this->templating = new TplEnvironment( HAU_DIR_TEMPLATES, cache: null,//HAU_DEBUG ? null : ['Hanyuu', GitInfo::hash(true)], debug: HAU_DEBUG, ); - $this->templating->addExtension(new HanyuuSasaeExtension($this)); + $this->templating->addExtension(new TemplatingExtension($this)); $this->templating->addGlobal('globals', [ 'siteInfo' => $this->siteInfo, @@ -51,7 +50,7 @@ class HanyuuContext { return $this->misuzuRpc; } - public function getDatabase(): IDbConnection { + public function getDatabase(): DbConnection { return $this->dbConn; } @@ -64,7 +63,7 @@ class HanyuuContext { return new DbMigrationManager($this->dbConn, 'hau_' . DbMigrationManager::DEFAULT_TABLE); } - public function createMigrationRepo(): IDbMigrationRepo { + public function createMigrationRepo(): DbMigrationRepo { return new FsDbMigrationRepo(HAU_DIR_MIGRATIONS); } @@ -77,7 +76,7 @@ class HanyuuContext { return $this->authInfo; } - public function getCSRFPSecret(): string { + public function getCsrfTokenSecret(): string { return $this->config->getString('csrfp:secret', 'beans'); } @@ -86,7 +85,7 @@ class HanyuuContext { return is_file($path) ? json_decode(file_get_contents($path)) : null; } - public function getTemplating(): SasaeEnvironment { + public function getTemplating(): TplEnvironment { return $this->templating; } @@ -111,15 +110,15 @@ class HanyuuContext { $this->oauth2Ctx, $this->templating, $this->getAuthInfo(...), - $this->getCSRFPSecret(...) + $this->getCsrfTokenSecret(...) )); - $rpcServer = new RpcServer; + $rpcServer = new HttpRpcServer; $routingCtx->register($rpcServer->createRouteHandler( new HmacVerificationProvider(fn() => $this->config->getString('aleister:secret')) )); - $rpcServer->register(new OAuth2\OAuth2RpcActions($this->oauth2Ctx)); + $rpcServer->register(new OAuth2\OAuth2RpcHandler($this->oauth2Ctx)); return $routingCtx; } diff --git a/src/MisuzuRpcClient.php b/src/MisuzuRpcClient.php index 95a3d68..495d3ec 100644 --- a/src/MisuzuRpcClient.php +++ b/src/MisuzuRpcClient.php @@ -3,15 +3,15 @@ namespace Hanyuu; use stdClass; use RuntimeException; -use Aiwass\Client\RpcClient; use Index\UriBase64; -use Syokuhou\IConfig; +use Index\Config\Config; +use RPCii\Client\{HttpRpcClient,RpcClient}; class MisuzuRpcClient { private RpcClient $client; - public function __construct(IConfig $config) { - $this->client = RpcClient::createHmac( + public function __construct(Config $config) { + $this->client = HttpRpcClient::createHmac( sprintf('%s/_hanyuu', $config->getString('endpoint')), fn() => $config->getString('secret') ); @@ -22,7 +22,7 @@ class MisuzuRpcClient { } public function authCheck(string $method, string $token, string $remoteAddr, array $avatars = []): MisuzuAuthInfo { - $result = $this->client->procedure('mszhau:authCheck', [ + $result = $this->client->action('mszhau:authCheck', [ 'method' => $method, 'token' => $token, 'remoteAddr' => $remoteAddr, diff --git a/src/OAuth2/OAuth2AccessInfo.php b/src/OAuth2/OAuth2AccessInfo.php index 11c4391..b94cf4b 100644 --- a/src/OAuth2/OAuth2AccessInfo.php +++ b/src/OAuth2/OAuth2AccessInfo.php @@ -1,7 +1,7 @@ getString(0), appId: $result->getString(1), diff --git a/src/OAuth2/OAuth2ApiRoutes.php b/src/OAuth2/OAuth2ApiRoutes.php index b2e1519..4ebdcfa 100644 --- a/src/OAuth2/OAuth2ApiRoutes.php +++ b/src/OAuth2/OAuth2ApiRoutes.php @@ -2,10 +2,11 @@ namespace Hanyuu\OAuth2; use RuntimeException; -use Index\Http\Routing\{HttpGet,HttpOptions,HttpPost,RouteHandler}; -use Syokuhou\IConfig; +use Index\Http\Routing\{HttpGet,HttpOptions,HttpPost,RouteHandler,RouteHandlerTrait}; + +final class OAuth2ApiRoutes implements RouteHandler { + use RouteHandlerTrait; -final class OAuth2ApiRoutes extends RouteHandler { public function __construct( private OAuth2Context $oauth2Ctx ) {} diff --git a/src/OAuth2/OAuth2AuthorisationData.php b/src/OAuth2/OAuth2AuthorisationData.php index 150510b..3c20c2a 100644 --- a/src/OAuth2/OAuth2AuthorisationData.php +++ b/src/OAuth2/OAuth2AuthorisationData.php @@ -4,16 +4,15 @@ namespace Hanyuu\OAuth2; use InvalidArgumentException; use RuntimeException; use Index\XString; -use Index\Data\DbStatementCache; -use Index\Data\IDbConnection; -use Hanyuu\Apps\AppInfo; -use Hanyuu\Apps\AppUriInfo; +use Index\Db\{DbConnection,DbStatementCache}; +use Hanyuu\Apps\{AppInfo,AppUriInfo}; class OAuth2AuthorisationData { - private IDbConnection $dbConn; private DbStatementCache $cache; - public function __construct(IDbConnection $dbConn) { + public function __construct( + private DbConnection $dbConn + ) { $this->dbConn = $dbConn; $this->cache = new DbStatementCache($dbConn); } diff --git a/src/OAuth2/OAuth2AuthorisationInfo.php b/src/OAuth2/OAuth2AuthorisationInfo.php index 850165c..4b370b3 100644 --- a/src/OAuth2/OAuth2AuthorisationInfo.php +++ b/src/OAuth2/OAuth2AuthorisationInfo.php @@ -2,7 +2,7 @@ namespace Hanyuu\OAuth2; use Index\UriBase64; -use Index\Data\IDbResult; +use Index\Db\DbResult; class OAuth2AuthorisationInfo { public function __construct( @@ -18,7 +18,7 @@ class OAuth2AuthorisationInfo { private int $expires ) {} - public static function fromResult(IDbResult $result): OAuth2AuthorisationInfo { + public static function fromResult(DbResult $result): OAuth2AuthorisationInfo { return new OAuth2AuthorisationInfo( id: $result->getString(0), appId: $result->getString(1), diff --git a/src/OAuth2/OAuth2Context.php b/src/OAuth2/OAuth2Context.php index bddef7d..0e62b71 100644 --- a/src/OAuth2/OAuth2Context.php +++ b/src/OAuth2/OAuth2Context.php @@ -3,8 +3,8 @@ namespace Hanyuu\OAuth2; use RuntimeException; use Hanyuu\Apps\{AppsContext,AppInfo}; -use Index\Data\IDbConnection; -use Syokuhou\IConfig; +use Index\Config\Config; +use Index\Db\DbConnection; class OAuth2Context { private OAuth2AuthorisationData $authorisations; @@ -12,8 +12,8 @@ class OAuth2Context { private OAuth2DevicesData $devices; public function __construct( - private IConfig $config, - IDbConnection $dbConn, + private Config $config, + DbConnection $dbConn, private AppsContext $appsCtx ) { $this->authorisations = new OAuth2AuthorisationData($dbConn); @@ -21,7 +21,7 @@ class OAuth2Context { $this->devices = new OAuth2DevicesData($dbConn); } - public function getConfig(): IConfig { + public function getConfig(): Config { return $this->config; } diff --git a/src/OAuth2/OAuth2DeviceInfo.php b/src/OAuth2/OAuth2DeviceInfo.php index 66a0413..161bca1 100644 --- a/src/OAuth2/OAuth2DeviceInfo.php +++ b/src/OAuth2/OAuth2DeviceInfo.php @@ -1,7 +1,7 @@ getString(0), appId: $result->getString(1), diff --git a/src/OAuth2/OAuth2DevicesData.php b/src/OAuth2/OAuth2DevicesData.php index 10c36f3..10a3f66 100644 --- a/src/OAuth2/OAuth2DevicesData.php +++ b/src/OAuth2/OAuth2DevicesData.php @@ -4,8 +4,7 @@ namespace Hanyuu\OAuth2; use InvalidArgumentException; use RuntimeException; use Index\XString; -use Index\Data\DbStatementCache; -use Index\Data\IDbConnection; +use Index\Db\{DbConnection,DbStatementCache}; use Hanyuu\Apps\AppInfo; class OAuth2DevicesData { @@ -14,7 +13,7 @@ class OAuth2DevicesData { private DbStatementCache $cache; public function __construct( - private IDbConnection $dbConn + private DbConnection $dbConn ) { $this->cache = new DbStatementCache($dbConn); } diff --git a/src/OAuth2/OAuth2RefreshInfo.php b/src/OAuth2/OAuth2RefreshInfo.php index 562c9e1..2aa7534 100644 --- a/src/OAuth2/OAuth2RefreshInfo.php +++ b/src/OAuth2/OAuth2RefreshInfo.php @@ -1,7 +1,7 @@ getString(0), appId: $result->getString(1), diff --git a/src/OAuth2/OAuth2RpcActions.php b/src/OAuth2/OAuth2RpcHandler.php similarity index 89% rename from src/OAuth2/OAuth2RpcActions.php rename to src/OAuth2/OAuth2RpcHandler.php index 3028927..b221087 100644 --- a/src/OAuth2/OAuth2RpcActions.php +++ b/src/OAuth2/OAuth2RpcHandler.php @@ -3,10 +3,11 @@ namespace Hanyuu\OAuth2; use RuntimeException; use Hanyuu\Apps\AppsContext; -use Aiwass\Server\{RpcActionHandler,RpcProcedure}; -use Syokuhou\IConfig; +use RPCii\Server\{RpcHandler,RpcHandlerCommon,RpcAction}; + +final class OAuth2RpcHandler implements RpcHandler { + use RpcHandlerCommon; -final class OAuth2RpcActions extends RpcActionHandler { public function __construct( private OAuth2Context $oauth2Ctx ) {} @@ -26,7 +27,7 @@ final class OAuth2RpcActions extends RpcActionHandler { return $scopes; } - #[RpcProcedure('hanyuu:oauth2:attemptAppAuth')] + #[RpcAction('hanyuu:oauth2:attemptAppAuth')] public function procAttemptAppAuth(string $remoteAddr, string $clientId, string $clientSecret = ''): array { try { $appInfo = $this->oauth2Ctx->getApps()->getAppsData()->getAppInfo(clientId: $clientId, deleted: false); @@ -52,7 +53,7 @@ final class OAuth2RpcActions extends RpcActionHandler { ]; } - #[RpcProcedure('hanyuu:oauth2:attemptBearerAuth')] + #[RpcAction('hanyuu:oauth2:attemptBearerAuth')] public function procAttemptBearerAuth(string $remoteAddr, string $token): array { try { $tokenInfo = $this->oauth2Ctx->getTokensData()->getAccessInfo($token, OAuth2TokensData::ACCESS_BY_TOKEN); @@ -73,7 +74,7 @@ final class OAuth2RpcActions extends RpcActionHandler { ]; } - #[RpcProcedure('hanyuu:oauth2:createAuthoriseRequest')] + #[RpcAction('hanyuu:oauth2:createAuthoriseRequest')] public function procCreateAuthoriseRequest(string $appId, ?string $scope = null): array { try { $appInfo = $this->oauth2Ctx->getApps()->getAppsData()->getAppInfo(appId: $appId, deleted: false); @@ -87,7 +88,7 @@ final class OAuth2RpcActions extends RpcActionHandler { return $this->oauth2Ctx->createDeviceAuthorisationRequest($appInfo, $scope); } - #[RpcProcedure('hanyuu:oauth2:createBearerToken:authorisationCode')] + #[RpcAction('hanyuu:oauth2:createBearerToken:authorisationCode')] public function procCreateBearerTokenAuthzCode(string $appId, bool $isAuthed, string $code, string $codeVerifier): array { try { $appInfo = $this->oauth2Ctx->getApps()->getAppsData()->getAppInfo(appId: $appId, deleted: false); @@ -101,7 +102,7 @@ final class OAuth2RpcActions extends RpcActionHandler { return $this->oauth2Ctx->redeemAuthorisationCode($appInfo, $isAuthed, $code, $codeVerifier); } - #[RpcProcedure('hanyuu:oauth2:createBearerToken:refreshToken')] + #[RpcAction('hanyuu:oauth2:createBearerToken:refreshToken')] public function procCreateBearerTokenRefreshToken(string $appId, bool $isAuthed, string $refreshToken, ?string $scope = null): array { try { $appInfo = $this->oauth2Ctx->getApps()->getAppsData()->getAppInfo(appId: $appId, deleted: false); @@ -115,7 +116,7 @@ final class OAuth2RpcActions extends RpcActionHandler { return $this->oauth2Ctx->redeemRefreshToken($appInfo, $isAuthed, $refreshToken, $scope); } - #[RpcProcedure('hanyuu:oauth2:createBearerToken:clientCredentials')] + #[RpcAction('hanyuu:oauth2:createBearerToken:clientCredentials')] public function procCreateBearerTokenClientCreds(string $appId, bool $isAuthed, ?string $scope = null): array { try { $appInfo = $this->oauth2Ctx->getApps()->getAppsData()->getAppInfo(appId: $appId, deleted: false); @@ -129,7 +130,7 @@ final class OAuth2RpcActions extends RpcActionHandler { return $this->oauth2Ctx->redeemClientCredentials($appInfo, $isAuthed, $scope); } - #[RpcProcedure('hanyuu:oauth2:createBearerToken:deviceCode')] + #[RpcAction('hanyuu:oauth2:createBearerToken:deviceCode')] public function procCreateBearerTokenDeviceCode(string $appId, bool $isAuthed, string $deviceCode): array { try { $appInfo = $this->oauth2Ctx->getApps()->getAppsData()->getAppInfo(appId: $appId, deleted: false); diff --git a/src/OAuth2/OAuth2TokensData.php b/src/OAuth2/OAuth2TokensData.php index 9d3e075..f522284 100644 --- a/src/OAuth2/OAuth2TokensData.php +++ b/src/OAuth2/OAuth2TokensData.php @@ -4,15 +4,14 @@ namespace Hanyuu\OAuth2; use InvalidArgumentException; use RuntimeException; use Index\XString; -use Index\Data\DbStatementCache; -use Index\Data\IDbConnection; +use Index\Db\{DbConnection,DbStatementCache}; use Hanyuu\Apps\AppInfo; class OAuth2TokensData { private DbStatementCache $cache; public function __construct( - private IDbConnection $dbConn + private DbConnection $dbConn ) { $this->cache = new DbStatementCache($dbConn); } diff --git a/src/OAuth2/OAuth2WebRoutes.php b/src/OAuth2/OAuth2WebRoutes.php index a955e36..f4adc93 100644 --- a/src/OAuth2/OAuth2WebRoutes.php +++ b/src/OAuth2/OAuth2WebRoutes.php @@ -3,22 +3,23 @@ namespace Hanyuu\OAuth2; use InvalidArgumentException; use RuntimeException; -use Index\CSRFP; -use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler}; -use Sasae\SasaeEnvironment; -use Syokuhou\IConfig; +use Index\CsrfToken; +use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler,RouteHandlerTrait}; +use Index\Templating\TplEnvironment; + +final class OAuth2WebRoutes implements RouteHandler { + use RouteHandlerTrait; -final class OAuth2WebRoutes extends RouteHandler { public function __construct( private OAuth2Context $oauth2Ctx, - private SasaeEnvironment $templating, + private TplEnvironment $templating, private $getAuthInfo, - private $getCSRFPSecret + private $getCsrfTokenSecret ) { if(!is_callable($getAuthInfo)) throw new InvalidArgumentException('$getAuthInfo must be callable'); - if(!is_callable($getCSRFPSecret)) - throw new InvalidArgumentException('$getCSRFPSecret must be callable'); + if(!is_callable($getCsrfTokenSecret)) + throw new InvalidArgumentException('$getCsrfTokenSecret must be callable'); } #[HttpGet('/oauth2/authorise')] @@ -30,7 +31,7 @@ final class OAuth2WebRoutes extends RouteHandler { 'register_url' => $authInfo->getRegisterUrl(), ]); - $csrfp = new CSRFP(($this->getCSRFPSecret)(), $authInfo->getSessionInfo()->getToken()); + $csrfp = new CsrfToken(($this->getCsrfTokenSecret)(), $authInfo->getSessionInfo()->getToken()); return $this->templating->render('oauth2/authorise', [ 'csrfp_token' => $csrfp->createToken(), @@ -50,7 +51,7 @@ final class OAuth2WebRoutes extends RouteHandler { $content = $request->getContent(); - $csrfp = new CSRFP(($this->getCSRFPSecret)(), $authInfo->getSessionInfo()->getToken()); + $csrfp = new CsrfToken(($this->getCsrfTokenSecret)(), $authInfo->getSessionInfo()->getToken()); if(!$csrfp->verifyToken((string)$content->getParam('_csrfp'))) return ['error' => 'csrf']; @@ -137,7 +138,7 @@ final class OAuth2WebRoutes extends RouteHandler { return ['error' => 'auth']; $sessionInfo = $authInfo->getSessionInfo(); - $csrfp = new CSRFP(($this->getCSRFPSecret)(), $sessionInfo->getToken()); + $csrfp = new CsrfToken(($this->getCsrfTokenSecret)(), $sessionInfo->getToken()); if(!$csrfp->verifyToken((string)$request->getParam('csrfp'))) return ['error' => 'csrf']; @@ -212,7 +213,7 @@ final class OAuth2WebRoutes extends RouteHandler { 'register_url' => $authInfo->getRegisterUrl(), ]); - $csrfp = new CSRFP(($this->getCSRFPSecret)(), $authInfo->getSessionInfo()->getToken()); + $csrfp = new CsrfToken(($this->getCsrfTokenSecret)(), $authInfo->getSessionInfo()->getToken()); return $this->templating->render('oauth2/verify', [ 'csrfp_token' => $csrfp->createToken(), @@ -232,7 +233,7 @@ final class OAuth2WebRoutes extends RouteHandler { $content = $request->getContent(); - $csrfp = new CSRFP(($this->getCSRFPSecret)(), $authInfo->getSessionInfo()->getToken()); + $csrfp = new CsrfToken(($this->getCsrfTokenSecret)(), $authInfo->getSessionInfo()->getToken()); if(!$csrfp->verifyToken((string)$content->getParam('_csrfp'))) return ['error' => 'csrf']; @@ -294,7 +295,7 @@ final class OAuth2WebRoutes extends RouteHandler { if($authInfo->isFailure()) return ['error' => 'auth']; - $csrfp = new CSRFP(($this->getCSRFPSecret)(), $authInfo->getSessionInfo()->getToken()); + $csrfp = new CsrfToken(($this->getCsrfTokenSecret)(), $authInfo->getSessionInfo()->getToken()); if(!$csrfp->verifyToken((string)$request->getParam('csrfp'))) return ['error' => 'csrf']; diff --git a/src/RoutingContext.php b/src/RoutingContext.php index 761e56f..eb8b444 100644 --- a/src/RoutingContext.php +++ b/src/RoutingContext.php @@ -1,24 +1,24 @@ templating = $templating; $this->router = new HttpRouter(errorHandler: new RoutingErrorHandler); $this->router->use('/', fn($resp) => $resp->setPoweredBy('Hanyuu')); } - public function getRouter(): IRouter { + public function getRouter(): Router { return $this->router; } - public function register(IRouteHandler $handler): void { + public function register(RouteHandler $handler): void { $this->router->register($handler); } diff --git a/src/RoutingErrorHandler.php b/src/RoutingErrorHandler.php index dbf6d66..c7b64af 100644 --- a/src/RoutingErrorHandler.php +++ b/src/RoutingErrorHandler.php @@ -1,10 +1,9 @@