diff --git a/composer.json b/composer.json index ab1f66c..12d3c40 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,6 @@ { "require": { - "flashwave/index": "^0.2408.40014", - "flashwave/sasae": "^1.1", - "flashwave/syokuhou": "^1.2", + "flashwave/index": "^0.2410", "erusev/parsedown": "~1.6", "sentry/sdk": "^4.0" }, diff --git a/composer.lock b/composer.lock index 16f6001..cc8223e 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": "a825e4d5e3378939f2eb894d05add96f", + "content-hash": "0fcc2129a9e1c99597116e91c7bb2df1", "packages": [ { "name": "erusev/parsedown", @@ -58,23 +58,28 @@ }, { "name": "flashwave/index", - "version": "v0.2408.40014", + "version": "v0.2410.51409", "source": { "type": "git", "url": "https://patchii.net/flash/index.git", - "reference": "fbca708fbd75e8ecc6b36b39c1307a67bf250808" + "reference": "c43c6eb334f85edf8fa7b5e4058b3ba35a27d960" }, "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": { @@ -96,85 +101,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-05T14:10:08+00:00" }, { "name": "guzzlehttp/psr7", @@ -461,16 +388,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": { @@ -505,9 +432,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", @@ -610,16 +537,16 @@ }, { "name": "sentry/sentry", - "version": "4.8.1", + "version": "4.9.0", "source": { "type": "git", "url": "https://github.com/getsentry/sentry-php.git", - "reference": "61770efd8b7888e0bdd7d234f0ba67b066e47d04" + "reference": "788ec170f51ebb22f2809a1e3f78b19ccd39b70d" }, "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/788ec170f51ebb22f2809a1e3f78b19ccd39b70d", + "reference": "788ec170f51ebb22f2809a1e3f78b19ccd39b70d", "shasum": "" }, "require": { @@ -683,7 +610,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.9.0" }, "funding": [ { @@ -695,7 +622,7 @@ "type": "custom" } ], - "time": "2024-07-16T13:45:27+00:00" + "time": "2024-08-08T14:40:50+00:00" }, { "name": "symfony/deprecation-contracts", @@ -766,16 +693,16 @@ }, { "name": "symfony/mime", - "version": "v7.1.2", + "version": "v7.1.5", "source": { "type": "git", "url": "https://github.com/symfony/mime.git", - "reference": "26a00b85477e69a4bab63b66c5dce64f18b0cbfc" + "reference": "711d2e167e8ce65b05aea6b258c449671cdd38ff" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/mime/zipball/26a00b85477e69a4bab63b66c5dce64f18b0cbfc", - "reference": "26a00b85477e69a4bab63b66c5dce64f18b0cbfc", + "url": "https://api.github.com/repos/symfony/mime/zipball/711d2e167e8ce65b05aea6b258c449671cdd38ff", + "reference": "711d2e167e8ce65b05aea6b258c449671cdd38ff", "shasum": "" }, "require": { @@ -830,7 +757,7 @@ "mime-type" ], "support": { - "source": "https://github.com/symfony/mime/tree/v7.1.2" + "source": "https://github.com/symfony/mime/tree/v7.1.5" }, "funding": [ { @@ -846,7 +773,7 @@ "type": "tidelift" } ], - "time": "2024-06-28T10:03:55+00:00" + "time": "2024-09-20T08:28:38+00:00" }, { "name": "symfony/options-resolver", @@ -917,20 +844,20 @@ }, { "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": "*" @@ -976,7 +903,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": [ { @@ -992,26 +919,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" @@ -1060,7 +986,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": [ { @@ -1076,24 +1002,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" @@ -1141,7 +1067,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": [ { @@ -1157,24 +1083,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": "*" @@ -1221,7 +1147,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": [ { @@ -1237,24 +1163,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": { @@ -1268,80 +1194,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" @@ -1352,10 +1205,6 @@ "MIT" ], "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -1365,7 +1214,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", @@ -1374,7 +1223,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": [ { @@ -1390,27 +1239,27 @@ "type": "tidelift" } ], - "time": "2024-05-31T15:07:36+00:00" + "time": "2024-09-09T11:45:10+00:00" }, { "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" @@ -1446,7 +1295,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": [ { @@ -1458,28 +1307,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.0", "source": { "type": "git", "url": "https://github.com/twigphp/Twig.git", - "reference": "67f29781ffafa520b0bbfbd8384674b42db04572" + "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/twigphp/Twig/zipball/67f29781ffafa520b0bbfbd8384674b42db04572", - "reference": "67f29781ffafa520b0bbfbd8384674b42db04572", + "url": "https://api.github.com/repos/twigphp/Twig/zipball/126b2c97818dbff0cdf3fbfc881aedb3d40aae72", + "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72", "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", @@ -1525,7 +1374,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.0" }, "funding": [ { @@ -1537,22 +1386,22 @@ "type": "tidelift" } ], - "time": "2024-05-16T10:04:27+00:00" + "time": "2024-09-09T17:55:12+00:00" } ], "packages-dev": [ { "name": "phpstan/phpstan", - "version": "1.11.9", + "version": "1.12.5", "source": { "type": "git", "url": "https://github.com/phpstan/phpstan.git", - "reference": "e370bcddadaede0c1716338b262346f40d296f82" + "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpstan/phpstan/zipball/e370bcddadaede0c1716338b262346f40d296f82", - "reference": "e370bcddadaede0c1716338b262346f40d296f82", + "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17", + "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17", "shasum": "" }, "require": { @@ -1597,7 +1446,7 @@ "type": "github" } ], - "time": "2024-08-01T16:25:18+00:00" + "time": "2024-09-26T12:45:22+00:00" } ], "aliases": [], diff --git a/database/2023_09_15_233145_existing_structure.php b/database/2023_09_15_233145_existing_structure.php index f724ab9..66cc5ae 100644 --- a/database/2023_09_15_233145_existing_structure.php +++ b/database/2023_09_15_233145_existing_structure.php @@ -1,9 +1,9 @@ hasValues('sentry:dsn')) (function($cfg) { diff --git a/src/Auth/ChatAuth.php b/src/Auth/ChatAuth.php index de7a04e..0f99977 100644 --- a/src/Auth/ChatAuth.php +++ b/src/Auth/ChatAuth.php @@ -2,10 +2,10 @@ namespace Seria\Auth; use stdClass; -use Syokuhou\IConfig; +use Index\Config\Config; final class ChatAuth { - public static function attempt(IConfig $config, string $cookie): object { + public static function attempt(Config $config, string $cookie): object { if(!empty($cookie)) { $method = 'Misuzu'; $signature = sprintf('verify#%s#%s#%s', $method, $cookie, $_SERVER['REMOTE_ADDR']); diff --git a/src/Colours.php b/src/Colours.php index 6499cfc..a733e47 100644 --- a/src/Colours.php +++ b/src/Colours.php @@ -3,7 +3,7 @@ namespace Seria; use Index\XNumber; use Index\Colour\Colour; -use Index\Colour\ColourRGB; +use Index\Colour\ColourRgb; final class Colours { public const RATIO_GOOD = 0x008000; @@ -55,6 +55,6 @@ final class Colours { public static function cached(int $raw): Colour { if(array_key_exists($raw, self::$colourCache)) return self::$colourCache[$raw]; - return self::$colourCache[$raw] = ColourRGB::fromRawRGB($raw); + return self::$colourCache[$raw] = ColourRgb::fromRawRgb($raw); } } diff --git a/src/HomeRoutes.php b/src/HomeRoutes.php index 47b6ae4..5f28573 100644 --- a/src/HomeRoutes.php +++ b/src/HomeRoutes.php @@ -1,12 +1,14 @@ router->registerContentHandler(new StringableContentHandler); // this should really be in Index lol but i can't be bothered rn! } - 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 346281f..2a89b9a 100644 --- a/src/RoutingErrorHandler.php +++ b/src/RoutingErrorHandler.php @@ -1,10 +1,9 @@ dbConn = $dbConn; $this->config = $config; @@ -35,7 +35,7 @@ final class SeriaContext { $this->usersCtx = new UsersContext($dbConn); } - public function getDbConn(): IDbTransactions { + public function getDbConn(): DbTransactions { return $this->dbConn; } @@ -48,7 +48,7 @@ final class SeriaContext { return new DbMigrationManager($this->dbConn, 'ser_' . DbMigrationManager::DEFAULT_TABLE); } - public function createMigrationRepo(): IDbMigrationRepo { + public function createMigrationRepo(): DbMigrationRepo { return new FsDbMigrationRepo(SERIA_DIR_MIGRATIONS); } @@ -68,16 +68,16 @@ final class SeriaContext { return $this->usersCtx; } - public function getTemplating(): ?SasaeEnvironment { + public function getTemplating(): ?TplEnvironment { return $this->templating; } - public function getCSRFP(): CSRFP { + public function getCSRFP(): CsrfToken { return $this->csrfp; } public function startCSRFP(string $secretKey, string $identity): void { - $this->csrfp = new CSRFP($secretKey, $identity); + $this->csrfp = new CsrfToken($secretKey, $identity); } public function startTemplating(): void { @@ -87,12 +87,12 @@ final class SeriaContext { 'display_timings_info' => SERIA_DEBUG, // + isFlash ]; - $this->templating = new SasaeEnvironment( + $this->templating = new TplEnvironment( SERIA_DIR_TEMPLATES, cache: SERIA_DEBUG ? null : ['Seria', GitInfo::hash(true)], debug: SERIA_DEBUG, ); - $this->templating->addExtension(new SeriaSasaeExtension($this, $this->siteInfo)); + $this->templating->addExtension(new TemplatingExtension($this, $this->siteInfo)); $this->templating->addGlobal('globals', $globals); } diff --git a/src/SiteInfo.php b/src/SiteInfo.php index 57a6cb2..1fedf5f 100644 --- a/src/SiteInfo.php +++ b/src/SiteInfo.php @@ -1,11 +1,11 @@ config->getString('name'); diff --git a/src/StringableContentHandler.php b/src/StringableContentHandler.php index 7d71e75..5f57e58 100644 --- a/src/StringableContentHandler.php +++ b/src/StringableContentHandler.php @@ -2,17 +2,15 @@ namespace Seria; use Stringable; -use Index\Http\HttpResponseBuilder; -use Index\Http\Content\StringContent; -use Index\Http\ContentHandling\IContentHandler; +use Index\Http\{HttpContentHandler,HttpResponseBuilder,StringHttpContent}; -class StringableContentHandler implements IContentHandler { +class StringableContentHandler implements HttpContentHandler { public function match(mixed $content): bool { return $content instanceof Stringable; } /** @param Stringable $content */ public function handle(HttpResponseBuilder $response, mixed $content): void { - $response->setContent(new StringContent((string)$content)); + $response->setContent(new StringHttpContent((string)$content)); } } diff --git a/src/SeriaSasaeExtension.php b/src/TemplatingExtension.php similarity index 97% rename from src/SeriaSasaeExtension.php rename to src/TemplatingExtension.php index 05a8c04..e80a43d 100644 --- a/src/SeriaSasaeExtension.php +++ b/src/TemplatingExtension.php @@ -5,7 +5,7 @@ use Twig\Extension\AbstractExtension; use Twig\TwigFunction; use Seria\Torrents\TorrentPeers; -final class SeriaSasaeExtension extends AbstractExtension { +final class TemplatingExtension extends AbstractExtension { private TorrentPeers $peers; public function __construct( diff --git a/src/Torrents/AnnounceEmpty.php b/src/Torrents/AnnounceEmpty.php index 83d557d..1762caa 100644 --- a/src/Torrents/AnnounceEmpty.php +++ b/src/Torrents/AnnounceEmpty.php @@ -1,20 +1,37 @@ 0, - 'min interval' => 0, - 'complete' => 0, - 'incomplete' => 0, - 'peers' => $this->compactPeers ? '' : [], - ]; + #[BencodeProperty('interval')] + public function getInterval(): int { + return 0; + } + + #[BencodeProperty('min interval')] + public function getMinimumInterval(): int { + return 0; + } + + #[BencodeProperty('complete')] + public function getComplete(): int { + return 0; + } + + #[BencodeProperty('incomplete')] + public function getIncomplete(): int { + return 0; + } + + #[BencodeProperty('peers')] + public function getIncomplete(): string|array { + return $this->compactPeers ? '' : []; } } diff --git a/src/Torrents/AnnounceFailure.php b/src/Torrents/AnnounceFailure.php index b0c6fd8..2b82584 100644 --- a/src/Torrents/AnnounceFailure.php +++ b/src/Torrents/AnnounceFailure.php @@ -1,12 +1,15 @@ $this->reason]; + #[BencodeProperty('failure reason')] + public function getReason(): string { + return $this->reason; } } diff --git a/src/Torrents/AnnounceInfo.php b/src/Torrents/AnnounceInfo.php index e3d8b86..2073a7a 100644 --- a/src/Torrents/AnnounceInfo.php +++ b/src/Torrents/AnnounceInfo.php @@ -1,9 +1,11 @@ interval; + } + + #[BencodeProperty('min interval')] + public function getMinimumInterval(): int { + return $this->minInterval; + } + + #[BencodeProperty('complete')] + public function getComplete(): int { + return $this->completePeers; + } + + #[BencodeProperty('incomplete')] + public function getIncomplete(): int { + return $this->incompletePeers; + } + + // #[BencodeProperty('downloaded')] + // public function getDownloaded(): int { + // return 0; // todo: keep track of how many completes + // } + + #[BencodeProperty('peers')] + public function getPeers(): string|array { if($this->compactPeers) return $this->createCompactPeersList(); + if($this->noPeerIds) return $this->createPeersListWithoutIds(); + return $this->createPeersListWithIds(); } - public function bencodeSerialise(): mixed { - $peers = $this->createPeersList(); - - return [ - 'interval' => $this->interval, - 'min interval' => $this->minInterval, - 'complete' => $this->completePeers, - 'incomplete' => $this->incompletePeers, - //'downloaded' => 0, todo: keep track of how many completes - 'peers' => $peers, - //'peers6' => '', todo: support ipv6 someday - ]; - } + // #[BencodeProperty('peers6')] + // public function getPeersV6(): int { + // return ''; // todo: support ipv6 someday + // } } diff --git a/src/Torrents/AnnounceRouting.php b/src/Torrents/AnnounceRouting.php index d1381ac..41d13d9 100644 --- a/src/Torrents/AnnounceRouting.php +++ b/src/Torrents/AnnounceRouting.php @@ -3,10 +3,12 @@ namespace Seria\Torrents; use RuntimeException; use Index\Bencode\Bencode; -use Index\Http\Routing\{HttpGet,RouteHandler}; +use Index\Http\Routing\{HttpGet,RouteHandler,RouteHandlerTrait}; use Seria\Users\UsersContext; -class AnnounceRouting extends RouteHandler { +class AnnounceRouting implements RouteHandler { + use RouteHandlerTrait; + public const INTERVAL = 1800; public const INTERVAL_MIN = 30; @@ -20,7 +22,8 @@ class AnnounceRouting extends RouteHandler { #[HttpGet('/announce/([A-Za-z0-9]+)')] #[HttpGet('/announce.php/([A-Za-z0-9]+)')] public function getAnnounce($response, $request, string $key = '') { - if(strlen(inet_pton($_SERVER['REMOTE_ADDR'])) !== 4) + $remoteAddr = $request->getRemoteAddress(); + if(strlen(inet_pton($remoteAddr)) !== 4) return new AnnounceFailure('Tracker is only supported over IPv4, please reset your DNS cache.'); $torrents = $this->torrentsCtx->getTorrents(); @@ -48,8 +51,6 @@ class AnnounceRouting extends RouteHandler { if(strlen($peerId) !== 20) return new AnnounceFailure('Invalid peer id.'); - $address = $_SERVER['REMOTE_ADDR']; - $port = (int)$request->getParam('port'); if($port < 1 || $port > 0xFFFF) return new AnnounceFailure('Invalid port number.'); @@ -96,7 +97,7 @@ class AnnounceRouting extends RouteHandler { if($peerInfo === null) { // could probably skip this is the event is 'stopped' $peerInfo = $peers->createPeer( - $torrentInfo, $userInfo, $peerId, $address, $port, self::INTERVAL, + $torrentInfo, $userInfo, $peerId, $remoteAddr, $port, self::INTERVAL, $userAgent, $key, $bytesUploaded, $bytesDownloaded, $bytesRemaining ); } else { @@ -118,7 +119,7 @@ class AnnounceRouting extends RouteHandler { ); $peers->updatePeer( - $torrentInfo, $peerInfo, $address, $port, self::INTERVAL, + $torrentInfo, $peerInfo, $remoteAddr, $port, self::INTERVAL, $userAgent, $bytesUploaded, $bytesDownloaded, $bytesRemaining ); } diff --git a/src/Torrents/TorrentBuilder.php b/src/Torrents/TorrentBuilder.php index 21f1997..1d2ccb8 100644 --- a/src/Torrents/TorrentBuilder.php +++ b/src/Torrents/TorrentBuilder.php @@ -5,7 +5,7 @@ use Exception; use InvalidArgumentException; use RuntimeException; use Index\Bencode\Bencode; -use Index\Data\{DbTools,IDbTransactions}; +use Index\Db\{DbTools,DbTransactions}; use Seria\Users\UserInfo; class TorrentBuilder { @@ -101,7 +101,7 @@ class TorrentBuilder { return hash('sha1', Bencode::encode($info), true); } - public function create(IDbTransactions $dbConn, TorrentsContext $torrentsCtx): string { + public function create(DbTransactions $dbConn, TorrentsContext $torrentsCtx): string { $torrents = $torrentsCtx->getTorrents(); $pieces = $torrentsCtx->getPieces(); $files = $torrentsCtx->getFiles(); diff --git a/src/Torrents/TorrentCreateRouting.php b/src/Torrents/TorrentCreateRouting.php index 20284d6..1ec3054 100644 --- a/src/Torrents/TorrentCreateRouting.php +++ b/src/Torrents/TorrentCreateRouting.php @@ -3,20 +3,22 @@ namespace Seria\Torrents; use Exception; use RuntimeException; -use Index\CSRFP; -use Index\Data\IDbTransactions; -use Index\Http\Routing\{HttpGet,HttpMiddleware,HttpPost,RouteHandler}; -use Sasae\SasaeEnvironment; +use Index\CsrfToken; +use Index\Db\DbTransactions; +use Index\Http\Routing\{HttpGet,HttpMiddleware,HttpPost,RouteHandler,RouteHandlerTrait}; +use Index\Templating\TplEnvironment; use Seria\Auth\AuthInfo; use Seria\Users\UsersContext; -class TorrentCreateRouting extends RouteHandler { +class TorrentCreateRouting implements RouteHandler { + use RouteHandlerTrait; + public function __construct( - private IDbTransactions $dbConn, + private DbTransactions $dbConn, private AuthInfo $authInfo, private TorrentsContext $torrentsCtx, - private CSRFP $csrfp, - private ?SasaeEnvironment $templating + private CsrfToken $csrfp, + private ?TplEnvironment $templating ) {} #[HttpMiddleware('/create')] diff --git a/src/Torrents/TorrentFileInfo.php b/src/Torrents/TorrentFileInfo.php index f574eb7..939fccc 100644 --- a/src/Torrents/TorrentFileInfo.php +++ b/src/Torrents/TorrentFileInfo.php @@ -1,16 +1,18 @@ id = $result->getString(0); $this->torrentId = $result->getString(1); $this->length = $result->getInteger(2); @@ -25,6 +27,7 @@ readonly class TorrentFileInfo implements IBencodeSerialisable { return $this->torrentId; } + #[BencodeProperty('length')] public function getLength(): int { return $this->length; } @@ -33,10 +36,8 @@ readonly class TorrentFileInfo implements IBencodeSerialisable { return $this->path; } - public function bencodeSerialise(): mixed { - return [ - 'length' => $this->length, - 'path' => explode('/', $this->path), - ]; + #[BencodeProperty('path')] + public function getPathArray(): array { + return explode('/', $this->path); } } diff --git a/src/Torrents/TorrentFiles.php b/src/Torrents/TorrentFiles.php index 407603c..94b9a39 100644 --- a/src/Torrents/TorrentFiles.php +++ b/src/Torrents/TorrentFiles.php @@ -3,13 +3,12 @@ namespace Seria\Torrents; use InvalidArgumentException; use RuntimeException; -use Index\Data\DbStatementCache; -use Index\Data\IDbConnection; +use Index\Db\{DbConnection,DbStatementCache}; class TorrentFiles { private DbStatementCache $cache; - public function __construct(IDbConnection $dbConn) { + public function __construct(DbConnection $dbConn) { $this->cache = new DbStatementCache($dbConn); } diff --git a/src/Torrents/TorrentInfo.php b/src/Torrents/TorrentInfo.php index 8c92dae..aa7e22d 100644 --- a/src/Torrents/TorrentInfo.php +++ b/src/Torrents/TorrentInfo.php @@ -1,7 +1,7 @@ id = $result->getString(0); $this->userId = $result->isNull(1) ? null : $result->getString(1); $this->infoHash = $result->getString(2); diff --git a/src/Torrents/TorrentInfoRouting.php b/src/Torrents/TorrentInfoRouting.php index 795bed8..b5a64bb 100644 --- a/src/Torrents/TorrentInfoRouting.php +++ b/src/Torrents/TorrentInfoRouting.php @@ -2,23 +2,25 @@ namespace Seria\Torrents; use RuntimeException; -use Index\CSRFP; -use Index\Http\Routing\{HttpGet,HttpMiddleware,HttpPost,RouteHandler}; -use Sasae\SasaeEnvironment; -use Syokuhou\IConfig; +use Index\CsrfToken; +use Index\Config\Config; +use Index\Http\Routing\{HttpGet,HttpMiddleware,HttpPost,RouteHandler,RouteHandlerTrait}; +use Index\Templating\TplEnvironment; use Seria\Auth\AuthInfo; use Seria\Users\UsersContext; -class TorrentInfoRouting extends RouteHandler { +class TorrentInfoRouting implements RouteHandler { + use RouteHandlerTrait; + private ?TorrentInfo $torrentInfo = null; public function __construct( - private IConfig $config, + private Config $config, private AuthInfo $authInfo, private TorrentsContext $torrentsCtx, private UsersContext $usersCtx, - private CSRFP $csrfp, - private ?SasaeEnvironment $templating + private CsrfToken $csrfp, + private ?TplEnvironment $templating ) {} #[HttpGet('/download/([0-9]+)')] diff --git a/src/Torrents/TorrentListRouting.php b/src/Torrents/TorrentListRouting.php index 0f19277..2318c83 100644 --- a/src/Torrents/TorrentListRouting.php +++ b/src/Torrents/TorrentListRouting.php @@ -2,17 +2,19 @@ namespace Seria\Torrents; use RuntimeException; -use Index\Http\Routing\{HttpGet,RouteHandler}; -use Sasae\SasaeEnvironment; +use Index\Http\Routing\{HttpGet,RouteHandler,RouteHandlerTrait}; +use Index\Templating\TplEnvironment; use Seria\Auth\AuthInfo; use Seria\Users\UsersContext; -class TorrentListRouting extends RouteHandler { +class TorrentListRouting implements RouteHandler { + use RouteHandlerTrait; + public function __construct( private AuthInfo $authInfo, private TorrentsContext $torrentsCtx, private UsersContext $usersCtx, - private ?SasaeEnvironment $templating + private ?TplEnvironment $templating ) {} #[HttpGet('/available')] diff --git a/src/Torrents/TorrentPeerInfo.php b/src/Torrents/TorrentPeerInfo.php index b99c81f..b7f27c7 100644 --- a/src/Torrents/TorrentPeerInfo.php +++ b/src/Torrents/TorrentPeerInfo.php @@ -1,7 +1,7 @@ id = $result->getString(0); $this->torrentId = $result->getString(1); $this->userId = $result->isNull(2) ? null : $result->getString(2); diff --git a/src/Torrents/TorrentPeers.php b/src/Torrents/TorrentPeers.php index 83b6410..9b046a6 100644 --- a/src/Torrents/TorrentPeers.php +++ b/src/Torrents/TorrentPeers.php @@ -3,16 +3,13 @@ namespace Seria\Torrents; use InvalidArgumentException; use RuntimeException; -use Index\Data\DbStatementCache; -use Index\Data\IDbConnection; +use Index\Db\{DbConnection,DbStatementCache}; use Seria\Users\UserInfo; class TorrentPeers { - private IDbConnection $dbConn; private DbStatementCache $cache; - public function __construct(IDbConnection $dbConn) { - $this->dbConn = $dbConn; + public function __construct(private DbConnection $dbConn) { $this->cache = new DbStatementCache($dbConn); } diff --git a/src/Torrents/TorrentPieceInfo.php b/src/Torrents/TorrentPieceInfo.php index e4f5b8f..5a02bbe 100644 --- a/src/Torrents/TorrentPieceInfo.php +++ b/src/Torrents/TorrentPieceInfo.php @@ -1,14 +1,14 @@ id = $result->getString(0); $this->torrentId = $result->getString(1); $this->hash = $result->getString(2); diff --git a/src/Torrents/TorrentPieces.php b/src/Torrents/TorrentPieces.php index e233443..1790a5b 100644 --- a/src/Torrents/TorrentPieces.php +++ b/src/Torrents/TorrentPieces.php @@ -3,13 +3,12 @@ namespace Seria\Torrents; use InvalidArgumentException; use RuntimeException; -use Index\Data\DbStatementCache; -use Index\Data\IDbConnection; +use Index\Db\{DbConnection,DbStatementCache}; class TorrentPieces { private DbStatementCache $cache; - public function __construct(IDbConnection $dbConn) { + public function __construct(DbConnection $dbConn) { $this->cache = new DbStatementCache($dbConn); } diff --git a/src/Torrents/Torrents.php b/src/Torrents/Torrents.php index 67ca169..ee14a0d 100644 --- a/src/Torrents/Torrents.php +++ b/src/Torrents/Torrents.php @@ -3,15 +3,13 @@ namespace Seria\Torrents; use InvalidArgumentException; use RuntimeException; -use Index\Data\DbStatementCache; -use Index\Data\IDbConnection; +use Index\Db\{DbConnection,DbStatementCache}; use Seria\Users\UserInfo; class Torrents { - 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/Torrents/TorrentsContext.php b/src/Torrents/TorrentsContext.php index 51443f1..3f71290 100644 --- a/src/Torrents/TorrentsContext.php +++ b/src/Torrents/TorrentsContext.php @@ -2,7 +2,7 @@ namespace Seria\Torrents; use Index\Bencode\Bencode; -use Index\Data\IDbConnection; +use Index\Db\DbConnection; use Seria\GitInfo; use Seria\Users\UserInfo; @@ -12,7 +12,7 @@ class TorrentsContext { private TorrentPeers $peers; private TorrentPieces $pieces; - public function __construct(IDbConnection $dbConn) { + public function __construct(DbConnection $dbConn) { $this->torrents = new Torrents($dbConn); $this->files = new TorrentFiles($dbConn); $this->peers = new TorrentPeers($dbConn); diff --git a/src/Users/ProfileRoutes.php b/src/Users/ProfileRoutes.php index e6e782d..090e4cf 100644 --- a/src/Users/ProfileRoutes.php +++ b/src/Users/ProfileRoutes.php @@ -2,17 +2,19 @@ namespace Seria\Users; use RuntimeException; -use Index\Http\Routing\{HttpGet,RouteHandler}; -use Sasae\SasaeEnvironment; +use Index\Http\Routing\{HttpGet,RouteHandler,RouteHandlerTrait}; +use Index\Templating\TplEnvironment; use Seria\Auth\AuthInfo; use Seria\Torrents\{TorrentsContext,TorrentInfo,TorrentPeerInfo}; -class ProfileRoutes extends RouteHandler { +class ProfileRoutes implements RouteHandler { + use RouteHandlerTrait; + public function __construct( private AuthInfo $authInfo, private TorrentsContext $torrentsCtx, private UsersContext $usersCtx, - private ?SasaeEnvironment $templating + private ?TplEnvironment $templating ) {} #[HttpGet('/profile/([a-zA-Z0-9\-_]+)')] diff --git a/src/Users/SettingsRoutes.php b/src/Users/SettingsRoutes.php index dc1c5d6..de15480 100644 --- a/src/Users/SettingsRoutes.php +++ b/src/Users/SettingsRoutes.php @@ -1,18 +1,20 @@ id = $result->getString(0); $this->name = $result->getString(1); diff --git a/src/Users/Users.php b/src/Users/Users.php index 4cee0e1..39d779a 100644 --- a/src/Users/Users.php +++ b/src/Users/Users.php @@ -5,15 +5,12 @@ use InvalidArgumentException; use RuntimeException; use Index\XString; use Index\Colour\Colour; -use Index\Data\DbStatementCache; -use Index\Data\DbTools; -use Index\Data\IDbConnection; -use Index\Net\IPAddress; +use Index\Db\{DbConnection,DbStatementCache,DbTools}; class Users { private DbStatementCache $cache; - public function __construct(IDbConnection $dbConn) { + public function __construct(DbConnection $dbConn) { $this->cache = new DbStatementCache($dbConn); } diff --git a/src/Users/UsersContext.php b/src/Users/UsersContext.php index dcf7f41..0687746 100644 --- a/src/Users/UsersContext.php +++ b/src/Users/UsersContext.php @@ -1,12 +1,12 @@ users = new Users($dbConn); } diff --git a/tools/migrate b/tools/migrate index 58b93b7..085347d 100755 --- a/tools/migrate +++ b/tools/migrate @@ -1,7 +1,5 @@ #!/usr/bin/env php