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
namespace Awaki;
use Index\Environment;
use Index\Data\ConnectionFailedException;
use Index\Data\DbTools;
use Syokuhou\SharpConfig;
@ -15,7 +13,9 @@ define('AWK_DIR_DBM', AWK_ROOT . '/database');
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');

View file

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

View file

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

View file

@ -1,9 +1,9 @@
<?php
namespace Awaki;
use Index\XNumber;
use Index\Data\IDbConnection;
use Index\Http\Routing\{HttpGet,HttpPost,RouteHandler};
use Index\Serialisation\Base62;
use Syokuhou\IConfig;
final class SatoriRoutes extends RouteHandler {
@ -14,7 +14,7 @@ final class SatoriRoutes extends RouteHandler {
#[HttpGet('/[bg]/([A-Za-z0-9]+)')]
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->addParameter(1, $linkId);
@ -62,7 +62,7 @@ final class SatoriRoutes extends RouteHandler {
}
return [
'url' => sprintf($this->config->getString('format'), Base62::encode($linkId)),
'url' => sprintf($this->config->getString('format'), XNumber::toBase62($linkId)),
];
}
}