mirror of
https://github.com/YGGverse/Pulsar.git
synced 2026-03-31 17:55:37 +00:00
implement custom route settings
This commit is contained in:
parent
536e15847e
commit
1c7e01f028
2 changed files with 31 additions and 15 deletions
|
|
@ -11,6 +11,10 @@
|
|||
{
|
||||
"host":"127.0.0.1",
|
||||
"port":1900,
|
||||
"route":
|
||||
{
|
||||
"/test":"/path/to/page.gmi"
|
||||
},
|
||||
"event":
|
||||
{
|
||||
"init":
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ class Nex implements MessageComponentInterface
|
|||
// Route request
|
||||
switch (true)
|
||||
{
|
||||
// Item
|
||||
// Chanel item
|
||||
case (bool) preg_match('/\/(?<id>\d+)($|\.gmi)$/i', $request, $attribute):
|
||||
|
||||
$lines = [];
|
||||
|
|
@ -145,7 +145,7 @@ class Nex implements MessageComponentInterface
|
|||
|
||||
break;
|
||||
|
||||
// Chanel
|
||||
// Channel page
|
||||
case (bool) preg_match('/^\/(?<alias>.+)$/i', $request, $attribute):
|
||||
|
||||
$lines = [];
|
||||
|
|
@ -207,6 +207,17 @@ class Nex implements MessageComponentInterface
|
|||
// Not found
|
||||
default:
|
||||
|
||||
// Try static route settings
|
||||
if (isset($this->_config->route->{$request}))
|
||||
{
|
||||
$response = file_get_contents(
|
||||
$this->_config->route->{$request}
|
||||
);
|
||||
}
|
||||
|
||||
// Build site map
|
||||
else
|
||||
{
|
||||
$lines = [];
|
||||
|
||||
// Get channels
|
||||
|
|
@ -225,6 +236,7 @@ class Nex implements MessageComponentInterface
|
|||
$lines
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
// Debug message event on enabled
|
||||
if ($this->_config->event->message->debug->enabled)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue