Browse Source

add aliases info, remove deprecated settings

main
ghost 11 months ago
parent
commit
0d5f100a25
  1. 12
      example/config.json
  2. 63
      src/server.php

12
example/config.json

@ -41,13 +41,14 @@
}, },
"dokuwiki": "dokuwiki":
{ {
"uri":
{
"home":"start"
},
"url": "url":
{ {
"source":"http://.." "source":"http://..",
"alias":
{
"gemini://..":"",
"gemini://..":""
}
} }
}, },
"string": "string":
@ -63,6 +64,7 @@
"nothing":"Nothing found by this request", "nothing":"Nothing found by this request",
"main":"Main page", "main":"Main page",
"source":"Source", "source":"Source",
"alias":"Alias",
"welcome":"About", "welcome":"About",
"about":"=> https://github.com/YGGverse/dokuwiki-gemini-server GitHub" "about":"=> https://github.com/YGGverse/dokuwiki-gemini-server GitHub"
} }

63
src/server.php

@ -307,6 +307,29 @@ $server->setHandler(
// Append about info // Append about info
$lines[] = $config->string->about; $lines[] = $config->string->about;
// Append about info
$lines[] = $config->string->about;
// Append aliases
if ($config->dokuwiki->url->alias)
{
$lines[] = sprintf(
'## %s',
$config->string->alias
);
foreach ($config->dokuwiki->url->alias as $base => $name)
{
$lines[] = sprintf(
'=> %s/%s %s',
$base,
$matches[1],
$name
);
}
}
// Build content
$response->setContent( $response->setContent(
implode( implode(
PHP_EOL, PHP_EOL,
@ -456,6 +479,25 @@ $server->setHandler(
// Append about info // Append about info
$lines[] = $config->string->about; $lines[] = $config->string->about;
// Append aliases
if ($config->dokuwiki->url->alias)
{
$lines[] = sprintf(
'## %s',
$config->string->alias
);
foreach ($config->dokuwiki->url->alias as $base => $name)
{
$lines[] = sprintf(
'=> %s/%s %s',
$base,
$matches[1],
$name
);
}
}
// Merge lines // Merge lines
$content = implode( $content = implode(
PHP_EOL, PHP_EOL,
@ -578,7 +620,7 @@ $server->setHandler(
// Append about info // Append about info
$lines[] = sprintf( $lines[] = sprintf(
'## %s', '## %s',
$config->string->resources $config->string->actions
); );
// Append search link // Append search link
@ -597,6 +639,25 @@ $server->setHandler(
// Append about info // Append about info
$lines[] = $config->string->about; $lines[] = $config->string->about;
// Append aliases
if ($config->dokuwiki->url->alias)
{
$lines[] = sprintf(
'## %s',
$config->string->alias
);
foreach ($config->dokuwiki->url->alias as $base => $name)
{
$lines[] = sprintf(
'=> %s/%s %s',
$base,
$matches[1],
$name
);
}
}
// Merge lines // Merge lines
$content = implode( $content = implode(
PHP_EOL, PHP_EOL,

Loading…
Cancel
Save