mirror of
https://github.com/shlinkio/shlink.git
synced 2025-01-22 14:33:16 -06:00
Added support for multi-segment slugs
This commit is contained in:
parent
a570ce202a
commit
fdd3e24967
@ -76,7 +76,7 @@ These routes have been removed, but have a direct replacement:
|
|||||||
* `/qr/{shortCode}[/{size}]` -> `/{shortCode}/qr-code[/{size}]`
|
* `/qr/{shortCode}[/{size}]` -> `/{shortCode}/qr-code[/{size}]`
|
||||||
* `PUT /rest/v{version}/short-urls/{shortCode}` -> `PATCH /rest/v{version}/short-urls/{shortCode}`
|
* `PUT /rest/v{version}/short-urls/{shortCode}` -> `PATCH /rest/v{version}/short-urls/{shortCode}`
|
||||||
|
|
||||||
When using the old ones, a 404 status will me returned now.
|
When using the old ones, a 404 status will be returned now.
|
||||||
|
|
||||||
### Removed command and route aliases
|
### Removed command and route aliases
|
||||||
|
|
||||||
|
@ -68,7 +68,6 @@ return [
|
|||||||
// This middleware is in front of tracking actions explicitly. Putting here for orphan visits tracking
|
// This middleware is in front of tracking actions explicitly. Putting here for orphan visits tracking
|
||||||
IpAddress::class,
|
IpAddress::class,
|
||||||
Core\ErrorHandler\NotFoundTypeResolverMiddleware::class,
|
Core\ErrorHandler\NotFoundTypeResolverMiddleware::class,
|
||||||
// TODO MultiSegmentSlugRedirectMiddleware
|
|
||||||
Core\ShortUrl\Middleware\ExtraPathRedirectMiddleware::class,
|
Core\ShortUrl\Middleware\ExtraPathRedirectMiddleware::class,
|
||||||
Core\ErrorHandler\NotFoundTrackerMiddleware::class,
|
Core\ErrorHandler\NotFoundTrackerMiddleware::class,
|
||||||
Core\ErrorHandler\NotFoundRedirectHandler::class,
|
Core\ErrorHandler\NotFoundRedirectHandler::class,
|
||||||
|
@ -36,11 +36,12 @@ return (new ConfigAggregator\ConfigAggregator([
|
|||||||
Importer\ConfigProvider::class,
|
Importer\ConfigProvider::class,
|
||||||
IpGeolocation\ConfigProvider::class,
|
IpGeolocation\ConfigProvider::class,
|
||||||
EventDispatcher\ConfigProvider::class,
|
EventDispatcher\ConfigProvider::class,
|
||||||
Core\ConfigProvider::class,
|
|
||||||
CLI\ConfigProvider::class,
|
CLI\ConfigProvider::class,
|
||||||
Rest\ConfigProvider::class,
|
Rest\ConfigProvider::class, // Load rest before Core, to prevent conflicting routes when multi-segment is enabled
|
||||||
|
Core\ConfigProvider::class,
|
||||||
new ConfigAggregator\PhpFileProvider('config/autoload/{{,*.}global,{,*.}local}.php'),
|
new ConfigAggregator\PhpFileProvider('config/autoload/{{,*.}global,{,*.}local}.php'),
|
||||||
$isTestEnv
|
$isTestEnv
|
||||||
|
// TODO Test routes must be loaded before core config
|
||||||
? new ConfigAggregator\PhpFileProvider('config/test/*.global.php')
|
? new ConfigAggregator\PhpFileProvider('config/test/*.global.php')
|
||||||
: new ConfigAggregator\ArrayProvider([]),
|
: new ConfigAggregator\ArrayProvider([]),
|
||||||
], 'data/cache/app_config.php', [
|
], 'data/cache/app_config.php', [
|
||||||
|
@ -17,18 +17,9 @@ return [
|
|||||||
],
|
],
|
||||||
'allowed_methods' => [RequestMethod::METHOD_GET],
|
'allowed_methods' => [RequestMethod::METHOD_GET],
|
||||||
],
|
],
|
||||||
[
|
|
||||||
'name' => Action\RedirectAction::class,
|
|
||||||
'path' => '/{shortCode}',
|
|
||||||
'middleware' => [
|
|
||||||
IpAddress::class,
|
|
||||||
Action\RedirectAction::class,
|
|
||||||
],
|
|
||||||
'allowed_methods' => [RequestMethod::METHOD_GET],
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
'name' => Action\PixelAction::class,
|
'name' => Action\PixelAction::class,
|
||||||
'path' => '/{shortCode}/track',
|
'path' => '/{shortCode:.+}/track',
|
||||||
'middleware' => [
|
'middleware' => [
|
||||||
IpAddress::class,
|
IpAddress::class,
|
||||||
Action\PixelAction::class,
|
Action\PixelAction::class,
|
||||||
@ -37,12 +28,21 @@ return [
|
|||||||
],
|
],
|
||||||
[
|
[
|
||||||
'name' => Action\QrCodeAction::class,
|
'name' => Action\QrCodeAction::class,
|
||||||
'path' => '/{shortCode}/qr-code',
|
'path' => '/{shortCode:.+}/qr-code',
|
||||||
'middleware' => [
|
'middleware' => [
|
||||||
Action\QrCodeAction::class,
|
Action\QrCodeAction::class,
|
||||||
],
|
],
|
||||||
'allowed_methods' => [RequestMethod::METHOD_GET],
|
'allowed_methods' => [RequestMethod::METHOD_GET],
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'name' => Action\RedirectAction::class,
|
||||||
|
'path' => '/{shortCode:.+}',
|
||||||
|
'middleware' => [
|
||||||
|
IpAddress::class,
|
||||||
|
Action\RedirectAction::class,
|
||||||
|
],
|
||||||
|
'allowed_methods' => [RequestMethod::METHOD_GET],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
@ -16,6 +16,14 @@ return (static function (): array {
|
|||||||
'routes' => [
|
'routes' => [
|
||||||
Action\HealthAction::getRouteDef(),
|
Action\HealthAction::getRouteDef(),
|
||||||
|
|
||||||
|
// Visits
|
||||||
|
Action\Visit\ShortUrlVisitsAction::getRouteDef([$dropDomainMiddleware]),
|
||||||
|
Action\Visit\TagVisitsAction::getRouteDef(),
|
||||||
|
Action\Visit\DomainVisitsAction::getRouteDef(),
|
||||||
|
Action\Visit\GlobalVisitsAction::getRouteDef(),
|
||||||
|
Action\Visit\OrphanVisitsAction::getRouteDef(),
|
||||||
|
Action\Visit\NonOrphanVisitsAction::getRouteDef(),
|
||||||
|
|
||||||
// Short URLs
|
// Short URLs
|
||||||
Action\ShortUrl\CreateShortUrlAction::getRouteDef([
|
Action\ShortUrl\CreateShortUrlAction::getRouteDef([
|
||||||
$contentNegotiationMiddleware,
|
$contentNegotiationMiddleware,
|
||||||
@ -32,14 +40,6 @@ return (static function (): array {
|
|||||||
Action\ShortUrl\ResolveShortUrlAction::getRouteDef([$dropDomainMiddleware]),
|
Action\ShortUrl\ResolveShortUrlAction::getRouteDef([$dropDomainMiddleware]),
|
||||||
Action\ShortUrl\ListShortUrlsAction::getRouteDef(),
|
Action\ShortUrl\ListShortUrlsAction::getRouteDef(),
|
||||||
|
|
||||||
// Visits
|
|
||||||
Action\Visit\ShortUrlVisitsAction::getRouteDef([$dropDomainMiddleware]),
|
|
||||||
Action\Visit\TagVisitsAction::getRouteDef(),
|
|
||||||
Action\Visit\DomainVisitsAction::getRouteDef(),
|
|
||||||
Action\Visit\GlobalVisitsAction::getRouteDef(),
|
|
||||||
Action\Visit\OrphanVisitsAction::getRouteDef(),
|
|
||||||
Action\Visit\NonOrphanVisitsAction::getRouteDef(),
|
|
||||||
|
|
||||||
// Tags
|
// Tags
|
||||||
Action\Tag\ListTagsAction::getRouteDef(),
|
Action\Tag\ListTagsAction::getRouteDef(),
|
||||||
Action\Tag\TagsStatsAction::getRouteDef(),
|
Action\Tag\TagsStatsAction::getRouteDef(),
|
||||||
|
@ -14,7 +14,7 @@ use Shlinkio\Shlink\Rest\Middleware\AuthenticationMiddleware;
|
|||||||
|
|
||||||
class DeleteShortUrlAction extends AbstractRestAction
|
class DeleteShortUrlAction extends AbstractRestAction
|
||||||
{
|
{
|
||||||
protected const ROUTE_PATH = '/short-urls/{shortCode}';
|
protected const ROUTE_PATH = '/short-urls/{shortCode:.+}';
|
||||||
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_DELETE];
|
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_DELETE];
|
||||||
|
|
||||||
public function __construct(private DeleteShortUrlServiceInterface $deleteShortUrlService)
|
public function __construct(private DeleteShortUrlServiceInterface $deleteShortUrlService)
|
||||||
|
@ -16,8 +16,8 @@ use Shlinkio\Shlink\Rest\Middleware\AuthenticationMiddleware;
|
|||||||
|
|
||||||
class EditShortUrlAction extends AbstractRestAction
|
class EditShortUrlAction extends AbstractRestAction
|
||||||
{
|
{
|
||||||
protected const ROUTE_PATH = '/short-urls/{shortCode}';
|
protected const ROUTE_PATH = '/short-urls/{shortCode:.+}';
|
||||||
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_PATCH, self::METHOD_PUT];
|
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_PATCH];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
private ShortUrlServiceInterface $shortUrlService,
|
private ShortUrlServiceInterface $shortUrlService,
|
||||||
|
@ -15,7 +15,7 @@ use Shlinkio\Shlink\Rest\Middleware\AuthenticationMiddleware;
|
|||||||
|
|
||||||
class ResolveShortUrlAction extends AbstractRestAction
|
class ResolveShortUrlAction extends AbstractRestAction
|
||||||
{
|
{
|
||||||
protected const ROUTE_PATH = '/short-urls/{shortCode}';
|
protected const ROUTE_PATH = '/short-urls/{shortCode:.+}';
|
||||||
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET];
|
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET];
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
|
@ -18,7 +18,7 @@ class ShortUrlVisitsAction extends AbstractRestAction
|
|||||||
{
|
{
|
||||||
use PagerfantaUtilsTrait;
|
use PagerfantaUtilsTrait;
|
||||||
|
|
||||||
protected const ROUTE_PATH = '/short-urls/{shortCode}/visits';
|
protected const ROUTE_PATH = '/short-urls/{shortCode:.+}/visits';
|
||||||
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET];
|
protected const ROUTE_ALLOWED_METHODS = [self::METHOD_GET];
|
||||||
|
|
||||||
public function __construct(private VisitsStatsHelperInterface $visitsHelper)
|
public function __construct(private VisitsStatsHelperInterface $visitsHelper)
|
||||||
|
Loading…
Reference in New Issue
Block a user