Compare commits
No commits in common. "a409410ea09878628c4e6194b6eee6e5ce9cd918" and "fcc6f13bd7daecb0d86918cb79c7de5e9162903d" have entirely different histories.
a409410ea0
...
fcc6f13bd7
6 changed files with 134 additions and 132 deletions
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"require": {
|
||||
"flashwave/index": "^0.2410",
|
||||
"flashii/apii": "^0.2",
|
||||
"sentry/sdk": "^4.0",
|
||||
"nesbot/carbon": "^3.7"
|
||||
},
|
||||
|
|
183
composer.lock
generated
183
composer.lock
generated
|
@ -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": "5bb4c1111eb08d57ef2ef77239a4ddc8",
|
||||
"content-hash": "0bd5a41ea92a75983cfabd9b9052a8a2",
|
||||
"packages": [
|
||||
{
|
||||
"name": "carbonphp/carbon-doctrine-types",
|
||||
|
@ -75,50 +75,13 @@
|
|||
],
|
||||
"time": "2024-02-09T16:56:22+00:00"
|
||||
},
|
||||
{
|
||||
"name": "flashii/apii",
|
||||
"version": "v0.2.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://patchii.net/flashii/apii-php.git",
|
||||
"reference": "6a93d31375dd7e75ff9264f3024f2208ce602f49"
|
||||
},
|
||||
"require": {
|
||||
"php": ">=8.1"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^1.12",
|
||||
"phpunit/phpunit": "^10.5"
|
||||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Flashii\\": "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": "Client library for the Flashii.net API.",
|
||||
"homepage": "https://api.flashii.net",
|
||||
"time": "2024-11-16T16:03:42+00:00"
|
||||
},
|
||||
{
|
||||
"name": "flashwave/index",
|
||||
"version": "v0.2410.191603",
|
||||
"version": "v0.2410.51409",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://patchii.net/flash/index.git",
|
||||
"reference": "17cdb4d1c239241200d7e30968122a8cd8b26509"
|
||||
"reference": "c43c6eb334f85edf8fa7b5e4058b3ba35a27d960"
|
||||
},
|
||||
"require": {
|
||||
"ext-mbstring": "*",
|
||||
|
@ -139,14 +102,6 @@
|
|||
},
|
||||
"type": "library",
|
||||
"autoload": {
|
||||
"files": [
|
||||
"src/Cache/ArrayCache/_ndx.php",
|
||||
"src/Cache/Memcached/_ndx.php",
|
||||
"src/Cache/Valkey/_ndx.php",
|
||||
"src/Db/MariaDb/_ndx.php",
|
||||
"src/Db/NullDb/_ndx.php",
|
||||
"src/Db/Sqlite/_ndx.php"
|
||||
],
|
||||
"psr-4": {
|
||||
"Index\\": "src"
|
||||
}
|
||||
|
@ -165,7 +120,7 @@
|
|||
],
|
||||
"description": "Composer package for the common library for my projects.",
|
||||
"homepage": "https://railgun.sh/index",
|
||||
"time": "2024-10-19T16:04:17+00:00"
|
||||
"time": "2024-10-05T14:10:08+00:00"
|
||||
},
|
||||
{
|
||||
"name": "guzzlehttp/psr7",
|
||||
|
@ -285,28 +240,28 @@
|
|||
},
|
||||
{
|
||||
"name": "jean85/pretty-package-versions",
|
||||
"version": "2.1.0",
|
||||
"version": "2.0.6",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/Jean85/pretty-package-versions.git",
|
||||
"reference": "3c4e5f62ba8d7de1734312e4fff32f67a8daaf10"
|
||||
"reference": "f9fdd29ad8e6d024f52678b570e5593759b550b4"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/3c4e5f62ba8d7de1734312e4fff32f67a8daaf10",
|
||||
"reference": "3c4e5f62ba8d7de1734312e4fff32f67a8daaf10",
|
||||
"url": "https://api.github.com/repos/Jean85/pretty-package-versions/zipball/f9fdd29ad8e6d024f52678b570e5593759b550b4",
|
||||
"reference": "f9fdd29ad8e6d024f52678b570e5593759b550b4",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"composer-runtime-api": "^2.1.0",
|
||||
"php": "^7.4|^8.0"
|
||||
"composer-runtime-api": "^2.0.0",
|
||||
"php": "^7.1|^8.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^3.2",
|
||||
"jean85/composer-provided-replaced-stub-package": "^1.0",
|
||||
"phpstan/phpstan": "^1.4",
|
||||
"phpunit/phpunit": "^7.5|^8.5|^9.6",
|
||||
"vimeo/psalm": "^4.3 || ^5.0"
|
||||
"phpunit/phpunit": "^7.5|^8.5|^9.4",
|
||||
"vimeo/psalm": "^4.3"
|
||||
},
|
||||
"type": "library",
|
||||
"extra": {
|
||||
|
@ -338,26 +293,26 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/Jean85/pretty-package-versions/issues",
|
||||
"source": "https://github.com/Jean85/pretty-package-versions/tree/2.1.0"
|
||||
"source": "https://github.com/Jean85/pretty-package-versions/tree/2.0.6"
|
||||
},
|
||||
"time": "2024-11-18T16:19:46+00:00"
|
||||
"time": "2024-03-08T09:58:59+00:00"
|
||||
},
|
||||
{
|
||||
"name": "nesbot/carbon",
|
||||
"version": "3.8.2",
|
||||
"version": "3.8.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/briannesbitt/Carbon.git",
|
||||
"reference": "e1268cdbc486d97ce23fef2c666dc3c6b6de9947"
|
||||
"reference": "bbd3eef89af8ba66a3aa7952b5439168fbcc529f"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/e1268cdbc486d97ce23fef2c666dc3c6b6de9947",
|
||||
"reference": "e1268cdbc486d97ce23fef2c666dc3c6b6de9947",
|
||||
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/bbd3eef89af8ba66a3aa7952b5439168fbcc529f",
|
||||
"reference": "bbd3eef89af8ba66a3aa7952b5439168fbcc529f",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
"carbonphp/carbon-doctrine-types": "<100.0",
|
||||
"carbonphp/carbon-doctrine-types": "*",
|
||||
"ext-json": "*",
|
||||
"php": "^8.1",
|
||||
"psr/clock": "^1.0",
|
||||
|
@ -446,7 +401,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-11-07T17:46:48+00:00"
|
||||
"time": "2024-08-19T06:22:39+00:00"
|
||||
},
|
||||
{
|
||||
"name": "psr/clock",
|
||||
|
@ -755,16 +710,16 @@
|
|||
},
|
||||
{
|
||||
"name": "sentry/sentry",
|
||||
"version": "4.10.0",
|
||||
"version": "4.9.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/getsentry/sentry-php.git",
|
||||
"reference": "2af937d47d8aadb8dab0b1d7b9557e495dd12856"
|
||||
"reference": "788ec170f51ebb22f2809a1e3f78b19ccd39b70d"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/2af937d47d8aadb8dab0b1d7b9557e495dd12856",
|
||||
"reference": "2af937d47d8aadb8dab0b1d7b9557e495dd12856",
|
||||
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/788ec170f51ebb22f2809a1e3f78b19ccd39b70d",
|
||||
"reference": "788ec170f51ebb22f2809a1e3f78b19ccd39b70d",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -782,12 +737,12 @@
|
|||
},
|
||||
"require-dev": {
|
||||
"friendsofphp/php-cs-fixer": "^3.4",
|
||||
"guzzlehttp/promises": "^2.0.3",
|
||||
"guzzlehttp/promises": "^1.0|^2.0",
|
||||
"guzzlehttp/psr7": "^1.8.4|^2.1.1",
|
||||
"monolog/monolog": "^1.6|^2.0|^3.0",
|
||||
"phpbench/phpbench": "^1.0",
|
||||
"phpstan/phpstan": "^1.3",
|
||||
"phpunit/phpunit": "^8.5|^9.6",
|
||||
"phpunit/phpunit": "^8.5.14|^9.4",
|
||||
"symfony/phpunit-bridge": "^5.2|^6.0|^7.0",
|
||||
"vimeo/psalm": "^4.17"
|
||||
},
|
||||
|
@ -828,7 +783,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/getsentry/sentry-php/issues",
|
||||
"source": "https://github.com/getsentry/sentry-php/tree/4.10.0"
|
||||
"source": "https://github.com/getsentry/sentry-php/tree/4.9.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -840,20 +795,20 @@
|
|||
"type": "custom"
|
||||
}
|
||||
],
|
||||
"time": "2024-11-06T07:44:19+00:00"
|
||||
"time": "2024-08-08T14:40:50+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/clock",
|
||||
"version": "v7.1.6",
|
||||
"version": "v7.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/clock.git",
|
||||
"reference": "97bebc53548684c17ed696bc8af016880f0f098d"
|
||||
"reference": "3dfc8b084853586de51dd1441c6242c76a28cbe7"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/clock/zipball/97bebc53548684c17ed696bc8af016880f0f098d",
|
||||
"reference": "97bebc53548684c17ed696bc8af016880f0f098d",
|
||||
"url": "https://api.github.com/repos/symfony/clock/zipball/3dfc8b084853586de51dd1441c6242c76a28cbe7",
|
||||
"reference": "3dfc8b084853586de51dd1441c6242c76a28cbe7",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -898,7 +853,7 @@
|
|||
"time"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/clock/tree/v7.1.6"
|
||||
"source": "https://github.com/symfony/clock/tree/v7.1.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -914,7 +869,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-25T14:20:29+00:00"
|
||||
"time": "2024-05-31T14:57:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/deprecation-contracts",
|
||||
|
@ -985,16 +940,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/mime",
|
||||
"version": "v7.1.6",
|
||||
"version": "v7.1.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/mime.git",
|
||||
"reference": "caa1e521edb2650b8470918dfe51708c237f0598"
|
||||
"reference": "711d2e167e8ce65b05aea6b258c449671cdd38ff"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/mime/zipball/caa1e521edb2650b8470918dfe51708c237f0598",
|
||||
"reference": "caa1e521edb2650b8470918dfe51708c237f0598",
|
||||
"url": "https://api.github.com/repos/symfony/mime/zipball/711d2e167e8ce65b05aea6b258c449671cdd38ff",
|
||||
"reference": "711d2e167e8ce65b05aea6b258c449671cdd38ff",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1049,7 +1004,7 @@
|
|||
"mime-type"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/mime/tree/v7.1.6"
|
||||
"source": "https://github.com/symfony/mime/tree/v7.1.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1065,20 +1020,20 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-10-25T15:11:02+00:00"
|
||||
"time": "2024-09-20T08:28:38+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/options-resolver",
|
||||
"version": "v7.1.6",
|
||||
"version": "v7.1.1",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/options-resolver.git",
|
||||
"reference": "85e95eeede2d41cd146146e98c9c81d9214cae85"
|
||||
"reference": "47aa818121ed3950acd2b58d1d37d08a94f9bf55"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/85e95eeede2d41cd146146e98c9c81d9214cae85",
|
||||
"reference": "85e95eeede2d41cd146146e98c9c81d9214cae85",
|
||||
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/47aa818121ed3950acd2b58d1d37d08a94f9bf55",
|
||||
"reference": "47aa818121ed3950acd2b58d1d37d08a94f9bf55",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1116,7 +1071,7 @@
|
|||
"options"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/options-resolver/tree/v7.1.6"
|
||||
"source": "https://github.com/symfony/options-resolver/tree/v7.1.1"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1132,7 +1087,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-25T14:20:29+00:00"
|
||||
"time": "2024-05-31T14:57:53+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/polyfill-ctype",
|
||||
|
@ -1611,16 +1566,16 @@
|
|||
},
|
||||
{
|
||||
"name": "symfony/translation",
|
||||
"version": "v7.1.6",
|
||||
"version": "v7.1.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/symfony/translation.git",
|
||||
"reference": "b9f72ab14efdb6b772f85041fa12f820dee8d55f"
|
||||
"reference": "235535e3f84f3dfbdbde0208ede6ca75c3a489ea"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/b9f72ab14efdb6b772f85041fa12f820dee8d55f",
|
||||
"reference": "b9f72ab14efdb6b772f85041fa12f820dee8d55f",
|
||||
"url": "https://api.github.com/repos/symfony/translation/zipball/235535e3f84f3dfbdbde0208ede6ca75c3a489ea",
|
||||
"reference": "235535e3f84f3dfbdbde0208ede6ca75c3a489ea",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1685,7 +1640,7 @@
|
|||
"description": "Provides tools to internationalize your application",
|
||||
"homepage": "https://symfony.com",
|
||||
"support": {
|
||||
"source": "https://github.com/symfony/translation/tree/v7.1.6"
|
||||
"source": "https://github.com/symfony/translation/tree/v7.1.5"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1701,7 +1656,7 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-28T12:35:13+00:00"
|
||||
"time": "2024-09-16T06:30:38+00:00"
|
||||
},
|
||||
{
|
||||
"name": "symfony/translation-contracts",
|
||||
|
@ -1783,16 +1738,16 @@
|
|||
},
|
||||
{
|
||||
"name": "twig/html-extra",
|
||||
"version": "v3.15.0",
|
||||
"version": "v3.13.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/html-extra.git",
|
||||
"reference": "2086023d3ffc4bae2b1115f715d17f97fd013665"
|
||||
"reference": "8229e750091171c1f11801a525927811c7ac5a7e"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/html-extra/zipball/2086023d3ffc4bae2b1115f715d17f97fd013665",
|
||||
"reference": "2086023d3ffc4bae2b1115f715d17f97fd013665",
|
||||
"url": "https://api.github.com/repos/twigphp/html-extra/zipball/8229e750091171c1f11801a525927811c7ac5a7e",
|
||||
"reference": "8229e750091171c1f11801a525927811c7ac5a7e",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1835,7 +1790,7 @@
|
|||
"twig"
|
||||
],
|
||||
"support": {
|
||||
"source": "https://github.com/twigphp/html-extra/tree/v3.15.0"
|
||||
"source": "https://github.com/twigphp/html-extra/tree/v3.13.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1847,20 +1802,20 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-09-30T06:41:48+00:00"
|
||||
"time": "2024-09-03T13:08:40+00:00"
|
||||
},
|
||||
{
|
||||
"name": "twig/twig",
|
||||
"version": "v3.15.0",
|
||||
"version": "v3.14.0",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/twigphp/Twig.git",
|
||||
"reference": "2d5b3964cc21d0188633d7ddce732dc8e874db02"
|
||||
"reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/2d5b3964cc21d0188633d7ddce732dc8e874db02",
|
||||
"reference": "2d5b3964cc21d0188633d7ddce732dc8e874db02",
|
||||
"url": "https://api.github.com/repos/twigphp/Twig/zipball/126b2c97818dbff0cdf3fbfc881aedb3d40aae72",
|
||||
"reference": "126b2c97818dbff0cdf3fbfc881aedb3d40aae72",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1914,7 +1869,7 @@
|
|||
],
|
||||
"support": {
|
||||
"issues": "https://github.com/twigphp/Twig/issues",
|
||||
"source": "https://github.com/twigphp/Twig/tree/v3.15.0"
|
||||
"source": "https://github.com/twigphp/Twig/tree/v3.14.0"
|
||||
},
|
||||
"funding": [
|
||||
{
|
||||
|
@ -1926,22 +1881,22 @@
|
|||
"type": "tidelift"
|
||||
}
|
||||
],
|
||||
"time": "2024-11-17T15:59:19+00:00"
|
||||
"time": "2024-09-09T17:55:12+00:00"
|
||||
}
|
||||
],
|
||||
"packages-dev": [
|
||||
{
|
||||
"name": "phpstan/phpstan",
|
||||
"version": "1.12.11",
|
||||
"version": "1.12.5",
|
||||
"source": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/phpstan/phpstan.git",
|
||||
"reference": "0d1fc20a962a91be578bcfe7cf939e6e1a2ff733"
|
||||
"reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17"
|
||||
},
|
||||
"dist": {
|
||||
"type": "zip",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/0d1fc20a962a91be578bcfe7cf939e6e1a2ff733",
|
||||
"reference": "0d1fc20a962a91be578bcfe7cf939e6e1a2ff733",
|
||||
"url": "https://api.github.com/repos/phpstan/phpstan/zipball/7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17",
|
||||
"reference": "7e6c6cb7cecb0a6254009a1a8a7d54ec99812b17",
|
||||
"shasum": ""
|
||||
},
|
||||
"require": {
|
||||
|
@ -1986,7 +1941,7 @@
|
|||
"type": "github"
|
||||
}
|
||||
],
|
||||
"time": "2024-11-17T14:08:01+00:00"
|
||||
"time": "2024-09-26T12:45:22+00:00"
|
||||
}
|
||||
],
|
||||
"aliases": [],
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
namespace EEPROM;
|
||||
|
||||
use Index\Config\Fs\FsConfig;
|
||||
use Index\Db\DbBackends;
|
||||
use Index\Db\DbTools;
|
||||
|
||||
define('PRM_STARTUP', microtime(true));
|
||||
define('PRM_ROOT', __DIR__);
|
||||
|
@ -40,7 +40,7 @@ if(!is_dir(PRM_UPLOADS))
|
|||
if(!is_dir(PRM_THUMBS))
|
||||
mkdir(PRM_THUMBS, 0775, true);
|
||||
|
||||
$db = DbBackends::create($cfg->getString('database:dsn', 'null:'));
|
||||
$db = DbTools::create($cfg->getString('database:dsn', 'null:'));
|
||||
$db->execute('SET SESSION time_zone = \'+00:00\', sql_mode = \'STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_ENGINE_SUBSTITUTION\';');
|
||||
|
||||
$eeprom = new EEPROMContext($cfg, $db);
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
namespace EEPROM\Auth;
|
||||
|
||||
use EEPROM\Users\UsersContext;
|
||||
use Flashii\{FlashiiClient,FlashiiUrls};
|
||||
use Flashii\Credentials\{BearerCredentials,MisuzuCredentials};
|
||||
use Index\Config\Config;
|
||||
use Index\Http\Routing\{HttpMiddleware,RouteHandler,RouteHandlerTrait};
|
||||
|
||||
|
@ -30,19 +28,16 @@ class AuthRoutes implements RouteHandler {
|
|||
$authMethod = strval($authParts[0] ?? '');
|
||||
$authToken = strval($authParts[1] ?? '');
|
||||
|
||||
$isMisuzu = strcasecmp($authMethod, 'misuzu') === 0;
|
||||
$isBearer = strcasecmp($authMethod, 'bearer') === 0;
|
||||
if(strcasecmp($authMethod, 'misuzu') === 0 || strcasecmp($authMethod, 'bearer') === 0) {
|
||||
$authResult = ChatAuth::attempt(
|
||||
$this->config->getString('endpoint'),
|
||||
$authMethod,
|
||||
$this->config->getString('secret'),
|
||||
$authToken
|
||||
);
|
||||
|
||||
if($isMisuzu || $isBearer) {
|
||||
$credentials = $isMisuzu ? new MisuzuCredentials($authToken) : new BearerCredentials($authToken);
|
||||
$flashii = new FlashiiClient('EEPROM', $credentials, new FlashiiUrls(
|
||||
$this->config->getString('api', FlashiiUrls::PROD_API_URL),
|
||||
$this->config->getString('id', FlashiiUrls::PROD_ID_URL)
|
||||
));
|
||||
|
||||
$authInfo = $flashii->v1()->me();
|
||||
if($authInfo !== null)
|
||||
$this->authInfo->setInfo($this->usersCtx->getUser($authInfo->getId()));
|
||||
if(!empty($authResult->success))
|
||||
$this->authInfo->setInfo($this->usersCtx->getUser($authResult->user_id));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
53
src/Auth/ChatAuth.php
Normal file
53
src/Auth/ChatAuth.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
namespace EEPROM\Auth;
|
||||
|
||||
use stdClass;
|
||||
|
||||
final class ChatAuth {
|
||||
public static function attempt(string $endPoint, string $method, string $secret, string $cookie): stdClass {
|
||||
if(!empty($cookie)) {
|
||||
$signature = sprintf('verify#%s#%s#%s', $method, $cookie, $_SERVER['REMOTE_ADDR']);
|
||||
$signature = hash_hmac('sha256', $signature, $secret);
|
||||
|
||||
$login = curl_init($endPoint);
|
||||
curl_setopt_array($login, [
|
||||
CURLOPT_AUTOREFERER => false,
|
||||
CURLOPT_FAILONERROR => false,
|
||||
CURLOPT_FOLLOWLOCATION => true,
|
||||
CURLOPT_HEADER => false,
|
||||
CURLOPT_POST => true,
|
||||
CURLOPT_POSTFIELDS => http_build_query([
|
||||
'method' => $method,
|
||||
'token' => $cookie,
|
||||
'ipaddr' => $_SERVER['REMOTE_ADDR'],
|
||||
], '', '&', PHP_QUERY_RFC3986),
|
||||
CURLOPT_RETURNTRANSFER => true,
|
||||
CURLOPT_TCP_FASTOPEN => true,
|
||||
CURLOPT_CONNECTTIMEOUT => 2,
|
||||
CURLOPT_MAXREDIRS => 2,
|
||||
CURLOPT_PROTOCOLS => CURLPROTO_HTTPS,
|
||||
CURLOPT_TIMEOUT => 5,
|
||||
CURLOPT_USERAGENT => 'EEPROM',
|
||||
CURLOPT_HTTPHEADER => [
|
||||
'Content-Type: application/x-www-form-urlencoded',
|
||||
'X-SharpChat-Signature: ' . $signature,
|
||||
],
|
||||
]);
|
||||
$userInfo = json_decode(curl_exec($login));
|
||||
curl_close($login);
|
||||
}
|
||||
|
||||
if(empty($userInfo->success)) {
|
||||
$userInfo = new stdClass;
|
||||
$userInfo->success = false;
|
||||
$userInfo->user_id = 0;
|
||||
$userInfo->username = 'Anonymous';
|
||||
$userInfo->colour_raw = 0x40000000;
|
||||
$userInfo->rank = 0;
|
||||
$userInfo->hierarchy = 0;
|
||||
$userInfo->perms = 0;
|
||||
}
|
||||
|
||||
return $userInfo;
|
||||
}
|
||||
}
|
|
@ -61,7 +61,7 @@ class EEPROMContext {
|
|||
|
||||
if($isApiDomain) {
|
||||
$routingCtx->register(new Auth\AuthRoutes(
|
||||
$this->config->scopeTo('apii'),
|
||||
$this->config->scopeTo('misuzu'),
|
||||
$this->authInfo,
|
||||
$this->usersCtx
|
||||
));
|
||||
|
|
Loading…
Reference in a new issue