Updated Index library in Seria.

This commit is contained in:
flash 2024-10-05 16:42:25 +00:00
parent be44b474e7
commit 9025435dff
37 changed files with 291 additions and 404 deletions

View file

@ -1,8 +1,6 @@
{ {
"require": { "require": {
"flashwave/index": "^0.2408.40014", "flashwave/index": "^0.2410",
"flashwave/sasae": "^1.1",
"flashwave/syokuhou": "^1.2",
"erusev/parsedown": "~1.6", "erusev/parsedown": "~1.6",
"sentry/sdk": "^4.0" "sentry/sdk": "^4.0"
}, },

333
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "a825e4d5e3378939f2eb894d05add96f", "content-hash": "0fcc2129a9e1c99597116e91c7bb2df1",
"packages": [ "packages": [
{ {
"name": "erusev/parsedown", "name": "erusev/parsedown",
@ -58,23 +58,28 @@
}, },
{ {
"name": "flashwave/index", "name": "flashwave/index",
"version": "v0.2408.40014", "version": "v0.2410.51409",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://patchii.net/flash/index.git", "url": "https://patchii.net/flash/index.git",
"reference": "fbca708fbd75e8ecc6b36b39c1307a67bf250808" "reference": "c43c6eb334f85edf8fa7b5e4058b3ba35a27d960"
}, },
"require": { "require": {
"ext-mbstring": "*", "ext-mbstring": "*",
"php": ">=8.3" "php": ">=8.3",
"twig/html-extra": "^3.13",
"twig/twig": "^3.14"
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "^1.11", "phpstan/phpstan": "^1.11",
"phpunit/phpunit": "^11.2" "phpunit/phpunit": "^11.2"
}, },
"suggest": { "suggest": {
"ext-mysqli": "Support for the Index\\Data\\MariaDB namespace (both mysqlnd and libmysql are supported).", "ext-memcache": "Support for the Index\\Cache\\Memcached namespace (only if you can't use ext-memcached for some reason).",
"ext-sqlite3": "Support for the Index\\Data\\SQLite namespace." "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", "type": "library",
"autoload": { "autoload": {
@ -96,85 +101,7 @@
], ],
"description": "Composer package for the common library for my projects.", "description": "Composer package for the common library for my projects.",
"homepage": "https://railgun.sh/index", "homepage": "https://railgun.sh/index",
"time": "2024-08-04T00:14:17+00:00" "time": "2024-10-05T14:10:08+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"
}, },
{ {
"name": "guzzlehttp/psr7", "name": "guzzlehttp/psr7",
@ -461,16 +388,16 @@
}, },
{ {
"name": "psr/log", "name": "psr/log",
"version": "3.0.0", "version": "3.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/php-fig/log.git", "url": "https://github.com/php-fig/log.git",
"reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001" "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/php-fig/log/zipball/fe5ea303b0887d5caefd3d431c3e61ad47037001", "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"reference": "fe5ea303b0887d5caefd3d431c3e61ad47037001", "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -505,9 +432,9 @@
"psr-3" "psr-3"
], ],
"support": { "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", "name": "ralouphie/getallheaders",
@ -610,16 +537,16 @@
}, },
{ {
"name": "sentry/sentry", "name": "sentry/sentry",
"version": "4.8.1", "version": "4.9.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/getsentry/sentry-php.git", "url": "https://github.com/getsentry/sentry-php.git",
"reference": "61770efd8b7888e0bdd7d234f0ba67b066e47d04" "reference": "788ec170f51ebb22f2809a1e3f78b19ccd39b70d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/61770efd8b7888e0bdd7d234f0ba67b066e47d04", "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/788ec170f51ebb22f2809a1e3f78b19ccd39b70d",
"reference": "61770efd8b7888e0bdd7d234f0ba67b066e47d04", "reference": "788ec170f51ebb22f2809a1e3f78b19ccd39b70d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -683,7 +610,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/getsentry/sentry-php/issues", "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": [ "funding": [
{ {
@ -695,7 +622,7 @@
"type": "custom" "type": "custom"
} }
], ],
"time": "2024-07-16T13:45:27+00:00" "time": "2024-08-08T14:40:50+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
@ -766,16 +693,16 @@
}, },
{ {
"name": "symfony/mime", "name": "symfony/mime",
"version": "v7.1.2", "version": "v7.1.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/mime.git", "url": "https://github.com/symfony/mime.git",
"reference": "26a00b85477e69a4bab63b66c5dce64f18b0cbfc" "reference": "711d2e167e8ce65b05aea6b258c449671cdd38ff"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/mime/zipball/26a00b85477e69a4bab63b66c5dce64f18b0cbfc", "url": "https://api.github.com/repos/symfony/mime/zipball/711d2e167e8ce65b05aea6b258c449671cdd38ff",
"reference": "26a00b85477e69a4bab63b66c5dce64f18b0cbfc", "reference": "711d2e167e8ce65b05aea6b258c449671cdd38ff",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -830,7 +757,7 @@
"mime-type" "mime-type"
], ],
"support": { "support": {
"source": "https://github.com/symfony/mime/tree/v7.1.2" "source": "https://github.com/symfony/mime/tree/v7.1.5"
}, },
"funding": [ "funding": [
{ {
@ -846,7 +773,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-06-28T10:03:55+00:00" "time": "2024-09-20T08:28:38+00:00"
}, },
{ {
"name": "symfony/options-resolver", "name": "symfony/options-resolver",
@ -917,20 +844,20 @@
}, },
{ {
"name": "symfony/polyfill-ctype", "name": "symfony/polyfill-ctype",
"version": "v1.30.0", "version": "v1.31.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-ctype.git", "url": "https://github.com/symfony/polyfill-ctype.git",
"reference": "0424dff1c58f028c451efff2045f5d92410bd540" "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/0424dff1c58f028c451efff2045f5d92410bd540", "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/a3cc8b044a6ea513310cbd48ef7333b384945638",
"reference": "0424dff1c58f028c451efff2045f5d92410bd540", "reference": "a3cc8b044a6ea513310cbd48ef7333b384945638",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=7.2"
}, },
"provide": { "provide": {
"ext-ctype": "*" "ext-ctype": "*"
@ -976,7 +903,7 @@
"portable" "portable"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-ctype/tree/v1.30.0" "source": "https://github.com/symfony/polyfill-ctype/tree/v1.31.0"
}, },
"funding": [ "funding": [
{ {
@ -992,26 +919,25 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-31T15:07:36+00:00" "time": "2024-09-09T11:45:10+00:00"
}, },
{ {
"name": "symfony/polyfill-intl-idn", "name": "symfony/polyfill-intl-idn",
"version": "v1.30.0", "version": "v1.31.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-intl-idn.git", "url": "https://github.com/symfony/polyfill-intl-idn.git",
"reference": "a6e83bdeb3c84391d1dfe16f42e40727ce524a5c" "reference": "c36586dcf89a12315939e00ec9b4474adcb1d773"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/a6e83bdeb3c84391d1dfe16f42e40727ce524a5c", "url": "https://api.github.com/repos/symfony/polyfill-intl-idn/zipball/c36586dcf89a12315939e00ec9b4474adcb1d773",
"reference": "a6e83bdeb3c84391d1dfe16f42e40727ce524a5c", "reference": "c36586dcf89a12315939e00ec9b4474adcb1d773",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1", "php": ">=7.2",
"symfony/polyfill-intl-normalizer": "^1.10", "symfony/polyfill-intl-normalizer": "^1.10"
"symfony/polyfill-php72": "^1.10"
}, },
"suggest": { "suggest": {
"ext-intl": "For best performance" "ext-intl": "For best performance"
@ -1060,7 +986,7 @@
"shim" "shim"
], ],
"support": { "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": [ "funding": [
{ {
@ -1076,24 +1002,24 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-31T15:07:36+00:00" "time": "2024-09-09T11:45:10+00:00"
}, },
{ {
"name": "symfony/polyfill-intl-normalizer", "name": "symfony/polyfill-intl-normalizer",
"version": "v1.30.0", "version": "v1.31.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-intl-normalizer.git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git",
"reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb" "reference": "3833d7255cc303546435cb650316bff708a1c75c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/a95281b0be0d9ab48050ebd988b967875cdb9fdb", "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/3833d7255cc303546435cb650316bff708a1c75c",
"reference": "a95281b0be0d9ab48050ebd988b967875cdb9fdb", "reference": "3833d7255cc303546435cb650316bff708a1c75c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=7.2"
}, },
"suggest": { "suggest": {
"ext-intl": "For best performance" "ext-intl": "For best performance"
@ -1141,7 +1067,7 @@
"shim" "shim"
], ],
"support": { "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": [ "funding": [
{ {
@ -1157,24 +1083,24 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-31T15:07:36+00:00" "time": "2024-09-09T11:45:10+00:00"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/polyfill-mbstring",
"version": "v1.30.0", "version": "v1.31.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/polyfill-mbstring.git",
"reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c" "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/fd22ab50000ef01661e2a31d850ebaa297f8e03c", "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/85181ba99b2345b0ef10ce42ecac37612d9fd341",
"reference": "fd22ab50000ef01661e2a31d850ebaa297f8e03c", "reference": "85181ba99b2345b0ef10ce42ecac37612d9fd341",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=7.2"
}, },
"provide": { "provide": {
"ext-mbstring": "*" "ext-mbstring": "*"
@ -1221,7 +1147,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-mbstring/tree/v1.30.0" "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.31.0"
}, },
"funding": [ "funding": [
{ {
@ -1237,24 +1163,24 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-06-19T12:30:46+00:00" "time": "2024-09-09T11:45:10+00:00"
}, },
{ {
"name": "symfony/polyfill-php72", "name": "symfony/polyfill-php81",
"version": "v1.30.0", "version": "v1.31.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-php72.git", "url": "https://github.com/symfony/polyfill-php81.git",
"reference": "10112722600777e02d2745716b70c5db4ca70442" "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-php72/zipball/10112722600777e02d2745716b70c5db4ca70442", "url": "https://api.github.com/repos/symfony/polyfill-php81/zipball/4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
"reference": "10112722600777e02d2745716b70c5db4ca70442", "reference": "4a4cfc2d253c21a5ad0e53071df248ed48c6ce5c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.1" "php": ">=7.2"
}, },
"type": "library", "type": "library",
"extra": { "extra": {
@ -1268,80 +1194,7 @@
"bootstrap.php" "bootstrap.php"
], ],
"psr-4": { "psr-4": {
"Symfony\\Polyfill\\Php72\\": "" "Symfony\\Polyfill\\Php81\\": ""
}
},
"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\\": ""
}, },
"classmap": [ "classmap": [
"Resources/stubs" "Resources/stubs"
@ -1352,10 +1205,6 @@
"MIT" "MIT"
], ],
"authors": [ "authors": [
{
"name": "Ion Bazan",
"email": "ion.bazan@gmail.com"
},
{ {
"name": "Nicolas Grekas", "name": "Nicolas Grekas",
"email": "p@tchwork.com" "email": "p@tchwork.com"
@ -1365,7 +1214,7 @@
"homepage": "https://symfony.com/contributors" "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", "homepage": "https://symfony.com",
"keywords": [ "keywords": [
"compatibility", "compatibility",
@ -1374,7 +1223,7 @@
"shim" "shim"
], ],
"support": { "support": {
"source": "https://github.com/symfony/polyfill-php80/tree/v1.30.0" "source": "https://github.com/symfony/polyfill-php81/tree/v1.31.0"
}, },
"funding": [ "funding": [
{ {
@ -1390,27 +1239,27 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-31T15:07:36+00:00" "time": "2024-09-09T11:45:10+00:00"
}, },
{ {
"name": "twig/html-extra", "name": "twig/html-extra",
"version": "v3.10.0", "version": "v3.13.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/twigphp/html-extra.git", "url": "https://github.com/twigphp/html-extra.git",
"reference": "1c045fc28ace0dcaf464f8e0d4e2aca6347d5fda" "reference": "8229e750091171c1f11801a525927811c7ac5a7e"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/twigphp/html-extra/zipball/1c045fc28ace0dcaf464f8e0d4e2aca6347d5fda", "url": "https://api.github.com/repos/twigphp/html-extra/zipball/8229e750091171c1f11801a525927811c7ac5a7e",
"reference": "1c045fc28ace0dcaf464f8e0d4e2aca6347d5fda", "reference": "8229e750091171c1f11801a525927811c7ac5a7e",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.2.5", "php": ">=8.0.2",
"symfony/deprecation-contracts": "^2.5|^3", "symfony/deprecation-contracts": "^2.5|^3",
"symfony/mime": "^5.4|^6.4|^7.0", "symfony/mime": "^5.4|^6.4|^7.0",
"twig/twig": "^3.0" "twig/twig": "^3.13|^4.0"
}, },
"require-dev": { "require-dev": {
"symfony/phpunit-bridge": "^6.4|^7.0" "symfony/phpunit-bridge": "^6.4|^7.0"
@ -1446,7 +1295,7 @@
"twig" "twig"
], ],
"support": { "support": {
"source": "https://github.com/twigphp/html-extra/tree/v3.10.0" "source": "https://github.com/twigphp/html-extra/tree/v3.13.0"
}, },
"funding": [ "funding": [
{ {
@ -1458,28 +1307,28 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-11T07:35:57+00:00" "time": "2024-09-03T13:08:40+00:00"
}, },
{ {
"name": "twig/twig", "name": "twig/twig",
"version": "v3.10.3", "version": "v3.14.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/twigphp/Twig.git", "url": "https://github.com/twigphp/Twig.git",
"reference": "67f29781ffafa520b0bbfbd8384674b42db04572" "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/twigphp/Twig/zipball/67f29781ffafa520b0bbfbd8384674b42db04572", "url": "https://api.github.com/repos/twigphp/Twig/zipball/126b2c97818dbff0cdf3fbfc881aedb3d40aae72",
"reference": "67f29781ffafa520b0bbfbd8384674b42db04572", "reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=7.2.5", "php": ">=8.0.2",
"symfony/deprecation-contracts": "^2.5|^3", "symfony/deprecation-contracts": "^2.5|^3",
"symfony/polyfill-ctype": "^1.8", "symfony/polyfill-ctype": "^1.8",
"symfony/polyfill-mbstring": "^1.3", "symfony/polyfill-mbstring": "^1.3",
"symfony/polyfill-php80": "^1.22" "symfony/polyfill-php81": "^1.29"
}, },
"require-dev": { "require-dev": {
"psr/container": "^1.0|^2.0", "psr/container": "^1.0|^2.0",
@ -1525,7 +1374,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/twigphp/Twig/issues", "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": [ "funding": [
{ {
@ -1537,22 +1386,22 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-05-16T10:04:27+00:00" "time": "2024-09-09T17:55:12+00:00"
} }
], ],
"packages-dev": [ "packages-dev": [
{ {
"name": "phpstan/phpstan", "name": "phpstan/phpstan",
"version": "1.11.9", "version": "1.12.5",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/phpstan/phpstan.git", "url": "https://github.com/phpstan/phpstan.git",
"reference": "e370bcddadaede0c1716338b262346f40d296f82" "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/e370bcddadaede0c1716338b262346f40d296f82", "url": "https://api.github.com/repos/phpstan/phpstan/zipball/7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17",
"reference": "e370bcddadaede0c1716338b262346f40d296f82", "reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1597,7 +1446,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2024-08-01T16:25:18+00:00" "time": "2024-09-26T12:45:22+00:00"
} }
], ],
"aliases": [], "aliases": [],

View file

@ -1,9 +1,9 @@
<?php <?php
use Index\Data\IDbConnection; use Index\Db\DbConnection;
use Index\Data\Migration\IDbMigration; use Index\Db\Migration\DbMigration;
final class ExistingStructure_20230915_233145 implements IDbMigration { final class ExistingStructure_20230915_233145 implements DbMigration {
public function migrate(IDbConnection $conn): void { public function migrate(DbConnection $conn): void {
$hasTorrents = false; $hasTorrents = false;
$hasTorrentsFiles = false; $hasTorrentsFiles = false;
$hasTorrentsPeers = false; $hasTorrentsPeers = false;

View file

@ -1,8 +1,8 @@
<?php <?php
namespace Seria; namespace Seria;
use Index\Data\DbTools; use Index\Config\Fs\FsConfig;
use Syokuhou\SharpConfig; use Index\Db\DbTools;
define('SERIA_STARTUP', microtime(true)); define('SERIA_STARTUP', microtime(true));
define('SERIA_ROOT', __DIR__); define('SERIA_ROOT', __DIR__);
@ -17,7 +17,7 @@ error_reporting(SERIA_DEBUG ? -1 : 0);
mb_internal_encoding('UTF-8'); mb_internal_encoding('UTF-8');
date_default_timezone_set('GMT'); date_default_timezone_set('GMT');
$cfg = SharpConfig::fromFile(SERIA_ROOT . '/seria.cfg'); $cfg = FsConfig::fromFile(SERIA_ROOT . '/seria.cfg');
if($cfg->hasValues('sentry:dsn')) if($cfg->hasValues('sentry:dsn'))
(function($cfg) { (function($cfg) {

View file

@ -2,10 +2,10 @@
namespace Seria\Auth; namespace Seria\Auth;
use stdClass; use stdClass;
use Syokuhou\IConfig; use Index\Config\Config;
final class ChatAuth { final class ChatAuth {
public static function attempt(IConfig $config, string $cookie): object { public static function attempt(Config $config, string $cookie): object {
if(!empty($cookie)) { if(!empty($cookie)) {
$method = 'Misuzu'; $method = 'Misuzu';
$signature = sprintf('verify#%s#%s#%s', $method, $cookie, $_SERVER['REMOTE_ADDR']); $signature = sprintf('verify#%s#%s#%s', $method, $cookie, $_SERVER['REMOTE_ADDR']);

View file

@ -3,7 +3,7 @@ namespace Seria;
use Index\XNumber; use Index\XNumber;
use Index\Colour\Colour; use Index\Colour\Colour;
use Index\Colour\ColourRGB; use Index\Colour\ColourRgb;
final class Colours { final class Colours {
public const RATIO_GOOD = 0x008000; public const RATIO_GOOD = 0x008000;
@ -55,6 +55,6 @@ final class Colours {
public static function cached(int $raw): Colour { public static function cached(int $raw): Colour {
if(array_key_exists($raw, self::$colourCache)) if(array_key_exists($raw, self::$colourCache))
return self::$colourCache[$raw]; return self::$colourCache[$raw];
return self::$colourCache[$raw] = ColourRGB::fromRawRGB($raw); return self::$colourCache[$raw] = ColourRgb::fromRawRgb($raw);
} }
} }

View file

@ -1,12 +1,14 @@
<?php <?php
namespace Seria; namespace Seria;
use Index\Http\Routing\{HttpGet,RouteHandler}; use Index\Http\Routing\{HttpGet,RouteHandler,RouteHandlerTrait};
use Sasae\SasaeEnvironment; use Index\Templating\TplEnvironment;
class HomeRoutes implements RouteHandler {
use RouteHandlerTrait;
class HomeRoutes extends RouteHandler {
public function __construct( public function __construct(
private ?SasaeEnvironment $templating private ?TplEnvironment $templating
) {} ) {}
#[HttpGet('/')] #[HttpGet('/')]

View file

@ -1,7 +1,7 @@
<?php <?php
namespace Seria; namespace Seria;
use Index\Http\Routing\{HttpRouter,IRouter,IRouteHandler}; use Index\Http\Routing\{HttpRouter,Router,RouteHandler};
class RoutingContext { class RoutingContext {
private HttpRouter $router; private HttpRouter $router;
@ -12,11 +12,11 @@ class RoutingContext {
$this->router->registerContentHandler(new StringableContentHandler); // this should really be in Index lol but i can't be bothered rn! $this->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; return $this->router;
} }
public function register(IRouteHandler $handler): void { public function register(RouteHandler $handler): void {
$this->router->register($handler); $this->router->register($handler);
} }

View file

@ -1,10 +1,9 @@
<?php <?php
namespace Seria; namespace Seria;
use Index\Http\{HttpResponseBuilder,HttpRequest}; use Index\Http\{HttpErrorHandler,HttpResponseBuilder,HttpRequest};
use Index\Http\ErrorHandling\IErrorHandler;
class RoutingErrorHandler implements IErrorHandler { class RoutingErrorHandler implements HttpErrorHandler {
public function __construct( public function __construct(
private SeriaContext $context private SeriaContext $context
) {} ) {}

View file

@ -2,29 +2,29 @@
namespace Seria; namespace Seria;
use InvalidArgumentException; use InvalidArgumentException;
use Index\CSRFP; use Index\CsrfToken;
use Index\Data\IDbTransactions; use Index\Config\Config;
use Index\Data\Migration\{IDbMigrationRepo,DbMigrationManager,FsDbMigrationRepo}; use Index\Db\DbTransactions;
use Sasae\SasaeEnvironment; use Index\Db\Migration\{DbMigrationManager,DbMigrationRepo,FsDbMigrationRepo};
use Syokuhou\IConfig; use Index\Templating\TplEnvironment;
use Seria\Auth\AuthInfo; use Seria\Auth\AuthInfo;
use Seria\Torrents\TorrentsContext; use Seria\Torrents\TorrentsContext;
use Seria\Users\UsersContext; use Seria\Users\UsersContext;
final class SeriaContext { final class SeriaContext {
private IDbTransactions $dbConn; private DbTransactions $dbConn;
private IConfig $config; private Config $config;
private ?SasaeEnvironment $templating = null; private ?TplEnvironment $templating = null;
private AuthInfo $authInfo; private AuthInfo $authInfo;
private SiteInfo $siteInfo; private SiteInfo $siteInfo;
private CSRFP $csrfp; private CsrfToken $csrfp;
private TorrentsContext $torrentsCtx; private TorrentsContext $torrentsCtx;
private UsersContext $usersCtx; private UsersContext $usersCtx;
public function __construct(IDbTransactions $dbConn, IConfig $config) { public function __construct(DbTransactions $dbConn, Config $config) {
$this->dbConn = $dbConn; $this->dbConn = $dbConn;
$this->config = $config; $this->config = $config;
@ -35,7 +35,7 @@ final class SeriaContext {
$this->usersCtx = new UsersContext($dbConn); $this->usersCtx = new UsersContext($dbConn);
} }
public function getDbConn(): IDbTransactions { public function getDbConn(): DbTransactions {
return $this->dbConn; return $this->dbConn;
} }
@ -48,7 +48,7 @@ final class SeriaContext {
return new DbMigrationManager($this->dbConn, 'ser_' . DbMigrationManager::DEFAULT_TABLE); return new DbMigrationManager($this->dbConn, 'ser_' . DbMigrationManager::DEFAULT_TABLE);
} }
public function createMigrationRepo(): IDbMigrationRepo { public function createMigrationRepo(): DbMigrationRepo {
return new FsDbMigrationRepo(SERIA_DIR_MIGRATIONS); return new FsDbMigrationRepo(SERIA_DIR_MIGRATIONS);
} }
@ -68,16 +68,16 @@ final class SeriaContext {
return $this->usersCtx; return $this->usersCtx;
} }
public function getTemplating(): ?SasaeEnvironment { public function getTemplating(): ?TplEnvironment {
return $this->templating; return $this->templating;
} }
public function getCSRFP(): CSRFP { public function getCSRFP(): CsrfToken {
return $this->csrfp; return $this->csrfp;
} }
public function startCSRFP(string $secretKey, string $identity): void { public function startCSRFP(string $secretKey, string $identity): void {
$this->csrfp = new CSRFP($secretKey, $identity); $this->csrfp = new CsrfToken($secretKey, $identity);
} }
public function startTemplating(): void { public function startTemplating(): void {
@ -87,12 +87,12 @@ final class SeriaContext {
'display_timings_info' => SERIA_DEBUG, // + isFlash 'display_timings_info' => SERIA_DEBUG, // + isFlash
]; ];
$this->templating = new SasaeEnvironment( $this->templating = new TplEnvironment(
SERIA_DIR_TEMPLATES, SERIA_DIR_TEMPLATES,
cache: SERIA_DEBUG ? null : ['Seria', GitInfo::hash(true)], cache: SERIA_DEBUG ? null : ['Seria', GitInfo::hash(true)],
debug: SERIA_DEBUG, debug: SERIA_DEBUG,
); );
$this->templating->addExtension(new SeriaSasaeExtension($this, $this->siteInfo)); $this->templating->addExtension(new TemplatingExtension($this, $this->siteInfo));
$this->templating->addGlobal('globals', $globals); $this->templating->addGlobal('globals', $globals);
} }

View file

@ -1,11 +1,11 @@
<?php <?php
namespace Seria; namespace Seria;
use Syokuhou\IConfig; use Index\Config\Config;
use Seria\Users\UserInfo; use Seria\Users\UserInfo;
class SiteInfo { class SiteInfo {
public function __construct(private IConfig $config) {} public function __construct(private Config $config) {}
public function getName(): string { public function getName(): string {
return $this->config->getString('name'); return $this->config->getString('name');

View file

@ -2,17 +2,15 @@
namespace Seria; namespace Seria;
use Stringable; use Stringable;
use Index\Http\HttpResponseBuilder; use Index\Http\{HttpContentHandler,HttpResponseBuilder,StringHttpContent};
use Index\Http\Content\StringContent;
use Index\Http\ContentHandling\IContentHandler;
class StringableContentHandler implements IContentHandler { class StringableContentHandler implements HttpContentHandler {
public function match(mixed $content): bool { public function match(mixed $content): bool {
return $content instanceof Stringable; return $content instanceof Stringable;
} }
/** @param Stringable $content */ /** @param Stringable $content */
public function handle(HttpResponseBuilder $response, mixed $content): void { public function handle(HttpResponseBuilder $response, mixed $content): void {
$response->setContent(new StringContent((string)$content)); $response->setContent(new StringHttpContent((string)$content));
} }
} }

View file

@ -5,7 +5,7 @@ use Twig\Extension\AbstractExtension;
use Twig\TwigFunction; use Twig\TwigFunction;
use Seria\Torrents\TorrentPeers; use Seria\Torrents\TorrentPeers;
final class SeriaSasaeExtension extends AbstractExtension { final class TemplatingExtension extends AbstractExtension {
private TorrentPeers $peers; private TorrentPeers $peers;
public function __construct( public function __construct(

View file

@ -1,20 +1,37 @@
<?php <?php
namespace Seria\Torrents; namespace Seria\Torrents;
use Index\Bencode\IBencodeSerialisable; use Index\Bencode\{BencodeProperty,BencodeSerializable,BencodeSerializableTrait};
class AnnounceEmpty implements BencodeSerializable {
use BencodeSerializableTrait;
class AnnounceEmpty implements IBencodeSerialisable {
public function __construct( public function __construct(
private bool $compactPeers private bool $compactPeers
) {} ) {}
public function bencodeSerialise(): mixed { #[BencodeProperty('interval')]
return [ public function getInterval(): int {
'interval' => 0, return 0;
'min interval' => 0, }
'complete' => 0,
'incomplete' => 0, #[BencodeProperty('min interval')]
'peers' => $this->compactPeers ? '' : [], 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 ? '' : [];
} }
} }

View file

@ -1,12 +1,15 @@
<?php <?php
namespace Seria\Torrents; namespace Seria\Torrents;
use Index\Bencode\IBencodeSerialisable; use Index\Bencode\{BencodeProperty,BencodeSerializable,BencodeSerializableTrait};
class AnnounceFailure implements BencodeSerializable {
use BencodeSerializableTrait;
class AnnounceFailure implements IBencodeSerialisable {
public function __construct(private string $reason) {} public function __construct(private string $reason) {}
public function bencodeSerialise(): mixed { #[BencodeProperty('failure reason')]
return ['failure reason' => $this->reason]; public function getReason(): string {
return $this->reason;
} }
} }

View file

@ -1,9 +1,11 @@
<?php <?php
namespace Seria\Torrents; namespace Seria\Torrents;
use Index\Bencode\IBencodeSerialisable; use Index\Bencode\{BencodeProperty,BencodeSerializable,BencodeSerializableTrait};
class AnnounceInfo implements BencodeSerializable {
use BencodeSerializableTrait;
class AnnounceInfo implements IBencodeSerialisable {
// todo: keep these in a field in ser_torrents so we don't need this slightly filthy hack anymore // todo: keep these in a field in ser_torrents so we don't need this slightly filthy hack anymore
// also useful for ipv6 peer support // also useful for ipv6 peer support
private int $completePeers = 0; private int $completePeers = 0;
@ -53,25 +55,44 @@ class AnnounceInfo implements IBencodeSerialisable {
return $peers; return $peers;
} }
public function createPeersList(): array|string { #[BencodeProperty('interval')]
public function getInterval(): int {
return $this->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) if($this->compactPeers)
return $this->createCompactPeersList(); return $this->createCompactPeersList();
if($this->noPeerIds) if($this->noPeerIds)
return $this->createPeersListWithoutIds(); return $this->createPeersListWithoutIds();
return $this->createPeersListWithIds(); return $this->createPeersListWithIds();
} }
public function bencodeSerialise(): mixed { // #[BencodeProperty('peers6')]
$peers = $this->createPeersList(); // public function getPeersV6(): int {
// return ''; // todo: support ipv6 someday
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
];
}
} }

View file

@ -3,10 +3,12 @@ namespace Seria\Torrents;
use RuntimeException; use RuntimeException;
use Index\Bencode\Bencode; use Index\Bencode\Bencode;
use Index\Http\Routing\{HttpGet,RouteHandler}; use Index\Http\Routing\{HttpGet,RouteHandler,RouteHandlerTrait};
use Seria\Users\UsersContext; use Seria\Users\UsersContext;
class AnnounceRouting extends RouteHandler { class AnnounceRouting implements RouteHandler {
use RouteHandlerTrait;
public const INTERVAL = 1800; public const INTERVAL = 1800;
public const INTERVAL_MIN = 30; public const INTERVAL_MIN = 30;
@ -20,7 +22,8 @@ class AnnounceRouting extends RouteHandler {
#[HttpGet('/announce/([A-Za-z0-9]+)')] #[HttpGet('/announce/([A-Za-z0-9]+)')]
#[HttpGet('/announce.php/([A-Za-z0-9]+)')] #[HttpGet('/announce.php/([A-Za-z0-9]+)')]
public function getAnnounce($response, $request, string $key = '') { 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.'); return new AnnounceFailure('Tracker is only supported over IPv4, please reset your DNS cache.');
$torrents = $this->torrentsCtx->getTorrents(); $torrents = $this->torrentsCtx->getTorrents();
@ -48,8 +51,6 @@ class AnnounceRouting extends RouteHandler {
if(strlen($peerId) !== 20) if(strlen($peerId) !== 20)
return new AnnounceFailure('Invalid peer id.'); return new AnnounceFailure('Invalid peer id.');
$address = $_SERVER['REMOTE_ADDR'];
$port = (int)$request->getParam('port'); $port = (int)$request->getParam('port');
if($port < 1 || $port > 0xFFFF) if($port < 1 || $port > 0xFFFF)
return new AnnounceFailure('Invalid port number.'); return new AnnounceFailure('Invalid port number.');
@ -96,7 +97,7 @@ class AnnounceRouting extends RouteHandler {
if($peerInfo === null) { if($peerInfo === null) {
// could probably skip this is the event is 'stopped' // could probably skip this is the event is 'stopped'
$peerInfo = $peers->createPeer( $peerInfo = $peers->createPeer(
$torrentInfo, $userInfo, $peerId, $address, $port, self::INTERVAL, $torrentInfo, $userInfo, $peerId, $remoteAddr, $port, self::INTERVAL,
$userAgent, $key, $bytesUploaded, $bytesDownloaded, $bytesRemaining $userAgent, $key, $bytesUploaded, $bytesDownloaded, $bytesRemaining
); );
} else { } else {
@ -118,7 +119,7 @@ class AnnounceRouting extends RouteHandler {
); );
$peers->updatePeer( $peers->updatePeer(
$torrentInfo, $peerInfo, $address, $port, self::INTERVAL, $torrentInfo, $peerInfo, $remoteAddr, $port, self::INTERVAL,
$userAgent, $bytesUploaded, $bytesDownloaded, $bytesRemaining $userAgent, $bytesUploaded, $bytesDownloaded, $bytesRemaining
); );
} }

View file

@ -5,7 +5,7 @@ use Exception;
use InvalidArgumentException; use InvalidArgumentException;
use RuntimeException; use RuntimeException;
use Index\Bencode\Bencode; use Index\Bencode\Bencode;
use Index\Data\{DbTools,IDbTransactions}; use Index\Db\{DbTools,DbTransactions};
use Seria\Users\UserInfo; use Seria\Users\UserInfo;
class TorrentBuilder { class TorrentBuilder {
@ -101,7 +101,7 @@ class TorrentBuilder {
return hash('sha1', Bencode::encode($info), true); 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(); $torrents = $torrentsCtx->getTorrents();
$pieces = $torrentsCtx->getPieces(); $pieces = $torrentsCtx->getPieces();
$files = $torrentsCtx->getFiles(); $files = $torrentsCtx->getFiles();

View file

@ -3,20 +3,22 @@ namespace Seria\Torrents;
use Exception; use Exception;
use RuntimeException; use RuntimeException;
use Index\CSRFP; use Index\CsrfToken;
use Index\Data\IDbTransactions; use Index\Db\DbTransactions;
use Index\Http\Routing\{HttpGet,HttpMiddleware,HttpPost,RouteHandler}; use Index\Http\Routing\{HttpGet,HttpMiddleware,HttpPost,RouteHandler,RouteHandlerTrait};
use Sasae\SasaeEnvironment; use Index\Templating\TplEnvironment;
use Seria\Auth\AuthInfo; use Seria\Auth\AuthInfo;
use Seria\Users\UsersContext; use Seria\Users\UsersContext;
class TorrentCreateRouting extends RouteHandler { class TorrentCreateRouting implements RouteHandler {
use RouteHandlerTrait;
public function __construct( public function __construct(
private IDbTransactions $dbConn, private DbTransactions $dbConn,
private AuthInfo $authInfo, private AuthInfo $authInfo,
private TorrentsContext $torrentsCtx, private TorrentsContext $torrentsCtx,
private CSRFP $csrfp, private CsrfToken $csrfp,
private ?SasaeEnvironment $templating private ?TplEnvironment $templating
) {} ) {}
#[HttpMiddleware('/create')] #[HttpMiddleware('/create')]

View file

@ -1,16 +1,18 @@
<?php <?php
namespace Seria\Torrents; namespace Seria\Torrents;
use Index\Bencode\IBencodeSerialisable; use Index\Bencode\{BencodeProperty,BencodeSerializable,BencodeSerializableTrait};
use Index\Data\IDbResult; use Index\Db\DbResult;
readonly class TorrentFileInfo implements BencodeSerializable {
use BencodeSerializableTrait;
readonly class TorrentFileInfo implements IBencodeSerialisable {
private string $id; private string $id;
private string $torrentId; private string $torrentId;
private int $length; private int $length;
private string $path; private string $path;
public function __construct(IDbResult $result) { public function __construct(DbResult $result) {
$this->id = $result->getString(0); $this->id = $result->getString(0);
$this->torrentId = $result->getString(1); $this->torrentId = $result->getString(1);
$this->length = $result->getInteger(2); $this->length = $result->getInteger(2);
@ -25,6 +27,7 @@ readonly class TorrentFileInfo implements IBencodeSerialisable {
return $this->torrentId; return $this->torrentId;
} }
#[BencodeProperty('length')]
public function getLength(): int { public function getLength(): int {
return $this->length; return $this->length;
} }
@ -33,10 +36,8 @@ readonly class TorrentFileInfo implements IBencodeSerialisable {
return $this->path; return $this->path;
} }
public function bencodeSerialise(): mixed { #[BencodeProperty('path')]
return [ public function getPathArray(): array {
'length' => $this->length, return explode('/', $this->path);
'path' => explode('/', $this->path),
];
} }
} }

View file

@ -3,13 +3,12 @@ namespace Seria\Torrents;
use InvalidArgumentException; use InvalidArgumentException;
use RuntimeException; use RuntimeException;
use Index\Data\DbStatementCache; use Index\Db\{DbConnection,DbStatementCache};
use Index\Data\IDbConnection;
class TorrentFiles { class TorrentFiles {
private DbStatementCache $cache; private DbStatementCache $cache;
public function __construct(IDbConnection $dbConn) { public function __construct(DbConnection $dbConn) {
$this->cache = new DbStatementCache($dbConn); $this->cache = new DbStatementCache($dbConn);
} }

View file

@ -1,7 +1,7 @@
<?php <?php
namespace Seria\Torrents; namespace Seria\Torrents;
use Index\Data\IDbResult; use Index\Db\DbResult;
readonly class TorrentInfo { readonly class TorrentInfo {
private string $id; private string $id;
@ -15,7 +15,7 @@ readonly class TorrentInfo {
private int $private; private int $private;
private string $comment; private string $comment;
public function __construct(IDbResult $result) { public function __construct(DbResult $result) {
$this->id = $result->getString(0); $this->id = $result->getString(0);
$this->userId = $result->isNull(1) ? null : $result->getString(1); $this->userId = $result->isNull(1) ? null : $result->getString(1);
$this->infoHash = $result->getString(2); $this->infoHash = $result->getString(2);

View file

@ -2,23 +2,25 @@
namespace Seria\Torrents; namespace Seria\Torrents;
use RuntimeException; use RuntimeException;
use Index\CSRFP; use Index\CsrfToken;
use Index\Http\Routing\{HttpGet,HttpMiddleware,HttpPost,RouteHandler}; use Index\Config\Config;
use Sasae\SasaeEnvironment; use Index\Http\Routing\{HttpGet,HttpMiddleware,HttpPost,RouteHandler,RouteHandlerTrait};
use Syokuhou\IConfig; use Index\Templating\TplEnvironment;
use Seria\Auth\AuthInfo; use Seria\Auth\AuthInfo;
use Seria\Users\UsersContext; use Seria\Users\UsersContext;
class TorrentInfoRouting extends RouteHandler { class TorrentInfoRouting implements RouteHandler {
use RouteHandlerTrait;
private ?TorrentInfo $torrentInfo = null; private ?TorrentInfo $torrentInfo = null;
public function __construct( public function __construct(
private IConfig $config, private Config $config,
private AuthInfo $authInfo, private AuthInfo $authInfo,
private TorrentsContext $torrentsCtx, private TorrentsContext $torrentsCtx,
private UsersContext $usersCtx, private UsersContext $usersCtx,
private CSRFP $csrfp, private CsrfToken $csrfp,
private ?SasaeEnvironment $templating private ?TplEnvironment $templating
) {} ) {}
#[HttpGet('/download/([0-9]+)')] #[HttpGet('/download/([0-9]+)')]

View file

@ -2,17 +2,19 @@
namespace Seria\Torrents; namespace Seria\Torrents;
use RuntimeException; use RuntimeException;
use Index\Http\Routing\{HttpGet,RouteHandler}; use Index\Http\Routing\{HttpGet,RouteHandler,RouteHandlerTrait};
use Sasae\SasaeEnvironment; use Index\Templating\TplEnvironment;
use Seria\Auth\AuthInfo; use Seria\Auth\AuthInfo;
use Seria\Users\UsersContext; use Seria\Users\UsersContext;
class TorrentListRouting extends RouteHandler { class TorrentListRouting implements RouteHandler {
use RouteHandlerTrait;
public function __construct( public function __construct(
private AuthInfo $authInfo, private AuthInfo $authInfo,
private TorrentsContext $torrentsCtx, private TorrentsContext $torrentsCtx,
private UsersContext $usersCtx, private UsersContext $usersCtx,
private ?SasaeEnvironment $templating private ?TplEnvironment $templating
) {} ) {}
#[HttpGet('/available')] #[HttpGet('/available')]

View file

@ -1,7 +1,7 @@
<?php <?php
namespace Seria\Torrents; namespace Seria\Torrents;
use Index\Data\IDbResult; use Index\Db\DbResult;
use Seria\Users\UserInfo; use Seria\Users\UserInfo;
readonly class TorrentPeerInfo { readonly class TorrentPeerInfo {
@ -18,7 +18,7 @@ readonly class TorrentPeerInfo {
private int $bytesDownloaded; private int $bytesDownloaded;
private int $bytesLeft; private int $bytesLeft;
public function __construct(IDbResult $result) { public function __construct(DbResult $result) {
$this->id = $result->getString(0); $this->id = $result->getString(0);
$this->torrentId = $result->getString(1); $this->torrentId = $result->getString(1);
$this->userId = $result->isNull(2) ? null : $result->getString(2); $this->userId = $result->isNull(2) ? null : $result->getString(2);

View file

@ -3,16 +3,13 @@ namespace Seria\Torrents;
use InvalidArgumentException; use InvalidArgumentException;
use RuntimeException; use RuntimeException;
use Index\Data\DbStatementCache; use Index\Db\{DbConnection,DbStatementCache};
use Index\Data\IDbConnection;
use Seria\Users\UserInfo; use Seria\Users\UserInfo;
class TorrentPeers { class TorrentPeers {
private IDbConnection $dbConn;
private DbStatementCache $cache; private DbStatementCache $cache;
public function __construct(IDbConnection $dbConn) { public function __construct(private DbConnection $dbConn) {
$this->dbConn = $dbConn;
$this->cache = new DbStatementCache($dbConn); $this->cache = new DbStatementCache($dbConn);
} }

View file

@ -1,14 +1,14 @@
<?php <?php
namespace Seria\Torrents; namespace Seria\Torrents;
use Index\Data\IDbResult; use Index\Db\DbResult;
readonly class TorrentPieceInfo { readonly class TorrentPieceInfo {
private string $id; private string $id;
private string $torrentId; private string $torrentId;
private string $hash; private string $hash;
public function __construct(IDbResult $result) { public function __construct(DbResult $result) {
$this->id = $result->getString(0); $this->id = $result->getString(0);
$this->torrentId = $result->getString(1); $this->torrentId = $result->getString(1);
$this->hash = $result->getString(2); $this->hash = $result->getString(2);

View file

@ -3,13 +3,12 @@ namespace Seria\Torrents;
use InvalidArgumentException; use InvalidArgumentException;
use RuntimeException; use RuntimeException;
use Index\Data\DbStatementCache; use Index\Db\{DbConnection,DbStatementCache};
use Index\Data\IDbConnection;
class TorrentPieces { class TorrentPieces {
private DbStatementCache $cache; private DbStatementCache $cache;
public function __construct(IDbConnection $dbConn) { public function __construct(DbConnection $dbConn) {
$this->cache = new DbStatementCache($dbConn); $this->cache = new DbStatementCache($dbConn);
} }

View file

@ -3,15 +3,13 @@ namespace Seria\Torrents;
use InvalidArgumentException; use InvalidArgumentException;
use RuntimeException; use RuntimeException;
use Index\Data\DbStatementCache; use Index\Db\{DbConnection,DbStatementCache};
use Index\Data\IDbConnection;
use Seria\Users\UserInfo; use Seria\Users\UserInfo;
class Torrents { class Torrents {
private IDbConnection $dbConn;
private DbStatementCache $cache; private DbStatementCache $cache;
public function __construct(IDbConnection $dbConn) { public function __construct(private DbConnection $dbConn) {
$this->dbConn = $dbConn; $this->dbConn = $dbConn;
$this->cache = new DbStatementCache($dbConn); $this->cache = new DbStatementCache($dbConn);
} }

View file

@ -2,7 +2,7 @@
namespace Seria\Torrents; namespace Seria\Torrents;
use Index\Bencode\Bencode; use Index\Bencode\Bencode;
use Index\Data\IDbConnection; use Index\Db\DbConnection;
use Seria\GitInfo; use Seria\GitInfo;
use Seria\Users\UserInfo; use Seria\Users\UserInfo;
@ -12,7 +12,7 @@ class TorrentsContext {
private TorrentPeers $peers; private TorrentPeers $peers;
private TorrentPieces $pieces; private TorrentPieces $pieces;
public function __construct(IDbConnection $dbConn) { public function __construct(DbConnection $dbConn) {
$this->torrents = new Torrents($dbConn); $this->torrents = new Torrents($dbConn);
$this->files = new TorrentFiles($dbConn); $this->files = new TorrentFiles($dbConn);
$this->peers = new TorrentPeers($dbConn); $this->peers = new TorrentPeers($dbConn);

View file

@ -2,17 +2,19 @@
namespace Seria\Users; namespace Seria\Users;
use RuntimeException; use RuntimeException;
use Index\Http\Routing\{HttpGet,RouteHandler}; use Index\Http\Routing\{HttpGet,RouteHandler,RouteHandlerTrait};
use Sasae\SasaeEnvironment; use Index\Templating\TplEnvironment;
use Seria\Auth\AuthInfo; use Seria\Auth\AuthInfo;
use Seria\Torrents\{TorrentsContext,TorrentInfo,TorrentPeerInfo}; use Seria\Torrents\{TorrentsContext,TorrentInfo,TorrentPeerInfo};
class ProfileRoutes extends RouteHandler { class ProfileRoutes implements RouteHandler {
use RouteHandlerTrait;
public function __construct( public function __construct(
private AuthInfo $authInfo, private AuthInfo $authInfo,
private TorrentsContext $torrentsCtx, private TorrentsContext $torrentsCtx,
private UsersContext $usersCtx, private UsersContext $usersCtx,
private ?SasaeEnvironment $templating private ?TplEnvironment $templating
) {} ) {}
#[HttpGet('/profile/([a-zA-Z0-9\-_]+)')] #[HttpGet('/profile/([a-zA-Z0-9\-_]+)')]

View file

@ -1,18 +1,20 @@
<?php <?php
namespace Seria\Users; namespace Seria\Users;
use Index\CSRFP; use Index\CsrfToken;
use Index\Http\Routing\{HttpGet,HttpMiddleware,HttpPost,RouteHandler}; use Index\Http\Routing\{HttpGet,HttpMiddleware,HttpPost,RouteHandler,RouteHandlerTrait};
use Sasae\SasaeEnvironment; use Index\Templating\TplEnvironment;
use Seria\Auth\AuthInfo; use Seria\Auth\AuthInfo;
use Seria\Users\UsersContext; use Seria\Users\UsersContext;
class SettingsRoutes extends RouteHandler { class SettingsRoutes implements RouteHandler {
use RouteHandlerTrait;
public function __construct( public function __construct(
private AuthInfo $authInfo, private AuthInfo $authInfo,
private UsersContext $usersCtx, private UsersContext $usersCtx,
private CSRFP $csrfp, private CsrfToken $csrfp,
private ?SasaeEnvironment $templating private ?TplEnvironment $templating
) {} ) {}
#[HttpMiddleware('/settings')] #[HttpMiddleware('/settings')]

View file

@ -3,7 +3,7 @@ namespace Seria\Users;
use RuntimeException; use RuntimeException;
use Index\Colour\Colour; use Index\Colour\Colour;
use Index\Data\IDbResult; use Index\Db\DbResult;
use Seria\Colours; use Seria\Colours;
readonly class UserInfo { readonly class UserInfo {
@ -16,7 +16,7 @@ readonly class UserInfo {
private int $bytesDownloaded; private int $bytesDownloaded;
private int $bytesUploaded; private int $bytesUploaded;
public function __construct(IDbResult $result) { public function __construct(DbResult $result) {
$this->id = $result->getString(0); $this->id = $result->getString(0);
$this->name = $result->getString(1); $this->name = $result->getString(1);

View file

@ -5,15 +5,12 @@ use InvalidArgumentException;
use RuntimeException; use RuntimeException;
use Index\XString; use Index\XString;
use Index\Colour\Colour; use Index\Colour\Colour;
use Index\Data\DbStatementCache; use Index\Db\{DbConnection,DbStatementCache,DbTools};
use Index\Data\DbTools;
use Index\Data\IDbConnection;
use Index\Net\IPAddress;
class Users { class Users {
private DbStatementCache $cache; private DbStatementCache $cache;
public function __construct(IDbConnection $dbConn) { public function __construct(DbConnection $dbConn) {
$this->cache = new DbStatementCache($dbConn); $this->cache = new DbStatementCache($dbConn);
} }

View file

@ -1,12 +1,12 @@
<?php <?php
namespace Seria\Users; namespace Seria\Users;
use Index\Data\IDbConnection; use Index\Db\DbConnection;
class UsersContext { class UsersContext {
private Users $users; private Users $users;
public function __construct(IDbConnection $dbConn) { public function __construct(DbConnection $dbConn) {
$this->users = new Users($dbConn); $this->users = new Users($dbConn);
} }

View file

@ -1,7 +1,5 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
use Index\Data\Migration\FsDbMigrationRepo;
require_once __DIR__ . '/../seria.php'; require_once __DIR__ . '/../seria.php';
try { try {

View file

@ -1,6 +1,6 @@
#!/usr/bin/env php #!/usr/bin/env php
<?php <?php
use Index\Data\Migration\FsDbMigrationRepo; use Index\Db\Migration\FsDbMigrationRepo;
require_once __DIR__ . '/../seria.php'; require_once __DIR__ . '/../seria.php';