mirror of
https://github.com/YGGverse/Pulsar.git
synced 2026-03-31 17:55:37 +00:00
resolve static route in priority
This commit is contained in:
parent
1c7e01f028
commit
cf36d79cad
1 changed files with 23 additions and 25 deletions
|
|
@ -78,6 +78,15 @@ class Nex implements MessageComponentInterface
|
||||||
// Route request
|
// Route request
|
||||||
switch (true)
|
switch (true)
|
||||||
{
|
{
|
||||||
|
// Try static route settings
|
||||||
|
case isset($this->_config->route->{$request}):
|
||||||
|
|
||||||
|
$response = file_get_contents(
|
||||||
|
$this->_config->route->{$request}
|
||||||
|
);
|
||||||
|
|
||||||
|
break;
|
||||||
|
|
||||||
// Chanel item
|
// Chanel item
|
||||||
case (bool) preg_match('/\/(?<id>\d+)($|\.gmi)$/i', $request, $attribute):
|
case (bool) preg_match('/\/(?<id>\d+)($|\.gmi)$/i', $request, $attribute):
|
||||||
|
|
||||||
|
|
@ -207,35 +216,24 @@ class Nex implements MessageComponentInterface
|
||||||
// Not found
|
// Not found
|
||||||
default:
|
default:
|
||||||
|
|
||||||
// Try static route settings
|
// Create site map
|
||||||
if (isset($this->_config->route->{$request}))
|
$lines = [];
|
||||||
|
|
||||||
|
// Get channels
|
||||||
|
foreach ((array) $this->_database->getChannels() as $channel)
|
||||||
{
|
{
|
||||||
$response = file_get_contents(
|
$lines[] = sprintf(
|
||||||
$this->_config->route->{$request}
|
'=> /%s %s',
|
||||||
|
$channel->alias,
|
||||||
|
$channel->title
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build site map
|
// Build response
|
||||||
else
|
$response = implode(
|
||||||
{
|
PHP_EOL,
|
||||||
$lines = [];
|
$lines
|
||||||
|
);
|
||||||
// Get channels
|
|
||||||
foreach ((array) $this->_database->getChannels() as $channel)
|
|
||||||
{
|
|
||||||
$lines[] = sprintf(
|
|
||||||
'=> /%s %s',
|
|
||||||
$channel->alias,
|
|
||||||
$channel->title
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Build response
|
|
||||||
$response = implode(
|
|
||||||
PHP_EOL,
|
|
||||||
$lines
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Debug message event on enabled
|
// Debug message event on enabled
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue