Updated Index for Awaki.

This commit is contained in:
flash 2024-08-04 22:08:54 +00:00
parent 7d1341b671
commit 1157c85d83
5 changed files with 45 additions and 56 deletions

View file

@ -1,8 +1,6 @@
<?php <?php
namespace Awaki; namespace Awaki;
use Index\Environment;
use Index\Data\ConnectionFailedException;
use Index\Data\DbTools; use Index\Data\DbTools;
use Syokuhou\SharpConfig; use Syokuhou\SharpConfig;
@ -15,7 +13,9 @@ define('AWK_DIR_DBM', AWK_ROOT . '/database');
require_once AWK_ROOT . '/vendor/autoload.php'; require_once AWK_ROOT . '/vendor/autoload.php';
Environment::setDebug(AWK_DEBUG); error_reporting(AWK_DEBUG ? -1 : 0);
mb_internal_encoding('UTF-8');
date_default_timezone_set('GMT');
$config = SharpConfig::fromFile(AWK_ROOT . '/awaki.cfg'); $config = SharpConfig::fromFile(AWK_ROOT . '/awaki.cfg');

View file

@ -1,9 +1,7 @@
{ {
"minimum-stability": "dev",
"prefer-stable": true,
"require": { "require": {
"flashwave/index": "dev-master", "flashwave/index": "^0.2408.40014",
"flashwave/syokuhou": "dev-master", "flashwave/syokuhou": "^1.2",
"sentry/sdk": "^4.0" "sentry/sdk": "^4.0"
}, },
"autoload": { "autoload": {

82
composer.lock generated
View file

@ -4,34 +4,30 @@
"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": "d5abb8ca3c597026b2d53f67c12b2681", "content-hash": "25cd4c9695654bac1ffda2ab6d6033de",
"packages": [ "packages": [
{ {
"name": "flashwave/index", "name": "flashwave/index",
"version": "dev-master", "version": "v0.2408.40014",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://patchii.net/flash/index.git", "url": "https://patchii.net/flash/index.git",
"reference": "e4c8ed711e045cffe840ba10a239ede14b0b171f" "reference": "fbca708fbd75e8ecc6b36b39c1307a67bf250808"
}, },
"require": { "require": {
"ext-mbstring": "*", "ext-mbstring": "*",
"php": ">=8.1" "php": ">=8.3"
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "^1.10", "phpstan/phpstan": "^1.11",
"phpunit/phpunit": "^10.2" "phpunit/phpunit": "^11.2"
}, },
"suggest": { "suggest": {
"ext-mysqli": "Support for the Index\\Data\\MariaDB namespace (both mysqlnd and libmysql are supported).", "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-sqlite3": "Support for the Index\\Data\\SQLite namespace."
}, },
"default-branch": true,
"type": "library", "type": "library",
"autoload": { "autoload": {
"files": [
"index.php"
],
"psr-4": { "psr-4": {
"Index\\": "src" "Index\\": "src"
} }
@ -50,25 +46,24 @@
], ],
"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-04-10T23:40:14+00:00" "time": "2024-08-04T00:14:17+00:00"
}, },
{ {
"name": "flashwave/syokuhou", "name": "flashwave/syokuhou",
"version": "dev-master", "version": "v1.2.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://patchii.net/flash/syokuhou.git", "url": "https://patchii.net/flash/syokuhou.git",
"reference": "c1fe9371ada20fcea51c225cc53b9ceae4642bc4" "reference": "129a46c0d917382f9bc195cce278be51984eb87d"
}, },
"require": { "require": {
"flashwave/index": "dev-master", "flashwave/index": "^0.2408.40014",
"php": ">=8.2" "php": ">=8.3"
}, },
"require-dev": { "require-dev": {
"phpstan/phpstan": "^1.10", "phpstan/phpstan": "^1.11",
"phpunit/phpunit": "^10.4" "phpunit/phpunit": "^11.2"
}, },
"default-branch": true,
"type": "library", "type": "library",
"autoload": { "autoload": {
"psr-4": { "psr-4": {
@ -89,20 +84,20 @@
], ],
"description": "Configuration library for PHP.", "description": "Configuration library for PHP.",
"homepage": "https://railgun.sh/syokuhou", "homepage": "https://railgun.sh/syokuhou",
"time": "2024-01-04T02:12:49+00:00" "time": "2024-08-04T01:07:23+00:00"
}, },
{ {
"name": "guzzlehttp/psr7", "name": "guzzlehttp/psr7",
"version": "2.6.2", "version": "2.7.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/guzzle/psr7.git", "url": "https://github.com/guzzle/psr7.git",
"reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221" "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/guzzle/psr7/zipball/45b30f99ac27b5ca93cb4831afe16285f57b8221", "url": "https://api.github.com/repos/guzzle/psr7/zipball/a70f5c95fb43bc83f07c9c948baa0dc1829bf201",
"reference": "45b30f99ac27b5ca93cb4831afe16285f57b8221", "reference": "a70f5c95fb43bc83f07c9c948baa0dc1829bf201",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -117,8 +112,8 @@
}, },
"require-dev": { "require-dev": {
"bamarni/composer-bin-plugin": "^1.8.2", "bamarni/composer-bin-plugin": "^1.8.2",
"http-interop/http-factory-tests": "^0.9", "http-interop/http-factory-tests": "0.9.0",
"phpunit/phpunit": "^8.5.36 || ^9.6.15" "phpunit/phpunit": "^8.5.39 || ^9.6.20"
}, },
"suggest": { "suggest": {
"laminas/laminas-httphandlerrunner": "Emit PSR-7 responses" "laminas/laminas-httphandlerrunner": "Emit PSR-7 responses"
@ -189,7 +184,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/guzzle/psr7/issues", "issues": "https://github.com/guzzle/psr7/issues",
"source": "https://github.com/guzzle/psr7/tree/2.6.2" "source": "https://github.com/guzzle/psr7/tree/2.7.0"
}, },
"funding": [ "funding": [
{ {
@ -205,7 +200,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2023-12-03T20:05:35+00:00" "time": "2024-07-18T11:15:46+00:00"
}, },
{ {
"name": "jean85/pretty-package-versions", "name": "jean85/pretty-package-versions",
@ -525,16 +520,16 @@
}, },
{ {
"name": "sentry/sentry", "name": "sentry/sentry",
"version": "4.7.0", "version": "4.8.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/getsentry/sentry-php.git", "url": "https://github.com/getsentry/sentry-php.git",
"reference": "d6769b2a5e6bf19ed3bbfbf52328ceaf8e6fcb1f" "reference": "61770efd8b7888e0bdd7d234f0ba67b066e47d04"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/getsentry/sentry-php/zipball/d6769b2a5e6bf19ed3bbfbf52328ceaf8e6fcb1f", "url": "https://api.github.com/repos/getsentry/sentry-php/zipball/61770efd8b7888e0bdd7d234f0ba67b066e47d04",
"reference": "d6769b2a5e6bf19ed3bbfbf52328ceaf8e6fcb1f", "reference": "61770efd8b7888e0bdd7d234f0ba67b066e47d04",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -598,7 +593,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.7.0" "source": "https://github.com/getsentry/sentry-php/tree/4.8.1"
}, },
"funding": [ "funding": [
{ {
@ -610,7 +605,7 @@
"type": "custom" "type": "custom"
} }
], ],
"time": "2024-04-10T13:22:13+00:00" "time": "2024-07-16T13:45:27+00:00"
}, },
{ {
"name": "symfony/deprecation-contracts", "name": "symfony/deprecation-contracts",
@ -681,16 +676,16 @@
}, },
{ {
"name": "symfony/options-resolver", "name": "symfony/options-resolver",
"version": "v7.0.7", "version": "v7.1.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/options-resolver.git", "url": "https://github.com/symfony/options-resolver.git",
"reference": "23cc173858776ad451e31f053b1c9f47840b2cfa" "reference": "47aa818121ed3950acd2b58d1d37d08a94f9bf55"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/options-resolver/zipball/23cc173858776ad451e31f053b1c9f47840b2cfa", "url": "https://api.github.com/repos/symfony/options-resolver/zipball/47aa818121ed3950acd2b58d1d37d08a94f9bf55",
"reference": "23cc173858776ad451e31f053b1c9f47840b2cfa", "reference": "47aa818121ed3950acd2b58d1d37d08a94f9bf55",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -728,7 +723,7 @@
"options" "options"
], ],
"support": { "support": {
"source": "https://github.com/symfony/options-resolver/tree/v7.0.7" "source": "https://github.com/symfony/options-resolver/tree/v7.1.1"
}, },
"funding": [ "funding": [
{ {
@ -744,17 +739,14 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2024-04-18T09:29:19+00:00" "time": "2024-05-31T14:57:53+00:00"
} }
], ],
"packages-dev": [], "packages-dev": [],
"aliases": [], "aliases": [],
"minimum-stability": "dev", "minimum-stability": "stable",
"stability-flags": { "stability-flags": [],
"flashwave/index": 20, "prefer-stable": false,
"flashwave/syokuhou": 20
},
"prefer-stable": true,
"prefer-lowest": false, "prefer-lowest": false,
"platform": [], "platform": [],
"platform-dev": [], "platform-dev": [],

View file

@ -3,7 +3,6 @@ namespace Awaki;
use Index\Data\IDbConnection; use Index\Data\IDbConnection;
use Index\Http\Routing\{HandlerAttribute,HttpGet,IRouter,IRouteHandler}; use Index\Http\Routing\{HandlerAttribute,HttpGet,IRouter,IRouteHandler};
use Index\Serialisation\Base62;
use Syokuhou\IConfig; use Syokuhou\IConfig;
final class RedirectorRoutes implements IRouteHandler { final class RedirectorRoutes implements IRouteHandler {

View file

@ -1,9 +1,9 @@
<?php <?php
namespace Awaki; namespace Awaki;
use Index\XNumber;
use Index\Data\IDbConnection; use Index\Data\IDbConnection;
use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler}; use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler};
use Index\Serialisation\Base62;
use Syokuhou\IConfig; use Syokuhou\IConfig;
final class SatoriRoutes extends RouteHandler { final class SatoriRoutes extends RouteHandler {
@ -14,7 +14,7 @@ final class SatoriRoutes extends RouteHandler {
#[HttpGet('/[bg]/([A-Za-z0-9]+)')] #[HttpGet('/[bg]/([A-Za-z0-9]+)')]
public function redirectSatoriShort($response, $request, string $linkId) { public function redirectSatoriShort($response, $request, string $linkId) {
$linkId = Base62::decode($linkId); $linkId = XNumber::fromBase62($linkId);
$getInfo = $this->dbConn->prepare('SELECT redir_url FROM awk_satori_redirects WHERE redir_id = ?'); $getInfo = $this->dbConn->prepare('SELECT redir_url FROM awk_satori_redirects WHERE redir_id = ?');
$getInfo->addParameter(1, $linkId); $getInfo->addParameter(1, $linkId);
@ -62,7 +62,7 @@ final class SatoriRoutes extends RouteHandler {
} }
return [ return [
'url' => sprintf($this->config->getString('format'), Base62::encode($linkId)), 'url' => sprintf($this->config->getString('format'), XNumber::toBase62($linkId)),
]; ];
} }
} }